Skip to content

feat(compat): work item change and history: X03, X02, sub work items and relations - #97

Merged
aRustyDev merged 1 commit into
mainfrom
feat/compat-work-items-update-history
Nov 7, 2026
Merged

aRustyDev merged 1 commit into
mainfrom
feat/compat-work-items-update-history

Conversation

@aRustyDev

Copy link
Copy Markdown
Owner

What

Stage 6b of #44, after 6a (#85): changing a work item and reading its history, against the pin.

Row Route Answer
X03 PATCH /api/workspaces/{slug}/projects/{project}/issues/{issue}/ changes the fields it names and leaves the rest; members and admins of the project, and the maker of the work item
X02 GET .../issues/{issue}/history/ the work item's history: one row for each difference between what the change asked and what the work item had
- GET .../issues/{issue}/sub-issues/, .../issue-relation/ the two reads the work item's page makes next, answered empty as D-021 does

How it works

  • Migration 0014 adds work_item_activities: one row per change an event names, keyed by (event_id, ordinal) so an event the queue delivers twice writes nothing the second time. The row names the work item's own workspace and project, so a read needs no join.
  • Ports: Tx::update_work_item, work_item_history and the activity writers, in the memory and Postgres adapters.
  • Core: Permission::UpdateWorkItem and update_issue; the activity consumer (process_event) now also projects the history.
  • Compat: the PATCH route, history/, sub-issues/ and issue-relation/; fixtures X02 and X03; contract.sh EXPECT_MAIN 54 to 55.
  • Docs: D-029 (six differences from the pin) and G-22 (what is recorded and what is read from source only).

For your decision

  • D-029 is proposed and pending your confirmation. Its six differences: a start date after the target date is refused with 400 (the pin stores the inverted pair); sort_order is refused with 400 because nothing here moves a work item; fields the pin accepts but no app sends are ignored; a description's history value is stored cleaned and capped at 16 KiB; a maker who is no longer in the project gets 403 where the pin lets them through; is_subscribed is false for everyone.

Rebase notes

The work was written before #86 (rustfmt) and #87 (the clippy deny list) landed, so it was rebased onto 41e87b1 and three things changed to fit main, with the work itself untouched:

  • five self.state.lock().unwrap() in the memory adapter now use the existing lock_unpoisoned();
  • PgTx::client() returns a Result on main, so the five calls in update_work_item take a ?;
  • the two new test files that have helper functions (thrust-core/tests/issue_updates.rs, thrust-adapters-memory/tests/history.rs) carry the #![allow(..., reason = ...)] header that clippy.toml asks for.

Verified

On the rebased commit, locally:

  • cargo fmt --all --check and scripts/check-deps.sh: clean.
  • cargo clippy --workspace --all-targets --locked -- -D warnings, and the wasm32 Worker run: clean.
  • cargo nextest run --profile ci --workspace: 2576 passed, 4 skipped (the new suites ran). Doctests pass.
  • cargo test -p thrust-adapters-selfhosted --test pg_adapter against Docker: 38 passed.

Not run by me: the contract cells (CI runs them), scripts/mutants.sh, cargo mutants, and the recorder against the pin. Fixtures X02 and X03 are as the authoring session recorded them. No dependency changed, so cargo deny was not re-run.

Refs: #44

🤖 Generated with Claude Code

…k items and relations the page asks for

Stage 6b of #44, after 6a (#85). PATCH on a work item (X03) and its history (X02) against the pin, plus the two reads the work
item page makes next, answered empty as D-021 does (sub-issues, issue-relation).

- migration 0014: work_item_activities, one row per change an event names, keyed by (event_id, ordinal) so a redelivered event writes nothing
- ports: Tx::update_work_item, work_item_history and the activity writers, in the memory and Postgres adapters
- core: Permission::UpdateWorkItem and update_issue; the activity consumer (process_event) now also projects history
- compat: the PATCH route, history/, sub-issues/ and issue-relation/; fixtures X02 and X03 recorded from the pin
- D-029 (six differences from the pin) and G-22 (what is recorded and what is read from source only); contract.sh EXPECT_MAIN 54 to 55

Refs: #44
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@aRustyDev
aRustyDev merged commit 062f809 into main Nov 7, 2026
30 checks passed
@aRustyDev
aRustyDev deleted the feat/compat-work-items-update-history branch November 7, 2026 03:47
This was referenced Nov 15, 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

Development

Successfully merging this pull request may close these issues.

1 participant