test: assert authoringMetaV2 word names and descriptions - #130
Conversation
Closes #84 Co-Authored-By: Claude <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe existing ChangesAuthoring metadata content test
Estimated code review effort: 1 (Trivial) | ~3 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
|
Producer note: backing off per protocol — this branch already carries a |
|
🤖 ai:producer |
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/src/concrete/FlareFtsoWords.pointers.t.sol`:
- Around line 54-71: The tests `testAuthoringMetaV2Content` and
`testAuthoringMetaContent` overlap by decoding
`LibFlareFtsoSubParser.authoringMetaV2()` and asserting the same `word`/length
coverage for the same three entries. Consolidate this into a single test by
removing `testAuthoringMetaV2Content` and strengthening
`testAuthoringMetaContent` to assert the full description strings for each
`AuthoringMetaV2` entry, keeping the existing unique `word` checks in that one
test.
🪄 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: 40d77796-75b3-4aac-83db-d097b47d396c
📒 Files selected for processing (1)
test/src/concrete/FlareFtsoWords.pointers.t.sol
|
🤖 ai:vetter |
|
Rework note (human): now stale after #136 merged. Line 24 asserts the OLD |
…work) Merges main (the #136 description rewrite landed after this branch) and pins authoringMeta[2].description to the source string in LibFlareFtsoSubParser.sol. Co-Authored-By: Claude <noreply@anthropic.com>
|
🤖 ai:vetter |
…t, drop near-twin Per the vetter reject at fc9ef5b: the added testAuthoringMetaV2Content duplicated main's testAuthoringMetaContent (names + constant-tied length already pinned there) while regressing the length pin to a hardcoded 3. Extend the existing test's non-empty description checks to full exact strings instead — the residual #84 gap was description content only. Mutation-validated: mutating the sflr-exchange-rate description in LibFlareFtsoSubParser.sol fails testAuthoringMetaContent; restored passes. Co-Authored-By: Claude <noreply@anthropic.com>
|
🤖 ai:producer |
|
🤖 ai:vetter |
|
Reviewed b11da46: approve I checked the one thing that would have made this PR reproduce the defect it fixes: whether the expected strings are literals or read back from the same source the code uses. They are literals. assertEq(
m[SUB_PARSER_WORD_FTSO_CURRENT_PRICE_USD].description,
"Returns the current USD price of the given token according to the FTSO. Accepts 2 inputs, ..."
);The full text is written out in the test file, not referenced from the constant. So it is an independent oracle — change the wording in the source and this fails. Had it read the same constant, it would have agreed with the code by construction, one layer up from the original problem. What it replaces is the non-discriminating shape, which makes this a real strengthening rather than an addition: - assertTrue(bytes(m[SUB_PARSER_WORD_FTSO_CURRENT_PRICE_USD].description).length > 0);A length-greater-than-zero check passes for any non-empty string, so every description could have been replaced with The word names were already pinned as Worth stating so it is not a surprise later: these descriptions are now change-detecting, so a deliberate rewording requires updating this test. That is the intended cost of a pin, and the duplication between source and test is the oracle — not something to factor out. Verified independently: |
Summary
testSubParserParseMetaverified thatauthoringMetaV2()produces bytes that hash correctly into the parse meta, but never asserted the actual word names or description strings. Any mutation to a word name or description text would silently pass.Adds
testAuthoringMetaV2Contentwhich decodes the authoring meta and pins:wordfield (ftso-current-price-usd,ftso-current-price-pair,sflr-exchange-rate)Mutation-validated: flipping
"ftso-current-price-usd"→"ftso-current-price-us"in the source produces abytes32assertion failure.Closes #84
Co-Authored-By: Claude noreply@anthropic.com
Summary by CodeRabbit