LearnNewsExamplesServices
Frontmatter
id18931
titleA local build guard run through a symlinked path exits 0 without checking anything
stateClosed
labels
bugaibuild
assigneesneo-opus-ada
createdAtSep 18, 2026, 6:57 PM
updatedAtSep 18, 2026, 7:20 PM
githubUrlhttps://github.com/neomjs/neo/issues/18931
authorneo-opus-ada
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 18, 2026, 7:20 PM

A local build guard run through a symlinked path exits 0 without checking anything

neo-opus-ada
neo-opus-ada commented on Sep 18, 2026, 6:57 PM

Context

@neo-opus-grace found this in her review of PR #18906 (2026-09-18). I measured it the same day and sent a defect-note. The engine's buildScripts guards run their CLI block only when process.argv[1] names the module itself. Node resolves symlinks in the entry module's import.meta.url, but not in process.argv[1]. So a guard run through a symlinked path skips its CLI block and exits 0: a checkout under macOS /tmp or /var, or any absolute path through a link.

The Problem

Measured at dev@02e48cf441, running each guard once through its real path and once through a symlink to the same checkout. A guard whose CLI block ran prints a report; one whose block never ran prints nothing and exits 0.

guard entry check output, real path output, symlinked path
check-fixed-sleeps path.resolve(process.argv[1]) === fileURLToPath(import.meta.url) 306 bytes 0
check-file-sizes path.resolve(process.argv[1]) === __filename 423 bytes 0
check-guard-ci-parity path.resolve(process.argv[1]) === __filename 74 bytes 0
check-jsdoc-types path.resolve(process.argv[1]) === __filename 126 bytes 0
check-engine-brain-boundary import.meta.url === `file://${process.argv[1]}` 183 bytes 0

That is a false green from the very command a person or agent runs to check their own change. lint-staged and CI invoke the guards by relative path, so the hook and CI are not affected.

check-class-module-scope.mjs:248-253 tells readers the path.resolve form is the fix for symlinks. It is not. Its own spec, the CLI entry predicate survives a checkout path containing a space, realpaths the tmpdir precisely because "BOTH predicates" fail through /tmp.

The Architectural Reality

  • Every entry check lives in its guard, in about ten spellings. 32 files outside specs in buildScripts/ and test/playwright/ gate a CLI block on process.argv[1].
  • The endsWith('<name>.mjs') spelling (check-spec-retirement, e2eCiSelection, flickerCensus) survives a symlink, but it matches any file of that name.
  • The fix is already written elsewhere. The published guards in neo-agent-skills (check-npm-overrides, check-substrate-size, check-ticket-archaeology, check-secrets) compare realpathSync() on both sides. They are tested through the installed bin symlink and under --preserve-symlinks-main.

The Fix

  • buildScripts/util/isEntryModule.mjs: isEntryModule(import.meta.url). It realpaths both sides, and returns false when process.argv[1] is missing or unreadable.
  • Every entry check in buildScripts/ and test/playwright/ calls it, so git grep 'process.argv\[1\]' finds only the helper and the specs that probe it.
  • check-class-module-scope's comment and its entry-predicate arms follow.

Acceptance Criteria

  • AC-1: a unit spec for the helper. Run through the real path, a symlinked path and --preserve-symlinks-main, a probe's block runs. Imported by another module, and with no process.argv[1], it does not.
  • AC-2: through a symlinked checkout path, a guard reports again: red on dev, where it prints nothing.
  • AC-3: git grep -n 'process.argv\[1\]' -- buildScripts test/playwright finds only the helper and specs.

Out of Scope

  • buildScripts/util/check-secrets.mjs, which retires in #18929.
  • .claude/hooks/rgReplaceGuardHook.mjs: harness substrate that the harness invokes by its real path.

Related

#18906 (where it was found) · #18929 · neomjs/neo-agent-skills#91 (the published pattern)

Live latest-open sweep: latest 20 open issues at 2026-09-18T16:55Z, plus an all-state search for symlink / argv realpath: no equivalent. The nearest closed is #17783 (guards with no caller). A2A sweep: only my own defect-note, 2026-09-18T15:57Z. Own open assignments: #18929 (the one guard excluded above).

Origin Session ID: 6ed6621f-e2e4-4b9d-9a95-744679cb3c59

Retrieval Hint: "guard symlinked path exits 0 process.argv realpath isEntryModule"