Repository navigation
feat(api-v1): describe the Labels operations in the OpenAPI document, written from the type the routes answer with - #193
Merged
Conversation
… written from the type the routes answer with The third of the per-resource steps of #58's schema diff (Projects was #179, States #188). The five label operations are in the document and in `described.operations`, so `scripts/check-openapi.sh` now diffs 18 of the pin's 32 against `oasdiff`. `LabelDto` is the 15 keys of the pin's `LabelSerializer`, and `label_body` builds it and serializes it (`into_object`, as the project and state bodies do). A work item read with `expand=labels` takes its labels from the same function, so the expansion is the same type. The list answers `Page<Value>` from `Plan::page`. The five handlers carry `#[utoipa::path]` with the pin's operation ids (the detail read is `get_labels` there), response descriptions (create answers 201) and no summaries, because the pin has none. The list's query is `ListQuery`: the pin lists `expand` and `order_by` for it and the route ignores both, as the pin's view does (D-032 (2)), so a request that sends them is answered as one that does not. `LabelCreateUpdateRequest` and `PatchedLabelCreateUpdateRequest` describe what the hand parser takes, as the project and state request types do. The wire is unchanged: the crate's tests 566 of 566 with the feature and 557 of 557 without it (6 new: 2 in `openapi.rs`, and the 415 matrix of 4 cases in `labels.rs`), the oracle gate and corpus comparison with the same numbers as G-25 (162 cases, 12 failures all accepted; 108 exchanges of which 11 are Labels, 13 accepted, 0 unaccepted; the corpus comparison's controls and C0 to C4), the contract `main` pass 70 of 70, and clippy clean for the crate with and without the feature, for the workspace and for the Worker on wasm32 (`utoipa` is not in its graph, and `cargo tree -i utoipa` finds it under `thrust-api-v1` with the feature, which is the control). The first generation had 49 findings, 4 of them new and unaccepted, all of one kind: the form and multipart bodies of `create_label` and `update_label` (SD-013, SD-014). Thrust answers 415 to both, as it does on a project and a state, but D-030 (5) is the projects' and the owner confirmed it for projects only. It is D-032 (6) now, **proposed and not confirmed**, in DEVIATIONS.md and in the register entries, so that the check does not pass over it. The schema of a label needed no other fix: nothing else in the 15 keys, the two request bodies or the list's parameters differed from the pin by more than the register already accepts. Controls, each shown on the real code: widening `LabelDto.name`'s `maxLength` from 255 to 300 turns 49 findings into 53, 4 of them unaccepted, one on each operation that answers with a label; skipping `parent` when it is `null` fails 8 tests, the new `a_labels_body_is_its_schema` among them and the work item's `expand=labels` test too; `json_body` made to read urlencoded forms fails exactly the six urlencoded cases of the three 415 tests (Labels, Projects, States) and none of the others. Nothing pinned a 415 for a form on a label before, which is the same gap as on the projects and the states; `a_form_or_a_multipart_body_is_a_415` is in `labels.rs` now. 49 findings (29 errors, 20 warnings), 0 unaccepted, 0 stale, 0 ambiguous, and the check's four controls still refuse. Not run here: `native-pg`, `worker-memory` and `worker-cf`, which CI runs. Refs: #58 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Closed
aRustyDev
added a commit
that referenced
this pull request
Nov 16, 2026
…ent, which now has all 32 of the pin's operations (#203) The fourth and last of the per-resource steps of #58's schema diff (Projects #179, States #188, Labels #193). The 14 work item operations (seven under `issues/` and the same seven under `work-items/`) are in the document and in `described.operations`, so `scripts/check-openapi.sh` now diffs the 32 operations of the scope `m1` against `oasdiff`. `IssueDto` is the 29 keys of the pin's `IssueSerializer`, and `work_item_body` builds it and serializes it. Where a body can say two things the type says both: a `state`, an assignee or a label is its id or, with `expand`, the object (`StateRef`, `UserRef`, `LabelRef`, over `StateBriefDto`, `UserBriefDto` and the `LabelDto` of the label routes), so the expansions that were `json!` are typed too. The list answers `Listing<T>`, a page or, when both halves of an integration key are named, the one work item; the search answers `IssueSearchDto`; the five names of a priority are `PriorityEnum`, written once for the body and the two request descriptions. The seven handlers carry `#[utoipa::path]` with the pin's operation ids, summaries and response descriptions (create answers 201). The routes register both families on the same handlers, so the document derives the `work-items/` family from the `issues/` one (`WorkItemsTwice`: the path, and the operation id followed by `_2`), and a test holds the two to be one set of operations. `Plan::envelope`, which stood for the lists that were not types yet, is gone. Two things in the document changed for every resource. An optional request body was written `oneOf [T, null]`, which claims a `null` body that the routes refuse (400); `OptionalBodies` writes it as the object, as the pin does, which also lets `oasdiff` see inside it (it reports a body wrapped in a `oneOf` and stops there). And `priority` is `allOf` of the enum by reference, as the pin writes it: a bare reference left 52 findings that would each have needed an entry, and entries for an enum would hide a value that is added. The wire is unchanged: the crate's tests 588 of 588 with the feature and 573 of 573 without it (22 new: 6 in `openapi.rs`, 16 in `work_items.rs`), the oracle gate and corpus comparison with the same numbers as G-25 (162 cases, 12 failures all accepted; 108 exchanges of which 36 are Work Items, 13 accepted, 0 unaccepted; the corpus comparison's controls and C0 to C4), the contract `main` pass 70 of 70, and clippy clean for the crate with and without the feature, for the workspace and for the Worker on wasm32 (`utoipa` is not in its graph). 103 findings (83 errors, 20 warnings), 0 unaccepted, 0 stale, 0 ambiguous, by 22 entries (SD-015 to SD-022 are new). The first generation had 108 unaccepted; what was left after the two changes above, 54, is of five kinds: - The form and multipart bodies of the four operations that read a body (SD-015, SD-016). Thrust answers 415 to both, as on the other three resources, but D-030 (5) is the projects' and the owner confirmed it for projects only. It is D-033 (11) now, **proposed and not confirmed**. - The pin's schema against the pin's own answers, each with its evidence and none of them a departure of Thrust's: the search (the schema describes one hit as the whole answer and a `sequence_id` that is a string; the recorded answer is `{"issues": [...]}` with a whole number: SD-017), the `state` (the schema says a uuid and the pin answers the object under `expand`, as the corpus's `list-expand-assignees-labels-state` records: SD-018, SD-019), and the list (a page, or the one work item for an integration key, which the schema does not describe: SD-020). - The range of `sequence_id`: an i64 here and an int32 there (SD-021, SD-022). Controls, each shown on the real code: a sixth priority in `PriorityEnum` turns 103 findings into 111, 8 unaccepted, and fails the test that ties the enum to the route; a `avatar_url` skipped when `null` fails 3 tests, the new `a_work_items_body_is_its_schema` and two that existed; the `OptionalBodies` modifier left out fails its test; the `_2` of the second family made `_3` fails the families test and the check (the document is not what the code writes); and `json_body` made to read urlencoded forms fails exactly the 10 urlencoded cases of the four `a_form_or_a_multipart_body_is_a_415` tests (2 each for Projects, States and Labels, 4 for Work Items). Nothing pinned a 415 for a form on a work item before. Not run here: `native-pg`, `worker-memory` and `worker-cf`, which CI runs. Refs: #58 Co-authored-by: Claude Sonnet 5.5 <[email protected]>
6 tasks
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.
Part of #58; this PR does not close it.
The third of the per-resource steps of the schema diff (Projects was #179, States #188): the five Labels operations are described by
thrust-api-v1's OpenAPI document, written from the type the routes answer with, andscripts/check-openapi.shnow diffs 18 of the pin's 32 operations. Work Items follow, as one pull request.For you to decide
D-032 (6), proposed: a form or multipart body is a 415 on a label. The pin reads both, Thrust reads JSON only (
request::json_body, one condition for every v1 route), andoasdiffreports the two media types removed fromcreate_labelandupdate_label. This is the third resource that raises it: you confirmed D-030 (5) for projects on 2026-11-07, and D-031 (5) (states, #188) and now D-032 (6) are proposed and not confirmed, each a new item of its own resource's record with its own register entries (SD-013 and SD-014 here), because I did not treat your answer for projects as covering the others. The behaviour is one condition for all the v1 routes, so one answer could settle all of them, and Work Items will raise it a fourth time. If you do not want it, the way out is for the routes to read forms, which is a feature, not a change to this PR.What it does
LabelDto, the 15 keys of the pin'sLabelSerializer(src/dto/labels.rs);label_bodybuilds it and serializes it. A work item read withexpand=labelstakes its labels from the same function, so the expansion is the same type. The list answersPage<Value>fromPlan::page, as Projects and States do.#[utoipa::path]with the pin's operation ids (the detail read isget_labelsthere) and its response descriptions (create answers 201), and no summaries, because the pin has none. The list takesListQuery: the pin listsexpandandorder_byfor it and the route ignores both, as the pin's view does (D-032 (2);fields_and_pages_work_on_the_list_and_order_by_and_expand_do_nothingis the test), so a request that sends them is answered as one that does not.LabelCreateUpdateRequestandPatchedLabelCreateUpdateRequest, hand-written descriptions of what the parser takes: onlynameis required and not blank,coloranddescriptioncan be blank and cannot benull,parentand the two external keys can benull.described.operations, the regenerated document, and the docs that said "Projects and States" (G-25,by-change.md,defect-matrix.md,standards.md,cicd.md).Findings
49 findings (29 errors, 20 warnings), 0 unaccepted, 0 stale, 0 ambiguous. The first generation had 4 new ones, all one kind: the two media types above on each of the two routes that read a body (SD-013, SD-014). Nothing else of the label schema differed from the pin by more than the register already accepts: the 15 keys, the two request bodies and the list's parameters needed no other fix.
Checked
mainpass 70 of 70, clippy clean for the crate with and without the feature, for the workspace, and for the Worker on wasm32.utoipais not in the Worker's graph (cargo tree -i utoipafinds no package there, and findsutoipa v6.0.0underthrust-api-v1with the feature, which is the control).LabelDto.name'smaxLengthfrom 255 to 300 turns 49 findings into 53 with 4 unaccepted, one on each operation that answers with a label (so the diff does see the Labels); skippingparentwhen it isnullfails 8 tests, among them the newa_labels_body_is_its_schemaand the work item'sexpand=labelstest;json_bodymade to read urlencoded forms fails exactly the six urlencoded cases of the threea_form_or_a_multipart_body_is_a_415tests (Labels, Projects, States) and no other test.a_form_or_a_multipart_body_is_a_415is added tolabels.rs.depsjob pass on this tree, and the document in the repository is the one the code writes.Not run
native-pg,worker-memoryandworker-cf(CI runs them), and the contract suite beyondnative-memory main.🤖 Generated with Claude Code