Skip to content

test(ines): make same-size prefix changes visible on coarse timestamps - #8689

Closed
hafeez97 wants to merge 1 commit into
morluto:mainfrom
hafeez97:fix/ines-change-test-timestamps
Closed

hafeez97 wants to merge 1 commit into
morluto:mainfrom
hafeez97:fix/ines-change-test-timestamps

Conversation

@hafeez97

@hafeez97 hafeez97 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #8685. rejects changed iNES prefixes at the target entry point failed in Linux CI because its same-size fixture rewrite can be invisible to file metadata. This makes the rewrite observable on any filesystem without weakening the assertion.

Problem and expected behavior

The test writes the iNES fixture, then rewrites it at the same size (counts, signature cases) on the first intercepted read, milliseconds later. The target guard (assertStableRegularFileIdentity) detects change by comparing dev, ino, size, mode, mtime and ctime. Linux stamps file times from a coarse clock, so both writes can share every compared field. The classifier then parses the rewritten header without a change signal, matching the CI failure: truncated iNES payload: header declares 4186128 bytes; file has 40976 (0x10 + 255 × 16384 + 8192, i.e. the counts mutation). macOS APFS records fine-grained times, which explains the local pass.

No metadata-based guard can detect a same-size rewrite within one timestamp tick, so this is a test synchronization defect, not a production guard bug.

Change and scope

After writing the fixture, the test sets its access and modified times to a fixed past instant (2000-01-01T00:00:00Z). The mutation's write then always produces a different mtime. Assertions are unchanged: the target route still requires a reason containing changed, and the inventory route still requires integrity.

Not included: changes to production identity checks. Other same-size rewrites in this file (overwritten header admission) zero the header and fail content validation regardless of timestamps, so they don't depend on this.

Contribution scope: not applicable (test-only fix within existing boundaries).

Contract and boundary impact

  • Semantic owner and earliest changed stage: test fixture setup only; production owner src/filesystem/RegularFile.ts unchanged.
  • Contribution scope fit and linked maintainer decision: not applicable.
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
  • Generated metadata, package, or installation impact: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

(Test-only change; none of the above apply to product behavior.)

Evidence and regression coverage

  • Tests added or updated: tests/boundary/filesystem/inesArtifact.test.ts, rejects changed iNES prefixes at the %s entry point.
  • Base reproduction or other evidence: the CI failure is in the linked issue. The cause is source-derived (the compared stat fields plus coarse Linux timestamp granularity) and consistent with the failing counts header size. Not reproduced at runtime on Linux.
  • User-visible CLI/MCP output (if applicable): not applicable.
  • Remaining proof gaps: no Linux run was available locally; the Linux CI shard on this PR is the first Linux execution.

Validation performed

  • npm run test:focused -- tests/boundary/filesystem/inesArtifact.test.ts (macOS arm64, Node 24.22.1): 37 passed.
  • npm run check:fast: typecheck and lint successful.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: macOS arm64 only; Linux pending CI.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: test-only; no new side effects.

Author readiness

Human owner: @hafeez97

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🤖 Generated with Claude Code

The changed-prefix regression rewrote its fixture at the same size within
milliseconds of creating it. Linux stamps mtime/ctime from a coarse clock,
so both writes can share every stat field the target guard compares, and the
classifier parsed the rewritten header without seeing a change. Age the
fixture's timestamps before the mutation so the rewrite is observable on any
filesystem while the test still requires a changed-input refusal.

Fixes morluto#8685

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@greptile-apps

greptile-apps Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This test-only change appears safe to merge.

Summary

Makes same-size fixture rewrites visible by setting the initial file timestamps to a fixed past date.

  • The iNES race test makes same-size rewrites visible on coarse-timestamp filesystems.

Reviews (1) · Last reviewed commit: "test(ines): make same-size prefix change..." · Reviewed by Greptile

@hafeez97
hafeez97 marked this pull request as ready for review November 2, 2026 17:44
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T17:46:32.070840Z e9e270d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@CassieFox23

Copy link
Copy Markdown
Contributor

TL;DR: I ran the one changed test file on Node 22.23.4, 24.22.1 and 26.12.1. All 37 tests passed on each version. On this head, the CI run is action_required and lists no test jobs.

Check Node 22.23.4 Node 24.22.1 Node 26.12.1
tests/boundary/filesystem/inesArtifact.test.ts pass: 1/1 files, 37/37 tests pass: 1/1 files, 37/37 tests pass: 1/1 files, 37/37 tests
  • The PR changes 1 file against the merge base: tests/boundary/filesystem/inesArtifact.test.ts.
  • Head e9e270d is 380 commits behind main 9d0e87f.
  • The CI workflow run is completed/action_required. Its check runs list no Source tests, Portable tests or Test shard jobs.
  • CodeQL production and 20 PR title runs are also completed/action_required.
  • PR readiness has 4 runs completed/success and 17 completed/cancelled. The commit status PR readiness is success.
  • Check runs: Greptile Review and 4 Validate author declaration runs succeeded. 13 Validate author declaration runs were cancelled.
  • GitHub shows mergeable true, state blocked, and not a draft.

Not run

  • A loop of npm run test:focused -- tests/boundary/filesystem/inesArtifact.test.ts on Linux, 30 or more runs with the utimes line present and again with it removed.
  • A merge with current main, 9d0e87f.
Test setup
  • Box: Fedora 44 VM (4 vCPUs, 8 GB) on my Nobara 44 PC, Linux 7.2.11
  • Node: 22.23.4, 24.22.1, 26.12.1
  • Head / base: e9e270d / 26c3e9e (merge base with main)
  • Install: npm ci --offline and npm run test:prepare on Node 24.22.1
Commands
npm ci --offline
npm run test:prepare
xvfb-run -a npm run test:focused -- tests/boundary/filesystem/inesArtifact.test.ts

🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

gensokyo-dev added a commit that referenced this pull request Nov 14, 2026
The changed-prefix regression rewrote its fixture at the same size within
milliseconds of creating it. Linux stamps mtime/ctime from a coarse clock,
so both writes can share every stat field the target guard compares, and the
classifier parsed the rewritten header without seeing a change. Age the
fixture's timestamps before the mutation so the rewrite is observable on any
filesystem while the test still requires a changed-input refusal.

Fixes #8685

Supersedes #8689

Co-Authored-By: gensokyo-dev <[email protected]>
N0zoM1z0 pushed a commit that referenced this pull request Nov 14, 2026
The changed-prefix regression rewrote its fixture at the same size within
milliseconds of creating it. Linux stamps mtime/ctime from a coarse clock,
so both writes can share every stat field the target guard compares, and the
classifier parsed the rewritten header without seeing a change. Age the
fixture's timestamps before the mutation so the rewrite is observable on any
filesystem while the test still requires a changed-input refusal.

Fixes #8685

Supersedes #8689

Co-Authored-By: gensokyo-dev <[email protected]>
@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Thank you! Your iNES coarse-timestamp fix landed with authorship kept in #10568 (rebase-merged), which fixes #8685. Closing as superseded.

@N0zoM1z0 N0zoM1z0 closed this Nov 14, 2026
@morluto morluto added the area: tests Test suite and verification label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tests Test suite and verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] iNES change-detection test failed with truncated-payload refusal in Linux CI

4 participants