feat(policy): add sort ListSubjectMappings API - #3255
Conversation
📝 WalkthroughWalkthroughAdds single-field sorting to ListSubjectMappings: proto/schemas for sort, mapping of sort to SQL field/direction, query ORDER BY made dynamic, utilities and tests updated, and docs/OpenAPI extended. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API as Policy API
participant DBClient as PolicyDBClient
participant DB as Database
Client->>API: ListSubjectMappingsRequest(sort)
API->>DBClient: GetSubjectMappingsSortParams(sort)
DBClient->>DB: listSubjectMappings(namespace, sort_field, sort_direction, limit, offset)
DB-->>DBClient: rows (ordered by chosen field/direction)
DBClient-->>API: subject mappings
API-->>Client: ListSubjectMappingsResponse
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces sorting capabilities to the ListSubjectMappings API. It defines the necessary protocol buffer structures, implements the mapping logic in the Go service layer, and updates the underlying SQL queries to handle dynamic sorting parameters. The changes ensure that API consumers can sort results by creation or update timestamps while maintaining backward compatibility. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. The list was static, fixed in time, Now sorting makes it feel sublime. By date or update, order flows, As logic in the database grows. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces sorting capabilities for listing subject mappings, allowing users to sort by creation and update timestamps in both ascending and descending order. The changes include updates to the protobuf definitions, database queries, and utility functions, supported by comprehensive integration and unit tests. Review feedback highlights opportunities to reduce code duplication in the new integration tests by extracting a helper method for subject mapping creation and to simplify a switch statement within the sorting utility function.
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
define SortSubjectMappingsType enum and SubjectMappingsSort message for strongly-typed sort on ListSubjectMappings RPC
following the pattern, change the ORDER BY to incorporate CASE WHEN structuring with the sort fields
helper maps proto enum values to strings, handler passes strings to sqlc
implement unit tests for all sort functions including nil, empty slice, nill element ([nill])
added 5 integration tests: CreatedAt ASC/DESC, UpdatedAt ASC/DESC, and then FallsBackToDefault (CreatedAt DESC)
ran buf generate originally, but needed to do 'make proto-generate' to capture grpc and openai docs
CREATED_AT and UPDATED_AT are used in this case for the protovalidate test which covers 3 cases: no sort (valid), one item sort (also valid), and two sort items (invalid, since max_items is 1 in the proto).
added helper (createSortTestSubjectMappings()), then refactored existing 5 sort cases to use the helper. added neccesary fmt import. improved existing test (UpdatedAt_ASC). this list API only requires 1 helper since it only uses time based tests.
created_at and updated_at sort fields are now constants defined at the beginning of utils.go. This is because goconst will fail on the case that these strings are being used more than 3 times without their own variable.
234f300 to
7970007
Compare
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/openapi/policy/subjectmapping/subject_mapping.openapi.yaml`:
- Around line 1580-1586: Update the description for the "sort" property in the
policy.subjectmapping.SubjectMappings schema to explicitly state the server's
default/fallback ordering when the field is omitted or empty (e.g., "When not
provided, results are ordered by <primaryField> ascending, then by
<secondaryField> descending" or whatever the server actually implements); keep
the existing maxItems note and add a sentence describing deterministic behavior
so clients can rely on the default order, referencing the sort array and the
SubjectMappingsSort item type.
In `@service/policy/db/utils.go`:
- Around line 317-321: The helper currently maps any non-DESC value to "ASC",
causing invalid/future policy.SortDirection values to be treated as ascending;
change the logic so only an explicit SORT_DIRECTION_ASC returns "ASC" and
SORT_DIRECTION_DESC returns "DESC", otherwise return an empty/invalid direction
(e.g., "" or nil-equivalent) so callers can detect invalid directions and fall
back to the default ordering (created_at DESC); update the branch that checks
s.GetDirection() (and the local variable direction) to only set "ASC" when
s.GetDirection() == policy.SortDirection_SORT_DIRECTION_ASC and "DESC" when ==
policy.SortDirection_SORT_DIRECTION_DESC, leaving direction empty for all other
values.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 21c7e93f-ce5e-435f-8469-3dbec3932a87
⛔ Files ignored due to path filters (1)
protocol/go/policy/subjectmapping/subject_mapping.pb.gois excluded by!**/*.pb.go
📒 Files selected for processing (10)
docs/grpc/index.htmldocs/openapi/policy/subjectmapping/subject_mapping.openapi.yamlservice/integration/subject_mappings_test.goservice/policy/db/queries/subject_mappings.sqlservice/policy/db/subject_mappings.goservice/policy/db/subject_mappings.sql.goservice/policy/db/utils.goservice/policy/db/utils_test.goservice/policy/subjectmapping/subject_mapping.protoservice/policy/subjectmapping/subject_mapping_test.go
was not using getSortDirection here, incorrect.
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
|
Resolves [DSPX-2686](https://virtru.atlassian.net/browse/DSPX-2686) ## Proposed Changes - Adds strongly-typed sort support to `ListSubjectConditionSets` RPC, following the pattern established in #3223 (ListAttributes) and #3255 (ListSubjectMappings) - Sortable fields: `created_at`, `updated_at` (ASC/DESC), with backward-compatible fallback to `created_at DESC` ## Changes **Proto** — `service/policy/subjectmapping/subject_mapping.proto` - `SortSubjectConditionSetsType` enum (`UNSPECIFIED`, `CREATED_AT`, `UPDATED_AT`) - `SubjectConditionSetsSort` message (field + direction) - `repeated SubjectConditionSetsSort sort = 11` on `ListSubjectConditionSetsRequest` with `max_items = 1` constraint - Regenerated protos and docs **SQL** — `service/policy/db/queries/subject_mappings.sql` - CASE WHEN sort blocks in `listSubjectConditionSets` query - Fallback `scs.created_at DESC` + tiebreaker `scs.id ASC` **Go** — `service/policy/db/utils.go` + `service/policy/db/subject_mappings.go` - `GetSubjectConditionSetsSortParams()`: maps enum to SQL-compatible field/direction strings - `ListSubjectConditionSets` handler wired to call mapper and pass params to sqlc query **Tests** - 8 unit tests for the enum mapper helper (nil, empty, unspecified, each field + direction) - 5 integration tests (created_at ASC/DESC, updated_at ASC/DESC, unspecified fallback) using `createSortTestSubjectConditionSets` suite helper - Protovalidate sort constraint test (`Test_ListSubjectConditionSetsRequest_Sort`) ## Notes - `otdfctl --sort` flag deferred to a follow-up, consistent with #3192, #3223, and #3255 ### Checklist - [x] I have added or updated unit tests - [x] I have added or updated integration tests (if appropriate) - [x] I have added or updated documentation ### Testing Instructions [DSPX-2686]: https://virtru.atlassian.net/browse/DSPX-2686?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added sorting for Subject Condition Set listings by created_at or updated_at (ASC/DESC). Requests accept at most one sort entry; default ordering is created_at DESC with deterministic tie-breaker when omitted or unspecified. * **Documentation** * Clarified shared sort-direction semantics: unspecified direction → ASC when a sort field is provided; omitted/UNSPECIFIED sort fields defer to each List endpoint’s documented default ordering. * **Tests** * Added unit and integration tests covering sort parameter handling, ordering, and validation. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Resolves DSPX-2689 Proposed Changes - Adds strongly-typed sort support to ListKeyAccessServers RPC, following the pattern established in #3223 (ListAttributes), #3255 (ListSubjectMappings), and #3272 (ListSubjectConditionSets) - Sortable fields: name, uri, created_at, updated_at (ASC/DESC), with backward-compatible fallback to created_at DESC Changes Proto — service/policy/kasregistry/key_access_server_registry.proto - SortKeyAccessServersType enum (UNSPECIFIED, NAME, URI, CREATED_AT, UPDATED_AT) - KeyAccessServersSort message (field + direction) - repeated KeyAccessServersSort sort = 11 on ListKeyAccessServersRequest with max_items = 1 constraint - Regenerated protos and docs SQL — service/policy/db/queries/key_access_server_registry.sql - CASE WHEN sort blocks in listKeyAccessServers query for 4 fields (8 blocks total) - Fallback kas.created_at DESC + tiebreaker kas.id ASC Go — service/policy/db/utils.go + service/policy/db/key_access_server_registry.go - GetKeyAccessServersSortParams(): maps enum to SQL-compatible field/direction strings - ListKeyAccessServers handler wired to call mapper and pass params to sqlc query - Extracted sortFieldName constant in utils.go to resolve goconst lint across sort helpers (slightly out of scope but necessary to avoid goconst errors, same pattern as sortFieldCreatedAt/sortFieldUpdatedAt from #3255) Tests - 12 unit tests for the enum mapper helper (nil, empty, unspecified, each field + direction) - 9 integration tests (created_at ASC/DESC, updated_at ASC/DESC, name ASC/DESC, uri ASC/DESC, unspecified fallback) using createSortTestKeyAccessServers and createNamedSortTestKeyAccessServers suite helpers - Protovalidate sort constraint test (Test_ListKeyAccessServersRequest_Sort) Notes - otdfctl --sort flag deferred to a follow-up, consistent with #3192, #3223, #3255, and #3272 ### Checklist - [x] I have added or updated unit tests - [x] I have added or updated integration tests (if appropriate) - [x] I have added or updated documentation ### Testing Instructions <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added sorting for Key Access Servers list (name, URI, created_at, updated_at) with ASC/DESC; single sort directive accepted; default ordering is created_at DESC then id ASC. * **Documentation** * Protocol and API docs updated to describe new sort parameters, enums/schemas, and default ordering behavior. * **Tests** * Added unit and integration tests to validate sort mapping, behavior, and single-sort request validation. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
### Proposed Changes Resolves DSPX-2690 - Adds strongly-typed sort support to ListObligations RPC, following the pattern established in #3223 (ListAttributes), #3255 (ListSubjectMappings), #3272 (ListSubjectConditionSets), and the ListKeyAccessServers PR - Sortable fields: name, fqn, created_at, updated_at (ASC/DESC), with backward-compatible fallback to created_at DESC ### Changes **Proto** — `service/policy/obligations/obligations.proto` - `SortObligationsType` enum (UNSPECIFIED, NAME, FQN, CREATED_AT, UPDATED_AT) - `ObligationsSort` message (field + direction) - `repeated ObligationsSort sort = 11` on `ListObligationsRequest` with `max_items = 1` constraint - Regenerated protos and docs **SQL** — `service/policy/db/queries/obligations.sql` - CASE WHEN sort blocks in `listObligations` query for 4 fields (8 blocks total) - FQN sort uses constructed expression `fqns.fqn || '/obl/' || LOWER(od.name)` since obligation FQNs aren't stored in `attribute_fqns` - Fallback `od.created_at DESC` **Go** — `service/policy/db/utils.go` + `service/policy/db/obligations.go` - `GetObligationsSortParams()`: maps enum to SQL-compatible field/direction strings - `ListObligations` handler wired to call mapper and pass params to sqlc query - Added `sortFieldName` and `sortFieldFQN` constants in `utils.go` (same pattern as `sortFieldCreatedAt`/`sortFieldUpdatedAt` from #3255) **Tests** - 12 unit tests for the enum mapper helper (nil, empty, unspecified, each field + direction) - 9 integration tests (name ASC/DESC, fqn ASC/DESC, created_at ASC/DESC, updated_at ASC/DESC, unspecified fallback) using `createSortTestObligations` and `createNamedSortTestObligations` suite helpers - Protovalidate sort constraint test (`Test_ListObligationsRequest_Sort`) ### Notes - otdfctl `--sort` flag deferred to a follow-up, consistent with #3192, #3223, #3255, and #3272 - Tie-breaker (`od.id ASC`) deferred to a follow-up refactoring ticket ### Checklist - [x] I have added or updated unit tests - [x] I have added or updated integration tests (if appropriate) - [x] I have added or updated documentation ### Testing Instructions <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added sorting to the obligations list API (name, FQN, created_at, updated_at) with ASC/DESC, single-sort-item constraint, and default ordering created_at DESC (ties by id ASC). * **Tests** * Added unit and integration tests covering all sort fields, directions, multi-namespace FQN ordering, unspecified fallback, and request validation for max-items. * **Documentation** * Updated API docs and table of contents to document sorting and removed an obsolete request description. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Diego <74568547+dsm20@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [0.24.0](protocol/go/v0.23.0...protocol/go/v0.24.0) (2026-04-17) ### Features * **policy:** add GetObligationTrigger RPC ([#3318](#3318)) ([d68e39d](d68e39d)) * **policy:** add sort ListSubjectMappings API ([#3255](#3255)) ([9d5d757](9d5d757)) * **policy:** add sort support to ListKeyAccessServer ([#3287](#3287)) ([7fae2d7](7fae2d7)) * **policy:** add sort support to listobligations api ([#3300](#3300)) ([9221cac](9221cac)) * **policy:** add sort support to ListSubjectConditionSets API ([#3272](#3272)) ([9010f12](9010f12)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: opentdf-automation[bot] <149537512+opentdf-automation[bot]@users.noreply.github.com>
### Proposed Changes Resolves DSPX-2691 - Adds strongly-typed sort support to ListRegisteredResources RPC, following the pattern established in #3223 (ListAttributes), #3255 (ListSubjectMappings), #3272 (ListSubjectConditionSets), #3300 (ListObligations), and the ListKeyAccessServers PR - Sortable fields: name, created_at, updated_at (ASC/DESC), with backward-compatible fallback to created_at DESC ### Changes **Proto** — `service/policy/registeredresources/registered_resources.proto` - `SortRegisteredResourcesType` enum (UNSPECIFIED, NAME, CREATED_AT, UPDATED_AT) - `RegisteredResourcesSort` message (field + direction) - `repeated RegisteredResourcesSort sort = 11` on `ListRegisteredResourcesRequest` with `max_items = 1` constraint - Regenerated protos and docs **SQL** — `service/policy/db/queries/registered_resources.sql` - CASE WHEN sort blocks in `listRegisteredResources` query for 3 fields (6 blocks total) - Fallback `r.created_at DESC` **Go** — `service/policy/db/utils.go` + `service/policy/db/registered_resources.go` - `GetRegisteredResourcesSortParams()`: maps enum to SQL-compatible field/direction strings - `ListRegisteredResources` handler wired to call mapper and pass params to sqlc query - No new constants needed — `sortFieldName`, `sortFieldCreatedAt`, `sortFieldUpdatedAt` already exist **Tests** - 11 unit tests for the enum mapper helper (nil, empty, unspecified, each field + direction, unspecified direction default) - 7 integration tests (name ASC/DESC, created_at ASC/DESC, updated_at ASC/DESC, unspecified fallback) using `createSortTestRegisteredResources` and `createNamedSortTestRegisteredResources` suite helpers - Protovalidate sort constraint test (`TestListRegisteredResourcesRequest_Sort`) ### Notes - otdfctl `--sort` flag deferred to a follow-up, consistent with #3192, #3223, #3255, #3272, and #3300 - Tie-breaker (`r.id ASC`) deferred to a follow-up refactoring ticket ### Checklist - [x] I have added or updated unit tests - [x] I have added or updated integration tests (if appropriate) - [x] I have added or updated documentation ### Testing Instructions <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Added sorting functionality to registered resources lists. Sort by name, creation date, or update date in ascending or descending order. Defaults to creation date (descending) when not specified. * **Documentation** * Updated API documentation with new sorting options and default ordering behavior. * **Tests** * Added integration and unit tests covering all sorting configurations. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
🤖 I have created a release *beep* *boop* --- ## [0.14.0](opentdf/platform@service/v0.13.0...service/v0.14.0) (2026-04-21) ### ⚠ BREAKING CHANGES * **sdk:** reclassify KAS 400 errors — distinguish tamper from misconfiguration ([opentdf#3166](opentdf#3166)) * **policy:** optional namespace for RRs ([opentdf#3165](opentdf#3165)) * **policy:** Namespace subject mappings and subject condition sets. ([opentdf#3143](opentdf#3143)) * **policy:** Optional namespace on actions protos, NamespacedPolicy feature flag ([opentdf#3155](opentdf#3155)) * **policy:** add namespaced actions schema and namespace-aware action queries ([opentdf#3154](opentdf#3154)) * **policy:** only require namespace on GetAction if no id provided ([opentdf#3144](opentdf#3144)) * **policy:** add namespace field to Actions proto ([opentdf#3130](opentdf#3130)) * **policy:** namespace Registered Resources ([opentdf#3111](opentdf#3111)) * **policy:** add namespace field to RegisteredResource proto ([opentdf#3110](opentdf#3110)) ### Features * **authz:** Namespaced policy in decisioning ([opentdf#3226](opentdf#3226)) ([0355934](opentdf@0355934)) * **cli:** migrate otdfctl into platform monorepo ([opentdf#3205](opentdf#3205)) ([5177bec](opentdf@5177bec)) * fix tracing ([opentdf#3242](opentdf#3242)) ([57e5680](opentdf@57e5680)) * **policy:** add GetObligationTrigger RPC ([opentdf#3318](opentdf#3318)) ([d68e39d](opentdf@d68e39d)) * **policy:** add namespace field to Actions proto ([opentdf#3130](opentdf#3130)) ([bedc9b3](opentdf@bedc9b3)) * **policy:** add namespace field to RegisteredResource proto ([opentdf#3110](opentdf#3110)) ([04fd85d](opentdf@04fd85d)) * **policy:** add namespaced actions schema and namespace-aware action queries ([opentdf#3154](opentdf#3154)) ([c0443f1](opentdf@c0443f1)) * **policy:** add sort ListSubjectMappings API ([opentdf#3255](opentdf#3255)) ([9d5d757](opentdf@9d5d757)) * **policy:** Add sort support listregisteredresources api ([opentdf#3312](opentdf#3312)) ([91a3ff3](opentdf@91a3ff3)) * **policy:** add sort support to ListAttributes API ([opentdf#3223](opentdf#3223)) ([ec3312f](opentdf@ec3312f)) * **policy:** add sort support to ListKeyAccessServer ([opentdf#3287](opentdf#3287)) ([7fae2d7](opentdf@7fae2d7)) * **policy:** Add sort support to ListNamespaces API ([opentdf#3192](opentdf#3192)) ([aac86cd](opentdf@aac86cd)) * **policy:** add sort support to listobligations api ([opentdf#3300](opentdf#3300)) ([9221cac](opentdf@9221cac)) * **policy:** add sort support to ListSubjectConditionSets API ([opentdf#3272](opentdf#3272)) ([9010f12](opentdf@9010f12)) * **policy:** add SortField proto and update PageRequest for sort support ([opentdf#3187](opentdf#3187)) ([6cf1862](opentdf@6cf1862)) * **policy:** Enforce same namespace when actions referenced downstream ([opentdf#3206](opentdf#3206)) ([4b5463a](opentdf@4b5463a)) * **policy:** namespace Registered Resources ([opentdf#3111](opentdf#3111)) ([6db1883](opentdf@6db1883)) * **policy:** Namespace subject mappings and condition sets ([opentdf#3172](opentdf#3172)) ([6deed50](opentdf@6deed50)) * **policy:** Namespace subject mappings and subject condition sets. ([opentdf#3143](opentdf#3143)) ([3006780](opentdf@3006780)) * **policy:** optional namespace for RRs ([opentdf#3165](opentdf#3165)) ([8948018](opentdf@8948018)) * **policy:** rollback migration strategy for namespaced actions ([opentdf#3235](opentdf#3235)) ([f7e5e01](opentdf@f7e5e01)) * **policy:** Seed existing namespaces with standard actions ([opentdf#3228](opentdf#3228)) ([12136b0](opentdf@12136b0)) * **policy:** Seed namespaces with standard actions on creation + namespaced actions for obligation triggers ([opentdf#3161](opentdf#3161)) ([984d76b](opentdf@984d76b)) ### Bug Fixes * **ci:** Upgrade toolchain version to 1.25.8 ([opentdf#3116](opentdf#3116)) ([e1b7882](opentdf@e1b7882)) * **core:** do not concat slashes directly in url/file paths ([opentdf#3290](opentdf#3290)) ([114c2a7](opentdf@114c2a7)) * **deps:** bump github.com/jackc/pgx/v5 from 5.7.5 to 5.9.0 in /service ([opentdf#3316](opentdf#3316)) ([017362e](opentdf@017362e)) * **deps:** bump github.com/opentdf/platform/lib/identifier from 0.2.0 to 0.3.0 in /service ([opentdf#3162](opentdf#3162)) ([8bc5dcd](opentdf@8bc5dcd)) * **deps:** bump github.com/opentdf/platform/protocol/go from 0.16.0 to 0.17.0 in /service ([opentdf#3125](opentdf#3125)) ([29fec61](opentdf@29fec61)) * **deps:** bump github.com/opentdf/platform/protocol/go from 0.17.0 to 0.21.0 in /service ([opentdf#3220](opentdf#3220)) ([e63add2](opentdf@e63add2)) * **deps:** bump github.com/opentdf/platform/protocol/go from 0.21.0 to 0.22.0 in /service ([opentdf#3248](opentdf#3248)) ([1ebce73](opentdf@1ebce73)) * **deps:** bump github.com/opentdf/platform/protocol/go from 0.22.0 to 0.23.0 in /service ([opentdf#3271](opentdf#3271)) ([3338b8e](opentdf@3338b8e)) * **deps:** bump github.com/opentdf/platform/protocol/go from 0.23.0 to 0.24.0 in /service ([opentdf#3321](opentdf#3321)) ([78e6022](opentdf@78e6022)) * **deps:** bump github.com/opentdf/platform/protocol/go from 0.24.0 to 0.25.0 in /service ([opentdf#3333](opentdf#3333)) ([3940bf8](opentdf@3940bf8)) * **deps:** bump github.com/opentdf/platform/sdk from 0.13.0 to 0.16.0 in /service ([opentdf#3356](opentdf#3356)) ([5617077](opentdf@5617077)) * **deps:** bump go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp from 1.42.0 to 1.43.0 in /service ([opentdf#3282](opentdf#3282)) ([046374a](opentdf@046374a)) * **deps:** bump go.opentelemetry.io/otel/sdk from 1.42.0 to 1.43.0 in /service ([opentdf#3281](opentdf#3281)) ([56b33f2](opentdf@56b33f2)) * **deps:** bump google.golang.org/grpc from 1.77.0 to 1.79.3 in /service ([opentdf#3176](opentdf#3176)) ([3289502](opentdf@3289502)) * **deps:** remove direct github.com/docker/docker dependency ([opentdf#3229](opentdf#3229)) ([2becb27](opentdf@2becb27)) * **deps:** upgrade testcontainers-go to resolve vulns ([opentdf#3299](opentdf#3299)) ([72c6f9b](opentdf@72c6f9b)) * **ers:** include standard JWT claims in claims mode entity resolution ([opentdf#3196](opentdf#3196)) ([6d50da1](opentdf@6d50da1)) * **ers:** ldap multi-strategy ers ([opentdf#3117](opentdf#3117)) ([d3aaf1a](opentdf@d3aaf1a)) * **policy:** deprecate ListAttributeValues in favor of existing GetAttribute ([opentdf#3108](opentdf#3108)) ([7e17c2d](opentdf@7e17c2d)) * **policy:** make obligation trigger uniqueness client-aware ([opentdf#3114](opentdf#3114)) ([9265bc3](opentdf@9265bc3)) * **policy:** omit empty attribute values from create responses ([opentdf#3193](opentdf#3193)) ([d298378](opentdf@d298378)) * **policy:** only require namespace on GetAction if no id provided ([opentdf#3144](opentdf#3144)) ([10d0c0f](opentdf@10d0c0f)) * **policy:** Optional namespace on actions protos, NamespacedPolicy feature flag ([opentdf#3155](opentdf#3155)) ([c20f039](opentdf@c20f039)) * **policy:** order List* results by created_at ([opentdf#3088](opentdf#3088)) ([ea90ac2](opentdf@ea90ac2)) * **sdk:** normalize issuer URL before OIDC discovery ([opentdf#3261](opentdf#3261)) ([61f98c9](opentdf@61f98c9)) * **sdk:** reclassify KAS 400 errors — distinguish tamper from misconfiguration ([opentdf#3166](opentdf#3166)) ([f04a385](opentdf@f04a385)) * **sdk:** remove testcontainers from consumer dependency graph ([opentdf#3129](opentdf#3129)) ([f17dcdd](opentdf@f17dcdd)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: opentdf-automation[bot] <149537512+opentdf-automation[bot]@users.noreply.github.com>
Resolves DSPX-2685
Proposed Changes
ListSubjectMappingsRPC, following thepattern established in feat(policy): add sort support to ListAttributes API #3223 (ListAttributes) and feat(policy): Add sort support to ListNamespaces API #3192 (ListNamespaces)
created_at,updated_at(ASC/DESC), withbackward-compatible fallback to
created_at DESCChanges
Proto —
service/policy/subjectmapping/subject_mapping.protoSortSubjectMappingsTypeenum (UNSPECIFIED,CREATED_AT,UPDATED_AT)SubjectMappingsSortmessage (field + direction)repeated SubjectMappingsSort sort = 11onListSubjectMappingsRequestwithmax_items = 1constraintSQL —
service/policy/db/queries/subject_mappings.sqlcreated_atandupdated_at(ASC/DESC each)sm.created_at DESC+ tiebreakersm.id ASCGo —
service/policy/db/utils.go+service/policy/db/subject_mappings.goGetSubjectMappingsSortParams(): maps enum to SQL-compatible field/direction stringsListSubjectMappingshandler wired to call mapper and pass params to sqlc querysortFieldCreatedAt/sortFieldUpdatedAtconstants inutils.goto resolvegoconstlint across all sort helpers (slightly out of scope but necessary to avoid goconst errors)Tests
createSortTestSubjectMappingssuite helperTest_ListSubjectMappingsRequest_Sort)Notes
namesort is listed in the ticket but thesubject_mappingstable has nonamecolumnotdfctl --sortflag deferred to a follow-up, consistent with feat(policy): Add sort support to ListNamespaces API #3192 and feat(policy): add sort support to ListAttributes API #3223Checklist
Summary by CodeRabbit
New Features
Documentation
Tests