Skip to content

feat(api-tokens): replace include_revoked boolean with StatusFilter enum#2746

Merged
migmartri merged 3 commits into
chainloop-dev:mainfrom
migmartri:allow-filter-api-tokens
Feb 17, 2026
Merged

feat(api-tokens): replace include_revoked boolean with StatusFilter enum#2746
migmartri merged 3 commits into
chainloop-dev:mainfrom
migmartri:allow-filter-api-tokens

Conversation

@migmartri

@migmartri migmartri commented Feb 17, 2026

Copy link
Copy Markdown
Member

Summary

  • Introduces a StatusFilter enum in APITokenServiceListRequest (proto) with three values: ACTIVE (default/0), REVOKED, and ALL
  • Deprecates the bool include_revoked field in the proto (kept for backward compatibility)
  • Updates the biz layer APITokenListFilters to use the typed APITokenStatusFilter instead of IncludeRevoked bool
  • Updates the data layer Ent query to apply RevokedAtIsNil(), RevokedAtNotNil(), or no predicate depending on the filter
  • Adds --status active|revoked|all flag to chainloop api-token list; deprecates --all (maps to --status all)
  • Adds integration tests covering all three status filter values

Examples

List only active tokens (default behaviour, unchanged):

chainloop api-token list
chainloop api-token list --status active

List only revoked tokens (new):

chainloop api-token list --status revoked

List all tokens regardless of status (replaces --all):

chainloop api-token list --status all

Using the deprecated --all flag still works but prints a warning:

$ chainloop api-token list --all
Warning: --all is deprecated, use --status all instead

Closes #2745

Introduce a StatusFilter enum in APITokenServiceListRequest with three
values: ACTIVE (default), REVOKED, and ALL. The previous boolean
include_revoked field is marked deprecated.

The biz layer APITokenListFilters gains a StatusFilter typed field,
replacing IncludeRevoked bool. The data layer query is updated to apply
the appropriate Ent predicate per filter value.

The CLI gains a --status flag accepting active/revoked/all. The --all
flag is deprecated and maps to --status all at runtime.

Closes chainloop-dev#2745

Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
STATUS_FILTER_ACTIVE = 0 is intentional: active tokens are the safe
default, matching proto3 zero-value semantics and preserving backward
compatibility with existing callers.

Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
@migmartri migmartri merged commit 7206670 into chainloop-dev:main Feb 17, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(api-tokens): replace include_revoked boolean with explicit StatusFilter enum

2 participants