Repository navigation
fix(build): the dist/esm identity guard judges paths below the build root (#19087) - #19088
Conversation
…root (#19087) findUnresolvableImports matched `/node_modules/neo.mjs/` on the absolute resolved path, so an engine built in place inside a consumer's node_modules/neo.mjs (the neomjs/pages deploy) flagged every import in its own tree and build-all exited 1. The resolved arm now reads the path relative to the root the build passes in; the specifier arm is unchanged.
neo-gpt-euclid
left a comment
There was a problem hiding this comment.
PR Review Summary
Status: Approved
🪜 Strategic-Fit Decision
- Decision: Approve.
- Rationale: The repair preserves the existing identity guard and removes the false positive caused by the build root's own path. The positive and negative controls cover the ticket's build and identity requirements.
Peer-Review Opening: The in-place build reproducer and the normalization control make the path rule reviewable at the same boundary the build uses.
🧭 Patch-Blind Premise Snapshot
- Inputs Read Before Patch:
#19087, the four changed-file names, currentdevversions ofesmDistTransforms.mjsandesmodules.mjs, their unit siblings, and the Pages build script atmain@1847ca65. A three-query Memory Core sweep found no prior mapping of this specific false positive; the originating guard is#17921/#17932. - Expected Solution Shape: Judge an emitted import against the build root, while retaining the specifier and resolved-target checks for a second engine graph. Do not hardcode the Pages path or suppress identity checking for all in-place builds. Tests should isolate the path arithmetic and run the real build script from a synthetic in-place root.
- Patch Verdict: Matches.
esmodules.mjspasses its root;findUnresolvableImportsusespath.relative(root, resolved)only for the resolved-path arm. The specifier arm remains, and the tests cover ordinary, nested, and normalized engine paths. - Premise Coherence: Coheres with verify-before-assert: the old guard's 3,214 false positives and the repaired path have red and positive controls, with the Pages build layout checked against its source script.
🕸️ Context & Graph Linking
- Target Epic / Issue ID: Resolves #19087
- Related Graph Nodes:
#19047deployment dry run;#17921/#17932originating identity guard. - Origin Session ID: 01a0cd6f-8c21-7171-9d8c-b15bea1e1e96
🔬 Depth Floor
Documented search: I checked for a caller missing the new root, an in-place test that could pass without an emitted import, and a normalized source-engine path escaping the guard. The production caller passes the root; the real-script fixture asserts emitted output; the normalized below/beside controls are rejected.
Rhetorical-Drift Audit: Pass. The PR claims a local Pages-layout build, not a deployed site. The diff and ticket preserve that boundary; the later deployment dry run remains with #19047.
🧠 Graph Ingestion Notes
- [KB_GAP]: None established; the current Knowledge Base did not retrieve this new guard, so exact source and the ticket supplied authority.
- [TOOLING_GAP]: None in the PR. Hosted Engine
build-allis separate from the author's local Pages-layout receipt. - [RETROSPECTIVE]: The build root's location cannot identify an emitted import's target. The resolved path must be judged relative to that root while the written specifier remains an independent signal.
🎯 Close-Target Audit
Resolves #19087 names an open leaf with bug / regression / build labels and no epic label. The commit subject references the same issue and adds no other close target. Findings: Pass.
N/A Audits — 📑 📡 🔗
N/A: this restores an already documented internal build guard, and the diff adds no external contract, OpenAPI tool, skill, or cross-substrate convention.
🪜 Evidence Audit
The PR declares L3 for the local Pages layout and L2 for the pure and real-script controls. The Pages script at main@1847ca65 invokes build-all with cwd node_modules/neo.mjs, matching the claimed route. The author reports old-guard exit 1 with 3,214 false positives and fixed-head exit 0 in 37 seconds on that layout; I did not rerun that external layout. The exact-head hosted unit log executes all three new identity controls and the in-place real-script control, and Engine build-all completes dist/esm. Findings: Pass for #19087; the actual deployment dry run remains #19047 work.
🧪 Test-Evidence & Location Audit
- Execution: Head
51066bbcb7109662bef10ec51c99f6d800761b4fhas 32 successful checks. The unit job log shows the new in-place positive, in-place identity negative, normalized below/beside negative, and real-script build controls passed.build-allreportsdist/esmcompleted in 5.16 s. - Reviewer falsifier: Exact-head diff and current caller search show the new root supplied by
esmodules.mjs;path.relativeretains thenode_modules/neo.mjssegment for nested and beside-root engine targets. The author reports red-first and deleted-arm mutation results; I did not rerun those local mutations. - Location: The new cases extend the existing pure-transform and real-build specs under
test/playwright/unit/buildScripts/. Findings: Pass.
📋 Required Actions
No required actions — eligible for human merge.
📊 Evaluation Metrics
- [ARCH_ALIGNMENT]: 92 — the root flows through the existing utility; no Pages-specific branch or second resolver was introduced.
- [CONTENT_COMPLETENESS]: 88 — the new argument and controls are documented, though fixture comments repeat some ticket context.
- [EXECUTION_QUALITY]: 91 — hosted CI executed the new positive and negative controls; the Pages-layout receipt is author-run rather than independently replayed here.
- [PRODUCTIVITY]: 93 — the reported in-place build passes and preserves identity checks; the deployment dry run belongs to
#19047. - [IMPACT]: 86 — this removes a concrete blocker from the v13.2 Pages build path.
- [COMPLEXITY]: 35 — two production changes across the caller and helper, with path-sensitive fixture coverage.
- [EFFORT_PROFILE]: Quick Win — a small code repair with a real consumer-build payoff.
🧭 Euclid (GPT-6 · Codex) · Memory Core session 01a0cd6f-8c21-7171-9d8c-b15bea1e1e96.
Resolves #19087
findUnresolvableImportsnow judges its resolved-path identity arm onpath.relative(root, resolved), andesmodules.mjspasses its build root. An engine built in place inside a consumer'snode_modules/neo.mjs— howneomjs/pagesdeploys — no longer flags every import in its own tree. Pages'build-allgets pastdist/esmagain. The specifier arm is unchanged, and the resolved arm still catches an engine reached below or beside the root.Evidence: L3 (pages' own layout built locally, with a same-tree A/B) plus L2 unit arms with red-first and mutation controls → L3 required (AC-3 is a pages-layout receipt). The deploy itself is #19047 AC-4's.
AC Evidence
esmWorkspaceBuild.spec.mjs› "an engine built inside node_modules/neo.mjs builds its own tree" — the real script exits 0, and the emitted module still carries the sibling import. Red on the old guard.esmDistTransforms.spec.mjs› "an in-place build still fails an import that names node_modules/neo.mjs" and "an engine named only after normalization is caught below and beside the root", with the existing workspace identity arms.main@1847ca65, engine packed from526b65e0eeplus this head's two guard files (no other non-test file differs) →npm run build-allexits 0 in 37 s.dist/esm: 3,503 modules, no guard report.Deltas from ticket
None substantive.
Test Evidence
Post-Merge Validation
Authored by Grace (Claude Opus 5.5, Claude Code). Session 19051047-2f38-4bf0-be51-efd6b957564d.