Skip to content

docs(accuracysnes): record why E8.06 is not reachable from the cart - #301

Merged
doublegate merged 1 commit into
mainfrom
docs/e8-06-withdrawn
Aug 1, 2026
Merged

docs(accuracysnes): record why E8.06 is not reachable from the cart#301
doublegate merged 1 commit into
mainfrom
docs/e8-06-withdrawn

Conversation

@doublegate

@doublegate doublegate commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Authored, injected and withdrawn the same day. Docs-only — the ROM is byte-identical (checksum $DA9E before and after), which is the withdrawal check this project uses.

The design was sound. Two KON writes exactly 32 SPC cycles apart, GAIN = $DF so ENVX climbs 2 per output sample, then difference the two voices: 4 for the two-sample lead hardware gives, 2 for the one-sample lead a per-sample poll would give. Both hardware outcomes are accepted, so no uncontrolled phase decides the verdict — the lesson from E8.01's two rejected drafts.

What killed it is the read window. Each voice's ENVX is latched at its own tick of the DSP's 32-tick schedule, so a reading taken between two voices' updates is one whole sample wrong — exactly the size of the signal. Bracketing the voice-6 read with two voice-7 reads and requiring them to agree does not fit:

three-reading window of a 32-cycle sample
dsp_read_to x3 39 cycles — a straddle is certain
register-landed reads (MOV Y,dp / MOV X,dp) 21 cycles — a straddle is likely

Injecting the named bug (KON examined every sample) trips the guard, not the row's own code, on both versions. A row whose named injection fires the guard rather than the assertion has not been demonstrated.

The reusable finding: two voices' ENVX cannot be compared at single-sample resolution from the cart. The loop is already as tight as the instruction set allows, so a future row needs a different observable rather than a faster one. E8.06's swallow half is not separately assertable either — at any gap both poll rates swallow or spare the first voice depending on phase, so the lead is what carries the claim.

The two new SPC700 emitters went with it: this file carries only opcodes a committed test exercises, and an unexercised encoding is an unverified one.

🤖 Generated with Claude Code

Documents the attempted and withdrawn AccuracySNES dossier assertion E8.06.

The proposed two-voice ENVX comparison is not reliable at single-sample resolution because DSP read timing spans too much of the sample window. The named bug triggers the guard before the assertion on both hardware versions.

The coverage denominator does not move. The ROM remains byte-identical and retains checksum $DA9E.

The claim is false if a future observable permits reliable cart-level single-sample envelope comparison, or if the timing and injection results are disproven.

Authored, injected and withdrawn the same day. The design was sound -- two KON
writes 32 cycles apart, GAIN $DF so ENVX climbs 2 per sample, difference the
two voices: 4 for the two-sample lead hardware gives, 2 for the one-sample
lead a per-sample poll would give, with both hardware outcomes accepted so no
uncontrolled phase decides the verdict.

What killed it is the read window. Each voice's ENVX is latched at its own
tick of the DSP's 32-tick schedule, so a reading taken between two voices'
updates is one whole sample wrong -- exactly the size of the signal. Bracketing
the voice-6 read with two voice-7 reads and requiring them to agree does not
fit: three dsp_read_to calls span 39 cycles of a 32-cycle sample, and even
landing each reading in its own register spans 21. Injecting the named bug
trips the guard rather than the row's own code on both versions, so the scored
assertion could not be demonstrated.

The reusable finding: two voices' ENVX cannot be compared at single-sample
resolution from the cart. The loop is already as tight as the instruction set
allows, so a future row needs a different observable rather than a faster one.
E8.06's swallow half is not separately assertable either -- at any gap both
poll rates swallow or spare the first voice depending on phase.

Withdrawal verified byte-clean: the ROM returned to checksum $DA9E, its value
before the row was added. The MOV Y,dp / MOV X,dp emitters went with it, since
this file carries only opcodes a committed test exercises.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings August 1, 2026 08:18
@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Documents the attempted and withdrawn E8.06 test. It records the two-voice KON timing design, ENVX read-window limitations, failed injection validation, and the conclusion that cart-level single-sample envelope comparisons are unreliable.

Changes

AccuracySNES test documentation

