feat: add GetDynamicDashboard to DashboardService - #441
Merged
Conversation
NickJosevski
force-pushed
the
nj/dashboard-dynamic
branch
from
August 10, 2026 06:51
b500823 to
732ddb0
Compare
APErebus
reviewed
Aug 11, 2026
| // dynamic dashboard endpoints: the deployments themselves in Items, plus the | ||
| // reference data needed to resolve the IDs those items carry. | ||
| type Dashboard struct { | ||
| Items []*DashboardItem `json:"Items"` |
Contributor
There was a problem hiding this comment.
Double check that DashboardItem is correct. When I did this change recently, it was missing some properties iirc
Contributor
Author
There was a problem hiding this comment.
The missing ones are there now, I did more testing on local instance, and it came up with more test cases
Id, Links, PendingInterruptionTypes, HasPendingPreconditions, PendingPreconditionTypes
DashboardService had no methods, so the dynamic dashboard endpoint was unreachable from the SDK. DashboardDynamicQuery and DashboardItem already existed. Adds GetDynamicDashboard and the Dashboard response type it returns. ProjectLimit is a pointer so callers can tell an uncapped dashboard from one capped at zero. Backs OctopusDeploy/cli#305. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
NickJosevski
force-pushed
the
nj/dashboard-dynamic
branch
from
August 11, 2026 02:11
732ddb0 to
73a8e8f
Compare
sathvikkumar-octo
approved these changes
Aug 11, 2026
sathvikkumar-octo
left a comment
There was a problem hiding this comment.
Seems reasonable.
Did a quick smoke test and I think everything needs to be IDs and not names and that tracks in the server handler for this
…n IDs DashboardItem was missing five fields the server returns: Id and Links (added by embedding resources.Resource), PendingInterruptionTypes, HasPendingPreconditions and PendingPreconditionTypes. The dynamic dashboard matches projects and environments on ID only. A name matches nothing and returns an empty dashboard rather than an error, so note that on the query fields and the method. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Environments used resources.ReferenceDataItem, which has only Id and Name, so the Links the server returns per environment were dropped. Replaced with DashboardEnvironment, matching the other reference types on this response. Adds e2e coverage exercising the service against a live server: unfiltered reference-data resolution, filtering by project and environment ID, the empty result a name produces, includePrevious, and a strict decode that fails if the server returns a field the SDK does not model. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
These tests read whatever the target instance holds rather than creating a deployment, so they failed against a CI instance with an empty dashboard. Anything needing an actual deployment now skips instead of asserting on an empty collection. The strict-decode test still runs, covering the envelope and logging that item fields went uncovered. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
PendingInterruptionTypes is a fixed five-value enum server side, so type it rather than passing strings. PendingPreconditionTypes stays []string: server side it is an open string set, not an enum. Co-Authored-By: Claude Opus 5 (1M context) <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.
Problem
DashboardServiceis wired up in the client with both itsDashboardandDashboardDynamiclinks, but carries no methods, so the dynamic dashboard is unreachable through the SDK.This is the data behind the legacy
octo list-latestdeploymentscommand. The new CLI has no equivalent, which is OctopusDeploy/cli#305.Change
GetDynamicDashboard(query)returns the release currently deployed to each environment, optionally narrowed by project and environment, and optionally including the deployment preceding the current one. A zero-valued query returns everything the caller can see.Adds a
Dashboardresponse type holding the items plus the reference data needed to resolve the IDs they carry —Projects,ProjectGroups,EnvironmentsandTenants.ProjectLimitis a*intso callers can tell an uncapped dashboard from one capped at zero.Completes
DashboardItem, which was missing five fields the server returns:IdandLinks(via aresources.Resourceembed),PendingInterruptionTypes,HasPendingPreconditionsandPendingPreconditionTypes.PendingInterruptionTypesis[]interruptions.InterruptionType.PendingPreconditionTypesis[]string, because server side it is an open string set rather than a fixed enum.Path expansion is split into an unexported
getDynamicDashboardPathso the query-to-URL mapping is unit testable without HTTP. This differs from sibling services that inlineGetURITemplate().Expand(...), because the dynamic dashboard has its own link rather than living under the service's URI template.GetDashboardfor the non-dynamic endpoint is deliberately left unimplemented; tracked in #442.Server behaviour, as measured
Verified by request against a live server. Counts are from that instance.
projects=<id>projects=<name>projects=<id>,<id>(comma-joined)projects=<id>&projects=<id>(repeated)projects=Projects-999999projects=<id>,Projects-999999projects=(empty)projects=<lowercased id>environments=<id>environments=<name>includePrevious=trueIsPrevious)includePrevious=1or garbageWhat this establishes:
Itemsflagged withIsPrevious, not in a separate collection. There is noPreviousItemson this response.IsFilteredreflects project and environment narrowing only;includePreviousdoes not set it.Tests
Unit tests cover construction, table-driven URI expansion, and deserialisation pinned against a capture from a real server.
E2e tests exercise the service against a live server: unfiltered reference-data resolution (every item's project and environment must resolve, and every item must carry
IdandLinks), filtering by project and environment ID, the empty result a name produces, unknown IDs, andincludePrevious. Fixtures are discovered from the server rather than hardcoded, so they run on any instance.One of them decodes the live response with
DisallowUnknownFields, so a field the server adds or renames fails a test instead of silently arriving as a zero value. That check is what caughtEnvironmentsdroppingLinks— it had been modelled asresources.ReferenceDataItem, which carries onlyIdandName; it is now aDashboardEnvironment.go build ./...,go vet ./pkg/dashboard/...andgo test ./pkg/dashboard/...are clean.🤖 Generated with Claude Code