Repository navigation
Add flowsheet move, edit, and rm commands - #5
Merged
Merged
Conversation
Follow-up to the in-show write loop (#2), closing out the remaining mutating flowsheet operations for mid-show correction (#3): reorder the queue, edit an entry, and delete one. Shared plumbing: factor postRaw's body-sending path into bodyRaw and add patchRaw/deleteRaw on top of it. DELETE carries a JSON body (the backend reads req.body.entry_id); the *bytes.Reader gives NewRequestWithContext a GetBody so the auth Transport's 401-retry rewind still replays it — covered by an explicit rewind test. - flowsheet move <entry_id> <new_position>: PATCH /flowsheet/play-order, 1-based, validated client-side. - flowsheet edit <entry_id> [flags]: PATCH /flowsheet with only the flags changed (pointer/omitempty fields keyed off Flags().Changed), so unset is left alone and --flag "" clears; fails fast on no fields rather than a 400. - flowsheet rm <entry_id>: DELETE /flowsheet, echoes the removed row, gated by --write. All three decode the projected entry and reuse entryResultRows for the confirmation; 404 maps to ExitNotFound. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
rybesh
force-pushed
the
flowsheet-write-core
branch
from
July 10, 2026 23:50
b1ef231 to
6e771f8
Compare
The FlowsheetUpdateFields doc claimed a uniform "clear vs leave alone" distinction, but omitempty on a pointer only expresses a true clear for the string fields; the *int fields can send 0 but not null. Correct the comment to say so. Also give DELETE /flowsheet a typed flowsheetDeleteRequest to match the move/update request structs instead of an inline map. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Closes #3. Follow-up to the in-show write loop (#2), closing out the remaining mutating flowsheet operations for mid-show correction: reorder the queue, edit an entry, and delete one.
Shared plumbing
Factor
postRaw's body-sending into abodyRaw(method, path, in)helper, then addpatchRawanddeleteRawon top. DELETE carries a JSON body (the backend readsreq.body.entry_id); the*bytes.ReadergivesNewRequestWithContextaGetBody, so the authTransport's 401-retry rewind still replays it — covered by an explicit rewind test.Commands
flowsheet move <entry_id> <new_position>—PATCH /flowsheet/play-order, 1-based, validatesnew_position >= 1client-side; both args int-parsed.flowsheet edit <entry_id> [flags]—PATCH /flowsheetwith only the flags actually changed (pointer/omitempty fields keyed offFlags().Changed), so an unset flag is left alone and--flag ""clears the field; fails fast on no fields rather than round-tripping to a 400. Booleans only send when explicitly passed.flowsheet rm <entry_id>—DELETE /flowsheet, echoes the removed row, gated by--write.All three decode the projected entry and reuse
entryResultRows/entryHeadersfor the confirmation; 404 maps toExitNotFound.Tests
Per the repo's red-green convention:
internal/api: method (PATCH/DELETE), path, and body assertions for each; the DELETE-with-body 401-retry rewind; 404 →StatusError.cmd: write-gate block without--write; arg parsing/validation (non-int entry_id,new_position < 1, empty edit); confirmation output.go test ./...andgo vet ./...both pass.Out of scope
The
notecommand and read helpers (latest/on-air/show <id>) — separate follow-ups.🤖 Generated with Claude Code