Repository navigation
fix(scripts): the ObjectQL double-limit lift reads identifiers from code, never from string or template text - #30521
Merged
Conversation
…ode, never from string or template text identifiersIn was a word regex over source text, the twin of the where-matcher lifter fixed earlier. It now walks the parsed tree; the self-test pins both directions. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CYZ6tmbWZDWzLW4Yzg
Contributor
Author
|
domain:server#4 · os-bill · session_01Utp6CZMkHvuDeVYgTD73qF 维护者速读
席位意见:ACCEPT(#30473)。这个测试替身检查不再因为报错文案里写到某个函数名就误判替身「无法判定」,判定结果只取决于代码本身;全仓库现有判定一条没变。 席位核对Head-sha:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Bill · project thread
domain:server#4 · os-bill · session_01Utp6CZMkHvuDeVYgTD73qF
Fixes #30473
Clause-②: no — an internal instrument; no product surface moves
Metadata-protocol: none
维护者速读
limit检查在"把替身的find抽出来单独运行"时,改为只顺着代码里出现的名字去找同文件依赖;字符串、模板文字正文和注释里的单词不再算数,${…}里的表达式照收。与刚合入的 fix(scripts): the where-matcher lift reads identifiers from code, never from template-literal text #30472(where-matcher 检查)同一处修法。scripts/check-objectql-double-limit.mjs的identifiersIn(改为遍历语法树)、discoverInSource里的sourceIdentifiers(方法只取参数和函数体)、buildCallable读集合的两行。pnpm check:objectql-double-limit,预期 self-test 打印 OK,全树一行41 unjudged,与 main 相同(合 main 后共 987 个候选)。What changes
identifiersInwas a word regex over source TEXT, the same function PR #30472 replaced incheck-where-matcher-conformance.mjs. It now walks the parsed tree and collectsIdentifiernodes only: string literals, a template literal's text, regular expressions and comments contribute nothing, and an identifier inside a${…}hole is collected. Discovery computes the sets off the nodes it already holds, so nothing is re-parsed: each visible declaration carriesidentifiersbeside itstext, and the candidate carriessourceIdentifiersfor exactly the text itssourcelifts (a method lifts asfunction (params) body, so its parameters and body are walked and its own name is not; an expression is walked whole).buildCallablefollows those sets.Not imported from the where-matcher gate. The seat asked for one implementation, shared if it fits. It does not fit here: this file's header records why its scope walk is hand-copied rather than imported ("a gate that imports its own substrate from another gate's file couples two tripwires that must be able to fail independently"). The walker is the same tree walk in both files (this one takes several nodes, for the method case), and the doc comment names its twin.
Where the defect bites in this gate. Measured, not assumed: this lift already survives a text-pulled sibling that throws
X is not defined(it stubs the name and retries) and stubs non-function initializers at stub class 2, so the where-matcher reproducer ("sparse driver" besideconst driver = { name }) seats here either way. What it cannot survive is a text-pulled FUNCTION-like sibling whose source cannot sit in the lift (function-like declarations are never stubbed). The self-test case uses anexport function:exportinside the lift body is a syntax error at every stub class, so the old lift answersUNJUDGED could not lift: SyntaxError: Unexpected token 'export'for a double that never calls it.Tests
Two fixtures and seven assertions in the existing battery (floor 56 → 63):
FIXTURE_TEXT_NAMES_SIBLING: a bounding, refusing double whose messages say "openDriver" (one template literal with a${k}hole, one plain string), besideexport function openDriver. Pinned: discovered;openDriverandimplementednot collected; judged CONFORMING.FIXTURE_HOLE_NAMES_HELPER: a same-file helperkeynamed only inside a${…}hole on the answering path. Pinned: discovered;keycollected; judged CONFORMING.Mutation replay (one-off, restored by blob hash == HEAD)
template-literal TEXT names no identifier: "openDriver" in the message is not collected,nor does a plain string literal: its "implemented" is not collected either,a double beside text naming a sibling binding lifts and is CONFORMING, not UNJUDGED.if (ts.isTemplateExpression(n)) return;): self-test exit 1 —the helper named only inside the hole is collected,so the hole-reading double lifts with its helper and is CONFORMING.main's module directly:UNJUDGED could not lift: SyntaxError: Unexpected token 'export'; through this branch:CONFORMING.Acceptance notes
origin/main(head 07592b3):987 structural candidate(s): 680 graded, 41 unjudged, gate exit 0.export functioncannot be lifted even when the double's CODE calls it. That limit is unchanged by this PR and no corpus double hits it today.Verification
Gate list derived by
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack(31 commands), each run with its exit code recorded before any pipe and reconciled with--ran;pnpm lintrun. Readings are in the os-dev-report on #30473.No changeset: the diff is one repo-root script that no released package ships (
skip-changeset).Generated by Claude Code