feat: migrate flashduty-cli onto go-flashduty (covered+non-enriched, dual-client)#24
Draft
ysyneu wants to merge 1 commit into
Draft
feat: migrate flashduty-cli onto go-flashduty (covered+non-enriched, dual-client)#24ysyneu wants to merge 1 commit into
ysyneu wants to merge 1 commit into
Conversation
…lient) Begin moving flashduty-cli off the hand-written flashduty-sdk onto the generated go-flashduty client. This is a behavior-preserving, dual-client transition: go.mod requires both SDKs, migrated handlers call the new `*go-flashduty.Client` (wired via `RunContext.GFClient` / `newGFClientFn`), and every deferred handler keeps an in-code `TODO(go-flashduty migration)` naming exactly why it stays on the legacy client. Migrated (28 commands): incident batch ops (ack/unack/close→Resolve/wake/ merge/snooze/reopen/reassign→Assign/add-responder/comment/disable-merge/ remove/create + war-room list/get/delete), alert merge/events, alert-event list, insight team/channel/responder/top-alerts, audit search, statuspage create-timeline, monit-query diagnose, monit-agent catalog/invoke. Deferred on legacy SDK (each TODO-annotated): - endpoint gap (pending upstream): war-room create/add-member/default- observers, change list/trend, statuspage list, insight notifications, mcp create - shape/enrichment divergence: incident list/get/timeline/feed/similar/ postmortem, alert list/get/timeline, oncall who/schedule, statuspage changes/create-incident, incident update (/reset drops --field), monit-query rows (raw→structured) Other changes: - TOON output moved from `sdk.Marshal(.., TOON)` to `toon-go` directly (toon promoted to a direct dep); SDK stays a pure client. - New test seam: go-flashduty's client is a concrete type, not an interface, so migrated-command tests run against `gfStub`, an httptest server that records the path + decoded body and replies with a canned envelope (internal/cli/gfstub_test.go). - Preserve exact legacy wire on assignment: both `incident create` and `incident reassign` set assigned_to.type = "assign" explicitly (the hand-written SDK forced it; leaving it empty would let the backend relabel an already-assigned incident as "reassign"). Guarded by two new wire-assertion tests. Verified: go build + go test (all 6 packages) + go vet + gofmt clean; in-process e2e against api-dev passes for migrated commands with coverage (remaining e2e failures reproduce identically on a clean origin/main baseline — stale --title flag tests, 31-day-window/429/401 env issues, and the not-migrated `change list`).
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.
What
Begin migrating
flashduty-clioff the hand-written flashduty-sdk onto the generated go-flashduty client. Behavior-preserving, dual-client transition:go.modrequires both SDKs; migrated handlers call*go-flashduty.Client(wired viaRunContext.GFClient/newGFClientFn); every deferred handler keeps an in-codeTODO(go-flashduty migration)naming exactly why it stays on legacy.This is the CLI counterpart to flashduty-mcp-server#61 (same dual-client pattern, same go-flashduty v0.3.0).
Migrated (28 commands)
Resolve, wake, merge, snooze, reopen, reassign→Assign, add-responder→ResponderAdd, comment, disable-merge, remove, create + war-room list/get/deleteDeferred on legacy SDK (each TODO-annotated)
/incident/resetdrops--field), monit-query rows (raw-bytes→structured)Other changes
sdk.Marshal(.., TOON)totoon-godirectly (promoted to a direct dep); the SDK stays a pure client.gfStub— an httptest server that records path + decoded body and replies with a canned envelope (internal/cli/gfstub_test.go).incident createandincident reassignsetassigned_to.type = "assign"explicitly. The hand-written SDK forced it; leaving it empty would let the backend relabel an already-assigned incident asreassignin the feed/IM cards. Guarded by two new wire-assertion tests. (Whetherreassignshould say "reassign" is a separate product decision, intentionally not bundled here.)Verification
go build+go test(all 6 packages) +go vet+gofmt -lclean.origin/mainbaseline (stale--titleflag tests, 31-day-window / 429 / 401-override-key env issues, and the not-migratedchange list) — pre-existing, not introduced here.Follow-up (blocked on upstream)
Once the gap endpoints are documented upstream → re-vendored into go-flashduty → released, switch the deferred handlers off legacy and drop the
flashduty-sdkdep. Same convergence as the MCP PR.