Title: Bind an approval to what its proposal was checked against by shipmill-romamo[bot] · Pull Request #369 · cloudfall-dev/cloudfall · GitHub
Open Graph Title: Bind an approval to what its proposal was checked against by shipmill-romamo[bot] · Pull Request #369 · cloudfall-dev/cloudfall
X Title: Bind an approval to what its proposal was checked against by shipmill-romamo[bot] · Pull Request #369 · cloudfall-dev/cloudfall
Description: Plan Serves: quality bar Files: sdk/src/cloudfall/proposal_binding.py (new), sdk/src/cloudfall/decision.py, sdk/src/cloudfall/app.py, config/schemas/v1/operation-decision.schema.json, config/tests/records/decisions/v0.8.0-bound-proposed.json, sdk/tests/test_decision.py, changelog.d/352-bind-approval.md Order: the failing tests first (playbook, verify playbook and diff edited after propose; a role edited and a commit made in a git project; an unbound older record; the CLI refusal), then the binding module, the record's binding and its schema, the check in approve() and in decisions approve before the id prompt, then the fixture and the changelog fragment Proof: test_an_edit_after_the_proposal_refuses_its_approval (playbook, verify-playbook, diff), test_a_role_edited_in_a_git_project_refuses_the_approval, test_a_commit_after_the_proposal_refuses_the_approval, test_a_git_project_with_no_commit_yet_binds_its_files, test_an_untouched_git_project_approves_as_before, test_a_proposal_recorded_before_bindings_is_refused, test_the_cli_refuses_a_changed_proposal_before_asking_for_its_id, and the new record fixture read by test_record_fixtures.py Summary approve() ran decision.playbook and decision.verify_playbook from their paths as they were at approval time, and the diff's sha256 recorded at propose time was never compared again, while its docstring promised the approval was of what was proposed. This implements D-20 (open PR #364). Record. New optional spec.binding (camelCase, like the rest of the record): playbookSha256, verifyPlaybookSha256 (null without a verify playbook), commit and worktreeSha256 (null outside a git work tree; commit is also null in a repository with no commit yet). Added to operation-decision.schema.json with additionalProperties: false; older records without it still read Propose. proposal_binding.bind() runs before the check run. worktreeSha256 is a sha256 over git diff --binary of tracked files plus each untracked, non-ignored file's path and content (length-prefixed), scoped to the project directory and leaving out the decisions directory, record/ and tmp/. git runs with an explicit argv via subprocess, output read as bytes and decoded as UTF-8 where text is read (a diff or a path need not be UTF-8). A dirty tree at propose time is allowed Approve. New refuse_changed() recomputes the binding and the diff file's sha256 before store.start and before anything runs. Any difference raises DecisionError with the new code decision_binding_changed, naming each part that changed and asking for a new proposal; the record stays proposed. A record with no binding is refused with the same code. decisions approve checks it before the attestation prompt, so nobody types an id for a proposal that can't run; it surfaces as PRECONDITION with context.code = decision_binding_changed, like the other DecisionErrors. decisions approve is not on MCP (mcp=False), so there is no MCP path to change Docstring. approve() now says what is bound: roles, templates and inventory only through git; outside git, the two playbooks and the diff Read operations (D-1, ran at propose) also carry a binding but are never approved, so nothing checks it. Replayed proposals (D-2/D-7) are refused as replayed before the binding check A git failure other than "not a repository" while binding raises decision_binding_git_failed. A controller with no git binary binds as outside git; a record bound in git is then refused at approval, since its commit no longer matches Test notes uv run ruff check .: pass uv run mypy: pass uv run pytest sdk/tests/test_decision.py sdk/tests/test_record_fixtures.py sdk/tests/test_stale.py sdk/tests/test_why.py sdk/tests/test_host_stats.py sdk/tests/test_agent_server.py sdk/tests/test_investigation.py: 250 passed; sdk/tests/test_resources.py: 6 passed The git tests build a temporary git project (git init, a commit with hooks and signing turned off) The full suite is left to CI Expect a small rebase against #365 (#356), which also changes propose() in decision.py Fixes #352 🤖 Generated with Claude Code
Open Graph Description: Plan Serves: quality bar Files: sdk/src/cloudfall/proposal_binding.py (new), sdk/src/cloudfall/decision.py, sdk/src/cloudfall/app.py, config/schemas/v1/operation-decision.schema.json, config/tests...
X Description: Plan Serves: quality bar Files: sdk/src/cloudfall/proposal_binding.py (new), sdk/src/cloudfall/decision.py, sdk/src/cloudfall/app.py, config/schemas/v1/operation-decision.schema.json, config/tests...
Opengraph URL: https://github.com/cloudfall-dev/cloudfall/pull/369
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:295f0dac-94ee-37b7-abf5-24f50e20349a |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 80BC:14E67C:46A4D:660B9:6B05A672 |
| html-safe-nonce | de959df32128dff0c1114a11019a2f8718e1a882dbe7341788769528f6788422 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MEJDOjE0RTY3Qzo0NkE0RDo2NjBCOTo2QjA1QTY3MiIsInZpc2l0b3JfaWQiOiI2NTc4MDcxMTg2Nzc2MTA2NjEwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 901ac649152fb3fc49597b52cd83112c0007374f0bbf6f721f7c0e9b224704e1 |
| hovercard-subject-tag | pull_request:5324745364 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/cloudfall-dev/cloudfall/pull/369/files |
| twitter:image | https://avatars.githubusercontent.com/u/5600783?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/5600783?s=400&v=4 |
| og:image:alt | Plan Serves: quality bar Files: sdk/src/cloudfall/proposal_binding.py (new), sdk/src/cloudfall/decision.py, sdk/src/cloudfall/app.py, config/schemas/v1/operation-decision.schema.json, config/tests... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1fb3ddc0b71892c329818732762bc26c09d4e193a34ef934888d4731e69c0173 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/cloudfall-dev/cloudfall git https://github.com/cloudfall-dev/cloudfall.git |
| octolytics-dimension-user_id | 339512759 |
| octolytics-dimension-user_login | cloudfall-dev |
| octolytics-dimension-repository_id | 1360999777 |
| octolytics-dimension-repository_nwo | cloudfall-dev/cloudfall |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1360999777 |
| octolytics-dimension-repository_network_root_nwo | cloudfall-dev/cloudfall |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 001eaa59a2e6bac6dc88d27c00f0240847562453 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width