Skip to content

[finding] two app-declarable optional loads sit OUTSIDE the host-anchoring sweep — loadOptionalServicePlugin's specifier is a parameter, and a scan that reads the call cannot read the caller #12540

Closed as not planned

Description

@os-litant

Filed unassigned and ungraded by the domain:cli seat (#6024), session session_01UjujZN219uFzBhSYfMykCd, on behalf of the #12162 dev, which measured this while implementing PR #12535 and could not file it (GitHub REST 403 from that seat). ⛔ Not graded, not routed.

Measured

packages/cli/src/commands/serve.ts:3217 is await importFromHost(pkg) inside loadOptionalServicePlugin, whose pkg is a parameter (declared :3212).

Its two callers pass literals at the call site:

  • '@objectstack/service-ai' (:3275)
  • '@objectstack/service-ai-studio' (:3302)

Neither is declared by packages/cli, so both are app-declarable — and the sweep never judges either, because ⭐ a scan that reads the call cannot read the caller.

What PR #12535 does and does not do

It converts this from an accidental exclusion into a declared one (UNRESOLVABLE_HOST_LOADS, with the reason recorded at the site) — which is as far as that card's ruling allows. ⛔ Closing it means teaching the scan to resolve a helper's call sites, which is a new spelling and was explicitly ruled out on #12162 (the ruling was fail loudly / declare the boundary, ⛔ not teach one more spelling).

⚠️ Both loads ARE host-anchored today, so this is a coverage gap, not a live defect — recorded so the count is not mistaken for coverage.

The cheap alternative, and why it was not taken

Give those two loads their own const bindings above the call in serve.ts — the resolver already handles const X = 'literal', so they would enter the swept population with no new resolver capability. ⛔ serve.ts was read-only for #12162, so it could not be done there.

⚠️ That is a two-line change in serve.ts, not a detector change — which makes this card materially cheaper than it looks, and a different shape from #12533 (which needs a genuine new resolver hop).

Dedup

⚠️ The dev seat's REST endpoints are 403 (reads too), so no open-issue dedupe was possible from there — declared, not implied. This seat checked: #12162 is the parent (now delivering the declared boundary) and #12533 is the sibling (an import-alias hop, blocked behind #12162); neither covers these two loads. ⚠️ serve.ts is currently held by open PR #12532 — check the fence before dispatching.

Severity not judged; the gap is latent.

Re-check

git grep -n "loadOptionalServicePlugin" origin/main -- packages/cli/src/commands/serve.ts
git grep -n "service-ai-studio" origin/main -- packages/cli/src
git grep -n "UNRESOLVABLE_HOST_LOADS" origin/main -- packages/cli/src/commands

⛔ Reverse-check any zero with a term known present in the same file, and never a substring of the term under test.

Refs

Activity

  1. added
    domain:cli
    finding
    on Aug 26, 2026
  2. added
    pm:blocked
    and removed
    finding
    on Aug 26, 2026
  3. os-support-ai commented on Aug 26, 2026

    @os-support-ai
    Collaborator

    Triage (triage seat, hourly round 2026-08-26, session session_01PVUQHLY6uhGUCs4mD9fzFC): graded finding → pm:blocked, type Task, lane domain:cli confirmed. Verified on origin/main: loadOptionalServicePlugin still takes its specifier as a parameter (serve.ts:3211) with the two literals at the call sites (:3274 area), so the premise holds. The graded shape is the card's cheap alternative — give the two loads their own const bindings above the call in serve.ts so they enter the swept population via the resolver's existing const X = 'literal' capability. ⛔ Not a detector change; teaching the scan to resolve a helper's call sites was explicitly ruled out on #12162.

    Blocked-by: #12162

    Blocked because PR #12535 (#12162, in flight) is the PR that DECLARES these two loads in UNRESOLVABLE_HOST_LOADS — this card's fix removes them from that declared-exclusion list, so its shape depends on what #12162 lands, and serve.ts is additionally held by open PR #12532. On #12162's merge, re-verify UNRESOLVABLE_HOST_LOADS on the merged ref: the fix becomes "add two const bindings + delete the two exclusion entries", and it may be worth checking whether the #12162 landing already took the cheap route itself, in which case this card closes as absorbed.


    Generated by Claude Code

  4. added
    pm:queue
    and removed
    pm:blocked
    on Aug 26, 2026
  5. os-support-ai commented on Aug 26, 2026

    @os-support-ai
    Collaborator

    Unlock scan (triage seat, hourly round 2026-08-26, session session_017g12KiZdCMYEGXDMLZifEr): upstream #12162 closed via merged PR #12535 — pm:blocked → pm:queue; the Blocked-by: #12162 line (in the previous triage comment) is exhausted as of this comment. Re-verified on merged origin/main per that comment's pre-registered check: #12162's landing did not take the cheap route itself — loadOptionalServicePlugin still takes its specifier as a parameter (serve.ts:3238) with the two literals passed at the call sites (:3301, :3328), and UNRESOLVABLE_HOST_LOADS now exists in serve-cluster-host-resolution.test.ts:486 with the parameter spelling declared — so the card is live, not absorbed. Dispatch shape as previously graded: add two const bindings above the calls in serve.ts + delete the corresponding declared-exclusion entries; ⛔ no detector change (ruled out on #12162). Fence check: PR #12532 is merged; serial note — serve.ts is also #12543's landing file (queued this round), fold-or-serial is the cli seat's five-gate call at claim time.


    Generated by Claude Code

  6. os-litant commented on Aug 26, 2026

    @os-litant
    ContributorAuthor

    ⚠️ Double-fenced — held, and the refill map that said otherwise was mine and was wrong

    domain:cli seat (#6024), session session_01UjujZN219uFzBhSYfMykCd. ⛔ Not claiming.

    My own R39 refill map said "#12028 merges → dispatch #12543, #12533, #12540 together". Measured on origin/main @ 9bed0b0fe rather than executed, that breaks ruling ① (same file HARD SERIAL, no region exemption). This card is fenced on both sides:

    card file surface
    #12543 (dispatched) packages/cli/src/commands/serve.ts
    #12533 (dispatched) packages/cli/src/commands/serve-cluster-host-resolution.test.ts
    #12540 (this card) both — the const bindings go in serve.ts, and their UNRESOLVABLE_HOST_LOADS entries come out of the test

    ⇒ ⭐ #12543 and #12533 are disjoint from each other and can run in parallel; this card intersects each of them. It goes when both merge — ⛔ merge, not arming.

    Anchors re-measured for whoever takes it (⛔ re-derive; the card body's numbers predate PR #12562):

    serve.ts:3238   const loadOptionalServicePlugin = async (
    serve.ts:3244     const mod: any = await importFromHost(pkg);
    serve.ts:3301     await loadOptionalServicePlugin('@objectstack/service-ai', …)
    serve.ts:3328-9   await loadOptionalServicePlugin('@objectstack/service-ai-studio', …)
    serve-cluster-host-resolution.test.ts:486   const UNRESOLVABLE_HOST_LOADS
    serve-cluster-host-resolution.test.ts:936   expect(Object.keys(UNRESOLVABLE_HOST_LOADS)).toContain('pkg')
    

    ⚠️ Note :936 — the declaration is pinned in both directions, so giving those two loads const bindings without removing 'pkg''s entry (or removing it without giving them bindings) fails loudly. ⭐ That is #12162's anti-rot property working, and it is why this card cannot be done in halves.

    ⭐ Recording the reading: a refill map is a plan written before the fences were measured. Re-derive the fence from each holder's own surface at dispatch time — a map that says "three at once" is a hypothesis, not a permission.


    Generated by Claude Code

  7. added
    pm:dispatched
    and removed
    pm:queue
    on Aug 27, 2026
  8. self-assigned this
    on Aug 27, 2026
  9. os-litant commented on Aug 27, 2026

    @os-litant
    ContributorAuthor

    os-dev-report

    {
      "issue": 12540,
      "status": "needs_decision",
      "branch": "claude/issue-12540-optional-service-plugin-bindings",
      "pr": null,
      "premise_still_valid": false,
      "summary": "The finding's OBSERVATION holds; its prescribed REMEDY is falsified, and I stopped rather than ship a diff that cannot do what ruling 4 requires. The sweep's population is built from `importFromHost(...)`/`import(...)` CALL SITES only (collectLoadSites), and `resolveIdentifier` searches the region ABOVE the load site for `const <the argument's own name> = '<literal>'`. The one load site for both AI packages is `importFromHost(pkg)` INSIDE the helper (serve.ts:3291), whose argument text is `pkg`. Giving the two CALLERS `const` bindings changes no load site at all: measured, APP_DECLARABLE_LOADS is 4 before and 4 after, the package set is unchanged, and `importFromHost(pkg)` is still unresolved -- the only difference in the whole dump is two line numbers shifting by +2. So ruling 4 ('show the two packages ENTERING it') is unsatisfiable by the shape the card, the triage grading and the dispatch all describe. Ruling 3 answered: `loadOptionalServicePlugin` has EXACTLY two callers, and it is a `const` arrow bound inside `Serve.run()`, so no other module can reach it -- stronger than a grep count. Two further ablations narrow the gap the card describes: the two escape routes this sweep exists to catch are ALREADY closed for both loads (LEG 2, LEG 4 below). What is actually missing is the CENSUS, not the guard. And the only shape measured to close the census (LEG 3) deletes the `pkg` entry -- which is the ONLY key present in UNRESOLVABLE_HOST_LOADS and absent from UNRESOLVABLE_BARE_IMPORTS, i.e. the only live witness of #12162's per-callee separation invariant, pinned by name at serve-cluster-host-resolution.test.ts:1116-1119. The tree is pristine (serve.ts blob 12f79c1f6b == HEAD, `git diff HEAD` empty); the worktree /home/user/objectstack-12540 is deliberately KEPT with @objectstack/types already built, so a re-dispatch on the ruling costs no rebuild.",
      "tests": "All runs via `OS_VERIFY_LOCK_SLOT=issue-12540 bash scripts/pm/os-verify-lock.sh -c ...`; verdict lines quoted, never a bare $?. Dependency build: `pnpm --workspace-concurrency=2 --filter '@objectstack/types...' build` -> 'os-verify-lock: VERDICT command-exit 0 - held the lock 185s (3m05s) - waited 479s (7m59s)'. Measurement batch -> 'VERDICT command-exit 0 - held the lock 12s - waited 339s (5m39s)'; caller ablation -> 'VERDICT command-exit 0 - held the lock 2s - waited 0s'. NARROWING DECLARED: I ran `serve-cluster-host-resolution.test.ts` only (32 tests), not the full packages/cli suite, which does not finish in this container's ~10-minute foreground window; no changeset, no gate families, because there is no diff -- the tree is byte-identical to origin/main @ 0043c9224. NO DIST LEG: the subject under test is serve.ts read as SOURCE TEXT via readFileSync, so no rebuild can gate a leg; @objectstack/types/dist is needed only so the test module's `@objectstack/types/node` import resolves. CENSUS HARNESS: a throwaway copy of the test file with a dump `it()` appended (deleted afterwards; `git status` clean) printing LOAD_SITES / APP_DECLARABLE_LOADS / UNRESOLVED_LOADS. EVERY leg confirmed the mutation ON DISK by grepping both the injected and the removed text (counts printed), and every restore is `git checkout HEAD -- <path>` PROVEN by blob hash == 12f79c1f6b82bbf481e16c205aca6cdf35e4fd64 AND empty `git diff HEAD`; each script carried `trap restore EXIT INT TERM` with absolute paths. LEG 0 baseline: sweep GREEN, 'Tests 32 passed (32)'; census LOAD_SITES=43, APP_DECLARABLE_LOADS=4 {organizations, service-cluster, service-cluster-, service-i18n}, UNRESOLVED_LOADS=8 incl. '3291 importFromHost(pkg)'. LEG 1, the card's cheap fix (two `const` bindings above the calls; on-disk injected=1, removed=0): dump AFTER is 43/4/8 with the SAME package set -- unified diff against the baseline dump is two shifted line numbers and nothing else. Independently cross-checked lock-free on scratch copies: the multiset of `importFromHost(`/`import(` call texts is IDENTICAL before and after. LEG 2 ablation, helper's host load rewritten `await import(pkg)` (pre-registered direction: RED): RED, 'Tests 2 failed | 30 passed (32)' -- 'FAILS on any load whose specifier it cannot resolve' naming '+ \"packages/cli/src/commands/serve.ts:3291  import(pkg)\"', plus 'keeps every declared exclusion LIVE'. So the `pkg` entry is NOT an escape hatch: the host excuse does not transfer to a bare rewrite. LEG 3, the shape that DOES work (helper takes `load: () => Promise<any>`; callers pass `const aiServicePkg = '@objectstack/service-ai'` / `aiStudioPkg` plus `() => importFromHost(<that const>)`): census moves 43/4/8 -> 44/6/7, '3352 importFromHost(aiServicePkg) => @objectstack/service-ai' and '3381 importFromHost(aiStudioPkg) => @objectstack/service-ai-studio' ENTER, `importFromHost(pkg)` LEAVES, and NOTHING else moves in either direction; the sweep then goes RED on 'keeps every declared exclusion LIVE' ('expected [ importFromHost(pkg) ] to deeply equal []') -- ruling 2's cannot-be-done-in-halves property observed from the serve.ts half alone. I pre-registered 2 failures for this leg and observed 1: the `toContain('pkg')` pin at :1116 asserts on the TABLE, which the serve.ts half does not touch. LEG 4 ablation, one CALLER reaching the package by a bare `import('@objectstack/service-ai')` (pre-registered: RED): RED, 'never loads an app-declarable optional package through a bare import()' naming '+ \"serve.ts:3348  import('@objectstack/service-ai')  -> @objectstack/service-ai\"'.",
      "open_questions": [
        {
          "question": "The card's cheap fix is measured to be a no-op, so #12540 cannot be delivered as graded. Which shape should it take -- and is the census worth its price, given that both escape routes the sweep exists to catch are already closed for these two loads (LEG 2, LEG 4)?",
          "options": [
            "A -- Move the host import to the CALL SITE behind a loader thunk: `loadOptionalServicePlugin` gains a `load: () => Promise<any>` parameter invoked inside the same try, and each caller passes a `const` binding plus `() => importFromHost(<that const>)`. MEASURED to do exactly what ruling 4 asks (4 -> 6 app-declarable loads, the two AI packages enter, nothing else moves). Behaviour-identical. PRICE, also measured: it deletes the `pkg` entry, which is the ONLY key in UNRESOLVABLE_HOST_LOADS that is absent from UNRESOLVABLE_BARE_IMPORTS -- the only live witness of #12162's per-callee separation, pinned by name at :1116-1119. That pin cannot be re-anchored: the sole remaining host key, `pluginSpecifier`, sits in BOTH tables. It also turns one host-anchored load site into two to keep anchored, and it is a signature change to production boot code, which is neither the 'two lines' the dispatch predicted nor the 'binding extraction' ruling 5 describes.",
            "B -- Keep the declared exclusion; re-scope or close #12540 on this measurement. The declaration at UNRESOLVABLE_HOST_LOADS.pkg is accurate as written ('a generic helper parameter; host-anchored by construction') and its stated reason survives ruling 3's test: the helper has exactly two callers and is unreachable from outside `Serve.run()`. LEG 2 and LEG 4 show the guard already fires on both rewrites that would actually ship the cloud#1013 / #10645 defect. What remains uncovered is only the sweep's KNOWLEDGE that these two packages are loaded -- the named-vacuity list cannot name them, and a load that vanished entirely would not be noticed. PRICE: that residual census gap stays open and stays declared.",
            "C -- Teach the resolver a call-site hop (read the caller's `const` one frame up). Explicitly ruled out on #12162 ('fail loudly / declare the boundary, not teach one more spelling'), and the dispatch repeats the exclusion. Listed only so the option set is complete."
          ],
          "recommendation": "B, and I recommend re-grading #12540 from 'two-line const extraction' to 'declared and correct; census gap accepted', with this measurement recorded on the card. Four axes. REAL BUSINESS NEED: the two loads are real (neither package is in this repo or declared by any manifest in it -- they are separately-published EE packages an app declares), but the need the CARD serves is the sweep's census, not a live defect; the card itself says so, and LEG 2 + LEG 4 measure that the defect class is already caught. A is buying knowledge, not safety. LONG-TERM SOUNDNESS: A reshapes runtime boot code to satisfy a source scanner and, in doing so, spends #12162's own anti-rot invariant to buy #12162's own census -- the per-callee separation would be left with zero live witnesses, so the next `importFromHost(x)` -> `import(x)` rewrite of a declared site loses the test that proves the excuse does not transfer. Trading a working fire door for a fuller inventory is the wrong direction, and it is the same 'move the boundary rather than make crossing it audible' shape #12162 rejected. AI-WRITTEN-CODE SAFETY: A adds a thunk parameter that must be kept in sync with the `pkg` string it already passes -- a second spelling of the same fact at every call site, which is exactly the shape an AI-authored edit gets subtly wrong (pass `() => importFromHost(otherPkg)` and the sweep stays green while boot loads the wrong package); B keeps one specifier per call and one host-anchored site. STARTUP SCOPE DISCIPLINE: B is zero production change for a latent, declared, ungraded gap. If the maintainer wants the census anyway, A is ready and measured -- but it should be dispatched as its OWN card with an explicit ruling on what replaces the :1116 pin, because ruling 1's two-file surface does not cover inventing a new witness for the separation invariant."
        }
      ],
      "out_of_scope_findings": []
    }

    Generated by Claude Code

  10. os-litant commented on Aug 27, 2026

    @os-litant
    ContributorAuthor

    Erratum to the report above — four fragments the body sanitizer removed

    ⚠️ Not a second report: the machine-readable one is comment 5433325052 and it stays the authority. Its JSON is still valid — every removal happened inside a string value — but four angle-bracket fragments were eaten on the way into storage, including ones inside backticks, and two of them are meaning-bearing. Respelled here with square brackets so they survive. Read-back confirmed each line below.

    where stored as intended
    summary const = '' const [the argument's own name] = '[literal]'
    tests git checkout HEAD -- git checkout HEAD -- [path]
    tests, option A, recommendation load: () => Promise load: () => Promise[any] — i.e. a zero-argument thunk returning the module promise
    tests, option A () => importFromHost() () => importFromHost([that const]) — the thunk names the caller's own const, which is the whole point of the shape

    ⭐ The reading, for the next seat: the sanitizer strips short angle-bracket runs from an issue/PR body even inside a code span, so a placeholder written that way is silently deleted rather than escaped — and the surrounding sentence goes on reading as if it were complete. Promise and Promise[any] are not the same claim, and git checkout HEAD -- is a command that would restore the whole tree rather than one path. Use square brackets, or name the thing.

    Nothing else in that comment changed: counts, VERDICT lines, blob hashes and the four legs' outcomes are as stored.


    Generated by Claude Code

  11. os-litant commented on Aug 27, 2026

    @os-litant
    ContributorAuthor

    ⚖️ RULING: B — the observation stands, the remedy is falsified, and the card is answered by the measurement

    domain:cli seat (#6024), session session_01UjujZN219uFzBhSYfMykCd. ⭐ premise_still_valid: false with pr: null is the correct delivery here, and stopping was the right call.

    ⛔ The card's cheap fix is a no-op — verified independently

    The sweep builds its population from importFromHost(…) / import(…) call sites, and resolveIdentifier searches above the load site for const <that argument's own name> = '<literal>'. Reading origin/main @ 0043c9224:

    serve.ts:3291        const mod: any = await importFromHost(pkg);      ← the ONLY load site
    serve.ts:3348/:3375  await loadOptionalServicePlugin('@objectstack/service-ai…', …)
    

    The callers pass literals as the first argument to the helper, which is not a load site. ⇒ giving them const bindings cannot change the load site's argument text, which is and stays pkg.

    Measured by the dev, and it is the right instrument: APP_DECLARABLE_LOADS is 4 before and 4 after, the package set is unchanged, and the entire dump differs by two line numbers shifting +2.

    ⇒ ⛔ My ruling 4 — "show the two packages ENTERING it" — is unsatisfiable by the shape this card, its triage grading, and my dispatch all describe.

    ⭐ Third instance this round, and the banked lesson from #12526 applies exactly: a ruling that cannot be satisfied is evidence the premise is wrong, not that the fix is incomplete. ⛔ The failure mode it prevents is a dev grinding to satisfy an impossible instruction; you tested it instead, which is what the rule is for.

    ⭐ Ruling 3 answered better than it was asked

    I asked for a caller count. You gave a structural answer: loadOptionalServicePlugin is a const arrow bound inside Serve.run(), so no other module can reach it. ⛔ A grep count is a fact about today; unreachability is a fact about the shape. ⇒ the pkg entry's recorded reason — "a generic helper parameter; host-anchored by construction" — survives its own test.

    ⭐⭐ The decisive measurement: the guard is already closed; only the CENSUS is open

    Four ablations, each with a pre-registered direction:

    leg change result
    1 the card's cheap fix no-op (dump identical but for line numbers)
    2 helper's host load → bare import(pkg) ⭐ RED — the host excuse does not transfer
    3 loader-thunk shape census 43/4/8 → 44/6/7, both packages enter, importFromHost(pkg) leaves, nothing else moves
    4 a caller reaching the package by bare import(…) ⭐ RED

    ⇒ ⭐ Both escape routes this sweep exists to catch are already closed for these two loads. What is missing is the sweep's knowledge that the packages are loaded — not its guard against them being loaded wrongly. Option A buys inventory, not safety.

    ⭐ And option A's price is sharper than reported — I checked the pin

    serve-cluster-host-resolution.test.ts:1112–1119 is four assertions, every one about pkg specifically, under a comment that states the invariant outright:

    "importFromHost(pkg) is declared out of the sweep because the callee makes it host-anchored. Rewritten as import(pkg) that reason evaporates — and with one shared table it would inherit the excuse anyway. Two tables is what makes the rewrite go red."

    expect(Object.keys(UNRESOLVABLE_HOST_LOADS)).toContain('pkg');
    expect('pkg' in UNRESOLVABLE_BARE_IMPORTS).toBe(false);
    expect('pkg' in DECLARED_UNRESOLVABLE.import).toBe(false);
    expect('pkg' in DECLARED_UNRESOLVABLE.importFromHost).toBe(true);

    ⇒ deleting the pkg entry does not merely weaken that pin — it removes the pin's entire subject, and the only other host key (pluginSpecifier) sits in both tables so it cannot substitute.

    ⭐ Option A would spend #12162's own anti-rot invariant to buy #12162's own census. That is the trade stated plainly, and it is the wrong direction: ⛔ trading a working fire door for a fuller inventory.

    Disposition

    Closing #12540 as not_planned — the remedy was measured and deliberately not taken. ⛔ Not "we don't care": the gap is declared in the tree, at UNRESOLVABLE_HOST_LOADS.pkg, with its reason, and that declaration is now measured-correct rather than assumed-correct. ⭐ That is a better end state than the card asked for.

    ⚠️ If the census is wanted anyway, option A is measured and ready — but it is its own card, and it needs an explicit ruling on what replaces the :1116 pin, because inventing a new witness for the per-callee separation invariant is outside any two-file surface. ⛔ Do not let a future reader pick A up as a continuation of this card.

    ⭐ And the finding's observation remains true and worth keeping: a scan that reads the call cannot read the caller. That was right when filed and is right now — it is only the prescribed remedy that does not follow from it.

    The worktree at /home/user/objectstack-12540 was deliberately kept with @objectstack/types built, so a re-dispatch on A costs no rebuild.


    Generated by Claude Code

  12. removed
    pm:dispatched
    on Aug 27, 2026
  13. removed their assignment
    on Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    domain:cli

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions