feat: upgrade existing elements to walkthrough specs (A-01/A-03/A-04/A-13/B-01/B-02)#41
Open
heijiLee wants to merge 8 commits into
Open
feat: upgrade existing elements to walkthrough specs (A-01/A-03/A-04/A-13/B-01/B-02)#41heijiLee wants to merge 8 commits into
heijiLee wants to merge 8 commits into
Conversation
Extend services/cli/src/reason.ts to decode the walkthrough-doc failure codes the six upgraded elements (A-01/A-03/A-04/A-13/B-01/B-02) now emit, and register the six wave-2 (CMP-003) elements that were missing from ELEMENT_LABELS despite being registered in DeployStack. Adds a recipeId-0 axis to the decode table since every element self-encodes its reasonCode with recipeId 0 (ComplianceEngine still hardcodes code 1 on its recipe-scoped propagation path, unchanged in this wave) - that is where the new codes are actually observable today (direct check() calls, HolderCount's ComplianceRejected revert, monitoring-flag events). Confirmed script/DeployStack.s.sol and test/integration/IntegrationBase.sol still call every legacy setter with its original signature, and scripts/e2e-anvil.sh never touches the CLI - no changes needed there. Adds FEATURES.md CMP-004 and a PROGRESS.md session record.
QualifiedPurchaser already guards its freshness subtraction against a future verifiedAt (age 0 = fresh), but IdentityUniqueness (_checkIdentity, KYC claim verifiedAt/maxAge) and AssetClassification (check, factsAsOf/maxFactAge) did not: an operator-set future anchor made the uint256 subtraction underflow and revert with a panic instead of the check returning a reason code. Apply the same `block.timestamp > anchor` guard to both, mirroring QualifiedPurchaser's comment style, and pin the behavior with one boundary test each (future anchor + nonzero max age => check PASSes, no revert).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on #39. Upgrades the six pre-existing thin mock elements IN PLACE to their
docs/elementswalkthrough specs — full failure-code taxonomies (A-01: 10 codes, A-03/A-04/A-13: 9, B-01/B-02: 6, each mapped to the doc §6 names in a contract-header table), the docs' §5.2 decision order, and richer operator-attested inputs:Compatibility (design invariant)
Every legacy setter keeps its exact signature and happy-path effect (legacy setter writes a fully-valid claim/card), and all new strictness is operator opt-in (defaults off) — DeployStack, IntegrationBase, CLI attest commands and the e2e runner are unaffected. Legacy code-1 meanings preserved per element.
Integration
reason.tsdecode table extended to all new codes (incl. a recipeId-0 axis) + smoke regressions againstcast keccakground truth.ComplianceEngine._runChecksre-encodes failures with code hardcoded to 1, so recipe-scoped decodes only see code 1 today; per-code detail flows via elements' self-encoded recipeId-0 codes.Verification
forge fmt --check/forge build/forge test --offline: 581/581 (39 suites). CLI + RFQ smoke pass. (tools/deploy-v3mocha step: pre-existing local env gap, vendored tool untouched.)