Skip to content

test(accuracy): sync AccuracyCoin to upstream ce61bb5 (holds 141/141) - #339

Merged
doublegate merged 1 commit into
mainfrom
test/accuracycoin-sync-ce61bb5
Aug 3, 2026
Merged

test(accuracy): sync AccuracyCoin to upstream ce61bb5 (holds 141/141)#339
doublegate merged 1 commit into
mainfrom
test/accuracycoin-sync-ce61bb5

Conversation

@doublegate

@doublegate doublegate commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

Re-syncs the AccuracyCoin accuracy oracle (100thCoin/AccuracyCoin, MIT) to the newest upstream ce61bb5 "Simplified Internal Data Bus error 3" (2026-08-03) — 8 commits ahead of the vendored 71f57fb (2026-06-26) — and re-validates RustyNES against it.

Four upstream commits change test behaviour (Internal Data Bus, Interrupt Flag Latency, DMC DMA Bus Conflicts, $2004 Stress Test); the rest are README typos. The compiled ROM recompiled (NROM, 32 KiB PRG + 8 KiB CHR, new content hash).

What changed

  • tests/roms/accuracycoin/AccuracyCoin.nes → new build (sha256 == upstream). The harness reads the ROM's own self-reported results at runtime (no memory-mapped protocol, no hard-coded expected list), so the new logic is exercised with no harness change.
  • SOURCE_CATALOG.tsv intentionally NOT regenerated — the ROM's test structure is byte-identical (the 189 Suite_*/table "name",… declaration lines diff to empty), so all 146 catalog entries (141 assigned + 5 excluded Power-On-State) and every result_addr are stable. Only test logic changed.
  • 4 of 26 custom sub-test ROMs regenerated (internal-data-bus, iflag-latency, dmc-bus-conflicts, ppu-misc-2004-stress) — the ones whose target test's logic changed. Rebuilt from ce61bb5 via scripts/accuracycoin-build/build_sub_test_rom.py; the (suite,test) indices were recovered from each old ROM's injected boot-wrapper (guaranteeing the same test lands) and re-verified in the rebuilds. These feed only the read-only trace/debug bins — no #[test] or insta snapshot references them, so nothing to re-bless. The other 22 sub-tests' targets are unchanged and left as-is.

Validation

cargo test -p rustynes-test-harness --features test-roms --test accuracycoin --test accuracycoin_runaheadpass (exit 0):

  • RAM-direct decoder (authoritative): total=146, pass=130, pass_with_code=11, fail=0, not_run=5 → 141/141 (100.00%), every suite clean.
  • accuracycoin_is_unaffected_by_run_ahead holds (bit-stable through run-ahead).

The four upstream behaviour fixes regressed nothing — RustyNES still passes all 141 assigned tests against the newest oracle. Emulator core is byte-identical (only the external oracle advanced), so no CHANGELOG entry.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved process locking so failures and acquisition timeouts stop execution instead of allowing concurrent runs.
    • Review comments are now posted safely before outdated matching comments are removed.
    • Prevented comments containing live authorization links from being published.
  • Tests

    • Updated AccuracyCoin NES test images and diagnostic data across CPU, DMA, PPU, controller, interrupt, and hardware-behavior coverage.

Copilot AI review requested due to automatic review settings August 3, 2026 19:03
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

💤 Files selected but had no reviewable changes (5)
  • tests/roms/AccuracyCoin/sub-tests/dmc-bus-conflicts.nes
  • tests/roms/AccuracyCoin/sub-tests/iflag-latency.nes
  • tests/roms/AccuracyCoin/sub-tests/internal-data-bus.nes
  • tests/roms/AccuracyCoin/sub-tests/ppu-misc-2004-stress.nes
  • tests/roms/accuracycoin/AccuracyCoin.nes
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: cb3a3642-655f-458a-81e8-4590a016d17d

📥 Commits

Reviewing files that changed from the base of the PR and between a09232f and cd0c4dc.

