Skip to content

feat(compat): work items, the list, the create and the detail: S47, S48, X01 - #85

Merged
aRustyDev merged 1 commit into
mainfrom
feat/compat-work-items-stage
Oct 26, 2026
Merged

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

Conversation

@aRustyDev

Copy link
Copy Markdown
Owner

What

Stage 6a of #44: a member makes a work item, the project lists it and the app opens it. Stage 6 is split as stage 3 was; 6b (X03 update, X02 history, and the peek view's other calls) follows once this merges.

Row Route Answer
S48 POST /api/workspaces/{slug}/projects/{id}/issues/ makes the work item (201, 26 keys): a priority, a state, dates, assignees, labels, a description the pin cleans; every field wrong in turn gets DRF's message. Members and admins of the project; a guest, a non-member and a stranger get the decorator's 403
S47 GET .../issues/ the flat list in the pin's envelope: cursor and per_page, the next and previous cursors, every order the pin allows (the others are -created_at), updated_at__gt; nothing grouped or filtered (D-028)
X01 GET .../issues/{id}/ the work item as the app opens it, with and without expand

How it works

  • Migration 0013 gives a work item what the app reads and writes: state, priority, start and target dates, the time it was completed and last changed and by whom, the description, assignees and labels. A work item the slice made reads as the pin's defaults (priority none, no state, <p></p>), so the slice routes and their tests are untouched except that a slice insert now writes updated_at = created_at (the model found Postgres's clock being used instead).
  • New ports: work_item_page, work_item_row, max_work_item_sort_order and Tx::insert_work_item_attrs, in the memory and Postgres adapters. A page is one statement with a window count (a second only when the page is empty, to still say how many there are). S47 is therefore at most five statements by construction (the caller's membership, a guest's workspace access and the project's flag, the page, its count); chore(worker): set placement.region = aws:us-east-1; add the 5-round-trip budget counter to the contract suite #39 is still open and no counter test holds it (list_endpoints_stay_within_five_db_round_trips does not exist yet), so this is recorded in G-21 and not asserted.
  • thrust-core issues: create_issue, list_issues, get_issue behind issue_reader and issue_writer. A creation, its attributes and its work_item.created event are one transaction. A new item's place is after the greatest in its state (65535, then steps of 10000, as the pin gives them: probed, not guessed).
  • Scope::mint is now only in authorize_with_role (authorize delegates to it); scripts/check-deps.sh follows.
  • thrust-compat-plane issues: DRF's readings, probed on the pin and recorded: a date as YYYY-MM-DD with or without the zeros, as YYYYMMDD or as an ISO week; a list of keys read member by member (null and "" members, null, a boolean); a page size with spaces or a plus sign. The description goes through thrust_editor_doc::sanitize::validate_html_content.
  • thrust-editor-doc gets a yjs feature (default on) around yrs; the compat crate takes only sanitize. The first full verification run failed scripts/check-deps.sh: yrs reaches getrandom and so wasm-bindgen and js-sys on wasm32, which the guard keeps out of this crate. I fixed the cause rather than add an exception. thrust-editor-worker asks for yjs, so it is unchanged.

For your decision

  • D-028 (new): work items are listed flat and unfiltered, with null-only parent, estimate, cycle and module. group_by, sub_group_by, the pin's legacy filters and a filters object that says anything are refused with 400 (the other choice, answering a grouped or filtered request with a flat list, would be wrong data); a parent_id that is a work item of the project is refused as not supported yet; per_page of 0 or less is 400 (the pin answers 500); is_draft: true and archived_at on a creation are ignored (the pin answers 500, and archives); a state or label of another project is told as no such object. Full list and the pin's side in DEVIATIONS.md.
  • Still waiting for your confirmation: D-022, D-023, D-025, D-026, D-027, and no outbox event for a project's creation or change.
  • Size: ammonia (and so html5ever) is now in the Worker bundle through the compat crate. I have not measured the bundle; spike 0006 measured the sanitiser alone.

Controls

45 one-line breakages, each applied from a backup and restored byte for byte (cmp), each failing at least one test (nextest exit 100). Two more did not count and were redone: one that did not compile (exit 101, which is not a detection) and one whose sed did not apply.

Breakage Result
Postgres adapter: dates ordered nulls first; the priority order not inverted; the state group order following the direction; ties oldest first; the total always one; the page's offset off by one; has_next at the limit; the count past the end off by one; assignees who left, or who are not in the project, shown; labels descending; the greatest place counting a deleted item, or ignoring the state; completed_at taken from updated_at; a slice insert not writing updated_at each fails the model or a pg_adapter test
migration 0013: the priority CHECK widened; the dates CHECK dropped; the state, label and assignee keys dropped; the backfill using now() each fails a pg_adapter test
core and handlers: a guest may make a work item; no default state; completed_at set for a cancelled state; the place's step 5000 or its first 65536; guests assignable; the default assignee dropped; equal dates refused; the guest's list unfiltered, and a guest reading what others made; parent kinds swapped and not expanded; the page size cap 1001; the next cursor plus two; the total pages floored; the default order ascending; urgent not a choice; the list's type name wrong; the description not cleaned; group_by and a priority filter allowed; 200 for 201; the guest's message changed; the compact date refused each fails a core or compat test (parity, the Caller by Row matrix or the issue tests)

The model's generator-coverage control reaches all 156 classes.

Mutation testing (cargo-mutants 27.1.0, nextest 0.9.140):

Scope Result
core issues.rs 31: 23 caught, 8 unviable, 0 missed
compat issues.rs 84: 68 caught, 15 unviable, 1 missed, equivalent. The first run missed 37 (the date forms, the list readers, the page size's bound); two more were redundant arms in key_list (removed, since key_field already answers null and ""). The one left is the "archived_at" arm of order: every listed item is unarchived, so ordering by it is all ties, newest first, which is what the fall-through gives; no route makes an archived item to tell them apart. Documented in G-21
memory adapter work_item_page, work_item_row, max_work_item_sort_order, insert_work_item_attrs, compare_work_items 55: 50 caught, 5 unviable, 0 missed. The first run missed 9, all in max_work_item_sort_order, which had no test in its own crate; it has a property now

Not mutated: the Postgres adapter, which the generated model and pg_adapter.rs cover.

Recording

Three fixtures: S48 (55 exchanges), S47 (55), X01 (8), recorded from the pin on a fresh stack; every earlier fixture is unchanged except S32, which is re-recorded: the normaliser had turned dates in request bodies into placeholders, so Thrust was sent invalid ones (found when S48 needed real dates). Request bodies now keep their times and dates in both normalisers (keep_times; a shared case in normalise-cases.json). Beyond the journey's own calls, the date edges (19, including week 53 and the first and last year) were probed on the pin; all agree with the tests.

Gaps (G-21, docs/src/testing/status.md)

Read from the source, not recorded: what a project guest and a workspace member outside the project see for each row (the Caller by Row matrix), updated_at__gt with a date, the envelope's arithmetic over many items (a property), the work items a guest made. Not built: grouping and filtering, the parent, estimate, cycle and modules, the counts of attachments, links and sub work items, a subscription. The model cannot reach an archived item or a draft (no route makes one; pg_adapter.rs holds the counts) nor a page of 1000 rows.

Verified

  • cargo nextest run --profile ci --workspace: 2213 passed, 4 skipped. Doctests pass.
  • scripts/contract.sh native-memory and native-pg: 54 of 54 (EXPECT_MAIN 53 to 54). The Worker targets are for CI.
  • Postgres adapter tests: 30 passed; the model at 256 cases.
  • scripts/check-deps.sh clean (it failed before the yjs split, which is the control for that fix); cargo check of thrust-worker and of thrust-editor-worker for wasm32 builds; clippy clean; scripts/mutants.sh kills every control.
  • mod.proptest-regressions gains one seed, a real counterexample (the updated_at divergence above), fixed. cargo fmt --check reports differences in files this PR does not touch (thrust-adapters-cloudflare); CI does not run it.

Effort

Modelled for the rows (research/0003 §8.1): S47 1.25, S48 0.9, X01 2.5, which is 4.65 pd. Most of this PR is the attribute tables, the page's orders and cursors in both adapters and the model extension, and probing the pin for DRF's readings, which the model prices separately or not at all. I did not time the work, so there is no actual pd to report.

Refs: plane-byd.12.2

🤖 Generated with Claude Code

…48, X01

Stage 6a of the walking skeleton (#44): the three rows the journey's last steps need. X02 (history) and X03 (update) follow in 6b.

A work item gains what the app reads and writes: a state, a priority, start and target dates, the time it was completed and last
changed and by whom, a description, assignees and labels (migration 0013, `work_item_details`; a work item the slice made reads as the
pin's defaults). The ports get `work_item_page`, `work_item_row`, `max_work_item_sort_order` and `Tx::insert_work_item_attrs`, in the
memory and Postgres adapters; the page is one statement with a window count (two when the page is empty), so S47 stays within five
round trips by construction. #39 is still open and no counter test holds it: recorded in G-21.

- thrust-core `issues`: `create_issue`, `list_issues`, `get_issue` behind `issue_reader` and `issue_writer`; the place of a new item is
  after the greatest in its state (65535, then steps of 10000, as the pin gives them).
- `Scope::mint` is now only in `authorize_with_role`, which `authorize` delegates to; `scripts/check-deps.sh` follows.
- thrust-compat-plane `issues`: the three handlers; DRF's field messages (a date read as Django does, in three forms; a list of keys
  read member by member), the pin's pagination envelope and cursors, its order allowlist, and the description cleaned by
  `thrust_editor_doc::sanitize`.
- thrust-editor-doc gets a `yjs` feature (default on) around `yrs`, so the compat crate takes only the sanitiser: `yrs` reaches
  getrandom and so wasm-bindgen and js-sys on wasm32, which `scripts/check-deps.sh` rightly refused in this crate.
- Fixtures S47, S48 and X01 recorded from the pin (55, 55 and 8 exchanges; S32 re-recorded: the normaliser kept request dates as
  placeholders, so Thrust was sent invalid ones). The normaliser gains `keep_times` for request bodies in both languages.
- New deviation D-028 (flat, unfiltered list; null-only parent, estimate, cycle and module; `per_page` of 0 or less is 400, the pin's
  500), pending owner confirmation. New gap G-21 and the mutation result in `docs/src/testing/status.md`.

Verified: nextest ci workspace 2213 passed; contract 54/54 on native-memory and native-pg; pg_adapter 30; wasm32 check of the Worker and
the editor Worker; check-deps clean (and it failed before the `yjs` split: the control); the model reaches every class and found a real
divergence (a slice-inserted item got Postgres's clock as `updated_at`; its seed is committed). Mutation: no missed mutant in core or
the memory adapter's work item methods; one in compat `issues.rs` (the `archived_at` arm of `order`), equivalent, documented in G-21.

Refs: plane-byd.12.2
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@aRustyDev
aRustyDev merged commit b1c9d1f into main Oct 26, 2026
28 checks passed
@aRustyDev
aRustyDev deleted the feat/compat-work-items-stage branch October 26, 2026 02:14
aRustyDev added a commit that referenced this pull request Nov 7, 2026
…k items and relations the page asks for (#97)

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]>
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