Skip to content

feat(core): rejection explanations, trend export, concurrency tests, safe backfill - #293

Merged
BigDella merged 5 commits into
Parcel-Protocol:mainfrom
zane1502:feat/utix-201-192-191-190
Oct 18, 2026
Merged

BigDella merged 5 commits into
Parcel-Protocol:mainfrom
zane1502:feat/utix-201-192-191-190

Conversation

@zane1502

Copy link
Copy Markdown
Contributor

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

  • Rejection explanations (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. explainRejection maps stable error codes, Result codes from idempotency/quota/export/replay, domain invariants INV-01 to INV-11, UnauthorizedError and unknown thrown values (fallback unexpected_failure, never exposing the raw message). renderRejection gives one shared text rendering.
  • Trend export (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 through exportRecords so 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.
  • Concurrency (core/invariants/commit.ts, docs/CONCURRENCY.md): commitMutation adds 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 via withIdempotency, and lock timeout (projection lock TTL, idempotency claim expiry). All interleavings are deterministic (no timers or randomness).
  • Backfill (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 and rollbackBackfill. Documents failure modes and recovery steps.
  • README doc index links; core/invariants/index.ts and core/migration/index.ts re-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 build and cargo test were 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.

@drips-wave

drips-wave Bot commented Oct 18, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@BigDella
BigDella merged commit f2937d3 into Parcel-Protocol:main Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants