A human phrase decision commits with its own recomputation job and answers 202 - #876
Merged
Merged
Conversation
…swers 202 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: WaylandYang <145302500+WaylandYang@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: WaylandYang <145302500+WaylandYang@users.noreply.github.com>
This was referenced Sep 23, 2026
Merged
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.
Implements the production half of ADR 0051. The store refactors and the isolated delivery regression landed in #841; this wires the route, the job kind and the page.
What changes
phrase_bindings::decide_with_deliverywrites the person's decision and enqueues amaterialize_typedjob in one transaction. The job's payload carries onlykb_id; the worker reads the current bindings and never replays the decision's old payload, so out-of-order jobs converge on the last decision (0051 §"Why a late decision is not lost").materialize::try_materializeis the job's entry:pg_try_advisory_xact_lockontyped_materialize, run the existingmaterialize_in_txon that connection, commit. Busy rolls back and the handler returnsDeferred(10 s) through the existing bounded deferral path; it is not a successful job.POST /kbs/{id}/review/alignment/phrases/{binding_id}now answers 202 with{ ok, job_id, status: "accepted" }and no inventedtypedcounts. The audit row carries the job id; the job writesalignment.materializedwhen the projection changed.GET /kbs/{id}/jobs/{job_id}: Viewer-level status read, scoped by the job payload'skb_id(another base's job id answers 404, like an invisible document).review/graphevents. Copy in both language packs.materialize_human(Bound lock waits for human phrase alignment review decisions (#798, #800) #864, merged earlier today) is retired: it bounded the route's synchronous wait for the lock, and the route no longer waits at all, so there is nothing left to bound. 0051 §Alternatives is the reasoning ("blocking on the materialization lock retains scarce connections; a bounded Deferred outcome preserves work"). The kind-word route's Bound lock waits for human kind-word review decisions #828 timeout is untouched. Its test file goes with it.design/ontology.mdstates the new contract.Verified against pgvector/pgvector:pg16 on a fresh database:
New coverage: decision and job commit together with a kb-scoped payload; an enqueue failure after the decision write rolls both back; a held lock is declined in under a second rather than waited for; jobs processed in either order converge on the last decision; the route answers 202, a Viewer can read the job in its base and gets 404 from another base, a Viewer cannot decide.
Stacked:
feat/alignment-cut2continues from this commit with the #807 lifecycle work; that PR will show only its own diff once this merges.🤖 Generated with Claude Code