Layer / File(s) Summary
E8.06 withdrawal analysis
docs/accuracysnes-plan.md
Adds the E8.06 test results, timing measurements, failed guard injection, and withdrawal conclusion.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 10
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title uses a valid Conventional Commits format and accurately describes the documentation added for E8.06.
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.
Changelog Entry ✅ Passed The full PR diff contains only 41 added lines in docs/accuracysnes-plan.md; it changes no emulator, frontend, CLI, API, or cartridge content, so CHANGELOG.md is not required.
Docs-As-Spec ✅ Passed Against the base branch, the PR changes only docs/accuracysnes-plan.md; no crates/rustysnes-/ path changes or observable crate behavior changes exist.
Accuracysnes Bookkeeping ✅ Passed The base-to-PR diff changes only docs/accuracysnes-plan.md; it adds or removes no test or scene under tests/roms/AccuracySNES/gen/src/.
No Panic On Untrusted Input ✅ Passed The commit changes only docs/accuracysnes-plan.md; the added 41 lines contain no .unwrap(), .expect(), or panic!() calls and add no executable code.
Safety Comment On New Unsafe ✅ Passed The pull request adds only 41 documentation lines in docs/accuracysnes-plan.md; it adds no unsafe block or unsafe fn, so no SAFETY comment is required.

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

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

Antigravity review (Gemini via Ultra)

This documentation-only PR records the design rationale, hardware read-window limitations, and withdrawal of test row E8.06 in docs/accuracysnes-plan.md.

Blocking issues

None found.

Suggestions

  • docs/accuracysnes-plan.md:298: The quoted specification refers to KON=$01 / KON=$02 and "voice 2", but lines 308, 316, and 321 analyze reads across voice 6 and voice 7. Reconcile the bitmasks/voice indices to keep the document consistent.
  • docs/accuracysnes-plan.md:327: The finding states "cannot be compared at single-sample resolution from the cart", but the 21-cycle and 39-cycle read windows describe SPC700 APU execution timing rather than SNES CPU cart-side access. Clarify the execution context.

Nitpicks

  • docs/accuracysnes-plan.md:316: Replace Unicode multiplication symbol × with standard ASCII x.

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

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

Documents why AccuracySNES row E8.06 was attempted and then withdrawn, capturing the key technical limitation (DSP ENVX latch timing/read window) so future work doesn’t repeat the same dead-end, while keeping the ROM byte-identical (checksum unchanged).

Changes:

  • Add a new subsection for E8.06 describing the intended design, the failure mode, and the reusable takeaway.
  • Record the “withdrawal verified byte-clean” rationale (ROM checksum returned to the prior value).

Comment thread docs/accuracysnes-plan.md
Comment on lines +298 to +302
**Attempted 2026-08-01 and withdrawn the same day.** The row reads: *"collapse case `KON=$01` /
`KON=$02` → usually only voice 2, and if both, voice 1 is **2 samples ahead**, proving the 16 kHz
rate."* It is `E8.01`'s mechanism asked the other way round, and the setup was already built, so it
looked like the cheapest row left in Group E.

@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 `@docs/accuracysnes-plan.md`:
- Around line 296-301: Annotate the E8.06 dossier entry in
docs/accuracysnes-plan.md as [NOT CART-MEASURABLE], preserving its existing
assertion and explaining the limitation with links to §E8.06 and ticket T-04-E.
Do not modify the generated coverage file, which already records E8.06 as
uncovered.
🪄 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: 913bfc2d-9333-4d64-9488-8a4d4f636383

📥 Commits

Reviewing files that changed from the base of the PR and between 6c09eb6 and 7c6e0c5.

📒 Files selected for processing (1)
  • docs/accuracysnes-plan.md
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: copilot-pull-request-reviewer
  • GitHub Check: build demo + docs
  • GitHub Check: review
🧰 Additional context used
📓 Path-based instructions (6)
docs/**/*.md

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Before changing a subsystem, consult docs/architecture.md, docs/STATUS.md, CONTRIBUTING.md, the relevant subsystem documentation, and applicable ADRs.

New subsystems must add documentation under docs/.

Files:

  • docs/accuracysnes-plan.md
