Skip to content

docs: describe controls as closed by server-side evaluation decisions - #469

Merged
ToreMerkely merged 9 commits into
mainfrom
7656-controls-closed-by-decisions
Oct 28, 2026
Merged

ToreMerkely merged 9 commits into
mainfrom
7656-controls-closed-by-decisions

Conversation

@ToreMerkely

Copy link
Copy Markdown
Contributor

Rewrite the Working with controls tutorial so a control's decision is recorded by evaluating a published policy on the server, not with kosli attest decision or flow templates. It states that a decision must be complete, notes that multi-level evaluations are not supported yet, and refreshes the decision screenshots.

See https://github.com/kosli-dev/server/issues/7656

🤖 Generated with Claude Code

A decision is now recorded by evaluating a published policy on the
server with `kosli evaluate policy --control`, and the server refuses a
decision from an inline policy. The tutorial still taught `kosli attest
decision`, attaching evidence by hand, and requiring decisions through
flow templates, all of which lead to trail compliance, the direction we
are moving away from.

The page now covers publishing a policy and recording a decision from
it, states that a decision must be complete to close a control, and
notes that multi-level evaluations are not supported yet. The decision
screenshots are retaken from a decision recorded by evaluation.

See kosli-dev/server#7656

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ToreMerkely
ToreMerkely requested a review from a team as a code owner October 26, 2026 12:28
@mintlify

mintlify Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
kosli 🟢 Ready View Preview Oct 28, 2026, 7:28 AM

@claude

claude Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @ToreMerkely's task in 2m 34s —— View job


Follow-up review (commits 0285005..8b27b64)

  • Fetch prior review comments and this PR's diff
  • Evaluate status of each previously-raised finding touched by the new commits
  • Review new commits' changed lines for bugs/regressions
  • Post inline comments for any new issues, close resolved ones
  • Post summary comment

Scope: only .github/workflows/pr-quality.yml changed (ci: run the rego example tests on opa 1.20.2, which ergo needs).

Result: the ergo opa check regression flagged in the prior round is now resolved — this commit bumps setup-opa from 1.9.0 to 1.20.2, which the Ergo Rego v1 examples need to type-check, and "Test live-docs scripts" is now green (run). Posted inline replies closing out the two previously-flagged locations (policy-reference/rego_policy.mdx:100, tutorials/working_with_controls.mdx:164). The other previously-raised findings weren't touched by this commit and are unchanged from the last round (already resolved, or accepted as out of scope).

No new bugs or regressions found in the changed lines.

Full details posted as a summary comment.

Comment thread tutorials/working_with_controls.mdx Outdated
Comment thread tutorials/working_with_controls.mdx
mbevc1
mbevc1 previously approved these changes Oct 26, 2026

@mbevc1 mbevc1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, only minor comment about the screenshots, when zoomed in they are a bit blurry. Not a blocker

The screenshots were captured at 1x and blurred when zoomed in, so all
four are retaken at 2x from the same 1920x1000 viewport while logged in.

"Only a published policy can record a decision" read as if `kosli attest
decision` no longer records decisions, which it still does. The rule
applies to evaluations, so the sentence now says so. The page also lost
its only pointer to Rego authoring, so it now links the Rego policy
reference and says the trail input schema gives the same input as
`kosli evaluate trail`.

See kosli-dev/server#7656

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ToreMerkely

Copy link
Copy Markdown
Contributor Author

@mbevc1 Fixed in 47c2d1c: all four screenshots retaken at 2x (3840 × 2000, from a 1920 × 1000 viewport), so they stay sharp when zoomed.

@claude

claude Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Follow-up review (commits 28afb5d..47c2d1c)

Scope: only the lines touched by the newest commit in tutorials/working_with_controls.mdx.

Previous finding Status
"Only a published policy can record a decision" contradicts client_reference/kosli_attest_decision.md Not addressed — sentence reworded, but kosli_attest_decision.md still describes kosli attest decision --compliant and is still in config/navigation.json, so the contradiction stands.
rctl-043.rego never shown / no reference page for kosli publish rego-policy or kosli evaluate policy Partially addressed — added a link to /policy-reference/rego_policy and a note that --input-schema trail matches kosli evaluate trail's input. The .rego file content is still not shown, and that reference page doesn't document kosli publish rego-policy, kosli evaluate policy, or the --input-schema flag itself, so the equivalence claim isn't backed by an authoritative source.

New inline comments: 0 — no bugs, security issues, or regressions found in the changed lines themselves.

The reference described only `kosli evaluate trail` and `kosli evaluate
trails`, which evaluate a policy in the CLI. Decisions against controls
now come from policies published with `kosli publish rego-policy` and
evaluated on the server with `kosli evaluate policy`, and that route has
a different contract: any package name with an `allow` rule, outputs
chosen by entrypoint annotations, multi-file bundles, a params schema
checked at evaluation, a trail moment as input with `evaluation.time` as
the only clock, and nondeterministic built-ins refused.

The page now documents that contract first and keeps the CLI commands in
a local evaluation section, with a table of how their input differs. The
controls tutorial no longer claims the two inputs are the same, and the
OPA tutorial links to the local sections it describes.

See kosli-dev/server#7656

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread policy-reference/rego_policy.mdx Outdated
@claude

claude Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Follow-up review (commits 47c2d1c..82e7fb4)

Scope: policy-reference/rego_policy.mdx (rewritten), plus anchor-link updates in tutorials/working_with_controls.mdx and tutorials/evaluate_trails_with_opa.mdx.

Previous finding Status
"Only a published policy can record a decision" contradicts client_reference/kosli_attest_decision.md Not touched by this commit — the sentence in working_with_controls.mdx wasn't changed since 47c2d1c. Per ToreMerkely's prior comment, this is accepted as-is: kosli attest decision still works outside controls, and deprecating it is a separate product decision out of scope for this PR.
.rego file content not shown / no docs for kosli publish rego-policy, kosli evaluate policy, --input-schema Resolved. policy-reference/rego_policy.mdx now shows full .rego examples (lines 282, 319), documents kosli publish rego-policy and its version-validation lifecycle ("Publishing a policy"), documents --input-schema trail/trails, and documents kosli evaluate policy end-to-end including output, exit codes, and --output json error kinds.

New regression (blocks CI): the rewritten examples at lines 142, 282, and 319 now declare packages other than policy (snyk_high, pr_approved), per the new text that "any package name works" for server-side evaluation. tests/test_rego_examples.py::test_rego_policy_follows_the_kosli_contract wasn't updated and still hard-asserts package == "policy" for every fenced block — the "Test live-docs scripts" job already fails on this PR (run). Posted as an inline comment on policy-reference/rego_policy.mdx:146.

No other bugs, broken anchors, or regressions found in the changed lines — the updated #local-input-data / #local-exit-codes / #policy-contract / #trail-moment anchor links all resolve to real headings in the rewritten page.

View job run

The repo's example test reads every Rego block with a package as a file
to create and requires `package policy` and an `allow` rule. The server
accepts any package name, but `package policy` is valid on both routes,
so the examples now declare it and also run with `kosli evaluate trail`.
The params schema snippet becomes a complete policy for the same reason.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread policy-reference/rego_policy.mdx
The safety rules and the example helper spoke of a trail being
compliant, which reads as checking flow-template compliance, the
direction we are moving away from. They now talk about a policy's
requirements, the helper is renamed `requirements_met`, and the
`is_compliant` field notes that a policy should check the attestations
it requires instead. The params schema snippet no longer reads an
attestation path that does not exist.

See kosli-dev/server#7656

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Add a policy step to the tutorial: an Ergo policy with a plain Rego
  alternative, tested with kosli evaluate policy --path, then published
- Show control creation as Kosli app, CLI and API tabs
- Explain evaluating several trails with repeated --context
- Explain why only published policies record decisions (no pipeline tampering)
- Put environment policies before asserting, move listing and archiving
  to a catalog section at the end, and hide the Coverage tab
- Make the pipeline diagram readable in dark mode
- Introduce Ergo and testing before publishing in the Rego reference

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread policy-reference/rego_policy.mdx
Comment thread tutorials/working_with_controls.mdx
ToreMerkely and others added 2 commits October 28, 2026 07:26
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Introduce controls, evidence, policies, decisions and environment
  policies before the sections that use them
- Pin the Ergo download to rego-v0.2.0 and declare ergo_spec v0.2
- Replace the reference examples with one simple multi-trail check in
  Ergo and Rego, and drop the Snyk example
- Say Ergo is open source, and that controls and policies are
  versioned separately
- Open each tab with a sentence

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread tests/test_rego_examples.py
@claude

claude Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Follow-up review status (commits c0ca137..0285005)

Previous finding Status
"Only a published policy can record a decision" contradicts client_reference/kosli_attest_decision.md Not touched by these commits. Accepted as-is per ToreMerkely's prior comment — out of scope for this PR.
.rego file content / kosli publish rego-policy / kosli evaluate policy docs Resolved (unchanged since prior round).
Package-name regression (snyk_high, pr_approved vs. hardcoded package == "policy" test) Resolved (unchanged since prior round) — verified every example in both files still declares package policy.
ergo.rego never shown as a fenced block / opa check fails with "undefined function data.ergo.report/violations" Not resolved. Commit e10948d adds tests/fixtures/ergo.rego (pinned to rego-v0.2.0) and checks Ergo-importing examples against it, which fixes the undefined function error — but opa check now fails on type errors inside ergo.rego itself (_assertion_children, lines 2550/2554/2559/4734), for both policy-reference/rego_policy.mdx:97 and tutorials/working_with_controls.mdx:161. The "Test live-docs scripts" job is still red: run. Posted as an inline comment on tests/test_rego_examples.py:98 with a suggested fix (opa eval instead of opa check for these blocks).

No other regressions found in the lines touched by e10948d/0285005 — the Ergo version bump (v0.1 → v0.2, latest → pinned rego-v0.2.0) is applied consistently across both files, and the anchor-link update (#check-pull-request-approvals-across-multiple-trails → #require-a-compliant-pull-request-on-every-trail) resolves correctly with no stale references to the removed Snyk example.

1 new inline comment, blocking CI.

View job run

Comment thread policy-reference/rego_policy.mdx
Comment thread tutorials/working_with_controls.mdx
@claude

claude Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Follow-up review (commits 0285005..8b27b64)

Scope: only the lines changed by the newest commit, ci: run the rego example tests on opa 1.20.2, which ergo needs — a one-line bump in .github/workflows/pr-quality.yml.

Previous finding Status
"Only a published policy can record a decision" contradicts client_reference/kosli_attest_decision.md Not touched by this commit — accepted as out of scope per ToreMerkely's earlier comment.
rctl-043.rego / missing reference pages for kosli publish rego-policy, kosli evaluate policy Not touched by this commit — already resolved in 82e7fb4.
Rego examples declaring non-policy package names (snyk_high, pr_approved) broke test_rego_policy_follows_the_kosli_contract Not touched by this commit — already resolved in 26e8d83.
Ergo examples (import data.ergo at policy-reference/rego_policy.mdx:100 and tutorials/working_with_controls.mdx:164) failed opa check with "undefined function data.ergo.report/violations" Resolved. The test-side fix (pinning tests/fixtures/ergo.rego and updating test_rego_examples.py) landed in e10948d/c0ca137 before this window; this commit supplies the missing piece — bumping setup-opa from 1.9.0 to 1.20.2, which Ergo's Rego v1 syntax needs to type-check. "Test live-docs scripts" is now green (run). Posted inline replies closing out both previously-flagged locations.

New inline comments: 0 bugs/regressions found in the changed lines — it is a single, correct version bump and CI confirms it fixes the prior failure.

View job run

@ToreMerkely
ToreMerkely merged commit 32278da into main Oct 28, 2026
6 checks passed
@ToreMerkely
ToreMerkely deleted the 7656-controls-closed-by-decisions branch October 28, 2026 07:51
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.

3 participants