Skip to content

test(artifacts): make same-size carrier rewrites observable - #8060

Closed
SahinurDEV wants to merge 1 commit into
morluto:mainfrom
SahinurDEV:test/deterministic-carrier-mutation
Closed

SahinurDEV wants to merge 1 commit into
morluto:mainfrom
SahinurDEV:test/deterministic-carrier-mutation

Conversation

@SahinurDEV

@SahinurDEV SahinurDEV commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Two artifact tests fail intermittently on Linux because a same-size rewrite can be invisible to the source-identity check. The tests now make the rewrite observable by setting a distinct mtime. No issue is linked; I found no existing report.

Problem and expected behavior

  • src/artifacts/pyinstaller/PyInstallerBoundaries.test.ts › "binds materialization to the inventoried digest and checks cached carrier freshness" rewrites the carrier with archive(Buffer.from("other")), the same size as the "first" original.
  • src/artifacts/NodeSeaArtifactReader.test.ts › "rejects post-classification carrier mutation before publishing Node SEA facts" (both cases) rewrites the carrier with a replacement of asserted equal length.

sameArtifactSourceIdentity compares dev, inode, size, mode, mtimeNs and ctimeNs. On ext4, two writes in quick succession can receive identical timestamps (coarse kernel clock), so the rewritten file has the same identity and the expected integrity rejection never happens. Observed on this host: two back-to-back writeFileSync calls produced the same mtimeNs and ctimeNs.

Change and scope

After each rewrite, the tests call utimes / utimesSync with a fixed, distinct time so the mutation is detectable through metadata, which is what the code under test relies on. Test-only change. Not included: changing the production freshness check to rehash content (a design decision for maintainers; this PR only documents the limitation in a comment).

Contract and boundary impact

  • Semantic owner and earliest changed stage: tests only

  • Contribution scope fit and linked maintainer decision: not applicable (test reliability fix)

  • 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

  • Documentation or usability only; no target interaction.

Evidence and regression coverage

  • Tests added or updated: the two tests above.
  • Base reproduction: on upstream main, npx vitest run src/artifacts/pyinstaller/PyInstallerBoundaries.test.ts failed with promise resolved "undefined" instead of rejecting (line 278); it passed when filtered with -t, which is consistent with timing. The Node SEA cases failed during a npx vitest run src/artifacts run and passed alone.
  • User-visible CLI/MCP output: not applicable
  • Remaining proof gaps: only verified on Linux/ext4; not run on macOS or Windows.

Validation performed

  • npx vitest run src/artifacts/pyinstaller/PyInstallerBoundaries.test.ts src/artifacts/NodeSeaArtifactReader.test.ts — 66/66 passed, three consecutive runs
  • npx prettier --check on both files — clean

Compatibility, safety, and release

  • Breaking changes or migration steps: none
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable
  • Package or release metadata impact: none
  • Security, privacy, process, or containment review: not applicable

Author readiness

Human owner: @SahinurDEV

  • 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.

Same-size rewrites in the PyInstaller freshness and Node SEA mutation
tests can land within one coarse kernel timestamp tick, leaving inode,
size, mtime and ctime unchanged, so the identity check sees no change
and the tests fail intermittently. Set a distinct mtime after each
rewrite.
@chatgpt-codex-connector

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 ⚠️ Failed 2026-10-29T20:08:03.020862Z
We couldn’t complete this review. Comment @codex review to try again.
6079b0f PR opened
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The test-only changes appear safe to merge.

Summary

Makes same-size rewrites visible to the existing freshness checks in two artifact tests.

  • Artifact tests make same-size carrier rewrites visible to metadata checks.

Reviews (1) · Last reviewed commit: "test(artifacts): make same-size carrier ..." · Reviewed by Greptile

SII-YDD added a commit to SII-YDD/rea that referenced this pull request Oct 31, 2026
Adopt the scoped two-file CI prerequisite from morluto#8060
(6079b0f). Preserve all original
integrity and metadata assertions.

Co-authored-by: SahinurDEV <68515168+SahinurDEV@users.noreply.github.com>
@CassieFox23

Copy link
Copy Markdown
Contributor

TL;DR: All 66 tests in the 2 changed test files passed on Node 22.23.4, 24.22.1 and 26.12.1. The head is 507 commits behind main. The CI run on this head is marked action_required, with no test jobs in its check runs.

I ran head 6079b0f in a VM. I ran the 2 changed files, src/artifacts/NodeSeaArtifactReader.test.ts and src/artifacts/pyinstaller/PyInstallerBoundaries.test.ts, together on each Node version. Each Node ran the files once, so this run can't show whether the intermittent failure is gone.

Check Node 22.23.4 Node 24.22.1 Node 26.12.1
Test Files pass, 2 passed (2) pass, 2 passed (2) pass, 2 passed (2)
Tests pass, 66 passed (66) pass, 66 passed (66) pass, 66 passed (66)

The head is 507 commits behind main 559083b.

CI on the head, read live with gh: mergeable true, state blocked, not a draft.

  • CI workflow run: completed/action_required (1 run).
  • PR title workflow runs: completed/action_required (4 runs).
  • PR readiness workflow runs: 1 success, 1 failure, 2 cancelled.
  • PR readiness commit status: success.
  • Validate author declaration check runs: 1 failure, 2 cancelled, 1 success.
  • Greptile Review check run: success.

I see no Source tests, Portable tests or Test shard jobs in the CI run's check runs.

Not run

  • A run of npx vitest run src/artifacts as a whole, not only the two test files, to check whether the Node SEA failures appear only in that full run.
  • A probe runs both test files 30+ times. It runs them with and without the utimes and utimesSync lines. The lines sit at PyInstallerBoundaries.test.ts:285 and NodeSeaArtifactReader.test.ts:835. It checks whether the flake returns only with those lines.
  • A merge with current main, 559083b.
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: 6079b0f / 860fdd8 (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 -- src/artifacts/NodeSeaArtifactReader.test.ts src/artifacts/pyinstaller/PyInstallerBoundaries.test.ts

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

@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Closing in favour of your own #10155, which covers these two tests plus the Uf2 and Deno readers with the relative-mtime approach.

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

Labels

area: evidence Evidence, artifacts, and reconstruction

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants