test(fork): add FORK_VAULT_COUNT enumeration to lock vault table length - #209
test(fork): add FORK_VAULT_COUNT enumeration to lock vault table length#209thedavidmeister wants to merge 6 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
WalkthroughReplaces the exported ChangesFork vault registry
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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 `@test/lib/LibFork.sol`:
- Line 25: The FORK_VAULT_COUNT constant at line 25 is a manual source of truth
that can drift from the actual number of WT_* vault constants defined above it.
Instead of maintaining separate WT_* constants and a manual count, consolidate
all vault definitions into a single canonical registry (such as an array or
mapping) that contains all the WT_* vault identifiers, and then derive
FORK_VAULT_COUNT mechanically from the length or size of this registry. This
ensures the count is always in sync with the actual number of vaults defined and
cannot accidentally drift out of sync.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 670937f4-6488-4ba1-8e0a-c778436ab244
📒 Files selected for processing (2)
test/lib/LibFork.soltest/src/concrete/ERC4626Words.fork.t.sol
…fork-vault-enumeration # Conflicts: # test/lib/LibFork.sol # test/src/concrete/ERC4626Words.fork.t.sol
|
Rework note (human reject, 2026-07-04): the enumeration lock is circular — adding a WT_* constant to LibFork without bumping FORK_VAULT_COUNT compiles and passes with the new vault unchecked (the fixed-size array only pins THIS test's own hand-list against THIS PR's own count, both hand-maintained), and the test adds a third and fourth hand-synced copy of the vault list (addresses + labels) — worsening exactly the multiple-sources hazard #139 flags — while duplicating the existing allForkVaults() loop at double fork cost. Wanted direction: allForkVaults() as the SINGLE source (tests never import per-vault constants; count = .length; labels via vm.toString as the existing loop already does). The issue's remaining legs (hand-pinned 1:1 expected rates, fork-block pin) need issue refinement or a design ruling, not a mechanical test PR — do not re-attempt #139 with list-copy tests. |
…fork-vault-enumeration
… source (rework) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
🤖 ai:producer
Branch also carries the previously-unpushed merge of origin/main (conflict resolution), now pushed. |
|
🤖 ai:vetter |
|
🤖 ai:producer |
…fork-vault-enumeration
Summary
FORK_VAULT_COUNT = 15constant totest/lib/LibFork.sol— the canonical count of WT_* vault address constants.testForkVaultEnumeration()which builds a fixed-sizeaddress[FORK_VAULT_COUNT]table of all 15 vaults and runscheckVaultover each.FORK_VAULT_COUNTentries, adding a new WT_* address without bumping the constant (and adding it to the table) causes a compile error — a new address cannot ship without a corresponding test entry.Refs #139.
Why this is needed
After PR #184 merged, expected values are now derived from the vault oracle rather than hand-typed. But the vault address list itself remains unchecked: adding a WT_* constant without a test lets the address ship untested, silently.
FORK_VAULT_COUNTenforces structural completeness at compile time.Test plan
forge buildsucceeds (fixed-size array initializer count matchesFORK_VAULT_COUNT)FORK_RPC_URL_BASEset):testForkVaultEnumerationpasses for all 15 vaultsFORK_VAULT_COUNTto 16:forge buildfails (compile error on array initializer length)🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
Summary by CodeRabbit