Skip to content

fix(aitesis): atomic approval workflow and request authorization - #487

Merged
forkwright merged 1 commit into
mainfrom
fix/aitesis-approval-workflow
Jul 2, 2026
Merged

fix(aitesis): atomic approval workflow and request authorization#487
forkwright merged 1 commit into
mainfrom
fix/aitesis-approval-workflow

Conversation

@forkwright

Copy link
Copy Markdown
Owner

Closes #395, #396, #397.

Changes

Verification

kanon gate --full green (fmt, check, advisory-parity, cargo-deny, clippy workspace, nextest, kanon lint). Authorization, idempotency (real DB-failure injection via a trigger), and retry-convergence paths tested.

Follow-ups noted

A unique index on (source, source_ref) was deliberately not added (it could fail startup on deployments that already have duplicate wants from this bug); a guarded dedup migration is the right place for it. A separate lingering-want-on-cancel-after-approve-failure path is pre-existing and worth its own issue.

- #395: submit_request always inserts a Submitted row and the auto-approve
  path delegates to the same validated approve sequence, so a validation or
  create-want failure leaves a recoverable Submitted row instead of an
  orphaned Approved one.
- #396: idempotent want creation via a new apotheke upsert_want_by_source_ref
  keyed on (source='request', source_ref=request id) inside a BEGIN IMMEDIATE
  transaction; a retried approve reuses the same want instead of double-
  inserting and orphaning one.
- #397: list_requests takes the caller's UserId and denies unless the caller
  is an admin or querying their own requests; the HTTP layer passes the
  JWT-derived caller id, never the query parameter.

Closes #395
Closes #396
Closes #397

Gate-Passed: kanon 0.1.5 +stages:fmt,check,clippy,nextest,lint sha:0d3f1742fb15e1f513bfc3a27503cbfa176bb20f
@forkwright
forkwright merged commit a27fd12 into main Jul 2, 2026
11 checks passed
@forkwright
forkwright deleted the fix/aitesis-approval-workflow branch July 2, 2026 13:24
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.

auto_approve persists Approved request before identity validation — orphaned non-terminal row on validation failure

1 participant