feat(gtd): context_entity_id on assign + harden complete() error path (#520 #522)#600
Merged
Merged
Conversation
…#522) When rows_affected==0 in gtd.complete (concurrent race), re-read the actual task state and distinguish terminal vs. non-terminal: terminal still reports "in terminal state", non-terminal now reports "changed from expected state ... retry with fresh state" to avoid a misleading message about a state that is not actually terminal. Adds regression test: complete_after_transition_to_active_succeeds — assign → transition(active) → gtd.complete must succeed end-to-end. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds `context_entity_id` (optional, full UUID only) to AssignParams. Strict validation: rejects short prefixes and non-entity targets with a clear error naming the field, expected shape, and bad value. Persists the canonical UUID under properties.context_entity_id and creates an annotates edge to the KG entity via create_note. Exposes the field at the top-level in render_task (gtd.assign / gtd.tasks / gtd.next responses) and in the nested properties of get. Updates the gtd.assign verb schema metadata with the new ParamDef. No DB migration — properties TEXT column already exists (V1). Latest migration remains V22. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This was referenced May 31, 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.
Summary
Two khive-pack-gtd fixes.
active→donecomplete path was already correct in-tree (schema.rsis_terminal={done,cancelled},handle_completeadmitsactive). The real defect was a stalerows_affected==0error that always claimed "terminal state" even on a non-terminal concurrent re-read. Fix branches the message onis_terminal(&actual_now). Locks in behavior with the exactassign → transition(active) → completeregression the issue asked for.context_entity_idtogtd.assign: strictUuid::from_strvalidation (rejects prefixes — no silent coerce/drop), entity-kind verification viaruntime.resolve(), persisted toproperties.context_entity_id, anannotatesedge viacreate_note, exposed inrender_task+ nested inget. No DB migration — V1 already hasproperties TEXT.Honest note on #522
The issue body described "
activetreated as terminal,active→donerejected." In the actual worktree that path already worked — the explorer caught this rather than fabricating a transition-table edit to match stale issue text. The landed fix hardens the adjacent real defect (misleading concurrent-update error) and adds the regression the issue's acceptance criterion calls for. Graded a non-blocking MIN by the play critic, disclosed transparently.Tests
complete_after_transition_to_active_succeedsassign_context_entity_id_round_trips_through_tasks_and_getassign_rejects_malformed_context_entity_idcargo test --workspace→ 0 failed ·cargo clippy --workspace --all-targets -- -D warnings→ clean (independently re-run). Migrations untouched (latest still V22).Scope
Part of the khive issue-sweep. Do not merge — awaiting Ocean's review. Each commit references its issue number(s).
🤖 Generated with Claude Code