**/*.{rs,md}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Chip-behavior changes must update both the chip implementation and the corresponding docs/<subsystem>.md documentation.

A chip change must update both the chip implementation and its corresponding docs/<chip>.md documentation in the same change.

Files:

  • docs/accuracysnes-plan.md
**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*: Do not commit or vendor the generated snesdev_wiki/ mirror; it is gitignored and intended only as a local reference.
Keep commits focused and use Conventional Commits: <type>(<scope>): <subject>, with an imperative subject of at most 72 characters.
Do not use emojis in code, comments, or commit messages.
Before opening a PR, ensure formatting, Clippy, workspace tests, the core embedded build, rustdoc with warnings denied, documentation coverage, and changelog requirements pass.
Ticket completion must be reflected in the relevant to-dos/ sprint file.

**/*: Preserve the one-directional crate graph: chip crates must not depend on one another; rustysnes-core ties them together.
Never commit commercial ROMs; only commit derived screenshots and hashes.
Keep docs/STATUS.md as the authoritative per-subsystem status and update project documentation in the same PR as code changes.
Do not treat RustyNES v2.0 or engine-lineage anchors as project releases.

Files:

  • docs/accuracysnes-plan.md
docs/**/*

📄 CodeRabbit inference engine (docs/testing-strategy.md)

Chip crates should exceed 90% unit-test coverage, and each chip should be fuzzable in isolation.

Files:

  • docs/accuracysnes-plan.md
docs/**

⚙️ CodeRabbit configuration file

docs/**: Docs are the spec, not a history log. Flag claims that contradict the code, counts that
contradict the generated docs/accuracysnes-coverage.md, and any statement of coverage that
is broader than what the corresponding test actually asserts.

Files:

  • docs/accuracysnes-plan.md
**/*.md

⚙️ CodeRabbit configuration file

