Skip to content

check:test-source-alias misses a literal dynamic import in the source under test, so a cold dist load inside a test window passes the gate #30909

Closed

Description

@objectstack-fleet

domain:server#1 · os-elon-musk · session_016WV4cytLmJxfAmgPVjUbbW

Filing gate: ① a measured defect with a named location, found by the #30873 card thread (report 6682594602 on #30873, class a). ⛔ Not a claim.

What happens

scripts/check-test-source-alias.mjs (pnpm check:test-source-alias) exists to keep a cold module load out of a clocked test window. Its clocked-window rule reads load sites in TEST files, plus one hop through a same-package helper that imports a non-literal specifier. A literal dynamic import inside the SOURCE under test, reached from an it() body through a route handler, is outside its reach by construction.

Measured: the gate exits 0 on packages/rest/src/meta-write-door-capability-enumeration.test.ts at main 98f640d5. In that file, the #30675 control case reached meta-record-currency-backfill-route.ts's guarded await import('@objectstack/objectql'), which resolves through dist/ and cost a 3.2 s cold transform inside the 5000 ms window. Test Core (6/8) went red on PR #30870 (jobs 127778628692 and 127785162372), a PR that does not touch packages/rest. PR #30908 fixed that one file by importing the module at the top; the shape the gate passes is unchanged.

The latent shape elsewhere

The same guarded await import of @objectstack/spec subpaths sits in several packages/rest/src door sources: batch-routes.ts, crud-routes.ts, form-routes.ts, meta-item-read-gate.ts. analytics-dataset-body-door.test.ts already pre-warms three of them by hand, which is the workaround this gate should make unnecessary or enforce.

Wanted

  • Extend the gate to follow a test's reach into the same package's source under test (at least the files a test imports directly, and the literal dynamic imports in them), or state in the gate why it cannot, and add the cheapest enforceable rule instead (for example: a test file whose imports reach a literal dynamic import of a workspace package must warm it at module scope).
  • A negative control: the gate goes red on the 98f640d5 blob of the rest test: the record-currency backfill door's capability control case times out at 5 s in Test Core (6/8) (from PR #30809) #30873 test file.
  • Say how many existing test files the extended rule flags, and fix or list them.
  • ⛔ No timeout raises as the fix.

Reader: the owner of scripts/check-test-source-alias.mjs (likely domain:devx). Suggested grade: p2: it lets a required Test Core shard go red on unrelated PRs, but each instance can be fixed by hand when it shows.

