scar-cli 0.31.0__tar.gz → 0.32.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.
Files changed (204) hide show
  1. scar_cli-0.32.0/.release-please-manifest.json +3 -0
  2. scar_cli-0.31.0/.scars/candidates/rich-values-never-in-markup.md → scar_cli-0.32.0/.scars/0031-rich-values-never-in-markup.landmine.md +5 -1
  3. {scar_cli-0.31.0 → scar_cli-0.32.0}/CHANGELOG.md +12 -0
  4. {scar_cli-0.31.0 → scar_cli-0.32.0}/PKG-INFO +1 -1
  5. {scar_cli-0.31.0 → scar_cli-0.32.0}/plugin/plugin.json +1 -1
  6. {scar_cli-0.31.0 → scar_cli-0.32.0}/pyproject.toml +1 -1
  7. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/agent.py +5 -0
  8. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/cascade.py +5 -2
  9. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/cli.py +25 -5
  10. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/codex.py +7 -3
  11. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/hooks.py +97 -9
  12. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/lint.py +19 -1
  13. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/record.py +60 -2
  14. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/signedpromote.py +19 -7
  15. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/store.py +13 -7
  16. scar_cli-0.32.0/tests/test_hook_failures.py +355 -0
  17. scar_cli-0.32.0/tests/test_render_fit.py +190 -0
  18. scar_cli-0.32.0/tests/test_sign_record.py +93 -0
  19. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_write_gate.py +2 -2
  20. {scar_cli-0.31.0 → scar_cli-0.32.0}/uv.lock +1 -1
  21. scar_cli-0.31.0/.release-please-manifest.json +0 -3
  22. {scar_cli-0.31.0 → scar_cli-0.32.0}/.claude-plugin/marketplace.json +0 -0
  23. {scar_cli-0.31.0 → scar_cli-0.32.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  24. {scar_cli-0.31.0 → scar_cli-0.32.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  25. {scar_cli-0.31.0 → scar_cli-0.32.0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  26. {scar_cli-0.31.0 → scar_cli-0.32.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  27. {scar_cli-0.31.0 → scar_cli-0.32.0}/.github/workflows/ci.yml +0 -0
  28. {scar_cli-0.31.0 → scar_cli-0.32.0}/.github/workflows/docs.yml +0 -0
  29. {scar_cli-0.31.0 → scar_cli-0.32.0}/.github/workflows/pr-validation.yml +0 -0
  30. {scar_cli-0.31.0 → scar_cli-0.32.0}/.github/workflows/release.yml +0 -0
  31. {scar_cli-0.31.0 → scar_cli-0.32.0}/.github/workflows/scar-review-queue.yml +0 -0
  32. {scar_cli-0.31.0 → scar_cli-0.32.0}/.gitignore +0 -0
  33. {scar_cli-0.31.0 → scar_cli-0.32.0}/.pre-commit-config.yaml +0 -0
  34. {scar_cli-0.31.0 → scar_cli-0.32.0}/.pre-commit-hooks.yaml +0 -0
  35. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0001-git-grep-ere-pitfalls.landmine.md +0 -0
  36. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0002-agent-direct-hook-install.deadend.md +0 -0
  37. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0003-installer-binds-to-active-venv-scar.landmine.md +0 -0
  38. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0004-promote-roundtrip-drops-expires-evidence.landmine.md +0 -0
  39. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0005-history-rewrite-orphans-commit-evidence.landmine.md +0 -0
  40. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0006-yaml-pattern-anchor-over-escaping.landmine.md +0 -0
  41. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0007-release-please-config-change-skips-open-pr.landmine.md +0 -0
  42. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0008-rich-output-nontty-must-bypass-rich.landmine.md +0 -0
  43. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0009-anchor-survival-harness-measures-symbol-not-path-anchors.deadend.md +0 -0
  44. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0010-git-returncode-128-vs-empty-tracked-set.landmine.md +0 -0
  45. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0011-lint-compile-check-lets-redos-anchors-hang-hotpath.landmine.md +0 -0
  46. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0012-firing-log-readers-need-blanket-guards.landmine.md +0 -0
  47. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0013-docusaurus-future-v4-requires-faster-dep.landmine.md +0 -0
  48. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0014-inject-flag-dest-collides-with-subcommand-dispatch.landmine.md +0 -0
  49. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0015-zero-checkruns-means-approval-gate-not-workflow-bug.deadend.md +0 -0
  50. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0016-hook-ownership-must-be-kind-scoped.landmine.md +0 -0
  51. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0017-codex-pretool-context-can-replay-apply-patch.landmine.md +0 -0
  52. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0018-cli-subparsers-register-through-_add-wrapper.landmine.md +0 -0
  53. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0019-token-in-scar-body-cannot-prove-hook-delivery.deadend.md +0 -0
  54. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0020-one-directional-health-check-leaves-flattering-direction-unwatched.landmine.md +0 -0
  55. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0021-posttool-fix-in-hooks-does-not-reach-codex-or-cascade.landmine.md +0 -0
  56. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0022-codex-hook-delivery-needs-user-file-and-trust.landmine.md +0 -0
  57. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0023-cascade-block-exit-collides-with-argparse.fence.md +0 -0
  58. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0024-host-detection-must-not-read-the-process-home.deadend.md +0 -0
  59. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0025-one-plugin-hook-manifest-two-hosts-two-root-variables.landmine.md +0 -0
  60. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0026-path-anchor-breadth-drives-the-review-due-threshold.landmine.md +0 -0
  61. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0027-slug-and-display-cleaning-are-different-jobs.landmine.md +0 -0
  62. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0028-violation-evidence-must-not-persist-raw-edits.fence.md +0 -0
  63. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0029-compliance-pools-by-repo-and-id.landmine.md +0 -0
  64. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/0030-presence-signer-input-canonical-subset.landmine.md +0 -0
  65. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/README.md +0 -0
  66. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/candidates/.gitkeep +0 -0
  67. {scar_cli-0.31.0 → scar_cli-0.32.0}/.scars/template.md +0 -0
  68. {scar_cli-0.31.0 → scar_cli-0.32.0}/AGENTS.md +0 -0
  69. {scar_cli-0.31.0 → scar_cli-0.32.0}/CONTRIBUTING.md +0 -0
  70. {scar_cli-0.31.0 → scar_cli-0.32.0}/IDEA.md +0 -0
  71. {scar_cli-0.31.0 → scar_cli-0.32.0}/LICENSE +0 -0
  72. {scar_cli-0.31.0 → scar_cli-0.32.0}/README.md +0 -0
  73. {scar_cli-0.31.0 → scar_cli-0.32.0}/ROADMAP.md +0 -0
  74. {scar_cli-0.31.0 → scar_cli-0.32.0}/SCAR-FORMAT.md +0 -0
  75. {scar_cli-0.31.0 → scar_cli-0.32.0}/SPEC.md +0 -0
  76. {scar_cli-0.31.0 → scar_cli-0.32.0}/STRESS-TEST.md +0 -0
  77. {scar_cli-0.31.0 → scar_cli-0.32.0}/action.yml +0 -0
  78. {scar_cli-0.31.0 → scar_cli-0.32.0}/codecov.yml +0 -0
  79. {scar_cli-0.31.0 → scar_cli-0.32.0}/experiments/anchor-survival/PROTOCOL.md +0 -0
  80. {scar_cli-0.31.0 → scar_cli-0.32.0}/experiments/anchor-survival/RESULTS.md +0 -0
  81. {scar_cli-0.31.0 → scar_cli-0.32.0}/experiments/anchor-survival/long_replay.py +0 -0
  82. {scar_cli-0.31.0 → scar_cli-0.32.0}/experiments/anchor-survival/replay.py +0 -0
  83. {scar_cli-0.31.0 → scar_cli-0.32.0}/experiments/anchor-survival/replay_shipped.py +0 -0
  84. {scar_cli-0.31.0 → scar_cli-0.32.0}/experiments/anchor-survival/test_replay_shipped.py +0 -0
  85. {scar_cli-0.31.0 → scar_cli-0.32.0}/experiments/auto-authorship/FINDINGS.md +0 -0
  86. {scar_cli-0.31.0 → scar_cli-0.32.0}/experiments/auto-authorship/PROTOCOL.md +0 -0
  87. {scar_cli-0.31.0 → scar_cli-0.32.0}/experiments/fence-honor/.gitignore +0 -0
  88. {scar_cli-0.31.0 → scar_cli-0.32.0}/experiments/fence-honor/PROTOCOL.md +0 -0
  89. {scar_cli-0.31.0 → scar_cli-0.32.0}/experiments/fence-honor/RESULTS.md +0 -0
  90. {scar_cli-0.31.0 → scar_cli-0.32.0}/experiments/fence-honor/fixture/.scars/0001-vendor-retry-window.fence.md +0 -0
  91. {scar_cli-0.31.0 → scar_cli-0.32.0}/experiments/fence-honor/fixture/.scars/0002-evicting-session-store.deadend.md +0 -0
  92. {scar_cli-0.31.0 → scar_cli-0.32.0}/experiments/fence-honor/fixture/.scars/0003-export-column-order.landmine.md +0 -0
  93. {scar_cli-0.31.0 → scar_cli-0.32.0}/experiments/fence-honor/fixture/README.md +0 -0
  94. {scar_cli-0.31.0 → scar_cli-0.32.0}/experiments/fence-honor/fixture/payments/retry.py +0 -0
  95. {scar_cli-0.31.0 → scar_cli-0.32.0}/experiments/fence-honor/fixture/reports/export.py +0 -0
  96. {scar_cli-0.31.0 → scar_cli-0.32.0}/experiments/fence-honor/fixture/services/sessions.py +0 -0
  97. {scar_cli-0.31.0 → scar_cli-0.32.0}/experiments/fence-honor/grade.py +0 -0
  98. {scar_cli-0.31.0 → scar_cli-0.32.0}/experiments/harvest/PROTOCOL.md +0 -0
  99. {scar_cli-0.31.0 → scar_cli-0.32.0}/experiments/harvest/harvest.py +0 -0
  100. {scar_cli-0.31.0 → scar_cli-0.32.0}/hook/scar-hooks.py +0 -0
  101. {scar_cli-0.31.0 → scar_cli-0.32.0}/plugin/hooks/run.sh +0 -0
  102. {scar_cli-0.31.0 → scar_cli-0.32.0}/plugin/skills/scar-authoring/SKILL.md +0 -0
  103. {scar_cli-0.31.0 → scar_cli-0.32.0}/plugin/skills/scar-authoring/assets/template.md +0 -0
  104. {scar_cli-0.31.0 → scar_cli-0.32.0}/release-please-config.json +0 -0
  105. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/__init__.py +0 -0
  106. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/clock.py +0 -0
  107. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/config.py +0 -0
  108. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/draftcheck.py +0 -0
  109. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/evidence.py +0 -0
  110. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/firing_log.py +0 -0
  111. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/gc.py +0 -0
  112. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/harvest.py +0 -0
  113. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/hosts.py +0 -0
  114. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/installer.py +0 -0
  115. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/match.py +0 -0
  116. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/mcp.py +0 -0
  117. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/model.py +0 -0
  118. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/orphan.py +0 -0
  119. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/output.py +0 -0
  120. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/presence.py +0 -0
  121. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/reanchor.py +0 -0
  122. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/renames.py +0 -0
  123. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/render.py +0 -0
  124. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/review.py +0 -0
  125. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/skills/scar-authoring/SKILL.md +0 -0
  126. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/skills/scar-authoring/assets/template.md +0 -0
  127. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/symbols.py +0 -0
  128. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/verify.py +0 -0
  129. {scar_cli-0.31.0 → scar_cli-0.32.0}/src/scar/violation_evidence.py +0 -0
  130. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/conformance_fetch.py +0 -0
  131. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/conformance_support.py +0 -0
  132. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/conftest.py +0 -0
  133. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/fixtures/conformance/promote.json +0 -0
  134. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/fixtures/conformance/regenerate.py +0 -0
  135. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/presence_fakes.py +0 -0
  136. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_action_yml.py +0 -0
  137. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_anchor_kind.py +0 -0
  138. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_block_capability.py +0 -0
  139. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_cascade.py +0 -0
  140. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_cli.py +0 -0
  141. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_clock.py +0 -0
  142. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_codex.py +0 -0
  143. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_compliance_stats.py +0 -0
  144. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_conformance_round_trip.py +0 -0
  145. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_context_size.py +0 -0
  146. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_docs.py +0 -0
  147. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_draftcheck.py +0 -0
  148. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_evidence.py +0 -0
  149. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_firing_log.py +0 -0
  150. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_gc.py +0 -0
  151. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_git_hook.py +0 -0
  152. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_harvest.py +0 -0
  153. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_hooks.py +0 -0
  154. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_hosts.py +0 -0
  155. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_installer.py +0 -0
  156. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_json_contract.py +0 -0
  157. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_lifecycle.py +0 -0
  158. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_lint.py +0 -0
  159. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_lint_downgrade.py +0 -0
  160. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_match.py +0 -0
  161. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_matched_by.py +0 -0
  162. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_mcp.py +0 -0
  163. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_model.py +0 -0
  164. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_orphan.py +0 -0
  165. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_output.py +0 -0
  166. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_plugin.py +0 -0
  167. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_precommit_hooks.py +0 -0
  168. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_presence.py +0 -0
  169. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_presence_adapters.py +0 -0
  170. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_presence_signer.py +0 -0
  171. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_promote_batch.py +0 -0
  172. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_promote_signed.py +0 -0
  173. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_reanchor.py +0 -0
  174. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_record.py +0 -0
  175. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_renames.py +0 -0
  176. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_render.py +0 -0
  177. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_review.py +0 -0
  178. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_review_queue.py +0 -0
  179. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_rich_markup_values.py +0 -0
  180. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_skill.py +0 -0
  181. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_store.py +0 -0
  182. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_sweep.py +0 -0
  183. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_symbols.py +0 -0
  184. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_terminal_branches.py +0 -0
  185. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_verdict_observability.py +0 -0
  186. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_verify.py +0 -0
  187. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_violation_evidence.py +0 -0
  188. {scar_cli-0.31.0 → scar_cli-0.32.0}/tests/test_write_gate_cli.py +0 -0
  189. {scar_cli-0.31.0 → scar_cli-0.32.0}/website/.gitignore +0 -0
  190. {scar_cli-0.31.0 → scar_cli-0.32.0}/website/docs/agents.md +0 -0
  191. {scar_cli-0.31.0 → scar_cli-0.32.0}/website/docs/concepts.md +0 -0
  192. {scar_cli-0.31.0 → scar_cli-0.32.0}/website/docs/index.md +0 -0
  193. {scar_cli-0.31.0 → scar_cli-0.32.0}/website/docs/methodology.md +0 -0
  194. {scar_cli-0.31.0 → scar_cli-0.32.0}/website/docs/quickstart.md +0 -0
  195. {scar_cli-0.31.0 → scar_cli-0.32.0}/website/docusaurus.config.ts +0 -0
  196. {scar_cli-0.31.0 → scar_cli-0.32.0}/website/package-lock.json +0 -0
  197. {scar_cli-0.31.0 → scar_cli-0.32.0}/website/package.json +0 -0
  198. {scar_cli-0.31.0 → scar_cli-0.32.0}/website/scripts/sync-changelog.mjs +0 -0
  199. {scar_cli-0.31.0 → scar_cli-0.32.0}/website/sidebars.ts +0 -0
  200. {scar_cli-0.31.0 → scar_cli-0.32.0}/website/src/css/custom.css +0 -0
  201. {scar_cli-0.31.0 → scar_cli-0.32.0}/website/static/img/favicon.svg +0 -0
  202. {scar_cli-0.31.0 → scar_cli-0.32.0}/website/static/img/social-card.png +0 -0
  203. {scar_cli-0.31.0 → scar_cli-0.32.0}/website/static/llms.txt +0 -0
  204. {scar_cli-0.31.0 → scar_cli-0.32.0}/website/tsconfig.json +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.32.0"
3
+ }
@@ -1,16 +1,20 @@
1
1
  ---
2
+ id: 31
2
3
  type: landmine
3
4
  title: Terminal output must pass values to rich as data through output.fmt, never inside a markup string
4
5
  severity: high
5
6
  confidence: 0.9
6
7
  created: 2026-11-20
7
8
  authors: ["claude-code"]
9
+ promoted_by: Kibukx
10
+ promoted_by_source: git-config-interactive
11
+ promoted_from: candidates/rich-values-never-in-markup.md
8
12
  anchors:
9
13
  - path: src/scar/output.py
10
14
  - path: src/scar/cli.py
11
15
  evidence:
12
16
  - issue: 414
13
- status: candidate
17
+ status: active
14
18
  ---
15
19
 
16
20
  Rich reads square brackets in any string as style tags. A value put into a
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.32.0](https://github.com/Daily-Nerd/Scar/compare/v0.31.0...v0.32.0) (2026-11-20)
4
+
5
+
6
+ ### Features
7
+
8
+ * **lint:** warn when a candidate's record will not fit the signer's limits ([#422](https://github.com/Daily-Nerd/Scar/issues/422)) ([9b0c722](https://github.com/Daily-Nerd/Scar/commit/9b0c7229547db6d3a522f775a9025f8a17f058cc))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **hooks:** record internal hook failures instead of discarding them ([#423](https://github.com/Daily-Nerd/Scar/issues/423)) ([89d639c](https://github.com/Daily-Nerd/Scar/commit/89d639c3fe9328f206faae75fed87876971df9f6)), closes [#420](https://github.com/Daily-Nerd/Scar/issues/420)
14
+
3
15
  ## [0.31.0](https://github.com/Daily-Nerd/Scar/compare/v0.30.0...v0.31.0) (2026-11-20)
4
16
 
5
17
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: scar-cli
3
- Version: 0.31.0
3
+ Version: 0.32.0
4
4
  Summary: SCAR — version control for negative knowledge (deadends, fences, landmines)
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scar",
3
- "version": "0.31.0",
3
+ "version": "0.32.0",
4
4
  "description": "SCAR — version control for negative knowledge (deadends, fences, landmines)",
5
5
  "hooks": {
6
6
  "PreToolUse": [
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "scar-cli"
3
- version = "0.31.0"
3
+ version = "0.32.0"
4
4
  description = "SCAR — version control for negative knowledge (deadends, fences, landmines)"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -152,6 +152,11 @@ def doctor(repo: Path) -> list[str]:
152
152
  findings.append("Codex hook trust: host-owned — run /hooks to confirm the "
153
153
  "Scar plugin hooks are enabled and trusted")
154
154
  findings.append("MCP command: scar mcp")
155
+ # Internal hook failures (#420): hooks fail open, so this is the only place
156
+ # a hook that crashes on every run shows up. Nothing is added when none
157
+ # were recorded.
158
+ from .hooks import hook_failure_summary
159
+ findings.extend(hook_failure_summary())
155
160
  return findings
156
161
 
157
162
 
@@ -38,6 +38,7 @@ from .hooks import (
38
38
  _extract_edit_content,
39
39
  _log_firing,
40
40
  _log_violation_firing,
41
+ record_hook_failure,
41
42
  _matched_by_of,
42
43
  _read_payload,
43
44
  _state_dir,
@@ -286,7 +287,9 @@ def cascade_hook() -> int:
286
287
  return 0
287
288
  try:
288
289
  return handler(payload)
289
- except Exception:
290
+ except Exception as exc:
290
291
  # Same contract as hooks.py, with more at stake: an unexpected failure
291
- # must never block the user's edit or command. Fail OPEN.
292
+ # must never block the user's edit or command. Fail OPEN. Recorded,
293
+ # never discarded (#420).
294
+ record_hook_failure("cascade-hook", exc)
292
295
  return 0
@@ -20,7 +20,8 @@ from typing import Callable
20
20
  from rich_argparse import RichHelpFormatter
21
21
 
22
22
  from .firing_log import read_firing_log_records
23
- from .lint import _is_redos_prone, lint_text
23
+ from .lint import _is_redos_prone, lint_text, render_fit_findings
24
+ from .record import render_fit
24
25
  from .match import (
25
26
  _armed_candidates,
26
27
  _violation_lines,
@@ -267,7 +268,8 @@ def _agent_doctor_rich(lines) -> None:
267
268
  for i, line in enumerate(lines):
268
269
  if i:
269
270
  body.append("\n")
270
- bad = "missing" in line or "not found" in line or "no-op" in line
271
+ bad = ("missing" in line or "not found" in line or "no-op" in line
272
+ or "internal failure" in line)
271
273
  body.append(line, style="yellow" if bad else "")
272
274
  output.show(output.panel(body, title="scar agent doctor", border_style="cyan"))
273
275
 
@@ -721,6 +723,17 @@ def _cmd_lint(args) -> int:
721
723
  for rel, finding in downgrade_findings(numbered_scars, cfg, store.next_id()):
722
724
  findings_by_file.append((rel, [finding]))
723
725
  failed_files.add(rel)
726
+ # #419: a candidate is measured as it will be promoted, with the id and
727
+ # promoted_from promote will set. Active scars are never measured.
728
+ for f in store.candidates():
729
+ try:
730
+ candidate = parse_scar_text(f.read_text(encoding="utf-8"))
731
+ except ParseError:
732
+ continue # lint_text already reported it as an error
733
+ fit_findings = render_fit_findings(
734
+ f.name, render_fit(store.as_promoted(f, candidate)))
735
+ if fit_findings:
736
+ findings_by_file.append((str(f.relative_to(store.root)), fit_findings))
724
737
  failed = len(failed_files)
725
738
 
726
739
  author_files: dict[str, dict[str, list[str]]] = {}
@@ -2889,7 +2902,7 @@ def _cmd_draft_check(args) -> int:
2889
2902
  hook can't gate a commit that already landed, and a direct human
2890
2903
  invocation should never fail a shell script that chains it."""
2891
2904
  from . import draftcheck
2892
- from .hooks import _state_dir
2905
+ from .hooks import _state_dir, hook_failures_path, record_hook_failure
2893
2906
 
2894
2907
  try:
2895
2908
  state_dir = _state_dir()
@@ -2927,11 +2940,18 @@ def _cmd_draft_check(args) -> int:
2927
2940
  if args.from_hook:
2928
2941
  draftcheck.touch_throttle(state_dir, repo)
2929
2942
  return 0
2930
- except Exception:
2943
+ except Exception as exc:
2931
2944
  # Contract (issue #117): advisory only, ALWAYS exit 0. A hook can't
2932
2945
  # gate a commit that already landed, and no internal failure here
2933
2946
  # (bad SCAR_STATE_DIR, git surprises, whatever) may propagate — same
2934
- # fail-open posture as hooks.py's precheck (#91).
2947
+ # fail-open posture as hooks.py's precheck (#91). Recorded, never
2948
+ # discarded (#420); a human at a terminal also gets one stderr line,
2949
+ # the hook gets none so it never pollutes a commit.
2950
+ record_hook_failure("draft-check", exc)
2951
+ if not args.from_hook:
2952
+ print(f"scar draft-check: internal error ({type(exc).__name__}: "
2953
+ f"{str(exc)[:200]}), recorded in {hook_failures_path()}; "
2954
+ "exit code stays 0", file=sys.stderr)
2935
2955
  return 0
2936
2956
 
2937
2957
 
@@ -26,6 +26,7 @@ from .hooks import (
26
26
  _read_payload,
27
27
  _recently_fired,
28
28
  _session_notice_payload,
29
+ record_hook_failure,
29
30
  _zero_hit_logging,
30
31
  )
31
32
  from .match import (
@@ -230,7 +231,8 @@ def pretool() -> int:
230
231
  matched=census.get(str(target.relative_to(store.root))),
231
232
  edit_id=edit_id, context_bytes=ctx,
232
233
  anchor_kind="edit")
233
- except Exception:
234
+ except Exception as exc:
235
+ record_hook_failure("codex-pretool", exc)
234
236
  return 0
235
237
  return 0
236
238
 
@@ -293,7 +295,8 @@ def posttool() -> int:
293
295
  store, str((store.root / path).resolve()), scoped,
294
296
  runtime=RUNTIME, edit_id=edit_id,
295
297
  armed_ids=armed.get(path, []))
296
- except Exception:
298
+ except Exception as exc:
299
+ record_hook_failure("codex-posttool", exc)
297
300
  return 0
298
301
  return 0
299
302
 
@@ -304,7 +307,8 @@ def session_notice() -> int:
304
307
  return 0
305
308
  try:
306
309
  return _session_notice_payload(payload, verify_claude_hook=False)
307
- except Exception:
310
+ except Exception as exc:
311
+ record_hook_failure("codex-session-notice", exc)
308
312
  return 0
309
313
 
310
314
 
@@ -142,6 +142,89 @@ def firing_log_path() -> Path:
142
142
  return _state_dir() / "firing-log.jsonl"
143
143
 
144
144
 
145
+ HOOK_FAILURE_MESSAGE_MAX = 300
146
+ # Simple size cap, not a retention policy (#420): past this, the oldest half is
147
+ # dropped. 64 KiB holds a few hundred rows, far more than doctor shows.
148
+ HOOK_FAILURE_LOG_MAX_BYTES = 64 * 1024
149
+
150
+
151
+ def hook_failures_path() -> Path:
152
+ """Where internal hook failures are recorded (#420): same state dir and
153
+ SCAR_STATE_DIR override as every other piece of hook state."""
154
+ return _state_dir() / "hook-failures.jsonl"
155
+
156
+
157
+ def record_hook_failure(hook: str, exc: BaseException,
158
+ repo: Path | str | None = None) -> None:
159
+ """THE one place an internal hook failure is recorded (#420).
160
+
161
+ Hooks fail open: an unexpected error exits 0 so the user's edit or commit
162
+ is never blocked. That is right, but discarding the error too made a hook
163
+ that crashes on every run look identical to a hook with nothing to say.
164
+ Every fail-open handler calls this before it returns 0; exit codes do not
165
+ change. Appends one JSON line: local timestamp, hook name, exception type,
166
+ truncated message, repo (the working directory when the caller has none).
167
+
168
+ NEVER raises. An unwritable state dir drops the failure, which is today's
169
+ behaviour, never a new way to break the hook. The blanket catch below is
170
+ the one place in the package where swallowing is the whole point: this
171
+ function runs inside handlers that are already handling a failure."""
172
+ try:
173
+ try:
174
+ message = str(exc)
175
+ except Exception:
176
+ message = "<unprintable exception>"
177
+ row = {"ts": clock.now(), "hook": hook, "exc_type": type(exc).__name__,
178
+ "message": message[:HOOK_FAILURE_MESSAGE_MAX],
179
+ "repo": str(repo) if repo is not None else os.getcwd()}
180
+ path = hook_failures_path()
181
+ path.parent.mkdir(parents=True, exist_ok=True)
182
+ with open(path, "a", encoding="utf-8") as fh:
183
+ fh.write(json.dumps(row) + "\n")
184
+ if path.stat().st_size > HOOK_FAILURE_LOG_MAX_BYTES:
185
+ lines = path.read_text(encoding="utf-8").splitlines()
186
+ tmp = path.with_name(path.name + ".tmp")
187
+ tmp.write_text("\n".join(lines[len(lines) // 2:]) + "\n",
188
+ encoding="utf-8")
189
+ os.replace(tmp, path)
190
+ except Exception:
191
+ pass
192
+
193
+
194
+ def _read_hook_failures() -> list[dict]:
195
+ """Recorded failures, oldest first. Blanket per line (scar 12): a reader
196
+ that escapes on one bad row would hide every failure after it."""
197
+ try:
198
+ text = hook_failures_path().read_text(encoding="utf-8")
199
+ except Exception:
200
+ return []
201
+ rows = []
202
+ for line in text.splitlines():
203
+ try:
204
+ row = json.loads(line)
205
+ except Exception:
206
+ continue
207
+ if (isinstance(row, dict) and isinstance(row.get("hook"), str)
208
+ and isinstance(row.get("exc_type"), str)):
209
+ rows.append(row)
210
+ return rows
211
+
212
+
213
+ def hook_failure_summary() -> list[str]:
214
+ """One line per hook that has recorded failures: count, last time, last
215
+ exception type and message. Empty when nothing was recorded."""
216
+ by_hook: dict[str, list[dict]] = {}
217
+ for row in _read_hook_failures():
218
+ by_hook.setdefault(row["hook"], []).append(row)
219
+ lines = []
220
+ for hook, rows in sorted(by_hook.items()):
221
+ last = rows[-1]
222
+ lines.append(f"{hook}: {len(rows)} internal failure(s), last "
223
+ f"{last.get('ts', '?')} {last['exc_type']}: "
224
+ f"{last.get('message', '')}")
225
+ return lines
226
+
227
+
145
228
  COOLDOWN_SECONDS = 4 * 3600 # fixed constant — deliberately not a config knob
146
229
 
147
230
 
@@ -343,8 +426,8 @@ def _log_firing(store: ScarStore, target: str, hits: list,
343
426
  record["matched_by"] = {str(k): list(v) for k, v in matched_by.items()}
344
427
  with open(log_path, "a", encoding="utf-8") as fh:
345
428
  fh.write(json.dumps(record) + "\n")
346
- except Exception:
347
- pass
429
+ except Exception as exc:
430
+ record_hook_failure("firing-log", exc)
348
431
 
349
432
 
350
433
  def _log_violation_firing(store: ScarStore, target: str, violations: list,
@@ -393,8 +476,8 @@ def _log_violation_firing(store: ScarStore, target: str, violations: list,
393
476
  record["edit_id"] = edit_id
394
477
  with open(log_path, "a", encoding="utf-8") as fh:
395
478
  fh.write(json.dumps(record) + "\n")
396
- except Exception:
397
- pass
479
+ except Exception as exc:
480
+ record_hook_failure("violation-log", exc)
398
481
 
399
482
 
400
483
  def posttool() -> int:
@@ -434,10 +517,11 @@ def posttool() -> int:
434
517
  vid = payload.get("tool_use_id")
435
518
  _log_violation_firing(store, target, violations, armed_ids=armed,
436
519
  edit_id=vid if isinstance(vid, str) else None)
437
- except Exception:
520
+ except Exception as exc:
438
521
  # Contract (module docstring): a hook must NEVER fail or delay the
439
522
  # user's action. Fail OPEN on any unexpected error — emit nothing
440
- # rather than raise.
523
+ # rather than raise. Recorded, never discarded (#420).
524
+ record_hook_failure("posttool", exc)
441
525
  return 0
442
526
  return 0
443
527
 
@@ -486,10 +570,12 @@ def precheck() -> int:
486
570
  # retrieval denominator, so it has to carry the kind
487
571
  # or the denominator lands in kind-unknown with it.
488
572
  anchor_kind="edit")
489
- except Exception:
573
+ except Exception as exc:
490
574
  # Contract (module docstring): a hook must NEVER fail or delay the user's
491
575
  # edit. Fail OPEN on any unexpected error — inject nothing rather than
492
576
  # raise (#91). Scoped to the ranking/render path, not the whole handler.
577
+ # Recorded, never discarded (#420).
578
+ record_hook_failure("precheck", exc)
493
579
  return 0
494
580
  return 0
495
581
 
@@ -529,9 +615,11 @@ def _precheck_command_payload(payload: dict,
529
615
  matched_by=_matched_by_of(matches),
530
616
  edit_id=edit_id if isinstance(edit_id, str) else None,
531
617
  anchor_kind="command")
532
- except Exception:
618
+ except Exception as exc:
533
619
  # Contract (module docstring): a hook must NEVER fail or delay the
534
- # user's command. Fail OPEN on any unexpected error.
620
+ # user's command. Fail OPEN on any unexpected error. Recorded, never
621
+ # discarded (#420).
622
+ record_hook_failure("precheck-command", exc)
535
623
  return 0
536
624
  return 0
537
625
 
@@ -11,7 +11,7 @@ from dataclasses import dataclass
11
11
  from . import clock, presence, symbols
12
12
  from .config import Config, signing_problem
13
13
  from .model import SEVERITIES, STATUSES, TYPES, ParseError, Scar, is_valid_url, parse_scar_text
14
- from .record import record_hash
14
+ from .record import MAX_RECORD_BYTES, MAX_RECORD_LINES, RenderFit, record_hash
15
15
 
16
16
 
17
17
  # A valid regex can still be a ReDoS weapon. re.compile accepts it (the syntax
@@ -356,6 +356,24 @@ def downgrade_findings(scars: list[tuple[str, Scar]], cfg: Config,
356
356
  return out
357
357
 
358
358
 
359
+ def render_fit_findings(name: str, fit: RenderFit) -> list[Finding]:
360
+ """The warning for a candidate whose record the signer would refuse (#419).
361
+ A warning, never an error: a repo with signing off loses nothing, and the
362
+ signer's own render check stays the authority at promotion."""
363
+ if fit.fits:
364
+ return []
365
+ parts = []
366
+ if fit.bytes_over:
367
+ parts.append(f"{fit.bytes_over} bytes over the signer's limit of "
368
+ f"{MAX_RECORD_BYTES} ({fit.bytes} bytes)")
369
+ if fit.lines_over:
370
+ parts.append(f"{fit.lines_over} lines over the signer's limit of "
371
+ f"{MAX_RECORD_LINES} ({fit.lines} lines)")
372
+ return [Finding(
373
+ "warning", f"candidate {name}: record is {' and '.join(parts)}; it "
374
+ "cannot be signed at promotion until it is shortened")]
375
+
376
+
359
377
  def lint_text(text: str, today: str | None = None) -> list[Finding]:
360
378
  try:
361
379
  scar = parse_scar_text(text)
@@ -6,14 +6,16 @@ them. The record holds only what a person decides (id, type, title, severity,
6
6
  anchors, body), built from parsed values so frontmatter quoting, key order and
7
7
  line endings cannot change it. Lifecycle fields are never included.
8
8
 
9
- Anchors are in on purpose: moving one changes where the scar fires. There is no
10
- size check here; the signer refuses an oversize record before any confirmation.
9
+ Anchors are in on purpose: moving one changes where the scar fires. Nothing
10
+ here refuses an oversize record: the signer does that before any confirmation,
11
+ and render_fit only predicts it so an author hears about it while drafting.
11
12
  """
12
13
  from __future__ import annotations
13
14
 
14
15
  import base64
15
16
  import hashlib
16
17
  import subprocess
18
+ from dataclasses import dataclass
17
19
  from pathlib import Path
18
20
 
19
21
  from .model import Scar
@@ -69,3 +71,59 @@ def record_hash(scar: Scar) -> str:
69
71
  stored, so an act can be compared against the record it sits on."""
70
72
  digest = hashlib.sha256(promoted_record(scar)).digest()
71
73
  return "u" + base64.urlsafe_b64encode(b"\x12\x20" + digest).decode("ascii").rstrip("=")
74
+
75
+
76
+ # The signer's render limits for the block that shows a record (#419). It
77
+ # refuses, never truncates, so a record over either cannot be signed.
78
+ MAX_RECORD_BYTES = 2048
79
+ MAX_RECORD_LINES = 32
80
+ # An escaped line wraps into continuation lines of at most this many characters.
81
+ _WRAP_WIDTH = 96
82
+
83
+
84
+ @dataclass(frozen=True)
85
+ class RenderFit:
86
+ bytes: int
87
+ lines: int
88
+
89
+ @property
90
+ def bytes_over(self) -> int:
91
+ return max(0, self.bytes - MAX_RECORD_BYTES)
92
+
93
+ @property
94
+ def lines_over(self) -> int:
95
+ return max(0, self.lines - MAX_RECORD_LINES)
96
+
97
+ @property
98
+ def fits(self) -> bool:
99
+ return self.bytes_over == 0 and self.lines_over == 0
100
+
101
+
102
+ def _block_lines(raw: bytes) -> int:
103
+ """Block lines the signer renders for `raw`. Per source line: a printable
104
+ ASCII byte (0x20 to 0x7E) is one character, any other byte is the four
105
+ characters `\\xHH`; an escape is never split, so a line wraps before the
106
+ escape that would pass the width. A final LF ends the last line, it does
107
+ not start another; an empty line still takes one block line."""
108
+ pieces = raw.split(b"\n")
109
+ if pieces[-1] == b"":
110
+ pieces.pop()
111
+ total = 0
112
+ for piece in pieces:
113
+ total += 1
114
+ size = 0
115
+ for byte in piece:
116
+ width = 1 if 0x20 <= byte <= 0x7E else 4
117
+ if size + width > _WRAP_WIDTH:
118
+ total += 1
119
+ size = 0
120
+ size += width
121
+ return total
122
+
123
+
124
+ def render_fit(scar: Scar) -> RenderFit:
125
+ """Size of the record a promotion would sign, in the two units the signer
126
+ limits. Like promoted_record it needs the scar as it will be promoted (an
127
+ id, and promoted_from when promote sets it)."""
128
+ raw = promoted_record(scar)
129
+ return RenderFit(bytes=len(raw), lines=_block_lines(raw))
@@ -17,6 +17,7 @@ from pathlib import Path
17
17
 
18
18
  from . import presence
19
19
  from .record import promoted_record, promotion_subject
20
+ from .model import Scar
20
21
  from .store import PreparedPromotion, ScarStore
21
22
 
22
23
 
@@ -31,11 +32,11 @@ class SignedPromoteError(Exception):
31
32
  self.cancelled = cancelled
32
33
 
33
34
 
34
- def subject_for(store: ScarStore, prepared: PreparedPromotion) -> str:
35
- subject = promotion_subject(store.root, prepared.scar.id)
35
+ def subject_for(store: ScarStore, scar: Scar, name: str) -> str:
36
+ subject = promotion_subject(store.root, scar.id)
36
37
  if subject is None:
37
38
  raise SignedPromoteError(
38
- f"{prepared.candidate.name}: repository root commit unavailable, so the "
39
+ f"{name}: repository root commit unavailable, so the "
39
40
  "promotion cannot be bound to this repository. Nothing was signed.")
40
41
  return subject
41
42
 
@@ -80,10 +81,15 @@ def preflight(store: ScarStore, org: str, targets: list[Path], reviewer: str,
80
81
  f"{target.name}: the signer cannot show this record: {exc.reason}.") from None
81
82
 
82
83
 
83
- def promote_one(store: ScarStore, prepared: PreparedPromotion, org: str) -> Path:
84
- name = prepared.candidate.name
85
- record = promoted_record(prepared.scar)
86
- subject = subject_for(store, prepared)
84
+ def sign_record(store: ScarStore, scar: Scar, org: str, name: str) -> tuple[str, str]:
85
+ """Obtain an accepted act and receipt for `scar`'s record as it stands, or
86
+ raise SignedPromoteError. The one owner of the sequence: head, sign (the
87
+ touch), first-acceptance check. It writes nothing and assumes neither a
88
+ candidate nor a file being created, so promotion and any later re-signing
89
+ share it. `name` only labels errors. Preflight is not run here: a batch
90
+ runs `preflight` once for every target before the first touch."""
91
+ record = promoted_record(scar)
92
+ subject = subject_for(store, scar, name)
87
93
  try:
88
94
  head = presence.head(org)
89
95
  except presence.PresenceError as exc:
@@ -108,6 +114,12 @@ def promote_one(store: ScarStore, prepared: PreparedPromotion, org: str) -> Path
108
114
  f"the touch was spent, but the checker did not accept the act: {exc.reason}. "
109
115
  f"Nothing was written: {name} is unchanged and its id is not used up.",
110
116
  touch_spent=True) from None
117
+ return jws, receipt
118
+
119
+
120
+ def promote_one(store: ScarStore, prepared: PreparedPromotion, org: str) -> Path:
121
+ name = prepared.candidate.name
122
+ jws, receipt = sign_record(store, prepared.scar, org, name)
111
123
  prepared.scar.promotion_act = jws
112
124
  prepared.scar.promotion_receipt = receipt
113
125
  try:
@@ -573,8 +573,7 @@ class ScarStore:
573
573
  self.check_promotable(candidate)
574
574
  candidate = self.candidate_path(candidate)
575
575
  text = candidate.read_text(encoding="utf-8")
576
- scar = parse_scar_text(text)
577
- scar.id = self.next_id()
576
+ scar = self.as_promoted(candidate, parse_scar_text(text))
578
577
  scar.status = "active"
579
578
  # #287: the reviewer is who VOUCHED, its own key. Never appended to
580
579
  # authors (that was #182's dedup, which an agent could turn into a
@@ -589,11 +588,6 @@ class ScarStore:
589
588
  # like promoted_by itself: whatever the candidate carried here was
590
589
  # never a real vouch either.
591
590
  scar.promoted_by_source = reviewer_source if reviewer else None
592
- # Always overwritten, like promoted_by: only promote knows the real
593
- # source. candidate is already resolved and known to sit in
594
- # candidates/, so this is the same string however the path was typed.
595
- scar.promoted_from = candidate.relative_to(
596
- self.scars_dir.resolve()).as_posix()
597
591
  # Like promoted_by, cleared: a candidate cannot have been signed, so an
598
592
  # act or receipt it carries is a claim nobody made (an agent can write
599
593
  # one). Only the signing step sets them, on the prepared scar.
@@ -603,6 +597,18 @@ class ScarStore:
603
597
  candidate=candidate, scar=scar,
604
598
  destination=self._destination(candidate, scar, scar.id))
605
599
 
600
+ def as_promoted(self, candidate: Path, scar: Scar) -> Scar:
601
+ """`scar` with the two record fields promotion decides: the next free
602
+ id and promoted_from. The one place they are set, so lint can measure
603
+ the record a candidate will sign without promoting it (#419).
604
+ promoted_from is always overwritten, like promoted_by: only promote
605
+ knows the real source. `candidate` must be resolved and inside
606
+ candidates/, so this is the same string however the path was typed."""
607
+ scar.id = self.next_id()
608
+ scar.promoted_from = candidate.relative_to(
609
+ self.scars_dir.resolve()).as_posix()
610
+ return scar
611
+
606
612
  def commit_promotion(self, prepared: "PreparedPromotion") -> Path:
607
613
  """Write the prepared scar, then remove its candidate. The write is an
608
614
  exclusive create: a file that appeared since prepare_promotion is never