sdk: round-4 CLI follow-ups — PM intent tokenAmount guard + resolveExpiration/collection-options specs (#0431-#0433)#244
Merged
Conversation
…piration/collection-options specs (#0431-#0433)
0431 canonical buildPredictionMarket{Buy,Sell}Intent now throw on
non-positive tokenAmount — closes the asymmetry where `bb build
pm-*-intent` rejected amount≤0 but `bb prediction-markets
buy/sell` (calling the canonical fn directly) silently accepted
it. Plus isUserRecurringApproval charge-period cap is now
bigint-exact (was a lossy Number() round-trip; matches the
producer userRecurringApproval).
0432 direct resolveExpiration unit spec — the duration branch value
was only tested indirectly (the ms-since-epoch + default branches
were); now all three branches + the ≥10-digit ms heuristic
boundary + invalid-input are asserted.
0433 collection-options.spec.ts — normalizeCollection (unwrap /
never-throw / raw-fallback) + validateCollectionOrExit (not-found
/ errors+warnings / BB_QUIET gate / silent-valid). Closes the
#0429 round-2 spec miss.
Build clean (no circular deps); unit 143 suites / 3108 tests;
integration 20 suites / 186 tests.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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 #243 (base
feat/0428-cli-followups-r3). Round-4 of the rolling audit — the codebase is converging; this is a tight batch (1 producer-correctness bug + 2 real coverage gaps, one a self-caught round-2 miss).buildPredictionMarketBuyIntent/buildPredictionMarketSellIntentnow throw on non-positivetokenAmount. Previously the slimbb build pm-*-intentbuilders guarded amount>0 but the end-userbb prediction-markets buy/sellcalled the canonical fn directly withBigInt(opts.tokenAmount)—--token-amount 0/-5flowed through. Guard now lives at the producer root (the #0422 pattern), so both surfaces enforce it. Also:isUserRecurringApproval's charge-period cap is now bigint-exact (wasBigInt(Math.min(Number(intervalLength), …))— lossy; now matches the produceruserRecurringApproval's pure-bigint cap — same producer↔recognizer-drift class as #0425).resolveExpirationunit spec. The duration branch (now + parseDuration) was only exercised indirectly via a determinism row that normalizes the time window out; now all three branches + the ≥10-digit ms-since-epoch heuristic boundary + invalid input are directly asserted.collection-options.spec.ts—normalizeCollection(envelope unwrap / never-throws / raw-fallback) +validateCollectionOrExit(not-found→exit2 / errors+warnings→exit2 /BB_QUIETgate / silent-when-valid). The #0429 ticket scoped this spec but it wasn't written (round-2 miss; caught by the round-3 audit).Scope notes
bb nfts bid/list --token-amount/--max-fills/--max-salesleft permissive — symmetric across build & end-user (≤0 → chain-accepted no-op), not an asymmetry; broad count-flag validation would be speculative.BitBadgesCollection.convert(BigIntify)is that class's own separately-tested concern and needs a full fixture; the boundary contract (unwrap/never-throw/fallback) is what #0429 actually fixed and is schema-independent.callApicopies vs sharedcallIndexer— is below the ≥3 dedup bar; not filed, per no-churn).Validation
tsc×2, no circular dependencies.Test plan
bb prediction-markets buy-yes … --token-amount 0now errors (parity withbb build pm-buy-intent)bun run build/test:unit/test:integrationgreen🤖 Generated with Claude Code
Stack: main ← #242 ← #243 ← this.