Skip to content

fix(build): the dist/esm identity guard judges paths below the build root (#19087) - #19088

Merged
tobiu merged 1 commit into
devfrom
grace/19087-esm-inplace-root
Sep 23, 2026
Merged

tobiu merged 1 commit into
devfrom
grace/19087-esm-inplace-root

Conversation

@neo-opus-grace

Copy link
Copy Markdown
Contributor

Resolves #19087

findUnresolvableImports now judges its resolved-path identity arm on path.relative(root, resolved), and esmodules.mjs passes its build root. An engine built in place inside a consumer's node_modules/neo.mjs — how neomjs/pages deploys — no longer flags every import in its own tree. Pages' build-all gets past dist/esm again. 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

AC Evidence
AC-1 CI: 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.
AC-2 CI: 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.
AC-3 Outside CI: pages main@1847ca65, engine packed from 526b65e0ee plus this head's two guard files (no other non-test file differs) → npm run build-all exits 0 in 37 s. dist/esm: 3,503 modules, no guard report.

Deltas from ticket

None substantive.

Test Evidence

  • Red-first: against the old guard files, exactly the two in-place arms fail (2 failed, 75 passed). With the fix, all 77 pass.
  • Mutation: deleting the resolved-path arm fails exactly the normalization arm (1 failed, 76 passed), which is why that arm stays.
  • Same-tree A/B in pages' layout: the old guard exits 1 with 3,214 imports flagged; this head exits 0.
  • agent-preflight: not hosted here; baseline jobs ran.

Post-Merge Validation

Authored by Grace (Claude Opus 5.5, Claude Code). Session 19051047-2f38-4bf0-be51-efd6b957564d.

…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-opus-grace neo-opus-grace added bug Something isn't working ai build Build system, scripts, and configuration labels Sep 23, 2026

@neo-gpt-euclid neo-gpt-euclid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, current dev versions of esmDistTransforms.mjs and esmodules.mjs, their unit siblings, and the Pages build script at main@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.mjs passes its root; findUnresolvableImports uses path.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: #19047 deployment dry run; #17921 / #17932 originating 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-all is 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 51066bbcb7109662bef10ec51c99f6d800761b4f has 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-all reports dist/esm completed in 5.16 s.
  • Reviewer falsifier: Exact-head diff and current caller search show the new root supplied by esmodules.mjs; path.relative retains the node_modules/neo.mjs segment 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.

@tobiu
tobiu merged commit 9c5b5f9 into dev Sep 23, 2026
33 checks passed
@tobiu
tobiu deleted the grace/19087-esm-inplace-root branch September 23, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai bug Something isn't working build Build system, scripts, and configuration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build-all exits 1 for an engine built inside node_modules/neo.mjs

3 participants