**/*.md: Docs are the spec, not a changelog. Flag prose that has drifted from the code it describes
rather than style nits. The markdownlint gate is pinned to v0.39.0 via pre-commit —
do not report rules that version does not have (MD060 in particular).

Files:

  • docs/accuracysnes-plan.md
🧠 Learnings (2)
📚 Learning: 2026-07-21T01:34:22.909Z
Learnt from: doublegate
Repo: doublegate/RustySNES PR: 189
File: docs/accuracysnes-plan.md:0-0
Timestamp: 2026-07-21T01:34:22.909Z
Learning: When reviewing the AccuracySNES documentation in docs/accuracysnes-*.md (notably docs/accuracysnes-plan.md vs the generated docs/accuracysnes-coverage.md), treat the reported metrics as intentionally non-equivalent: the battery test count and dossier assertion coverage are not interchangeable. Do not infer one count/coverage from the other during review (e.g., one test may contain multiple assertions, and multiple tests may contribute to a single assertion/row such as E6.02).

Applied to files:

  • docs/accuracysnes-plan.md
📚 Learning: 2026-07-21T05:22:58.848Z
Learnt from: doublegate
Repo: doublegate/RustySNES PR: 197
File: docs/accuracysnes-plan.md:598-600
Timestamp: 2026-07-21T05:22:58.848Z
Learning: In the AccuracySNES documentation under `docs/`, when an assertion exists in the research dossier but cannot be measured/verified by the current cartridge timing test, distinguish the dossier assertion from test measurability: keep the original hardware assertion (and any contribution to the coverage denominator) intact, withdraw/stop using the specific test coverage only if the sources cannot decompose the required CPU-cycle timing into bus vs internal components, and mark the row as not measurable using the `[NOT CART-MEASURABLE ...]` annotation with links to the corresponding plan section (e.g., `docs/accuracysnes-plan.md` §A5.20) and the related roadmap/ticket (e.g., `to-dos/ROADMAP.md` ticket `T-06-A`). Ensure the documentation/coverage reporting treats the row as uncovered rather than removing or redefining the assertion.

Applied to files:

  • docs/accuracysnes-plan.md

Comment thread docs/accuracysnes-plan.md
Comment on lines +296 to +301
### `E8.06` — authored, injected, and withdrawn: two voices cannot be compared at one sample

**Attempted 2026-08-01 and withdrawn the same day.** The row reads: *"collapse case `KON=$01` /
`KON=$02` → usually only voice 2, and if both, voice 1 is **2 samples ahead**, proving the 16 kHz
rate."* It is `E8.01`'s mechanism asked the other way round, and the setup was already built, so it
looked like the cheapest row left in Group E.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -n -C 4 'E8\.06|NOT CART-MEASURABLE' docs to-dos

Repository: doublegate/RustySNES

Length of output: 9101


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- required documentation context ---'
for f in docs/architecture.md docs/STATUS.md CONTRIBUTING.md; do
  if [ -f "$f" ]; then
    printf '\n### %s\n' "$f"
    sed -n '1,220p' "$f"
  fi
done

printf '%s\n' '--- E8.06 and coverage conventions ---'
rg -n -C 8 'E8\.06|NOT CART-MEASURABLE|coverage|T-06|roadmap' \
  docs/accuracysnes-plan.md docs/accuracysnes-research-dossier.md \
  docs/accuracysnes-coverage.md to-dos

printf '%s\n' '--- candidate subsystem and ADR documentation ---'
rg -l -i 'AccuracySNES|SPC|DSP|audio|E8' docs adr* 2>/dev/null | head -80

Repository: doublegate/RustySNES

Length of output: 50379


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- plan section ---'
sed -n '280,345p' docs/accuracysnes-plan.md

printf '%s\n' '--- dossier E8 section and related status conventions ---'
sed -n '1278,1310p' docs/accuracysnes-research-dossier.md
rg -n -C 3 '\[NOT CART-MEASURABLE' docs to-dos

printf '%s\n' '--- coverage generator and dossier parsing ---'
rg -n -C 5 'accuracysnes-coverage|NOT CART-MEASURABLE|research-dossier|Uncovered|uncovered' \
  tests scripts docs to-dos \
  -g '*.rs' -g '*.py' -g '*.sh' -g '*.md' -g '*.toml'

printf '%s\n' '--- E8.06 ticket references ---'
rg -n -C 5 'E8\.06|T-[A-Z0-9-]+' docs/accuracysnes-plan.md \
  docs/accuracysnes-research-dossier.md to-dos | \
  grep -E 'E8\.06|T-[A-Z0-9-]+' | head -120

Repository: doublegate/RustySNES

Length of output: 50378


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- exact roadmap E-ticket rows ---'
sed -n '448,470p' to-dos/ROADMAP.md

printf '%s\n' '--- all exact E8.06 references ---'
rg -n 'E8\.06' . \
  -g '!snesdev_wiki/**' \
  -g '!target/**'

printf '%s\n' '--- coverage parser and report implementation ---'
fd -t f . tests/roms/AccuracySNES/gen/src | sort
rg -n -C 8 'fn parse_enumeration|parse_enumeration|coverage_report|covered|uncovered' \
  tests/roms/AccuracySNES/gen/src

printf '%s\n' '--- status-marker grammar ---'
rg -n -C 4 'NOT CART-MEASURABLE|NOT.*MEASURABLE|status marker|annotation' \
  tests/roms/AccuracySNES docs to-dos \
  -g '*.rs' -g '*.md' -g '*.toml'

Repository: doublegate/RustySNES

Length of output: 37167


Annotate E8.06 in the dossier as not cart-measurable.

Keep the assertion unchanged and add a [NOT CART-MEASURABLE] explanation linking docs/accuracysnes-plan.md §E8.06 and ticket T-04-E. Do not edit the generated coverage file; it already lists E8.06 as uncovered.

🤖 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 `@docs/accuracysnes-plan.md` around lines 296 - 301, Annotate the E8.06 dossier
entry in docs/accuracysnes-plan.md as [NOT CART-MEASURABLE], preserving its
existing assertion and explaining the limitation with links to §E8.06 and ticket
T-04-E. Do not modify the generated coverage file, which already records E8.06
as uncovered.

Sources: Path instructions, Learnings

@doublegate
doublegate merged commit ba1ea3a into main Aug 1, 2026
14 checks passed
@doublegate
doublegate deleted the docs/e8-06-withdrawn branch August 1, 2026 08:22
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