Repository navigation
feat: kosli evaluate policy --identifier, evaluate a published Rego policy - #1261
Conversation
…eprecated alias --path (-p) names the files to send, so --identifier can name a published policy next to it (server#7081). --policy stays one release because sdlc-policies runs the latest CLI and passes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…licy
Sends policy: {"identifier": ...} so the server evaluates the policy's
current version (server#7081). Exactly one of --identifier or --path is
required, checked on resolved values so a KOSLI_IDENTIFIER exported by a
pipeline cannot silently win or lose against --path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The evaluation cites the policy it ran (server#7081): a published policy by identifier, version and digest, an inline one by its digest. It is printed as a POLICY row and a policy object in JSON. evaluate trail is unchanged, so its server-side path still prints what the local path does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The bundle errors now say --path, while evaluate trail still passes its one --policy, so the comments say which flag each command reads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Claude encountered an error after 3m 12s —— View job Follow-up review of commits 0a928c4..bdb3b94
Changed in this push: Posted the findings summary as a PR comment. No new bugs found in the changed lines — the refactor ( |
…s the server gave it The policy's outputs stay under result.outputs, so no output name can clash with the fields beside them, and the policy citation needs no special handling. evaluate trail --server-side still prints what the local path does. sdlc-policies reads the new shape after the release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow-up review: commits 0a928c4..bdb3b94Reviewed only the lines touched by the newest commit (bdb3b94, "evaluate policy
All 5 original inline review threads are already marked resolved on GitHub. New findings in the changed lines: none. Traced the Generated with Claude Code |
Implements the CLI side of kosli-dev/server#7081:
kosli evaluate policycan run a Rego policy published withkosli publish rego-policy(#1256), by its identifier.What it does
--pathreplaces--policy(commit 1)--path(-p, repeatable) sends the policy's files, as--policydid.--policystays for one release as a deprecated alias: hidden from the help, andFlag --policy has been deprecated, use --path insteadon stderr (so--output jsonstays clean). sdlc-policies runs the latest CLI and passes--policy.--path.--identifier(commit 2)policy: {"identifier": "pr-approved"}. The server evaluates the policy's current version, the highest valid one. No files are read.--identifieror--pathis required, refused before any request:only one of --identifier or --path can be given/one of --identifier or --path is required.KOSLI_IDENTIFIERexported by a pipeline is refused next to--pathrather than silently winning or losing.The policy that ran is printed (commits 3 and 5)
--output jsonprints the evaluation as the server gave it:id,status,policy,result: {allow, outputs},decision_attestation_id. The policy's outputs stay underresult.outputs, so no output name can clash with the fields beside them.--assertreadsresult.allow.POLICY:row: a published policy aspr-approved, version 3 (sha256:…), an inline policy by its digest only.POLICYrow.Decisions worth a reviewer's attention
KOSLI_<FLAG>, soKOSLI_IDENTIFIERandKOSLI_PATHare read too. A conflict is refused (tested), not resolved silently.evaluate policy --output jsonchanges shape. It no longer copies the flatevaluate trailshape (allow,violationsand outputs at the top level); it echoes the server's evaluation (review feedback). This removes the reserved output names from its help. sdlc-policies, which reads the old shape, is updated after the release.evaluate trail/evaluate trailsare unchanged, including--server-side, which still prints the same bytes as the local path (tested with a verdict that cites a policy).runServerEvaluationis split:awaitServerEvaluationcreates and waits, and each command prints.Depends on
identifiervariant and thepolicyfield in the response. Until it is merged,--identifiergets a 400 from the server, and noPOLICYrow is printed.Not in this PR
--policyto--path, and reads the new JSON shape (that repo).--policy.Testing
cmd/kosli/evaluatePolicy_test.go(14),internal/evaluations/client_test.go(3), and a cited-policy case inevaluateServerSide_test.go, all against stubbed servers.pathandidentifierinspec.jsonand the regeneratedcoverage.json.make test_integrationpasses (3609 tests, 53 skipped).make lint: 0 issues.🤖 Generated with Claude Code