Skip to content

test: fix TestGenesis_ValidTokenIdsPreserved + TestGetKnownGoodCollectionId#93

Merged
trevormil merged 1 commit intomasterfrom
fix/test-suite-token-ids
May 9, 2026
Merged

test: fix TestGenesis_ValidTokenIdsPreserved + TestGetKnownGoodCollectionId#93
trevormil merged 1 commit intomasterfrom
fix/test-suite-token-ids

Conversation

@trevormil
Copy link
Copy Markdown
Collaborator

Summary

Cherry-picks the test fix from #91 so the test suite goes green independent of the EIP-712 work (which is gated on the upstream go-ethereum patch).

Both tests authored token-id shapes the chain has never accepted. keeper.CreateTokens (tokens.go:23) requires ValidTokenIds to be a single contiguous range starting from 1 — a constraint dating back to the v0.47 fork in 2023. These tests came in later (badges→tokenization rename and the AI-generated genesis test sweep) without ever being run against the production code path. PR #79 closed the production-side hole that had been silently dropping these invalid inputs, which unmasked them.

  • simulation/helpers.go GetOrCreateCollection: was building ValidTokenIds with GetBoundedTimelineTimes, which returns randomly-positioned ranges appropriate for timeline-time fields (TransferTimes, OwnershipTimes) but not for token IDs. Replaced with [{Start:1, End:1+rand}].
  • ai_test genesis: was hardcoding two ranges with a gap ([1..50], [100..200]). Replaced with single [1..200] range.

Refs bitbadges-autopilot#0381. Carved out of #91 so the test suite can be green without waiting on the EIP-712 fork merge.

Test plan

  • go test -tags=test ./x/tokenization/ai_test/unit/genesis/... -run TestGenesisTestSuite/TestGenesis_ValidTokenIdsPreserved — passes
  • go test -tags=test ./x/tokenization/simulation/... -run TestGetKnownGoodCollectionId — passes
  • Full make test clean in CI

🤖 Generated with Claude Code

…tionId

Both tests authored token-id shapes that the chain has never accepted.
keeper.CreateTokens (tokens.go:23) requires ValidTokenIds to be a single
contiguous range starting from 1 — the constraint dates back to the v0.47
fork in 2023. These tests came in later (badges→tokenization rename and
the AI-generated genesis test sweep) without ever being run against the
production code path.

- simulation/helpers.go GetOrCreateCollection: was building ValidTokenIds
  with GetBoundedTimelineTimes, which returns randomly-positioned ranges
  appropriate for timeline-time fields (TransferTimes, OwnershipTimes) but
  not for token IDs. Replaced with [{Start:1, End:1+rand}].
- ai_test genesis: was hardcoding two ranges with a gap
  ([1..50], [100..200]). Replaced with single [1..200] range.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@trevormil trevormil merged commit fa3ce07 into master May 9, 2026
6 checks passed
@trevormil trevormil deleted the fix/test-suite-token-ids branch May 9, 2026 14:02
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