Skip to content

check-driver-conformance: the unbounded import regex still spans two import statements — a locally-imported same-named fixture counts as shared-standard coverage #12320

Description

@yinlianghui

Observation-class finding, measured while implementing the comment-masking remedy for #12135 (that card's remedy (2)). Filed unassigned. This is the residual that remedy (1) — "bound the import scan to one statement" — would have closed and masking does not. #12135 is being closed by its own PR, so the unchosen remedy is recorded here rather than lost with it.

The shape

drivenFrom() in scripts/check-driver-conformance.mjs decides "is the marker imported from @objectstack/spec/data" with:

new RegExp(`import[\\s\\S]*?\\b${symbol}\\b[\\s\\S]*?from\\s+['"]${quoted}['"]`)

[\s\S]*? is unbounded on both sides, so the match need not lie inside one import statement. Masking comments (the #12135 fix) removes the prose assembly path, but not the cross-statement one: the import keyword, the symbol, and the from '@objectstack/spec/data' can come from three different statements of live code.

Measured

Synthetic, on masked text, against the merged detector:

import { AGGREGATION_CASES } from './local-fixture.js';
import { TEMPORAL_CASES } from '@objectstack/spec/data';
for (const c of AGGREGATION_CASES) {}

drivenFrom(stripComments(src), 'AGGREGATION_CASES', '@objectstack/spec/data') === true

The marker is imported from a local module and never from the shared one, yet the cell scores as covered. That defeats the rule the self-test already pins one spelling of — "a locally re-declared fixture is not the shared standard" — by importing the local fixture instead of declaring it with const.

Not live on this tree

Swept all 5 driver packages x 9 case-sets after the masking fix: 54 (file, marker) import readings, 0 differ between the unbounded regex and a per-statement read. So this is a latent hole, not a wrong number today — which is why it is a finding and carries no pm:queue.

Suggested shape, if picked up

Iterate import statements and require the symbol to appear in the clause of the one whose specifier matches, rather than letting the regex roam:

for (const m of src.matchAll(/import\s+([^;]*?)\s+from\s+['"]([^'"]+)['"]/g)) { … }

Whoever takes it should re-run the 54-reading sweep first: a bounded read is strictly narrower, so any cell it drops is a cell whose coverage was only ever detected by the loose form, and that is a headline-number change needing a measured DEBT entry rather than a silent absorption.

Dedup note

⚠️ The duplicate scan could not be completed. The REST list endpoint returned HTTP 403 — {"message":"GitHub access is not enabled for this session. …"} — the known per-session outage tracked as #12123. An empty search result here is not evidence that no duplicate exists, and none is claimed. The local half was done: nothing in scripts/check-driver-conformance.mjs and no .changeset/ entry records this residual. Worth a re-check at triage.

Follow-up to #12135; sibling of #12014.

Activity

  1. self-assigned this
    on Aug 25, 2026
  2. yinlianghui commented on Aug 25, 2026

    @yinlianghui
    CollaboratorAuthor

    Claim: devx@objectstack seat (#6023) · session session_01UjM2ia8Av1v5NqfqQEQmC6 · R9
    Branch claude/issue-12320-driver-conformance-import-regex · dedicated worktree · model tier: standard.

    Declared file surface: scripts/check-driver-conformance.mjs (+ its self-test, if it has one). Nothing else without saying so.

    Serial: none. No open PR claims this file.


    Zone 1 — rulings (scope, not facts; not renegotiable)

    1. The surface above is the whole surface. ⛔ Not dispatch-gates.mjs, ⛔ not bare-root-worklist.mjs — both have writer slots taken this round (extractWatchHints strips a module-relative literal's own depth, so unreachableReason prints false "never was a repo path" rows for files the gates really read — residue-side repair, shape pending the #12371 ruling #12299, [finding] #12300 retired the double-slash refusal — 4 bare-root-worklist TRIAGE rows still refuse on a mechanism the tree no longer has, and their VERDICTS (not just their prose) are now unsupported #12328).
    2. The defect is a false green: a locally-imported same-named fixture counting as shared-standard coverage. The fix must make that case red. A fix that merely narrows the regex without proving the previously-passing case now fails has not been demonstrated.
    3. ⛔ Do not "fix" this by relaxing what the gate asserts. This gate's job is to tell shared-standard coverage from local imitation; widening the accept set is the failure direction.
    4. Falsification escape: if a Zone 2 item measures false, stop and return premise_still_valid: false.

    Zone 2 — my assumptions; falsify them before building on them

    a. I take the card's reading that the import regex is unbounded and spans two import statements. I have not read the regex. Read it and state what it actually matches before changing it.
    b. I assume there is at least one live instance in the tree today — a driver whose conformance coverage is currently credited to a locally-imported same-named fixture. ⚠️ I have not counted them. If the count is zero, this is a latent defect and the card is a pin-only job, not a repair: say so, and pin it.
    c. I assume a regex is the right instrument at all. If the honest fix is a real parse (this repo routes TypeScript parsing through ts-parse.mjs, and check:parse-guard enforces it), say so — a second unbounded regex is not an improvement over the first.

    Zone 3 — suggested route (not binding)

    Read the regex → enumerate what it matches today across the real population, with a positive control so a zero-count means "none" rather than "my search was wrong" → establish whether the false-green case is live or latent → fix, and pin both directions (a genuine shared-standard import still passes; a local same-named fixture now fails).

    Ablate, confirm on disk, restore under trap … EXIT INT TERM, prove byte-identical with git hash-object. Gate union at the final commit, re-derived on STALE TREE. Exit codes before any pipe.


    Generated by Claude Code

  3. yinlianghui commented on Aug 25, 2026

    @yinlianghui
    CollaboratorAuthor

    os-dev-report

    {
      "issue": 12320,
      "status": "done",
      "branch": "claude/issue-12320-driver-conformance-import-regex",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/12370",
      "premise_still_valid": true,
      "summary": "The CARD's premise holds in both halves and the card is implemented. Zone 2a: read the regex before changing it — `import[\\s\\S]*?\\bSYMBOL\\b[\\s\\S]*?from\\s+['\"]SPEC['\"]`, both quantifiers unbounded, so the import keyword / symbol / specifier need not come from one statement; the card's synthetic reproduces (loose=true). Zone 2b measured FALSE, which is the card's own reading and NOT the dispatch's: the ruling assumed at least one LIVE instance, and there are zero. Swept 5 drivers x 9 case-sets = 2664 (file, marker) readings — of which 54 are readings where the marker appears in code at all, reconciling exactly with the card's 54 — and 0 differ between the roaming and per-statement reads; covered cells 45 -> 45; no cell's covering-file SET moves; the gate's full stdout is byte-identical before and after. So no cell is dropped and no DEBT entry is owed. Per Zone 2b's own zero-branch ('say so, and pin it') this was a pin-only job, and it is delivered as one: the bound plus both-direction pins. Flagging the conflict rather than picking a side silently — Zone 1.4's blanket falsification escape says stop, Zone 2b's specific zero-branch says pin it; I took the specific one, since the fix depends on 2a (which measured TRUE) and not on 2b, so nothing was built on the false assumption. Zone 2c answered by measurement, not preference: an AST read via ts-parse.mjs was prototyped, is correct, and found 0 unparseable files among the 296 driver sources — rejected because ts-parse.mjs imports typescript, which would trade a gate that runs in a fresh worktree with no node_modules for one that refuses until pnpm install has run (911ms/pass vs ~0.4s for the whole gate today). The bounded form is not a second roaming regex: the clause class [^;'\"] cannot cross a statement terminator or a string literal, and it is now the ONLY import matcher in the file — the reference half's own roaming import-stripper was folded into it. One thing the ruling did not anticipate: the bound silently WEAKENED an existing pin. #12135's falsifiability probe was written as drivenFrom(proseOnly, ...), so bounding the scan turned it from a statement about comment masking into a statement about the bound (that fixture is now red for two independent reasons). Repaired, not absorbed: the probe now asserts against the superseded rule spelled out as text, and a new fixture — marker genuinely imported from the shared module, referenced only in a docblock — keeps masking itself falsifiable (unmasked: coverage; masked: not).",
      "tests": "All 12 gates green at bfa9860e0a, the final commit (union run AFTER the last commit; exit codes captured by redirecting to a file before any pipe, never a bare $? after tail). Gate list derived by `node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack` from the real change set (1 path, merge base 1f6b8bb19), not from the dispatch prompt: check:agent-test-spelling, check:bash32-floor, check:cli-command-ids, check:cross-package-test-inputs, check:driver-conformance, check:entry-guard, check:parse-guard, check:pnpm-filter-targets, check-ci-filter-parity, check-cross-package-test-inputs — all EXIT=0 — plus check:nul-bytes (EXIT=0) and the gate's own --self-test (EXIT=0). Gate verdict lines quoted, not $?: 'check-driver-conformance: OK — 45 covered cell(s), 0 in the DEBT ledger, 0 exempt.' identical to baseline; 'check-nul-bytes: OK (scanned 6837 text file(s) ... no raw ASCII control bytes).' ABLATION (Zone 1.2, proving the false-green case is now RED): no build/dist is involved — this is a plain .mjs gate, nothing is compiled — so the dist-preflight does not apply, but the on-disk confirmation does and was done. Ran on the COMMITTED fix under `trap 'git checkout -- $F' EXIT INT TERM`. First attempt was rejected by my own check as unclean: shell escaping mangled the injected regex and the self-test went red on 24 cases, i.e. a broken mutation rather than a revert — readings discarded, redone in Python. Clean run: anchor asserted to occur exactly once before mutating; mutation confirmed on disk THREE ways — anchor text count 1 -> 0, the mutated drivenFrom printed from disk showing the roaming form restored, and the blob moving e51329eab4 -> 5c664f1e37. (One counter printed 0 for its 'want 1' injected-text probe; that needle was mis-escaped in Python and measured nothing — the three confirmations above are what the reading rests on, stated so the 0 is not read as a failure.) On that ablated tree the self-test failed on EXACTLY the two #12320 cases and nothing else: 'a marker imported from a LOCAL module is not shared-standard coverage...' and 'and the cell it would have covered is uncovered, through the real scan'. Restore leg verified byte-identical: git hash-object back to e51329eab4. SWEEP CONTROLS: the 0-differ count is only meaningful with a positive control, so one was armed — the card's cross-statement synthetic through the same comparison reads loose=true bounded=false (the sweep CAN see the shape), and a genuine shared import reads true in both. Not run: no package test/typecheck, because the diff touches one dependency-free repo-tooling script that no package compiles; its verification IS the gate plus its self-test.",
      "open_questions": [],
      "out_of_scope_findings": []
    }

    Notes outside the JSON, for triage:

    Generated by Claude Code


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions