Skip to content

feat(attest): add --control to attest override and show overrides in get trail - #1435

Merged
ToreMerkely merged 7 commits into
mainfrom
feat/attest-override-control
Dec 2, 2026
Merged

ToreMerkely merged 7 commits into
mainfrom
feat/attest-override-control

Conversation

@ToreMerkely

Copy link
Copy Markdown
Contributor

Prepares kosli attest override for release, ahead of #1403 which unhides it.

  • attest override gains --control: an override of a decision that was never reported has no control to inherit, so it appeared on no control's page and satisfied no policy rule written for a control.
  • get trail marks a slot whose newest attestation is an override, and describes an override event with what it overrode, the reason and the compliance it gave.
  • A test now checks that an override changes the trail; until now the tests only checked the flags and that the server answered.
  • The test mongo gets a higher limit of open files, as resetting the test database twice after a start passed docker's default.

See kosli-dev/server#6645

Checklist

  • Docs are autogenerated from CLI help — make sure the help text reflects your changes
  • Helm chart (charts/k8s-reporter/) updated, if needed. Note: these changes live in a separate PR
  • Terraform provider and related changes (terraform-provider-kosli, terraform-aws-kosli-reporter) updated, if needed

🤖 Generated with Claude Code

ToreMerkely and others added 6 commits December 1, 2026 08:30
An override of a decision belongs to the control the decision was for.
When the decision was reported the server takes the control from it, but
a decision that was never reported has none to take, so its override
appeared on no control's page and satisfied no policy rule written for a
control. The flag lets the caller name the control.

The server refuses a control for any other attestation type, so the CLI
says so before sending anything.

See kosli-dev/server#6645

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The tests of attest override checked its flags and that the server
answered, never that anything changed. A failed attestation is now
reported, overridden, and the trail read back before and after: the slot
goes from non-compliant to compliant and becomes the override, naming
the attestation it overrides.

See kosli-dev/server#6645

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
get trail gave no sign of an override. A slot whose newest attestation
is an override looked like any reported attestation, and an override
event was printed as its raw type, attestation_overridden, with no
compliance and no hint of what was overridden or why.

The markdown attestation table now marks such a slot "(override)", and
both outputs describe an override event with the type and name of what
it overrode, the reason, and the compliance it gave; the markdown links
it to the override.

The fixture still carried overridden_attestation_id, which the server no
longer returns; it has the fields that replaced it.

See kosli-dev/server#6645

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Running the whole suite, rather than the override suite alone, showed
two things the new flag needed. The audit of flags given an empty value
did not know about it, so it is added to the audit's coverage file; an
empty --control is refused like any other. And the new test created a
control with the identifier the decision suite also creates, which the
server refuses the second time, so it has one of its own.

See kosli-dev/server#6645

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Each run resets the test database, which recreates every collection and
index. The mongo container ran at docker's default limit of open files,
and as the server gained collections the second reset after a start
began to pass it: mongo aborted with "Too many open files" and every
later run failed at setup until the server was restarted.

The limit is now the one the server repo gives its own test mongo.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@ToreMerkely
ToreMerkely enabled auto-merge (squash) December 2, 2026 12:32
@github-actions github-actions Bot added go Pull requests that update go code feat labels Dec 2, 2026
@claude

claude Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @ToreMerkely's task in 53s —— View job


Follow-up review complete

Reviewed git diff 7af7d1cd..870fd6a5 — the only change is a one-line help-text update in cmd/kosli/root.go (originalAttestationTypeFlag).

Status of previous findings:

  1. attestOverride.go:104 — system:decision discoverability/UX nit: ✅ Resolved (as intended by the author). originalAttestationTypeFlag help text now lists custom:<name> and system:decision explicitly, fixing the "hard to find" half of the comment. The acceptance check itself is intentionally left as-is — the author clarified the server rejects a bare decision regardless of --control, so loosening the CLI check would just move the error server-side.
  2. getTrail.go:489 — nil any formatting as %!s(<nil>): Not touched by this commit. Author explained this is a won't-fix: reason and original_attestation_type are required fields enforced by both the CLI flags and the server, so the nil case can't occur in practice.
  3. attestOverride_test.go:162 — coverage gap for --control: Not touched by this commit. Author explained this is a won't-fix: no CLI command reads the control back off a decision, so a get trail assertion here would only duplicate what TestAttestOverrideTakesEffectOnTheTrail already checks; the server's own tests cover the stored control.

New issues in the diff: none — the change is a documentation string only, no logic touched.

No new inline comments posted.

Comment thread cmd/kosli/attestOverride.go Resolved
Comment thread cmd/kosli/getTrail.go Resolved
Comment thread cmd/kosli/attestOverride_test.go Resolved
--control is only allowed with --original-attestation-type
system:decision, but the help for that flag listed the builtin types and
"custom" and never the decision type, so nothing told a user how to
spell the one value --control needs. A flow template spells it
"decision", which the server refuses on an override.

The example for a custom type is now custom:<name>, as the server
refuses a bare "custom" too.

See kosli-dev/server#6645

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@ToreMerkely
ToreMerkely merged commit 50a6746 into main Dec 2, 2026
24 checks passed
@ToreMerkely
ToreMerkely deleted the feat/attest-override-control branch December 2, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants