Skip to content

docs: add error_codes.md aligned with on-main errors.rs#17

Merged
graveyieldprotocol merged 1 commit into
mainfrom
docs/error-codes-realign
May 16, 2026
Merged

docs: add error_codes.md aligned with on-main errors.rs#17
graveyieldprotocol merged 1 commit into
mainfrom
docs/error-codes-realign

Conversation

@graveyieldprotocol

@graveyieldprotocol graveyieldprotocol commented May 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds docs/error_codes.md as the canonical markdown source-of-truth for both programs' error tables, sourced verbatim from programs/grave-scanner/src/errors.rs (6000-6019) and programs/grave-vault/src/errors.rs (7000-7014).
  • Updates docs/README.md with a new Reference section linking the new file.
  • Documents the drift in a dedicated section: Combined Tech Doc v3.0 .docx §4.2 lists a different scheme (7000-7018 with names like AMMRedemptionFailed, JupiterSwapFailed, InvalidMerkleProof, InvalidSnapshotData, ComputeBudgetTooLow). On-main is the lock per docs/README.md's "markdown wins when .docx disagrees" rule; the .docx scheme is superseded.

Why this PR

Spec drift between code and canon docs is treated as a bug per docs/README.md. The drift on error tables wasn't catchable until now because the Combined Tech Doc has no markdown source-of-truth in the repo — only the frozen .docx snapshot. This PR introduces a focused, narrow-scope markdown file for the error tables alone so future drift is detectable by inspection.

A follow-up PR can add a scripts/check-error-codes.sh CI step that diffs errors.rs discriminants against error_codes.md rows. Out of scope here since this is a no-code docs-only PR.

Out of scope

  • Full Combined Tech Doc markdown migration (docs/grave-scanner-grave-vault-combined.md). Separate, larger PR if/when ordered.
  • Regeneration of published/GraveScanner_GraveVault_CombinedTechnicalDocumentation_v3_0.docx. Per docs/README.md, that happens at the next minor revision.
  • Drift-detection CI script.
  • m5/m6/m7 GraveVault work (parallel workstream; new error codes 7015+ will append in this file as those PRs land).

Heads-up on CI

The anchor-build job has been failing on main since PR #15 (toolchain investigation in progress, parallel workstream). This docs-only PR will inherit the red status — merge is gated on the parallel CI fix landing first per the locked security posture (no merging while required checks are red).

Test plan

  • terminology-lint.sh local pre-check — passes (no forbidden vocabulary in either file)
  • Markdown lints cleanly (verified locally)
  • CodeRabbit review (mandatory pre-merge)
  • anchor-build job green (gated on parallel CI fix landing first)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Added comprehensive error codes reference covering scanner (6000–6019) and vault (7000–7014) program error conditions with detailed specifications.
    • Updated main documentation index with link to new error codes reference.

Review Change Stack

Mirrors programs/grave-scanner/src/errors.rs (6000-6019) and
programs/grave-vault/src/errors.rs (7000-7014) exactly. Per
docs/README.md, markdown is the source-of-truth when it disagrees
with the .docx snapshots. Previously, error tables had no markdown
source so the v3.0 Combined Tech Doc .docx (which lists a 7000-7018
scheme with names like AMMRedemptionFailed) was de facto canon,
drifting from on-main.

This file establishes the markdown source-of-truth so future drift
on this surface is detectable by inspection. Updates docs/README.md
to link the new file under a new "Reference" section.

No code changes. No CI workflow changes. The Combined Tech Doc full
markdown migration is out of scope for this PR.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 15, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9de688a4-a903-4dd2-beb8-42fabda027e7

📥 Commits

Reviewing files that changed from the base of the PR and between 10a0fa2 and 87cbf9f.

📒 Files selected for processing (2)
  • docs/README.md
  • docs/error_codes.md

📝 Walkthrough

Walkthrough

A new docs/error_codes.md file establishes the authoritative single source of truth for GraveScanner (6000–6019) and GraveVault (7000–7014) error codes, declaring a mirroring contract to Rust errors.rs sources with a "Rust sources win" rule and lock-step maintenance requirement. The docs/README.md is updated to add a Reference section linking to this new document.

Changes

Error Codes Reference Documentation

Layer / File(s) Summary
Error codes reference document
docs/error_codes.md
Establishes the contract declaring error_codes.md as the living source of truth mirroring programs/grave-scanner/src/errors.rs and programs/grave-vault/src/errors.rs with a "Rust sources win" rule. Specifies the lock-step update convention and on-chain error code derivation from Anchor's #[error_code] discriminants. Publishes the GraveScanner error table (6000–6019) and GraveVault error table (7000–7014), each mapping numeric codes to named errors and failure conditions. Documents how this markdown supersedes the v3.0 .docx snapshot and sets the requirement that future combined tech docs reference this file rather than re-tabulating codes. Includes a footer noting the mirroring date.
README documentation index
docs/README.md
Adds a new "Reference" section with a table entry linking to "Error codes (Scanner 6000-6019, Vault 7000-7014)" and its corresponding error_codes.md document.

🎯 1 (Trivial) | ⏱️ ~3 minutes

A reference carved in stone (or markdown, at least),
Error codes gathered, documented with finesse—
GraveScanner, GraveVault, now clear and precise,
The source of truth established, once and twice. 🪶✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: adding error_codes.md aligned with errors.rs sources, which is the primary objective.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/error-codes-realign

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@graveyieldprotocol graveyieldprotocol merged commit 704ca9c into main May 16, 2026
8 checks passed
graveyieldprotocol added a commit that referenced this pull request May 19, 2026
Step-level CI timing on fixup #3 reveals the actual failure:

  Step 7 'Install Anchor CLI'        completed in  0s  conclusion=success
  Step 8 'Pin platform-tools v1.54'  completed in 48s  conclusion=success
  Step 9 'Anchor build'              completed in  1s  conclusion=failure

`cargo binstall --no-confirm --version 0.32.1 anchor-cli` silently
no-ops on anchor-cli 0.32.x — it exits 0 without installing `anchor`
on PATH, then `anchor build` exits immediately (1s) because the
binary doesn't exist. This is the same silent-no-op pattern I have
in failure-pattern memory; I had closed PR #18 thinking cargo-binstall
was working (based on PR #17's intermittent success), but it's actually
flaky/broken for 0.32.x consistently.

Fix: replace cargo binstall with `cargo install --locked --version
0.32.1 anchor-cli` + an `anchor --version` assertion. Source compile
takes ~5-7 min on a cold cache but is cached by Swatinem/rust-cache@v2,
so steady-state CI time is unchanged. The version assertion fails the
install step itself on any future regression instead of deferring to
the build step where the symptom is opaque (0s install + 1s build
failure is harder to diagnose than a clean install-step failure).

Combined with fixup #2 (platform-tools v1.54) and fixup #3 (--no-idl
to skip nightly-Rust IDL generation), this should clear anchor build.

Locally verified all three together produce a clean `anchor build
--no-idl` in 5.67s on m5 and 5.02s on m6.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
graveyieldprotocol added a commit that referenced this pull request May 19, 2026
Step-level CI timing on fixup #3 reveals the actual failure:

  Step 7 'Install Anchor CLI'        completed in  0s  conclusion=success
  Step 8 'Pin platform-tools v1.54'  completed in 48s  conclusion=success
  Step 9 'Anchor build'              completed in  1s  conclusion=failure

`cargo binstall --no-confirm --version 0.32.1 anchor-cli` silently
no-ops on anchor-cli 0.32.x — it exits 0 without installing `anchor`
on PATH, then `anchor build` exits immediately (1s) because the
binary doesn't exist. This is the same silent-no-op pattern I have
in failure-pattern memory; I had closed PR #18 thinking cargo-binstall
was working (based on PR #17's intermittent success), but it's actually
flaky/broken for 0.32.x consistently.

Fix: replace cargo binstall with `cargo install --locked --version
0.32.1 anchor-cli` + an `anchor --version` assertion. Source compile
takes ~5-7 min on a cold cache but is cached by Swatinem/rust-cache@v2,
so steady-state CI time is unchanged. The version assertion fails the
install step itself on any future regression instead of deferring to
the build step where the symptom is opaque (0s install + 1s build
failure is harder to diagnose than a clean install-step failure).

Combined with fixup #2 (platform-tools v1.54) and fixup #3 (--no-idl
to skip nightly-Rust IDL generation), this should clear anchor build.

Locally verified all three together produce a clean `anchor build
--no-idl` in 5.67s on m5 and 5.02s on m6.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.

1 participant