Repository navigation
feat(server): add claims storage, identity status API and claim search filters - #2257
Merged
Merged
Conversation
Contributor
|
The latest Buf updates on your PR. Results from workflow Buf CI / verify-proto (pull_request).
|
ramizpolic
marked this pull request as ready for review
October 1, 2026 14:22
ramizpolic
requested review from
csirmazbendeguz,
lgecse and
tkircsi
and
a balanced review from Copilot
October 1, 2026 14:36
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Claim responses can violate their error-field contract, and subject filtering cannot use its declared index.
Review effort: Balanced
Findings: 2
Open (3)
What changed in this PR
Adds persisted identity/ownership verification results, a read-only identity API, and claim-aware search support.
Changes:
- Adds claim-result storage and role-scoped search filters.
- Introduces and registers
IdentityService. - Exposes identity/owner filters through
dirctland documentation.
| File | Description |
|---|---|
server/types/search.go |
Adds claim search filters. |
server/types/identity.go |
Defines claim storage types and constants. |
server/types/database.go |
Adds claim persistence API. |
server/server.go |
Registers IdentityService. |
server/database/utils/utils.go |
Converts claim queries into filters. |
server/database/utils/utils_test.go |
Tests query conversion. |
server/database/identity_claims_test.go |
Tests storage and filtering. |
server/database/gorm/record.go |
Integrates claims and filters. |
server/database/gorm/migration.go |
Migrates the claims table. |
server/database/gorm/identity_claims.go |
Implements claim persistence and SQL filters. |
server/controller/identity.go |
Implements identity RPCs. |
server/controller/identity_test.go |
Tests identity RPC behavior. |
reconciler/tasks/signature/task_test.go |
Updates the database fake. |
proto/agntcy/dir/search/v1/record_query.proto |
Defines claim query types. |
proto/agntcy/dir/identity/v1/identity_service.proto |
Defines IdentityService. |
docs/content/dir/dir-cli-reference.md |
Documents new flags. |
cli/cmd/search/search.go |
Adds CLI examples. |
cli/cmd/search/filters.go |
Registers and builds claim filters. |
cli/cmd/search/filters_test.go |
Tests new CLI filters. |
api/search/v1/record_query.pb.go |
Regenerates search API types. |
api/identity/v1/identity_service.pb.go |
Generates identity messages. |
api/identity/v1/identity_service_grpc.pb.go |
Generates identity gRPC bindings. |
Files not reviewed (3)
- api/identity/v1/identity_service.pb.go: Generated file
- api/identity/v1/identity_service_grpc.pb.go: Generated file
- api/search/v1/record_query.pb.go: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Oct 1, 2026
tkircsi
reviewed
Oct 1, 2026
…h filters Add the identity_claims table keyed by (record_cid, role) with the last verification result of a record's identity and ownership claims, a read-only IdentityService (GetIdentityStatus, Resolve) over it, and the search filters that read the same data (identity, owner, identity-verified, owner-verified) on the search/v1 query types, the server query builder and dirctl search. Nothing writes the table yet; the reconciler task will. The name lookup of NamingService.Resolve moves into a helper shared with IdentityService. Signed-off-by: Ramiz Polic <[email protected]>
Restore naming.go and give the identity controller its own name lookup, so NamingService can be removed without touching IdentityService. Signed-off-by: Ramiz Polic <[email protected]>
--exclude-identity and --exclude-owner, and --identity-verified=false and --owner-verified=false, filtered on what is absent or unverified, which nobody searches for. The claim subject filters keep their include form only, and the claim verified filters keep only the true form. The server rejects the negated and false queries instead of silently reading them. Signed-off-by: Ramiz Polic <[email protected]>
GetIdentityStatus answers NotFound for a CID that is not a record instead of an empty result, and only returns a reason for a failed claim. The subject filters match on LOWER(subject), so index that instead of the plain column. Drop a leftover Excluded.Owners field. Signed-off-by: Ramiz Polic <[email protected]>
Measured on 200k records and 2k claims, the subject filter takes ~45ms with no subject index, with the plain one, and with a functional LOWER(subject) one: the planner drives the correlated EXISTS from records and never uses any of them. The index only pays off if the query shape changes, so it is left as it was. Signed-off-by: Ramiz Polic <[email protected]>
ramizpolic
force-pushed
the
feat/identity-04-claims-api
branch
from
October 2, 2026 11:04
3d05f18 to
b74e23d
Compare
Build the dial options in a fresh slice instead of appending to the caller-provided authOpts, which gocritic's appendAssign reports and wsl wants separated from the connection setup. Signed-off-by: Ramiz Polic <[email protected]>
tkircsi
approved these changes
Oct 2, 2026
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
Fourth PR in the identity/ownership claims epic (#2212), after #2221 (claim types), #2223 (signing and verification) and #2242 (key resolvers), all merged. Adds the read side of claim verification: where the last result of each claim is stored, how to read it, and how to search on it.
Nothing writes the table yet. This PR creates the schema and the readers only; the reconciler task that verifies claims and writes results is a separate PR. No resolver or SPIFFE wiring, and
server/ingestis untouched.Storage
identity_claimsholds the last verification result of a record's claim, one row per(record_cid, role)(composite primary key), withsubject,status(verifiedorfailed),errorandverified_at.subjectandstatusare indexed for the search filters. The table is created by the existingAutoMigrateand cascades with the record, likescan_reportsandname_verifications, so removing a record removes its claim results.UpsertIdentityClaim(the writer the reconciler will call) rejects an unknown role or status, and fillsverified_atif it is unset.GetIdentityClaimByCIDreturnsErrIdentityClaimNotFoundwhen there is no row.IdentityService
A new read-only
agntcy.dir.identity.v1.IdentityService, registered inserver.goonly:GetIdentityStatus(cid | name [, version])returns theidentityandownerresults. A claim with no result yet is left unset: that is not an error. A name resolves to its latest version unless a version is given.Resolve(name [, version])returns all versions of a name newest first, or the specific version.The service is independent of
NamingService: it has its own name lookup (a name without anhttp://orhttps://prefix also matches its prefixed forms, asNamingService.Resolvedoes), andnaming.gois not touched, soNamingServicecan be removed without affecting it.Search filters
Four new
RecordQueryTypes onsearch/v1, handled by the server query builder and exposed indirctl search:dirctl searchIDENTITY--identityOWNER--ownerIDENTITY_VERIFIED--identity-verifiedOWNER_VERIFIED--owner-verifiedEach filter is role-scoped: an owner subject never matches
--identity. They compile to correlatedEXISTSsubqueries onidentity_claims, so a record is never duplicated.These filters only look for what is there. The claim subject filters have no
--exclude-twin, and the two verified filters have no=falseform: records without a verified claim are not something to search for.--identity-verified=falseis ignored by the CLI, and the server rejects a negated subject query or a verified query with any value buttruerather than reading it as something else.Notes
DatabaseAPIgains a sub-interface (IdentityClaimDatabaseAPI), which takes it to 11 embedded methods; I added//nolint:interfacebloatwith the reason. Fakes that implement the whole interface (one inreconciler/tasks/signature) gain the two new methods.api/identity/v1/identity_service*.pb.go,api/search/v1/record_query.pb.go) is frombuf generatewith the pinned buf 1.66.1; no other generated file changed.NamingServiceeither.Contains
proto/agntcy/dir/identity/v1/identity_service.proto,proto/agntcy/dir/search/v1/record_query.proto(+ generatedapi/)server/database/gorm/identity_claims.go,server/types/identity.go,server/types/database.go,server/types/search.goserver/database/gorm/record.go,migration.go,server/database/utils/utils.go(filters)server/controller/identity.go,server/server.gocli/cmd/search/filters.go,search.go, anddocs/content/dir/dir-cli-reference.mdVerification
go build,go vet,go testand golangci-lint (0 issues) pass forserver,cliandreconciler, andgo build/go vetforapi,client,utilsandtests.(record, role)and keeps the other role; not found; invalid role and status rejected;verified_atdefaulted; the rows go with the record.--identity,--owner,--identity-verifiedand--owner-verifiedhas a test against a seeded claims table (a record with verified claims, a record with a failed identity claim, and one with none): exact and wildcard subjects, an owner subject not matching--identityand the reverse, combinations, and a count that does not double records with several matching claims.GetIdentityStatuswith no claims (no error), one claim, both claims, by CID, by name (latest and a given version), the CID taking precedence over a name, and the error codes.Resolvereturns all versions newest first and the specific version.falseforms, and flag registration: no--exclude-identity/--exclude-owner, and=falseon the claim verified flags adds no query.failedinstead ofverifiedeach make a test fail.Closes #2215