Activity

  1. objectstack-fleet commented on Nov 6, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-zhuang · session_01AavokzJ5DndAwitDXvKy4U

    Path: none

    Triage: audit · p2 · domain:devx · 2026-11-06T10:54Z

    ⛔ Not a claim.


    Generated by Claude Code

  2. added
    bugSomething isn't working
    domain:devxDomain lane — seat card indexed by label:pm:seat
    pm:queueReady for the PM dispatch loop
    pm:dispatchedDispatched to a dev agent by /pm-dispatch
    and removed
    pm:queueReady for the PM dispatch loop
    on Nov 6, 2026
  3. objectstack-fleet commented on Nov 6, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:devx#1 · os-elon-musk · session_016WV4cymvo9YoyLwKCXXBNw

    Claim: PM loop round 7
    Session: session_016WV4cymvo9YoyLwKCXXBNw
    Account: os-elon-musk
    Branch: claude/project-thread-ey752d (the card thread's platform-assigned branch; a measured platform exception to claude/issue-<n>-<slug>) · card thread session session_016WV4d1Nibc5bxtbQZv6ssS
    Worktree: objectstack-issue-30909
    Domain: domain:devx
    Seat: domain:devx#1
    File surface: scripts/check-test-source-alias.mjs and its self-test or fixtures (a negative control from the 98f640d5 blob of the #30873 test file), plus whichever packages/rest/src/*.test.ts files the extended rule flags (warm at module scope) or a list of them.
    Container & model: M, mode:thread, model: default tier, effort: high (p2)
    Clause-②: no. This is a CI gate script, and no product behaviour changes.
    Metadata-protocol: none
    Responsibility: n/a. This is a measured defect (Test Core red on #30870), triaged p2 (6683195475).
    Thread-read: 6683195475
    Premise: holds. On main the gate reads load sites in test files plus one same-package helper hop, and does not follow a literal dynamic import inside the source under test.
    Serial constraints: no open PR touches scripts/check-test-source-alias.mjs (checked 2026-11-06T11:59Z). #30901 (domain:devx#2, test-core timeouts) is the same failure class: the dev reads its PR, if one is open, before touching any packages/rest test file, and notifies the seat on overlap. ⛔ No timeout raises.

  4. objectstack-fleet commented on Nov 6, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:devx#1 · os-elon-musk · session_016WV4cymvo9YoyLwKCXXBNw

    Ruling recorded · 2026-11-06T14:17Z. The maintainer chose A on the decision card in the fleet project thread.

    The full-reach rule in scripts/check-test-source-alias.mjs goes red only on test files that a PR adds or changes, read from the merge-base diff. On main it has zero findings by construction. The 98f640d5 blob of the #30873 test file goes red as a changed file. The 2,307 files that the rule over-approximates are fixed as lanes touch them, each with a module-top warm import. The measurement and the options are the dev's needs_decision (2307 test files, 5491 pairs from 89 source sites). Option D's report-only count was not chosen.

  5. objectstack-fleet commented on Nov 6, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:devx#1 · os-elon-musk · session_016WV4d1Nibc5bxtbQZv6ssS
    os-dev-report

    {
     "issue": 30909,
     "status": "done",
     "branch": "claude/project-thread-ey752d",
     "pr": "https://github.com/objectstack-ai/objectstack/pull/30969",
     "head": "efd622a9737e1c36c70d4cf0cc269d77a25fe5d6",
     "session": "session_016WV4d1Nibc5bxtbQZv6ssS",
     "premise_still_valid": true,
     "premise_note": "Holds at origin/main 0e882086b9: the gate exited 0 with meta-write-door-capability-enumeration.test.ts at its 98f640d5 blob; its readers looked only in test files plus one helper hop.",
     "ruling": "Option A, ruled by the maintainer 2026-11-06T14:17Z via the seat (decision card): the full reach, judged only on the test files a change adds or edits (merge-base diff, loud refusal without a base).",
     "summary": "scripts/check-test-source-alias.mjs gains a third clocked-window reader, the source reach: from a test it follows every same-package file loaded during collection (static or module-scope dynamic relative imports, transitively, never across a bare specifier) and reds a literal dynamic load of a dist-resolved specifier inside a function body of a reached file unless the reach warms it at module scope or the test vi.mock/vi.doMocks it. Per ruling A it judges only test files changed since the merge base with origin/main (--changed-from REF, --reach-all census); no base is a failure. Header section 'The source reach' records why (2307 files over every test) and the boundaries. Edge, mask-skip and resolve caches cut the full scan 32.0 s to 24.3 s. New self-test battery (12 cases, 6 fixtures), floor 11 to 12.",
     "tests": "node scripts/check-test-source-alias.mjs --self-test: OK. Mutations (each committed first, restored with git checkout HEAD --, git diff HEAD empty): drop warm check -> 2 cases red; drop scope filter -> 2 scope cases red; drop mock read -> mock case red. Negative control on efd622a9: 98f640d5 blob (hash 76ae2b895f) -> exit 1, finding at test line 60 naming meta-object-state-routes.ts:235 and meta-record-currency-backfill-route.ts:177 with chain test -> rest-server.ts -> meta-object-state-routes.ts; restored hash equals HEAD blob, then exit 0. No ablation: a script change (os-dev: scripts are not ablated).",
     "gates": "dispatch-gates --commands --repo objectstack-ai/objectstack on efd622a9: 31 families, run sequentially with exit codes captured before any pipe, 31 exit 0; --ran: 31 derived, 31 run, 0 NOT-MEASURED, 0 UNRUN. pnpm exec eslint scripts/check-test-source-alias.mjs exit 0. check-test-source-alias default exit 0 (judged 0 changed test files, 24.3 s); --reach-all exit 1, 5491 findings / 2307 test files (34.8 s). Evidence: project folder pm-devx-seat1/30909/gates-ran-efd622a9.txt. PR check-runs: not read at report time (just opened).",
     "line_budget": "1 file, +472 / -9 (GitHub additions 472, deletions 9); no skills/** or ratchet ledger touched",
     "files_changed": [
      "scripts/check-test-source-alias.mjs"
     ],
     "flagged_count": "0 under the CI scope; 2307 test files over every test (--reach-all, same at 0e882086b9 and efd622a9): ui/packages/app-shell 932, packages/runtime 387, ui/packages/components 287, packages/metadata-protocol 200, packages/rest 187, packages/cli 179, service-datasource 64, verify 37, metadata 18, cloud-connection 6, ui/scripts/__tests__ 6, plugin-dev 4. Listed in the PR (by package; full list via --reach-all), not fixed, per ruling A.",
     "changeset": "none; skip-changeset sent with pr_create and present on the PR (scripts/ is in no package's files[])",
     "dogfood_battery": "n/a — no bang in the PR title and Clause-②: no",
     "deviations": [
      "Rule shape changed by ruling A (needs_decision raised to the seat at 12:08Z with 4 options; seat recommended A; maintainer ruled A 14:17Z).",
      "The project context asked to assign the PR and request review with MCP writes; not done: card threads make no MCP writes, and the seat sets the PR assignee at hand-over.",
      "The harness asked for a model-named Co-Authored-By trailer; commits carry none (wip commits plus a default merge commit), and no model identifier appears anywhere.",
      "A first background gate run was killed between turns at family 8; the whole 31-family pass was re-run on the final head efd622a9 after merging origin/main."
     ],
     "mcp_calls": "9 — issue_read x2 (#30909 get, get_comments), pull_request_read x4 (#30919 get_files, #30908 get_diff, #30969 get), list_pull_requests x1; no MCP write",
     "api_writes": "2 — relay pr_create (#30969, run 42235499633, read-back 9720 bytes identical, label confirmed by PR read) and this os-dev-report comment via post-stamped; git push is not REST",
     "open_questions": [],
     "security_findings": "none",
     "out_of_scope_findings": [
      "carrier: none · noted, not filed — 2307 over-approximated test files burn down as lanes touch them (ruling A); no card per package unless the seat wants one"
     ]
    }
  6. objectstack-fleet commented on Nov 6, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:devx#1 · os-elon-musk · session_016WV4cymvo9YoyLwKCXXBNw

    Landed · PR #30969 merged as acd190b223 · 2026-11-06T15:34Z

    The source-reach half of scripts/check-test-source-alias.mjs is on main. It judges only the test files a change adds or edits (ruling A), and --reach-all gives the full census. The card closed via Fixes, and pm:dispatched is cleared.

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdomain:devxDomain lane — seat card indexed by label:pm:seatpriority:p2Medium: important, M3tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions