Repository navigation
feat(core): rejection explanations, trend export, concurrency tests, safe backfill - #293
Merged
BigDella merged 5 commits intoOct 18, 2026
Merged
Conversation
|
@zane1502 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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
Adds four small, additive modules, one per issue, each following existing repository patterns (Result types, the privacy-safe exporter, the idempotency and replay stores, the migration module).
Changes
core/errors/explanations.ts,docs/REJECTION_EXPLANATIONS.md): stable reason codes in five categories (validation, policy, permission, stale state, unexpected), each with user-safe copy and ordered recovery hints.explainRejectionmaps stable error codes,Resultcodes from idempotency/quota/export/replay, domain invariantsINV-01toINV-11,UnauthorizedErrorand unknown thrown values (fallbackunexpected_failure, never exposing the raw message).renderRejectiongives one shared text rendering.core/export/trends.ts,docs/EXPORTS.md): UTC hour/day/week aggregation of operation events (counts, failures, failure rate, exact stroop volume as a decimal string), generated throughexportRecordsso it carries the schema version, generation metadata, expiry, redaction, pagination, quota and audit. Maintainer scope only; per-account dimensions are never read. Invalid windows, ranges or events fail with explicit codes.core/invariants/commit.ts,docs/CONCURRENCY.md):commitMutationadds compare-and-set with retry around the pure ticket mutations, so a request that loses a race is judged against the winner's result. Stress tests cover concurrent success, oversell, double redeem, conflicting transfers, replayed nonce, lost races, duplicate retries viawithIdempotency, and lock timeout (projection lock TTL, idempotency claim expiry). All interleavings are deterministic (no timers or randomness).core/migration/backfill.ts,scripts/backfill.mjs,docs/BACKFILL.md,npm run backfill): dry run by default with a bounded redacted diff, per-batch checkpoints with compare-and-set revisions, resume, idempotent re-runs, skipped/failed reporting with a failure budget, before-image journal androllbackBackfill. Documents failure modes and recovery steps.core/invariants/index.tsandcore/migration/index.tsre-exports.No existing API, schema or behavior is changed. No snapshots or generated files.
Issues
Resolves #201
Resolves #192
Resolves #191
Resolves #190
Verification
Manual code review only: I reviewed the complete diff, traced each new test against the code by hand, and checked consistency with the existing modules.
cargo buildandcargo testwere not run (this is a TypeScript repository), and no tests, linters, type checks or builds were executed, so the new test files have not been run.