📒 Files selected for processing (5)
  • tests/roms/AccuracyCoin/sub-tests/dmc-bus-conflicts.nes
  • tests/roms/AccuracyCoin/sub-tests/iflag-latency.nes
  • tests/roms/AccuracyCoin/sub-tests/internal-data-bus.nes
  • tests/roms/AccuracyCoin/sub-tests/ppu-misc-2004-stress.nes
  • tests/roms/accuracycoin/AccuracyCoin.nes

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The agy review script now fails closed on serialization errors and protects newly posted comments from cleanup. The AccuracyCoin main ROM and four sub-test ROM binaries were regenerated with updated test code and embedded data.

Changes

agy review workflow

Layer / File(s) Summary
Fail-closed agy serialization
scripts/agy-review.sh
The script now requires flock, aborts on lock setup failures, and stops when lock acquisition times out.
Protected comment lifecycle
scripts/agy-review.sh
The script checks OAuth URLs before posting, posts the new review first, and excludes that comment from deletion. Older deletion failures remain warnings.

AccuracyCoin ROM artifacts

Layer / File(s) Summary
Regenerated AccuracyCoin test ROM suite
tests/roms/accuracycoin/AccuracyCoin.nes, tests/roms/AccuracyCoin/sub-tests/*.nes
The main ROM and four sub-test ROMs contain regenerated metadata, executable test routines, vectors, lookup tables, diagnostics, graphics, and trailing binary data.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant agy-review.sh
  participant flock
  participant agy
  participant GitHub API
  agy-review.sh->>flock: acquire required process lock
  flock-->>agy-review.sh: return lock status
  agy-review.sh->>agy: run serialized review
  agy-review.sh->>GitHub API: post comment after OAuth URL check
  agy-review.sh->>GitHub API: delete older matching bot comments
Loading

Possibly related PRs

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 9
✅ Passed checks (9 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the AccuracyCoin synchronization, upstream commit, and validation result, which match the primary changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Docs-As-Spec Sync ✅ Passed The PR changes only scripts/agy-review.sh and AccuracyCoin ROM test assets; no files under the four chip crates changed, so the documentation-sync condition does not apply.
Changelog Entry For User-Visible Changes ✅ Passed The PR changes only AccuracyCoin test ROMs and CI reviewer tooling; no runtime emulator code changes. CHANGELOG.md [Unreleased] is empty, appropriately for test/CI-only work.
No Unwrap/Expect/Panic On Untrusted Input ✅ Passed The PR adds no .unwrap(), .expect(), or panic!(); the only textual change is shell code, and the other five changes are binary NES ROM assets.
Safety Comment On New Unsafe Blocks ✅ Passed The full PR diff adds only scripts/agy-review.sh and NES binaries; it adds no Rust unsafe blocks or unsafe functions requiring SAFETY comments.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/accuracycoin-sync-ce61bb5

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/agy-review.sh`:
- Around line 548-551: Validate new_comment_id after resolving the latest GitHub
Actions review comment and before issuing the cleanup gh api request. Require a
non-empty positive numeric ID; when validation fails, log the resolution failure
and skip deletion entirely, ensuring the subsequent filter cannot delete the
newly posted comment.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 00b82f6e-0c8e-4835-af34-5478c687d7fb

📥 Commits

Reviewing files that changed from the base of the PR and between 71d48ef and a09232f.

📒 Files selected for processing (6)
  • scripts/agy-review.sh
  • tests/roms/AccuracyCoin/sub-tests/dmc-bus-conflicts.nes
  • tests/roms/AccuracyCoin/sub-tests/iflag-latency.nes
  • tests/roms/AccuracyCoin/sub-tests/internal-data-bus.nes
  • tests/roms/AccuracyCoin/sub-tests/ppu-misc-2004-stress.nes
  • tests/roms/accuracycoin/AccuracyCoin.nes

Comment thread scripts/agy-review.sh Outdated
Comment on lines +548 to +551
new_comment_id="$(gh api "repos/${REPO}/issues/${PR}/comments" --paginate \
--jq '[.[] | select(.user.type == "Bot" and .user.login == "github-actions[bot]") | select(.body | contains("'"${MARKER}"'"))] | last | .id' 2>/dev/null)"
gh api "repos/${REPO}/issues/${PR}/comments" --paginate \
--jq ".[] | select(.user.type == \"Bot\" and .user.login == \"github-actions[bot]\") | select(.body | contains(\"${MARKER}\")) | .id" 2>/dev/null \
--jq ".[] | select(.user.type == \"Bot\" and .user.login == \"github-actions[bot]\") | select(.body | contains(\"${MARKER}\")) | select(.id != ${new_comment_id:-0}) | .id" 2>/dev/null \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Validate new_comment_id before cleanup.

If the first list request returns no matching comment, new_comment_id can be empty or null. The ${new_comment_id:-0} fallback then excludes no real comment. If the second request sees the newly posted comment, cleanup can delete it.

Require a positive numeric ID before deletion. If ID resolution fails, log the failure and skip cleanup so both the fresh and prior reviews remain available.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/agy-review.sh` around lines 548 - 551, Validate new_comment_id after
resolving the latest GitHub Actions review comment and before issuing the
cleanup gh api request. Require a non-empty positive numeric ID; when validation
fails, log the resolution failure and skip deletion entirely, ensuring the
subsequent filter cannot delete the newly posted comment.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Antigravity (agy) PR-review helper script, tightening its concurrency guard (fail-closed locking) and reordering comment posting/de-duplication to reduce the risk of losing the last successful bot review.

Changes:

  • Make flock-based serialization fail-closed (missing flock or lock timeout now aborts instead of running unserialized).
  • Add an unconditional OAuth URL leak guard before any comment deletion/posting actions.
  • Post the new PR comment first, then delete prior bot review comments (excluding the newly posted one).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/agy-review.sh Outdated
Comment on lines +548 to +551
new_comment_id="$(gh api "repos/${REPO}/issues/${PR}/comments" --paginate \
--jq '[.[] | select(.user.type == "Bot" and .user.login == "github-actions[bot]") | select(.body | contains("'"${MARKER}"'"))] | last | .id' 2>/dev/null)"
gh api "repos/${REPO}/issues/${PR}/comments" --paginate \
--jq ".[] | select(.user.type == \"Bot\" and .user.login == \"github-actions[bot]\") | select(.body | contains(\"${MARKER}\")) | .id" 2>/dev/null \
--jq ".[] | select(.user.type == \"Bot\" and .user.login == \"github-actions[bot]\") | select(.body | contains(\"${MARKER}\")) | select(.id != ${new_comment_id:-0}) | .id" 2>/dev/null \
Comment thread scripts/agy-review.sh Outdated
Comment on lines +414 to +418
# instead of failing. FAIL CLOSED: if flock is missing, or the lock can't be
# taken/times out, exit rather than let two agy processes race each other --
# a fail-open here made the exact collision this lock exists to prevent still
# reachable (one run can burn the whole ${AGY_RETRIES}x${AGY_LOCK_WAIT}s wait).
command -v flock >/dev/null 2>&1 || {
Re-sync the AccuracyCoin accuracy oracle (100thCoin/AccuracyCoin, MIT) to
the newest upstream, `ce61bb5` "Simplified Internal Data Bus error 3"
(2026-08-03), advancing the vendored suite 8 commits from `71f57fb`
(2026-06-26), and re-validate RustyNES against it. Four of the eight
upstream commits change test *behaviour* -- "Simplified Internal Data Bus
error 3", "Fixed a bug in Interrupt Flag Latency", "Updated DMC DMA Bus
Conflicts", and "Fixed an edge case in $2004 Stress Test"; the remaining
four are README typo/formatting fixes. The compiled ROM recompiled
(NROM, 32 KiB PRG + 8 KiB CHR, same 40976 B, new content hash).

Primary oracle ROM
------------------
`tests/roms/accuracycoin/AccuracyCoin.nes` is replaced with the new build
(sha256 verified identical to the freshly fast-forwarded reference clone).
The screen-grid + RAM-direct result decoders in
`crates/rustynes-test-harness/src/accuracy_coin*.rs` read the ROM's own
self-reported per-test results at runtime -- there is no memory-mapped
status protocol and no hard-coded expected-pass list -- so the new logic
is exercised without touching the harness.

Catalog is deliberately NOT regenerated
----------------------------------------
`tests/roms/AccuracyCoin/SOURCE_CATALOG.tsv` (the 146-entry
`suite<TAB>name<TAB>result_addr` source of truth the RAM-direct decoder
embeds via `include_str!`) is unchanged, because the ROM's test *structure*
is byte-identical across the update: the 189 `Suite_*` / `table "name",...`
declaration lines diff to empty between `71f57fb` and `ce61bb5`. Every test
name, suite membership, and `result_addr` is therefore stable (146 rows =
141 assigned tests + 5 "Power On State" print-only tests the upstream
display routine excludes from the result table). Only test logic changed,
not the catalog.

Regenerated single-test sub-test ROMs (4 of 26)
-----------------------------------------------
The custom sub-test ROMs are whole-battery builds with a boot wrapper that
jumps straight to one target test (`scripts/accuracycoin-build/
build_sub_test_rom.py`, which injects `LDY #suite / STY / JSR SetUpSuite /
JSR LoadSuiteMenuNoRendering / LDX #test / STX` into
`AutomaticallyRunEveryTestInROM`). Because a sub-test ROM embeds the entire
recompiled ROM, the four whose *target* test's logic changed are rebuilt
from `ce61bb5`:

  - internal-data-bus.nes     suite=19 (CPU Behavior 2)  test=4
  - iflag-latency.nes         suite=11 (CPU Interrupts)  test=0
  - dmc-bus-conflicts.nes     suite=12 (DMA Tests)       test=6
  - ppu-misc-2004-stress.nes  suite=18 (PPU Misc.)       test=6

The `(suite, test)` indices were recovered directly from each pre-existing
ROM's injected wrapper (byte pattern `A0 ss 84 .. 20 .. .. 20 .. .. A2 tt
86 ..`) rather than re-derived, guaranteeing each rebuild lands the exact
same test as before; the indices were then re-verified against the rebuilt
ROMs. These four feed only the read-only trace/debug binaries
(`trace_dmc_dma`, `trace_apu_reg_activation`, `trace_controller_strobing`,
`validate_sub_test_rom`) -- no `#[test]` or `insta` snapshot references
them, so there is nothing to re-bless. The other 22 sub-tests' target
tests are unchanged upstream and are intentionally left as-is.

Re-validation (unchanged: 141/141, 100.00%)
-------------------------------------------
`cargo test -p rustynes-test-harness --features test-roms --test
accuracycoin --test accuracycoin_runahead` passes (exit 0):
  - RAM-direct decoder (authoritative): total=146, pass=130,
    pass_with_code=11, fail=0, skipped=0, not_run=5 (the excluded Power On
    State tests) => 141/141 assigned tests, 100.00%. Every one of the 20
    suites reports zero failures.
  - `accuracycoin_is_unaffected_by_run_ahead` holds -- the pass count is
    bit-stable across the snapshot/restore run-ahead path.
The four upstream behaviour fixes regressed nothing; RustyNES still passes
all 141 assigned tests against the newest oracle.

The emulator core is byte-identical -- only the external oracle advanced --
so no CHANGELOG behaviour entry is warranted. The reference clone
`ref-proj/AccuracyCoin` (gitignored) was fast-forwarded locally and is not
part of this commit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@doublegate
doublegate force-pushed the test/accuracycoin-sync-ce61bb5 branch from a09232f to cd0c4dc Compare August 3, 2026 20:13
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Antigravity review (Gemini via Ultra)

This PR updates five binary .nes test ROM files in the AccuracyCoin suite to upstream commit ce61bb5.

Blocking issues

None found.

Suggestions

  • Check path casing consistency between tests/roms/AccuracyCoin/sub-tests/ and tests/roms/accuracycoin/. On case-sensitive filesystems, inconsistent directory casing can cause path resolution or test discovery failures.
  • Provide SHA-256 checksums or build provenance in the commit description for modified binary blobs to verify binary integrity and facilitate auditing.

Nitpicks

  • The PR description lacks test output logs to substantiate the title's claim of passing 141/141 tests.

Automated first-pass review by agy on a self-hosted runner -- not a human review.

@doublegate
doublegate merged commit 26c467c into main Aug 3, 2026
24 checks passed
@doublegate
doublegate deleted the test/accuracycoin-sync-ce61bb5 branch August 3, 2026 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants