Skip to content

feat(genesis): challenge v1 persistence, service, and apex domain rules#46

Merged
Undline merged 2 commits intomainfrom
dev
Apr 8, 2026
Merged

feat(genesis): challenge v1 persistence, service, and apex domain rules#46
Undline merged 2 commits intomainfrom
dev

Conversation

@Undline
Copy link
Copy Markdown
Contributor

@Undline Undline commented Apr 8, 2026

  • Add migration 008: core_genesis.instance_id and genesis_challenge table (one-shot, 5m TTL).

  • Add modulr_core.genesis challenge builder/verify and GenesisChallengeService; GenesisChallengeRepository.

  • CoreGenesisRepository: touch, get_or_create_instance_id; validate modulr_apex_domain with dotted DNS-style rules (same as register_org), max 253 chars.

  • Tests for challenge issue/verify/replay/expiry and apex validation.

- Add migration 008: core_genesis.instance_id and genesis_challenge table (one-shot, 5m TTL).

- Add modulr_core.genesis challenge builder/verify and GenesisChallengeService; GenesisChallengeRepository.

- CoreGenesisRepository: touch, get_or_create_instance_id; validate modulr_apex_domain with dotted DNS-style rules (same as register_org), max 253 chars.

- Tests for challenge issue/verify/replay/expiry and apex validation.

Made-with: Cursor
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d72b93b92b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

signature_hex=signature_hex,
expected_subject_pubkey_hex=row.subject_signing_pubkey_hex,
)
self._challenges.mark_consumed(challenge_id, consumed_at=now)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Map consume race failures to GenesisChallengeError

When two verification requests for the same challenge_id run concurrently, both can read consumed_at IS NULL, but only one UPDATE ... WHERE consumed_at IS NULL succeeds; the loser triggers RuntimeError("challenge not found or already consumed") from mark_consumed. Because verify_and_consume does not catch that exception, this race surfaces as an internal error instead of the expected domain-level rejection (challenge already consumed), which will produce flaky 500s under retries or duplicate submissions.

Useful? React with 👍 / 👎.

@Undline Undline merged commit 0b3ff33 into main Apr 8, 2026
1 check passed
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