scar-cli 0.32.0__tar.gz → 0.34.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scar_cli-0.34.0/.release-please-manifest.json +3 -0
- scar_cli-0.34.0/.scars/candidates/scar-files-have-one-reader.md +37 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/CHANGELOG.md +30 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/PKG-INFO +1 -1
- {scar_cli-0.32.0 → scar_cli-0.34.0}/SPEC.md +325 -13
- {scar_cli-0.32.0 → scar_cli-0.34.0}/plugin/plugin.json +1 -1
- {scar_cli-0.32.0 → scar_cli-0.34.0}/pyproject.toml +1 -1
- scar_cli-0.34.0/src/scar/atomic.py +47 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/cascade.py +4 -16
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/cli.py +581 -326
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/clock.py +17 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/gc.py +6 -20
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/hooks.py +6 -5
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/lint.py +13 -3
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/model.py +20 -2
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/renames.py +25 -21
- scar_cli-0.34.0/src/scar/signedpromote.py +309 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/store.py +114 -34
- scar_cli-0.34.0/tests/test_act_line.py +122 -0
- scar_cli-0.34.0/tests/test_atomic.py +197 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_hook_failures.py +116 -2
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_json_contract.py +44 -0
- scar_cli-0.34.0/tests/test_presence.py +108 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_presence_adapters.py +13 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_presence_signer.py +46 -0
- scar_cli-0.34.0/tests/test_resign.py +478 -0
- scar_cli-0.34.0/tests/test_scar_reader.py +209 -0
- scar_cli-0.34.0/tests/test_sign_in_place.py +551 -0
- scar_cli-0.34.0/tests/test_signing_contract.py +481 -0
- scar_cli-0.34.0/tests/test_signing_refuses_unreadable.py +241 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_terminal_branches.py +9 -8
- scar_cli-0.34.0/tests/test_terminal_plain_parity.py +510 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_verify.py +30 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_write_gate.py +85 -9
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_write_gate_cli.py +17 -5
- {scar_cli-0.32.0 → scar_cli-0.34.0}/uv.lock +1 -1
- {scar_cli-0.32.0 → scar_cli-0.34.0}/website/docs/agents.md +2 -2
- scar_cli-0.32.0/.release-please-manifest.json +0 -3
- scar_cli-0.32.0/src/scar/signedpromote.py +0 -130
- scar_cli-0.32.0/tests/test_presence.py +0 -47
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.claude-plugin/marketplace.json +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.github/workflows/ci.yml +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.github/workflows/docs.yml +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.github/workflows/pr-validation.yml +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.github/workflows/release.yml +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.github/workflows/scar-review-queue.yml +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.gitignore +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.pre-commit-config.yaml +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.pre-commit-hooks.yaml +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0001-git-grep-ere-pitfalls.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0002-agent-direct-hook-install.deadend.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0003-installer-binds-to-active-venv-scar.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0004-promote-roundtrip-drops-expires-evidence.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0005-history-rewrite-orphans-commit-evidence.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0006-yaml-pattern-anchor-over-escaping.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0007-release-please-config-change-skips-open-pr.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0008-rich-output-nontty-must-bypass-rich.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0009-anchor-survival-harness-measures-symbol-not-path-anchors.deadend.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0010-git-returncode-128-vs-empty-tracked-set.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0011-lint-compile-check-lets-redos-anchors-hang-hotpath.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0012-firing-log-readers-need-blanket-guards.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0013-docusaurus-future-v4-requires-faster-dep.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0014-inject-flag-dest-collides-with-subcommand-dispatch.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0015-zero-checkruns-means-approval-gate-not-workflow-bug.deadend.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0016-hook-ownership-must-be-kind-scoped.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0017-codex-pretool-context-can-replay-apply-patch.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0018-cli-subparsers-register-through-_add-wrapper.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0019-token-in-scar-body-cannot-prove-hook-delivery.deadend.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0020-one-directional-health-check-leaves-flattering-direction-unwatched.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0021-posttool-fix-in-hooks-does-not-reach-codex-or-cascade.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0022-codex-hook-delivery-needs-user-file-and-trust.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0023-cascade-block-exit-collides-with-argparse.fence.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0024-host-detection-must-not-read-the-process-home.deadend.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0025-one-plugin-hook-manifest-two-hosts-two-root-variables.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0026-path-anchor-breadth-drives-the-review-due-threshold.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0027-slug-and-display-cleaning-are-different-jobs.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0028-violation-evidence-must-not-persist-raw-edits.fence.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0029-compliance-pools-by-repo-and-id.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0030-presence-signer-input-canonical-subset.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/0031-rich-values-never-in-markup.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/README.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/candidates/.gitkeep +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/.scars/template.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/AGENTS.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/CONTRIBUTING.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/IDEA.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/LICENSE +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/README.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/ROADMAP.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/SCAR-FORMAT.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/STRESS-TEST.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/action.yml +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/codecov.yml +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/experiments/anchor-survival/PROTOCOL.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/experiments/anchor-survival/RESULTS.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/experiments/anchor-survival/long_replay.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/experiments/anchor-survival/replay.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/experiments/anchor-survival/replay_shipped.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/experiments/anchor-survival/test_replay_shipped.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/experiments/auto-authorship/FINDINGS.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/experiments/auto-authorship/PROTOCOL.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/experiments/fence-honor/.gitignore +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/experiments/fence-honor/PROTOCOL.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/experiments/fence-honor/RESULTS.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/experiments/fence-honor/fixture/.scars/0001-vendor-retry-window.fence.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/experiments/fence-honor/fixture/.scars/0002-evicting-session-store.deadend.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/experiments/fence-honor/fixture/.scars/0003-export-column-order.landmine.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/experiments/fence-honor/fixture/README.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/experiments/fence-honor/fixture/payments/retry.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/experiments/fence-honor/fixture/reports/export.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/experiments/fence-honor/fixture/services/sessions.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/experiments/fence-honor/grade.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/experiments/harvest/PROTOCOL.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/experiments/harvest/harvest.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/hook/scar-hooks.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/plugin/hooks/run.sh +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/plugin/skills/scar-authoring/SKILL.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/plugin/skills/scar-authoring/assets/template.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/release-please-config.json +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/__init__.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/agent.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/codex.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/config.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/draftcheck.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/evidence.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/firing_log.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/harvest.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/hosts.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/installer.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/match.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/mcp.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/orphan.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/output.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/presence.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/reanchor.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/record.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/render.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/review.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/skills/scar-authoring/SKILL.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/skills/scar-authoring/assets/template.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/symbols.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/verify.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/src/scar/violation_evidence.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/conformance_fetch.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/conformance_support.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/conftest.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/fixtures/conformance/promote.json +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/fixtures/conformance/regenerate.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/presence_fakes.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_action_yml.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_anchor_kind.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_block_capability.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_cascade.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_cli.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_clock.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_codex.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_compliance_stats.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_conformance_round_trip.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_context_size.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_docs.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_draftcheck.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_evidence.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_firing_log.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_gc.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_git_hook.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_harvest.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_hooks.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_hosts.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_installer.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_lifecycle.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_lint.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_lint_downgrade.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_match.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_matched_by.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_mcp.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_model.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_orphan.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_output.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_plugin.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_precommit_hooks.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_promote_batch.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_promote_signed.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_reanchor.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_record.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_renames.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_render.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_render_fit.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_review.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_review_queue.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_rich_markup_values.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_sign_record.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_skill.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_store.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_sweep.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_symbols.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_verdict_observability.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/tests/test_violation_evidence.py +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/website/.gitignore +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/website/docs/concepts.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/website/docs/index.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/website/docs/methodology.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/website/docs/quickstart.md +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/website/docusaurus.config.ts +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/website/package-lock.json +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/website/package.json +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/website/scripts/sync-changelog.mjs +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/website/sidebars.ts +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/website/src/css/custom.css +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/website/static/img/favicon.svg +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/website/static/img/social-card.png +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/website/static/llms.txt +0 -0
- {scar_cli-0.32.0 → scar_cli-0.34.0}/website/tsconfig.json +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: landmine
|
|
3
|
+
title: Scar files are read in one place; a direct read_text on a scar path brings back the crash
|
|
4
|
+
severity: medium
|
|
5
|
+
confidence: 0.8
|
|
6
|
+
created: 2026-11-21
|
|
7
|
+
authors: ["claude-code"]
|
|
8
|
+
anchors:
|
|
9
|
+
- path: src/scar/store.py
|
|
10
|
+
- pattern: "parse_scar_text\(\w+\.read_text"
|
|
11
|
+
violation: "parse_scar_text\(\w+\.read_text"
|
|
12
|
+
evidence:
|
|
13
|
+
- issue: 439
|
|
14
|
+
- url: https://github.com/Daily-Nerd/Scar/issues/439
|
|
15
|
+
expires:
|
|
16
|
+
condition: "scar files stop being read as UTF-8 text, or the reader moves out of store.py"
|
|
17
|
+
review_after: 2027-05-21
|
|
18
|
+
status: candidate
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
store.read_scar_text and store.read_scar are the only code that opens a scar
|
|
22
|
+
file. They turn bytes that are not valid UTF-8 into a ParseError, so such a
|
|
23
|
+
file is listed as an unparseable scar (status, lint, the hook notice) like one
|
|
24
|
+
with no frontmatter. Calling Path.read_text on a scar path instead raises
|
|
25
|
+
UnicodeDecodeError, which no caller of the old per-site reads caught: lint and
|
|
26
|
+
status ended in a traceback, and the hooks, which catch everything, silently
|
|
27
|
+
stopped every scar from firing because of one file.
|
|
28
|
+
|
|
29
|
+
The same reader feeds the signing path: ScarStore.seen_receipts refuses when any
|
|
30
|
+
scar file cannot be read, because a file the store cannot parse has no receipt it
|
|
31
|
+
can list for the checker's `seen` argument.
|
|
32
|
+
|
|
33
|
+
Read a scar through read_scar (parse) or read_scar_text (text; pass
|
|
34
|
+
keep_newlines=True when the file will be rewritten and CRLF must survive).
|
|
35
|
+
tests/test_scar_reader.py fails if a new read_text or read_bytes appears in
|
|
36
|
+
src/scar outside its short allowlist of non-scar files. See
|
|
37
|
+
https://github.com/Daily-Nerd/Scar/issues/439.
|
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.34.0](https://github.com/Daily-Nerd/Scar/compare/v0.33.0...v0.34.0) (2026-11-21)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **promote:** reanchor --apply and orphan --fix-renames sign in place when the scar is signed ([#435](https://github.com/Daily-Nerd/Scar/issues/435)) ([fb31b06](https://github.com/Daily-Nerd/Scar/commit/fb31b0610e7c445d6bac9d9d89f0ae45b1d2a443)), closes [#434](https://github.com/Daily-Nerd/Scar/issues/434)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **promote:** refuse to sign over unreadable scar files and share one definition of the act line ([#440](https://github.com/Daily-Nerd/Scar/issues/440)) ([0ae1694](https://github.com/Daily-Nerd/Scar/commit/0ae16940f5030faca60e0715dd0d15bc722e857e))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Documentation
|
|
17
|
+
|
|
18
|
+
* **spec:** specify signed promotion and correct the re-signing guidance ([#438](https://github.com/Daily-Nerd/Scar/issues/438)) ([4b59449](https://github.com/Daily-Nerd/Scar/commit/4b594493d948e4d979c6e94f91f1b4447c53f562)), closes [#437](https://github.com/Daily-Nerd/Scar/issues/437)
|
|
19
|
+
|
|
20
|
+
## [0.33.0](https://github.com/Daily-Nerd/Scar/compare/v0.32.0...v0.33.0) (2026-11-21)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* **promote:** scar resign signs an active scar's record again ([#426](https://github.com/Daily-Nerd/Scar/issues/426)) ([5f5e130](https://github.com/Daily-Nerd/Scar/commit/5f5e1308573f60a3e73a68212f4a3a825828af3d))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* **cli:** terminal output shows every line the plain output shows ([#433](https://github.com/Daily-Nerd/Scar/issues/433)) ([d49ae51](https://github.com/Daily-Nerd/Scar/commit/d49ae51826be0570f9ade8965ef775aed64782e2))
|
|
31
|
+
* **hooks:** fail open at the dispatcher and show the age of recorded failures ([#431](https://github.com/Daily-Nerd/Scar/issues/431)) ([086f454](https://github.com/Daily-Nerd/Scar/commit/086f4543336b38e2b26007d9f4b2349909864e42)), closes [#428](https://github.com/Daily-Nerd/Scar/issues/428)
|
|
32
|
+
|
|
3
33
|
## [0.32.0](https://github.com/Daily-Nerd/Scar/compare/v0.31.0...v0.32.0) (2026-11-20)
|
|
4
34
|
|
|
5
35
|
|
|
@@ -172,8 +172,8 @@ All harvest output is `candidates/`, never active. Precision over recall: a harv
|
|
|
172
172
|
|
|
173
173
|
## 9. Machine-readable output contract
|
|
174
174
|
|
|
175
|
-
|
|
176
|
-
`stats`, `gc`, `orphan`, `reanchor`, `draft-check`. Two more are machine-mode by
|
|
175
|
+
Eleven subcommands accept `--json`: `lint`, `status`, `check`, `sweep`, `why`,
|
|
176
|
+
`stats`, `gc`, `orphan`, `reanchor`, `draft-check`, `resign`. Two more are machine-mode by
|
|
177
177
|
design: `scar inject` (hook JSON or silence) and `scar brief --compact`.
|
|
178
178
|
|
|
179
179
|
Everything in this section is a **promise to external consumers**. It exists
|
|
@@ -233,8 +233,9 @@ Top-level keys, and the keys of each object inside the listed arrays.
|
|
|
233
233
|
| `why` | `path` str, `records` array | `records[]`: `id`, `type`, `status`, `title`, `file`, `body` |
|
|
234
234
|
| `stats` | `repo` str, `total_firings` int, `per_scar` array, `most_fired` int, `last_fired` str, `never_fired` array of int, `demotions` int, `demotions_path_only` int, `demotions_cooldown` int, `demotions_reason_unknown` int, `census_known` int, `census_unknown` int, `cofires_per_edit` float **or null**, `edits_multi_fire` int, `path_only_ratio` float **or null**, `edits_observed` int, `injection_rate` float **or null**, `retrieval_misses` int **or null**, `instrument_disconnected` bool, `posttool_silent` bool, `last_fired_age_days` int, `armed_firings` int, `armed_unknown` int, `verdicts_expected` int, `verdicts_observed` int, `verdicts_unresolved` int, `verdicts_unplaceable` int, `firings_block_capable` int, `firings_advisory` int, `firings_block_unknown` int, `all_firings_advisory` bool, `firings_context_known` int, `firings_context_unknown` int, `command_firings` int, `firings_kind_unknown` int, `advisories` array, `compliance` object (§9.12). `window` object **only when `--since`/`--until` is given** | `per_scar[]`: `id`, `count`, `violations`. `window`: `since`, `until`, `excluded_undated`. `compliance`: `F`, `V`, `rate`, `violations_unmatched`, `verdicts_expected`, `verdicts_observed`, `verdicts_resolved`, `verdict_completeness`, `top_scar` (`repo`, `id`, `share`, `F`, `V`, `rate`) |
|
|
235
235
|
| `gc` | `removed_markers` int, `dropped_firings` int, `dry_run` bool, `candidates` array, `fp_log` object | `candidates[]`: `name`, `age_days`. `fp_log`: `present`, `size`, `lines`, `path` (the state-dir log, #341), `legacy` (`null`, or `path` + `lines` of a leftover `.scars/candidates/fp-log.txt`) |
|
|
236
|
-
| `orphan` | `orphan_detected`, `partial_rot` arrays |
|
|
237
|
-
| `reanchor` | `proposals`, `pattern_diagnostics` arrays |
|
|
236
|
+
| `orphan` | `orphan_detected`, `partial_rot` arrays (list mode). `--apply`: `orphaned` bool, `scar_id` int, `path` str, `reason` str. `--fix-renames`: `fixed`, `skipped`, `refused` arrays | `--fix-renames` `fixed[]`: `scar_id` int, `renamed` object, `signed` bool. `refused[]`: `scar_id` int, `reason` str, `touch_spent` bool |
|
|
237
|
+
| `reanchor` | `proposals`, `pattern_diagnostics` arrays (list mode). `--apply`: `fixed`, `skipped`, `refused` arrays | `--apply` `fixed[]`: `anchor_kind`, `dead_anchor`, `proposed_anchor`, `signed` bool. `refused[]`: `scar_id` int, `reason` str, `touch_spent` bool |
|
|
238
|
+
| `resign` | `signed` bool, `id` int. `path` str **only when `signed` is true**; `reason` str and `touch_spent` bool **only when it is false** | none |
|
|
238
239
|
| `draft-check` | `triggered` bool, `revert_language`, `revert_commits`, `reset_hard`, `churn` ints. `message` str **only when `triggered` is true** | — |
|
|
239
240
|
|
|
240
241
|
`gc` mutates state. A consumer that only wants to observe MUST pass
|
|
@@ -379,8 +380,17 @@ directory is not a usable git repo. A consumer must treat empty stdout as "no
|
|
|
379
380
|
verdict", never as a parse error. When it does emit, `message` is present only
|
|
380
381
|
on `triggered: true`; there is no message to carry otherwise.
|
|
381
382
|
|
|
382
|
-
`reanchor --json`
|
|
383
|
-
|
|
383
|
+
`reanchor --json` lists proposals; `reanchor --apply --id N --json` emits the
|
|
384
|
+
result of the apply (`fixed`, `skipped`, `refused`). `--apply` is
|
|
385
|
+
human-review-only and never CI. `orphan --json` covers the list, `--apply` and
|
|
386
|
+
`--fix-renames`: `orphan --apply --id N --json` emits `orphaned` (true),
|
|
387
|
+
`scar_id`, `path` and `reason`.
|
|
388
|
+
|
|
389
|
+
On every early exit of `reanchor` and `orphan` (no `.scars/`, git unavailable,
|
|
390
|
+
`--apply` without `--id`, an id that is not eligible, a refused transition)
|
|
391
|
+
`--json` prints `{"error": "<message>"}` and the exit code is non-zero. The
|
|
392
|
+
guaranteed keys above are those of a successful run, so a consumer checks for
|
|
393
|
+
`error` first.
|
|
384
394
|
|
|
385
395
|
### 9.7 A demotion says why
|
|
386
396
|
|
|
@@ -493,13 +503,6 @@ emptied, when a writer has no match objects in hand, and a MISSING `matched_by`
|
|
|
493
503
|
means the row predates the field, never "no kinds". Readers must not treat its
|
|
494
504
|
absence as a value.
|
|
495
505
|
|
|
496
|
-
### 9.4 Enforcement
|
|
497
|
-
|
|
498
|
-
`tests/test_json_contract.py` asserts every guaranteed key above against live
|
|
499
|
-
command output, and asserts the nullable semantics of §9.2. A guarantee no
|
|
500
|
-
test enforces is an untestable assertion, and untestable assertions are the
|
|
501
|
-
ones that reach `main` wrong.
|
|
502
|
-
|
|
503
506
|
### 9.10 Install detection
|
|
504
507
|
|
|
505
508
|
`scar hook install` and `scar skill install` without `--runtime` detect hosts (claude, codex, windsurf, cursor, opencode) by config directory or binary on PATH, and resolve for each the channel that already serves it: `settings` (Scar's own entries in the host's hook file), `plugin` (the scar marketplace plugin installed and not disabled), or `none`. windsurf is repo-scoped: its hooks file is written into the working repo, so the binary on PATH counts only when that repo is inside a git repository. On a terminal, one question per present, wirable, unserved host, default no. Without a terminal, exactly one such host is installed; zero or several means the commands are printed and nothing is written. Zero detected hosts says so, rather than naming the plugin. `--all` wires every such host. `--runtime claude` on a Claude Code already served by the plugin refuses unless `--force`. `--all` and `--force` apply to `install` only, and `--force` applies to `--runtime claude` only. A missing or unreadable plugin registry never counts as `plugin`.
|
|
@@ -603,3 +606,312 @@ are never averaged. `--all-repos` carries one `compliance` block per repo group.
|
|
|
603
606
|
**`injection_rate` is coverage, not a retrieval rate.** It is the share of
|
|
604
607
|
observed edits where any scar fired. It does not say whether the right scar was
|
|
605
608
|
shown, and it must not be given a retrieval threshold.
|
|
609
|
+
|
|
610
|
+
### 9.13 Enforcement
|
|
611
|
+
|
|
612
|
+
`tests/test_json_contract.py` asserts every guaranteed key above against live
|
|
613
|
+
command output, and asserts the nullable semantics of §9.2. A guarantee no
|
|
614
|
+
test enforces is an untestable assertion, and untestable assertions are the
|
|
615
|
+
ones that reach `main` wrong.
|
|
616
|
+
|
|
617
|
+
## 10. Signed promotion
|
|
618
|
+
|
|
619
|
+
Signing is optional and per repository. An `org` in `.scars/config.json` turns
|
|
620
|
+
it on. With it on, promoting a scar needs a person's touch on a signing key, and
|
|
621
|
+
the proof is stored in the scar file as an act. This section states the rules
|
|
622
|
+
that decide whether an act still belongs to a scar, and which commands may write
|
|
623
|
+
a scar that carries one.
|
|
624
|
+
|
|
625
|
+
The code is the source of truth. `tests/test_signing_contract.py` rebuilds the
|
|
626
|
+
constants, the worked example, the lint states, the verify states and the
|
|
627
|
+
command list from the code, and fails when this section disagrees. Scar's own
|
|
628
|
+
side is specified here: what it sends to the signer and the checker, and what it
|
|
629
|
+
relies on in their answers. What those programs do beyond that is not.
|
|
630
|
+
|
|
631
|
+
### 10.1 What is signed
|
|
632
|
+
|
|
633
|
+
The signed bytes are the output of `promoted_record` in `record.py`. Nothing
|
|
634
|
+
else rebuilds them. They are UTF-8 with LF line endings and one trailing LF,
|
|
635
|
+
in this order:
|
|
636
|
+
|
|
637
|
+
- `id: <n>`
|
|
638
|
+
- `type: <type>`
|
|
639
|
+
- `title: <title>`
|
|
640
|
+
- `severity: <severity>`
|
|
641
|
+
- `promoted_from: <path>`, only when the field is set
|
|
642
|
+
- `anchors:`
|
|
643
|
+
- one line ` - <kind>: <value>` per anchor, kinds in the order path, pattern,
|
|
644
|
+
symbol, command, values in file order
|
|
645
|
+
- `---`
|
|
646
|
+
- the body, with CRLF and CR turned into LF and trailing whitespace removed
|
|
647
|
+
|
|
648
|
+
The record is built from parsed values, so quoting, key order and line endings
|
|
649
|
+
in the file cannot change the bytes. The parser has already removed leading and
|
|
650
|
+
trailing whitespace from the body.
|
|
651
|
+
|
|
652
|
+
Status, evidence, authors, `promoted_by`, confidence, expiry, review dates, the
|
|
653
|
+
act and the receipt are not in the record. So archiving, challenging, orphaning
|
|
654
|
+
and adding an evidence note never invalidate an act. Anchors are in the record
|
|
655
|
+
on purpose: moving one changes where the scar fires.
|
|
656
|
+
|
|
657
|
+
The block below is the record of a scar whose file quotes its title, lists its
|
|
658
|
+
anchors in the order command, symbol, pattern, path, uses CRLF line endings, and
|
|
659
|
+
carries status, evidence and an act. None of those show up in it.
|
|
660
|
+
|
|
661
|
+
```text
|
|
662
|
+
id: 7
|
|
663
|
+
type: fence
|
|
664
|
+
title: Retry loop is deliberate
|
|
665
|
+
severity: high
|
|
666
|
+
promoted_from: candidates/retry-loop.md
|
|
667
|
+
anchors:
|
|
668
|
+
- path: src/net.py
|
|
669
|
+
- path: src/util.py
|
|
670
|
+
- pattern: retry\(
|
|
671
|
+
- symbol: retry_with_backoff
|
|
672
|
+
- command: git push --force
|
|
673
|
+
---
|
|
674
|
+
The backoff is slow on purpose.
|
|
675
|
+
Do not remove it.
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
Hash of the block above: `uEiC7uY8ZT_WOnAUSVgOFNb4GHGIRAZlZBdDrIHebxr0lag`
|
|
679
|
+
|
|
680
|
+
### 10.2 The hash
|
|
681
|
+
|
|
682
|
+
An act stores `inputs_hash`: the letter `u` followed by the unpadded base64url
|
|
683
|
+
of the bytes `0x12 0x20` and the SHA-256 of the record. `record_hash` computes
|
|
684
|
+
it. Scar computes it from the file every time and never stores it.
|
|
685
|
+
|
|
686
|
+
`act_inputs_hash` in `presence.py` reads `inputs_hash` out of an act without
|
|
687
|
+
looking at the signature. A match proves the act was made for these bytes. It
|
|
688
|
+
does not prove the act is genuine. Only the checker says that.
|
|
689
|
+
|
|
690
|
+
### 10.3 The subject
|
|
691
|
+
|
|
692
|
+
The subject ties an act to one scar in one repository: the scar id, a hyphen,
|
|
693
|
+
and the first 16 hex characters of the first-parent root commit
|
|
694
|
+
(`promotion_subject`).
|
|
695
|
+
|
|
696
|
+
Pattern: `^[0-9]+-[0-9a-f]{16}$`
|
|
697
|
+
|
|
698
|
+
An anchor rewrite does not change the subject. If git cannot name exactly one
|
|
699
|
+
root commit (not a repository, no commits, more than one root), there is no
|
|
700
|
+
subject, and every signing path refuses (`subject_for`, `machine_checks`).
|
|
701
|
+
|
|
702
|
+
### 10.4 The act's words
|
|
703
|
+
|
|
704
|
+
The consumer is `scar` and the action is `promote`. The action stays `promote`
|
|
705
|
+
for every signature, including re-signing and signing in place. The consumer
|
|
706
|
+
must never change: it is part of what is signed, and a new one would make every
|
|
707
|
+
stored act fail its recheck. The method is a fixed string in `presence.py`,
|
|
708
|
+
which the contract test pins. The validity window is one hour. It is a
|
|
709
|
+
constant, not configuration.
|
|
710
|
+
|
|
711
|
+
The signer and the checker are run only from the fixed absolute paths in
|
|
712
|
+
`presence.py`, never through `PATH`, with no variable or flag to move them.
|
|
713
|
+
|
|
714
|
+
| Name | Value | Meaning |
|
|
715
|
+
|---|---|---|
|
|
716
|
+
| `MAX_RECORD_BYTES` | `2048` | Largest record the signer will show |
|
|
717
|
+
| `MAX_RECORD_LINES` | `32` | Most block lines the signer will show |
|
|
718
|
+
| `WRAP_WIDTH` | `96` | Characters per block line before it wraps (private in `record.py`, measured by the test) |
|
|
719
|
+
| `CONSUMER` | `scar` | The consumer in every act |
|
|
720
|
+
| `ACTION` | `promote` | The action in every act |
|
|
721
|
+
| `METHOD` | fixed string in presence.py | The method in every act |
|
|
722
|
+
| `EXPIRES_IN_S` | `3600` | Seconds a fresh act stays acceptable, as a decimal string |
|
|
723
|
+
| `CHECKER_TIMEOUT_S` | `10` | Seconds Scar waits for the checker and for quick signer calls |
|
|
724
|
+
| `SIGNER_TIMEOUT_S` | `300` | Seconds Scar waits for a person at the signer's prompt |
|
|
725
|
+
| `CONFIG_NAME` | `config.json` | The config file inside `.scars/` |
|
|
726
|
+
| `SIGNER` | fixed absolute path in presence.py | The signer program |
|
|
727
|
+
| `CHECKER` | fixed absolute path in presence.py | The checker program |
|
|
728
|
+
|
|
729
|
+
An org that allows a shorter window than `EXPIRES_IN_S` answers
|
|
730
|
+
`validity_too_long` at the first-acceptance check, after the touch. The remedy
|
|
731
|
+
is a deliberate change to the constant.
|
|
732
|
+
|
|
733
|
+
### 10.5 Where the act lives
|
|
734
|
+
|
|
735
|
+
Two frontmatter lines: `promotion_act` (the compact signed act) and
|
|
736
|
+
`promotion_receipt` (the receipt id the checker returned).
|
|
737
|
+
|
|
738
|
+
Both are read at column 0 only. The parser and `with_act` share one definition
|
|
739
|
+
of the line, `ACT_LINE_RE` in `model.py` (`^promotion_(act|receipt):`). An
|
|
740
|
+
indented line that starts with one of the two names belongs to whatever block it
|
|
741
|
+
sits in: it is neither read as the act nor removed by `with_act`. No other key is
|
|
742
|
+
narrowed this way.
|
|
743
|
+
|
|
744
|
+
`with_act` in `signedpromote.py` sets them with a text edit of the frontmatter
|
|
745
|
+
and nothing else. Every existing column-0 line of either key is removed, and the pair
|
|
746
|
+
goes where the first one was. With none, it goes before `anchors:`, else at the
|
|
747
|
+
end of the frontmatter. The body is never read as frontmatter. The file's line
|
|
748
|
+
ending is kept.
|
|
749
|
+
|
|
750
|
+
A candidate never keeps an act or a receipt: `prepare_promotion` clears both.
|
|
751
|
+
|
|
752
|
+
### 10.6 Config
|
|
753
|
+
|
|
754
|
+
`.scars/config.json` is read only by `config.load`.
|
|
755
|
+
|
|
756
|
+
- `org`: a non-empty string. It turns signing on.
|
|
757
|
+
- `signed_from`: a whole number of 1 or more. It is the first scar id that must
|
|
758
|
+
carry an act.
|
|
759
|
+
|
|
760
|
+
A file that exists and cannot be read, or has a bad `org` or `signed_from`, is
|
|
761
|
+
an error. It is never read as "no org". `signing_problem` refuses an org
|
|
762
|
+
without `signed_from`, and a `signed_from` past the next free id. Promote and
|
|
763
|
+
resign refuse a config that lint would refuse.
|
|
764
|
+
|
|
765
|
+
### 10.7 No org, no signing
|
|
766
|
+
|
|
767
|
+
With no org, promote behaves as it always did and prints `not signed`.
|
|
768
|
+
`scar resign` refuses with "no org". No flag signs, and no flag skips signing.
|
|
769
|
+
|
|
770
|
+
### 10.8 The write gate
|
|
771
|
+
|
|
772
|
+
The only in-place write of a numbered scar is `write_active_scar` in `store.py`.
|
|
773
|
+
It protects a scar whose act matches its record, whatever its status. When the
|
|
774
|
+
old file's act matches, the new text is written in exactly two cases:
|
|
775
|
+
|
|
776
|
+
- the same act over the same record;
|
|
777
|
+
- a changed record with a different act whose `inputs_hash` is the hash of the
|
|
778
|
+
new record.
|
|
779
|
+
|
|
780
|
+
Anything else raises `SignedRecordWouldChange` and leaves the file untouched:
|
|
781
|
+
a changed record with the old act kept, a dropped act, an altered act over an
|
|
782
|
+
unchanged record, text that no longer parses. An act that already mismatched or
|
|
783
|
+
cannot be read is not protected. The write goes through and lint reports it.
|
|
784
|
+
|
|
785
|
+
The gate does no cryptography. The second case proves the act was made for
|
|
786
|
+
these bytes, not that it is genuine.
|
|
787
|
+
|
|
788
|
+
So a tool that rewrites a signed scar has two outcomes: it signs the new
|
|
789
|
+
record, or it refuses. An act that matches its record is never left stale by a
|
|
790
|
+
tool.
|
|
791
|
+
|
|
792
|
+
The limit: a tool signs only a scar whose act matches its record. A scar with a
|
|
793
|
+
stale act, or with no act at or after `signed_from`, is written with no touch by
|
|
794
|
+
`scar reanchor --apply` and `scar orphan --fix-renames`, and lint reports it.
|
|
795
|
+
|
|
796
|
+
### 10.9 Sizes
|
|
797
|
+
|
|
798
|
+
The signer shows the whole record or refuses. A record over `MAX_RECORD_BYTES`
|
|
799
|
+
bytes or `MAX_RECORD_LINES` lines cannot be signed. Lines are counted as the
|
|
800
|
+
signer wraps them (`render_fit`): a printable ASCII byte is one character, any
|
|
801
|
+
other byte is four, an escape is never split, and a line wraps at `WRAP_WIDTH`.
|
|
802
|
+
|
|
803
|
+
Refusal happens before any touch (`render_check`, `preflight`,
|
|
804
|
+
`new_record_checks`). Lint warns about a candidate over either limit
|
|
805
|
+
(`render_fit_findings`). It never errors.
|
|
806
|
+
|
|
807
|
+
### 10.10 Order of a signature
|
|
808
|
+
|
|
809
|
+
1. Machine checks (`machine_checks`): both programs exist at their fixed paths,
|
|
810
|
+
no scar file in the store is unreadable (see step 5), git can name the root
|
|
811
|
+
commit, the checker has a head, and this machine's key is still enrolled.
|
|
812
|
+
2. Render check: the signer shows the record without signing it, or refuses.
|
|
813
|
+
3. The head is fetched again.
|
|
814
|
+
4. Sign. This is the touch.
|
|
815
|
+
5. First-acceptance check (`ingest`). The `seen` list holds the receipts of
|
|
816
|
+
every scar file in the store, archived and orphaned ones included, sorted and
|
|
817
|
+
unique. Signing refuses when any scar file cannot be read: it does not parse,
|
|
818
|
+
is not valid UTF-8, or cannot be opened. The refusal names the files, says
|
|
819
|
+
nothing was signed and points at `scar lint`. It is made in step 1, before the
|
|
820
|
+
first prompt of a batch and before any touch, and made again before step 3 and
|
|
821
|
+
after step 4 (after the touch it is a spent touch and nothing is written).
|
|
822
|
+
6. One write.
|
|
823
|
+
|
|
824
|
+
Promote runs steps 1 and 2 for the whole batch before the first touch, then
|
|
825
|
+
steps 3 to 6 for each scar in turn. Resign and the tools that sign in place run
|
|
826
|
+
steps 1 and 2 on the new text, and before step 6 they read the file again and
|
|
827
|
+
refuse if it changed since it was judged. Promote creates the active file with
|
|
828
|
+
an exclusive create. The others write through the gate.
|
|
829
|
+
|
|
830
|
+
Nothing reaches disk unless the checker answered `valid: true` with reason `ok`
|
|
831
|
+
for these exact bytes, this subject and the consumer `scar`. A refusal after
|
|
832
|
+
the touch says the touch was spent and leaves the file as it was.
|
|
833
|
+
|
|
834
|
+
### 10.11 Which scars are signed
|
|
835
|
+
|
|
836
|
+
A scar is signed when it is active and its act matches its record (`is_signed`).
|
|
837
|
+
Only an active scar is ever signed (`check_signable_status`, `resign_target`).
|
|
838
|
+
|
|
839
|
+
| Status | Signed | Why |
|
|
840
|
+
|---|---|---|
|
|
841
|
+
| `candidate` | no | Promotion signs it as it becomes active |
|
|
842
|
+
| `active` | yes | |
|
|
843
|
+
| `challenged` | no | Refused: only an active scar is signed |
|
|
844
|
+
| `orphaned` | no | Refused: only an active scar is signed |
|
|
845
|
+
| `archived` | no | Refused, and archived is terminal |
|
|
846
|
+
| `template` | no | Not a scar |
|
|
847
|
+
|
|
848
|
+
A scar outside `active` that lint reports for a stale or missing act has no
|
|
849
|
+
command that signs it. For a challenged or orphaned scar, edit `status:` back to
|
|
850
|
+
`active` by hand (status is not in the record, so the act is unaffected), then
|
|
851
|
+
run the command. For an archived scar there is no way back: archived is
|
|
852
|
+
terminal, and the knowledge returns as a new candidate.
|
|
853
|
+
|
|
854
|
+
### 10.12 What each command does
|
|
855
|
+
|
|
856
|
+
| Command | Effect | Code | Pinned by |
|
|
857
|
+
|---|---|---|---|
|
|
858
|
+
| `scar promote` (org set) | One touch per candidate, written only after acceptance. A batch is a queue: a failure at k leaves 1 to k-1 promoted | `promote_one`, `_promote_one`, `preflight` | `tests/test_promote_signed.py` |
|
|
859
|
+
| `scar resign --id N` | Signs the record as it stands and swaps only the act and receipt lines. Refused when the act already matches | `resign_target`, `resign_one`, `_cmd_resign` | `tests/test_resign.py` |
|
|
860
|
+
| `scar reanchor --apply` | One touch. Anchors, notes and act in one write. Refuses otherwise | `_reanchor_apply`, `_sign_in_place` | `tests/test_sign_in_place.py` |
|
|
861
|
+
| `scar orphan --fix-renames` | Unsigned scars first with no touch, then signed scars in id order, one touch each. A cancel stops the asking | `_orphan_fix_renames`, `_sign_in_place` | `tests/test_sign_in_place.py` |
|
|
862
|
+
| `scar orphan --apply`, `scar challenge`, `scar archive`, evidence notes | Status and notes only. The record is unchanged, so the act still matches | `transition`, `append_evidence_note`, `write_active_scar` | `tests/test_write_gate.py` |
|
|
863
|
+
| hand edit of the record | The act goes stale and lint errors. `scar resign` is the remedy for an active scar | `downgrade_findings` | `tests/test_resign.py` |
|
|
864
|
+
| `scar lint` | Never signs. Reports the states of 10.13, and with `--verify-promotion` those of 10.14 | `downgrade_findings`, `verify_store` | `tests/test_signing_contract.py` |
|
|
865
|
+
|
|
866
|
+
### 10.13 Lint states
|
|
867
|
+
|
|
868
|
+
`downgrade_findings` is structural and needs no verifier, so CI runs it. Every
|
|
869
|
+
state is an error:
|
|
870
|
+
|
|
871
|
+
| Kind | When | Message contains |
|
|
872
|
+
|---|---|---|
|
|
873
|
+
| `act-without-org` | A scar has an act and the config names no org | `names no org` |
|
|
874
|
+
| `act-unreadable` | The act is not three segments, its payload is not base64url JSON, or it has no `inputs_hash` | `cannot be read` |
|
|
875
|
+
| `act-stale` | The act's `inputs_hash` is not the hash of the current record | `changed since it was signed` |
|
|
876
|
+
| `act-missing` | A scar that is not a candidate, at or after `signed_from`, has no act | `carries no promotion_act` |
|
|
877
|
+
| `config-no-signed-from` | The config names an org without `signed_from` | `names an org but not signed_from` |
|
|
878
|
+
| `config-past-next-id` | `signed_from` is past the next free id | `is beyond the next id` |
|
|
879
|
+
|
|
880
|
+
For `act-unreadable`, `act-stale` and `act-missing` the message ends with
|
|
881
|
+
`scar resign --id N` only when the scar is active (`_resign_hint`), because
|
|
882
|
+
resign refuses every other status.
|
|
883
|
+
|
|
884
|
+
### 10.14 Verify states
|
|
885
|
+
|
|
886
|
+
`scar lint --verify-promotion` checks the act of each scar that still injects
|
|
887
|
+
(active or challenged) and prints one state per scar. States are reported and
|
|
888
|
+
never lint errors. Only `rechecked: true` from the checker is `verified`.
|
|
889
|
+
|
|
890
|
+
| State | Meaning |
|
|
891
|
+
|---|---|
|
|
892
|
+
| `verified` | The checker answered `rechecked: true` |
|
|
893
|
+
| `unverified` | The scar has no act |
|
|
894
|
+
| `not proven: <reason>` | The checker answered anything else. Its reason is shown as it came |
|
|
895
|
+
| `not verified: verifier not installed` | Nothing at the checker's fixed path |
|
|
896
|
+
| `not verified: no org in .scars/config.json` | File missing, invalid, or `org` absent or empty |
|
|
897
|
+
| `not verified: repository root commit unavailable` | git cannot name the root commit |
|
|
898
|
+
| `not verified: verifier failed` | Nonzero exit, timeout, or output that is not the expected JSON |
|
|
899
|
+
|
|
900
|
+
### 10.15 What this section does not claim
|
|
901
|
+
|
|
902
|
+
- `seen` holds the receipts of every scar file that can be read, and signing
|
|
903
|
+
refuses while any scar file cannot be read. A scar file in `.scars/candidates/`
|
|
904
|
+
is not part of the list: no act of a candidate exists.
|
|
905
|
+
- Nothing proves that a title or body can never make `promoted_record` differ
|
|
906
|
+
between parse and reserialize. `new_record_checks` guards the in-place case by
|
|
907
|
+
comparing hashes with placeholder act and receipt lines, and refuses before
|
|
908
|
+
any touch when they differ. That is a guard, not a guarantee.
|
|
909
|
+
- The signer's and the checker's own protocol is out of scope: what the touch
|
|
910
|
+
shows, and what the recheck accepts.
|
|
911
|
+
|
|
912
|
+
### 10.16 Tests that pin this section
|
|
913
|
+
|
|
914
|
+
`tests/test_signing_contract.py` ties this section to the code. The gate rule is
|
|
915
|
+
pinned by `tests/test_write_gate.py` and the size boundaries by
|
|
916
|
+
`tests/test_render_fit.py`. The contract test only checks that the constants and
|
|
917
|
+
the outcomes stated here match them.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""The one owner of "replace a file atomically" (#430).
|
|
2
|
+
|
|
3
|
+
Standard library only and no package imports, so the hook hot path can pull it
|
|
4
|
+
in without paying for the store, the CLI or rich.
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import os
|
|
9
|
+
import shutil
|
|
10
|
+
import tempfile
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def atomic_write_text(path: Path | str, text: str, *,
|
|
15
|
+
copymode_from: Path | str | None = None) -> None:
|
|
16
|
+
"""Replace ``path`` with ``text`` so a reader sees the old file or the new
|
|
17
|
+
one, never a partial write.
|
|
18
|
+
|
|
19
|
+
The text goes to a uniquely named temp file in the same directory (the
|
|
20
|
+
swap must not cross a filesystem), is written as UTF-8 with no newline
|
|
21
|
+
translation, then swapped in with os.replace. ``copymode_from`` copies that
|
|
22
|
+
file's permission bits onto the temp file first.
|
|
23
|
+
|
|
24
|
+
On any failure, KeyboardInterrupt included: the descriptor is closed, the
|
|
25
|
+
temp file is removed, and the original error propagates. Removing the temp
|
|
26
|
+
file is best effort and never replaces that error. No locking: two writers
|
|
27
|
+
race, and the last replace wins."""
|
|
28
|
+
path = Path(path)
|
|
29
|
+
fd, tmp_name = tempfile.mkstemp(dir=str(path.parent),
|
|
30
|
+
prefix=f".{path.name}.", suffix=".tmp")
|
|
31
|
+
try:
|
|
32
|
+
try:
|
|
33
|
+
fh = os.fdopen(fd, "w", encoding="utf-8", newline="")
|
|
34
|
+
except BaseException:
|
|
35
|
+
os.close(fd)
|
|
36
|
+
raise
|
|
37
|
+
with fh:
|
|
38
|
+
fh.write(text)
|
|
39
|
+
if copymode_from is not None:
|
|
40
|
+
shutil.copymode(copymode_from, tmp_name)
|
|
41
|
+
os.replace(tmp_name, path)
|
|
42
|
+
except BaseException:
|
|
43
|
+
try:
|
|
44
|
+
os.unlink(tmp_name)
|
|
45
|
+
except OSError:
|
|
46
|
+
pass
|
|
47
|
+
raise
|
|
@@ -30,10 +30,10 @@ from __future__ import annotations
|
|
|
30
30
|
import json
|
|
31
31
|
import os
|
|
32
32
|
import sys
|
|
33
|
-
import tempfile
|
|
34
33
|
import time
|
|
35
34
|
from pathlib import Path
|
|
36
35
|
|
|
36
|
+
from .atomic import atomic_write_text
|
|
37
37
|
from .hooks import (
|
|
38
38
|
_extract_edit_content,
|
|
39
39
|
_log_firing,
|
|
@@ -92,9 +92,8 @@ def _remember_fired(keys: list[str]) -> bool:
|
|
|
92
92
|
the caller blocks ONLY on True, because an unrecordable fire means the
|
|
93
93
|
retry would bounce again, and again, with no way out for the user.
|
|
94
94
|
|
|
95
|
-
Written
|
|
96
|
-
|
|
97
|
-
never observe a half-written state file.
|
|
95
|
+
Written through atomic_write_text, as gc.truncate_firing_log is: a
|
|
96
|
+
concurrent hook run can never observe a half-written state file.
|
|
98
97
|
"""
|
|
99
98
|
now = time.time()
|
|
100
99
|
state = _load_fire_state()
|
|
@@ -105,18 +104,7 @@ def _remember_fired(keys: list[str]) -> bool:
|
|
|
105
104
|
path = fire_state_path()
|
|
106
105
|
try:
|
|
107
106
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
108
|
-
|
|
109
|
-
prefix=path.name + ".", suffix=".tmp")
|
|
110
|
-
try:
|
|
111
|
-
with os.fdopen(fd, "w", encoding="utf-8") as fh:
|
|
112
|
-
json.dump(state, fh)
|
|
113
|
-
os.replace(tmp_name, path)
|
|
114
|
-
except Exception:
|
|
115
|
-
try:
|
|
116
|
-
os.unlink(tmp_name)
|
|
117
|
-
except OSError:
|
|
118
|
-
pass
|
|
119
|
-
raise
|
|
107
|
+
atomic_write_text(path, json.dumps(state))
|
|
120
108
|
except Exception:
|
|
121
109
|
return False
|
|
122
110
|
return True
|