Repository navigation
feat: add scorecards exemptions list command (ISP-1898) - #253
Merged
Merged
Conversation
Adds `cortex scorecards exemptions list`, backed by GET /api/v1/scorecards/exemptions, with the endpoint's filters (scorecard, entity, rule, status, requester, approver, onlyActive) and the standard list options.
mmaikel
marked this pull request as ready for review
November 17, 2026 08:41
mmaikel
requested review from
AdmTal,
hannavigil,
justinmarinelli-dev,
peytondmurray,
ryan-doucette,
shalarn1 and
tonytino
November 17, 2026 08:42
AdmTal
approved these changes
Nov 17, 2026
tonytino
approved these changes
Nov 17, 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.
Linear: ISP-1898
Why
cortex scorecards exemptionscan request, approve, deny and revoke exemptions, but it can't list them. Tealium asked for this.GET /api/v1/scorecards/exemptionswas added to the public API in October (CD-594), but the CLI was never updated to use it. For now customers have to callcortex rest get -e api/v1/scorecards/exemptionsdirectly.What changed
New command
cortex scorecards exemptions listincortexapps_cli/commands/scorecards_commands/exemptions.py. It is built the same way asscorecards list:--scorecard-tag,-sscorecardTag--entity-tag,-eentityTag--rule-id,-riruleIdentifier(the API requires--scorecard-tagwith it)--status,-ststatus: one of PENDING, APPROVED, REJECTED, REVOKED, EXPIRED--requester-email,-rerequesterEmail--approver-email,-aeapproverEmail--only-active,-aonlyActive=trueIt also has the standard list options. Without
--pageit fetches every page (client.fetch).--page/--page-sizereturn a single page.--table/--csvuse these default columns: ID, Scorecard, Rule, Entity, Status, Requester, EndDate. Filters that aren't set are not sent. Validation (rule without scorecard, EXPIRED with--only-active) is left to the API, the same as in the rest of the CLI. For example, the API's 400 message is printed as is. The other four exemption commands are not changed.Screenshots
Tests
New file:
tests/test_scorecards_exemptions_list.py. It has 9 tests that mock the API withresponses. The exemption tests intest_scorecards.pyexplain why a live test isn't practical: exemptions can't be put into a known state on the shared test tenants. The tests cover:listappears in the group's help--statusis rejected--pagemakes a single request8 of the 9 tests fail on
mainbecause the command doesn't exist. The status test passes onmaintoo, because any unknown command exits non-zero. All 9 pass on this branch.I didn't run the command against a live tenant (no API key here). I checked param names and the response shape (
exemptionslist plustotal/page/totalPages) againstPublicScorecardRuleExemptionsController.listRuleExemptionsin brain-backend.Size: production +70/−0, tests +136/−0.
Independent review: approve, confidence 90, all acceptance criteria met, no blocking issues. It suggested some optional follow-ups:
--statuscould ignore case.-ahelp could mention that it can't be combined with EXPIRED.--csv,-C,-F,-Sand--no-headers. These work through the shared output helper and were checked by hand, but no test covers them.Follow-ups (not in this PR)
The simplify review found two problems in
CortexClient.fetch()that affect every list command, so they belong in their own PR:pageSize=250, so--page-sizedoes nothing without--page.Decisions for reviewer
-s,-eand-rireuse what the sibling commands use.-st,-re,-aeand-aare new. The alternative is long flags only for these, which breaks the "long and short" rule in STYLE.md.--entity-taginstead of--tag-or-id/-t. The other exemption commands accept--tag-or-id, but the list endpoint'sentityTagonly accepts a tag, so the flag says so. The alternative is to use-tfor consistency and document that it takes a tag only.requestedBy.email. When an API key made the request, the actor hasapiKeyLast4instead and the cell is blank, because a column can only read one field. Approver (exemptionStatus.handledBy.email) is left out: it's empty while an exemption is pending, and it really means whoever handled it, including people who rejected or revoked. On an 80-column terminal rich truncates the wider cells (Rich is the library that draws the tables, and every CLI table works this way). The alternative is to leave Requester out and let people add it with-C.feat:, so merging gives a minor release.Opened by Hermes ISP autopilot (owner-directed). Needs human review before it is ready.