api: ?env= query filter on list endpoints (slice 1)#27
Merged
Conversation
…yments) GET /api/v1/resources and GET /api/v1/deployments accept an optional ?env= query parameter, server-side filtering by the resources.env / deployments.env column. Omitting it returns all envs (backward compatible). Bogus envs (uppercase, spaces, unicode) fail NormalizeEnv and return 200 + empty — keeps the dashboard stable on stale client state instead of 400-ing. Closes the most-visible cosmetic-env gap from ENV-AWARE-DEPLOYMENTS-DESIGN.md §4 slice 1: switching the dashboard env switcher to "staging" now genuinely filters the resources + deployments lists. Slice 1 is the smallest user-visible win in the 6-slice plan; the remaining slices (family schema, provision-twin, family deploy bindings, vault auto-copy on promote, per-env access policy) are queued behind it. Tests: internal/handlers/list_env_filter_test.go (6 cases) — no filter returns all envs, ?env=staging filters correctly, bogus env returns 200+empty for both endpoints. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 tasks
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.
Summary
GET /api/v1/resources?env=stagingandGET /api/v1/deployments?env=stagingfilter server-side by the env column?env=returns all envs (backward compatible)NormalizeEnvand return 200 + empty — keeps the UI stable on stale client stateSlice 1 of the env-aware deployments plan in ENV-AWARE-DEPLOYMENTS-DESIGN.md. Closes the most-visible cosmetic-env gap: switching the dashboard sidebar env switcher to staging now actually filters the lists. Remaining slices (resource family schema, provision-twin, family deploy bindings, vault auto-copy on promote, per-env access policy) are queued.
Test plan
🤖 Generated with Claude Code