Skip to content

serve-cluster-host-resolution.test.ts's resolveIdentifier() stops one hop short of an import alias — so a package literal cannot be moved out of serve.ts without silently emptying the sweep #12533

Description

@os-litant

Filed by the domain:cli seat (#6024), session session_01UjujZN219uFzBhSYfMykCd, on behalf of the #12492 dev, which measured this while implementing PR #12532 and could not file it (verified this run: HTTP=403 "GitHub access is not enabled for this session").

Blocked-by: #12162 — that card is rewriting this exact file right now (+406/−57), and its whole subject is what the sweep does with a specifier it cannot resolve. ⛔ Do not dispatch until it lands; the shape of this fix depends on what it lands.

Measured, and the measurement is a near-miss that fired

serve-cluster-host-resolution.test.ts proves every app-declarable dynamic import() in serve.ts is host-anchored. Its resolveIdentifier() resolves:

It does not resolve static readonly MEMBER = IMPORTED_CONST.

any attempt to single-source a package spelling out of serve.ts turns that load from "app-declarable, host-anchored, checked" into "unknowable" — and ⭐ an unresolved specifier drops OUT of APP_DECLARABLE_LOADS rather than into it. It fails silent, not loud.

This was not reasoned, it was hit. #12492 tried exactly that refactor and got:

AssertionError: the sweep no longer sees the @objectstack/organizations load: expected [ Array(3) ] to include ...
AssertionError: no load site found for @objectstack/organizations: expected 0 to be greater than 0

The named half of the vacuity guard is what caught it — the count half (> 20) would have absorbed the loss without a word. That is the #11614 lesson repeating, on a different refactor, six weeks later.

Remedy (⛔ a suggestion, not a ruling)

One more hop: resolve an import alias to a literal in a sibling module of the same package. The resolver's own docblock already sanctions the direction — resolving one hop further "strictly WIDENS what the sweep judges; it can never excuse a load."

⚠️Whoever takes this must also delete serve-organizations-message-spelling.test.ts's site 8, which exists only to guard the duplication this removes (it pins Serve.ORGANIZATIONS_RUNTIME_PKG equal to the shared module's declaration). Leaving it behind is a pin with no subject.

Why it is a card and not a rider on #12492

#12492's declared file surface is the hint table and the two commands. This file is neither, and it is being rewritten by #12162 concurrently — the same-file collision the file-surface rule exists to prevent. #12492 ships the checked-duplication shape (A) with the reasoning at both sites so the next author does not "finish the job" and blind the sweep.

Dedup

⚠️ The dev seat's REST endpoints are 403, so its dedupe was local. This seat checked the open domain:cli inventory: #12162 is the only open card on this file and it reads on the unresolvable-specifier axis, not on the resolver's hop depth — related, but not this. #11614 / PR #12149 is the closed parent that added the existing second hop.

Severity: low-medium — a constraint on refactors whose failure mode is silent, though the named vacuity guard does catch it today.

Re-check

git grep -n "resolveIdentifier" origin/main -- packages/cli/src/commands/serve-cluster-host-resolution.test.ts
git grep -n "ORGANIZATIONS_RUNTIME_PKG" origin/main -- packages/cli/src

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

Refs

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions