feat: user.* namespace, core-computed verification TTL, user.created on mint - #65
Merged
Merged
Conversation
Adds `UserEventType` (`user.created` only) to the §3.3 catalogue and the `EventType` union, per spec v0.5 §3.2/§3.3/§4.3. There is no `user.create` command - a row is minted inside the command that needs one (today `claim.submit`) and `user.created` is emitted. Tracks the header comment to v0.5. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SRhu5TK6KW3YyXFR8yDDJ1
… config claim.submit no longer relays verification_expires_at from the caller. A new pure resolver, resolveVerificationTtl(method, config?), returns the code lifetime from the §9.5 per-method defaults and bounds; handleClaimSubmit adds it to an injected clock (a resolved Date, never imported) to stamp claim.verification_started.expires_at. manual and gbp_oauth have no OSDS-side code, so expires_at is null. The TTL config is optional and threaded like enabledMethods is today; when absent, the §9.5 defaults apply. A stored TTL outside the bounds throws - it is not clamped, and a malformed value never silently falls back to the default. Reading the config from a tenant settings table is out of scope (issue filed) - there is no home for it in the schema yet. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SRhu5TK6KW3YyXFR8yDDJ1
When claim.submit resolves the claimant to a freshly minted users row, core now emits user.created (§4.3) ahead of claim.submitted, in the same transaction. A reused row emits nothing. upsertClaimant keeps ON CONFLICT DO UPDATE (a no-op email write) and reads (xmax = 0) AS inserted to tell a fresh INSERT from a conflict. DO UPDATE blocks on a concurrent uncommitted insert of the same key and then returns the surviving row; DO NOTHING + a follow-up SELECT would race - the other transaction's row is not yet visible - and could mint two users. writeOutboxEvents gains a keyIndex (default 0) so the idempotency key and the returned event id stay on claim.submitted even though user.created is written first. A multi-event command still has exactly one non-null idempotency_key. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SRhu5TK6KW3YyXFR8yDDJ1
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.
Brings the claim submit path in line with spec v0.5.
Tenant TTL config is threaded as a parameter; reading it from a settings table is #63.
Closes #54
Closes #58