scar-cli 0.28.0__tar.gz → 0.29.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.28.0 → scar_cli-0.29.0}/.github/workflows/ci.yml +37 -3
- scar_cli-0.29.0/.release-please-manifest.json +3 -0
- scar_cli-0.28.0/.scars/candidates/compliance-pools-by-repo-and-id.md → scar_cli-0.29.0/.scars/0029-compliance-pools-by-repo-and-id.landmine.md +4 -2
- scar_cli-0.29.0/.scars/0030-presence-signer-input-canonical-subset.landmine.md +35 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/template.md +2 -1
- {scar_cli-0.28.0 → scar_cli-0.29.0}/CHANGELOG.md +18 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/PKG-INFO +1 -1
- {scar_cli-0.28.0 → scar_cli-0.29.0}/SCAR-FORMAT.md +2 -1
- {scar_cli-0.28.0 → scar_cli-0.29.0}/SPEC.md +2 -1
- {scar_cli-0.28.0 → scar_cli-0.29.0}/plugin/plugin.json +1 -1
- {scar_cli-0.28.0/src/scar → scar_cli-0.29.0/plugin}/skills/scar-authoring/SKILL.md +7 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/plugin/skills/scar-authoring/assets/template.md +2 -1
- {scar_cli-0.28.0 → scar_cli-0.29.0}/pyproject.toml +1 -1
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/cli.py +165 -20
- scar_cli-0.29.0/src/scar/clock.py +30 -0
- scar_cli-0.29.0/src/scar/config.py +69 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/gc.py +1 -1
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/harvest.py +3 -3
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/hooks.py +5 -4
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/lint.py +71 -4
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/mcp.py +27 -4
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/model.py +50 -15
- scar_cli-0.29.0/src/scar/presence.py +229 -0
- scar_cli-0.29.0/src/scar/record.py +60 -0
- scar_cli-0.29.0/src/scar/signedpromote.py +118 -0
- {scar_cli-0.28.0/plugin → scar_cli-0.29.0/src/scar}/skills/scar-authoring/SKILL.md +7 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/skills/scar-authoring/assets/template.md +2 -1
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/store.py +195 -12
- scar_cli-0.29.0/src/scar/verify.py +87 -0
- scar_cli-0.29.0/tests/conformance_fetch.py +109 -0
- scar_cli-0.29.0/tests/conformance_support.py +191 -0
- scar_cli-0.29.0/tests/fixtures/conformance/promote.json +146 -0
- scar_cli-0.29.0/tests/fixtures/conformance/regenerate.py +71 -0
- scar_cli-0.29.0/tests/presence_fakes.py +75 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_cli.py +160 -17
- scar_cli-0.29.0/tests/test_clock.py +169 -0
- scar_cli-0.29.0/tests/test_conformance_round_trip.py +166 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_lifecycle.py +29 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_lint.py +47 -0
- scar_cli-0.29.0/tests/test_lint_downgrade.py +181 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_mcp.py +50 -1
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_model.py +98 -0
- scar_cli-0.29.0/tests/test_presence.py +27 -0
- scar_cli-0.29.0/tests/test_presence_adapters.py +59 -0
- scar_cli-0.29.0/tests/test_presence_signer.py +229 -0
- scar_cli-0.29.0/tests/test_promote_batch.py +283 -0
- scar_cli-0.29.0/tests/test_promote_signed.py +281 -0
- scar_cli-0.29.0/tests/test_record.py +164 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_store.py +231 -0
- scar_cli-0.29.0/tests/test_verify.py +264 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/uv.lock +1 -1
- {scar_cli-0.28.0 → scar_cli-0.29.0}/website/docs/agents.md +44 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/website/docs/concepts.md +3 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/website/docs/quickstart.md +1 -0
- scar_cli-0.28.0/.release-please-manifest.json +0 -3
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.claude-plugin/marketplace.json +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.github/workflows/docs.yml +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.github/workflows/pr-validation.yml +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.github/workflows/release.yml +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.github/workflows/scar-review-queue.yml +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.gitignore +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.pre-commit-config.yaml +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.pre-commit-hooks.yaml +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0001-git-grep-ere-pitfalls.landmine.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0002-agent-direct-hook-install.deadend.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0003-installer-binds-to-active-venv-scar.landmine.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0004-promote-roundtrip-drops-expires-evidence.landmine.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0005-history-rewrite-orphans-commit-evidence.landmine.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0006-yaml-pattern-anchor-over-escaping.landmine.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0007-release-please-config-change-skips-open-pr.landmine.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0008-rich-output-nontty-must-bypass-rich.landmine.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0009-anchor-survival-harness-measures-symbol-not-path-anchors.deadend.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0010-git-returncode-128-vs-empty-tracked-set.landmine.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0011-lint-compile-check-lets-redos-anchors-hang-hotpath.landmine.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0012-firing-log-readers-need-blanket-guards.landmine.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0013-docusaurus-future-v4-requires-faster-dep.landmine.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0014-inject-flag-dest-collides-with-subcommand-dispatch.landmine.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0015-zero-checkruns-means-approval-gate-not-workflow-bug.deadend.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0016-hook-ownership-must-be-kind-scoped.landmine.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0017-codex-pretool-context-can-replay-apply-patch.landmine.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0018-cli-subparsers-register-through-_add-wrapper.landmine.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0019-token-in-scar-body-cannot-prove-hook-delivery.deadend.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0020-one-directional-health-check-leaves-flattering-direction-unwatched.landmine.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0021-posttool-fix-in-hooks-does-not-reach-codex-or-cascade.landmine.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0022-codex-hook-delivery-needs-user-file-and-trust.landmine.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0023-cascade-block-exit-collides-with-argparse.fence.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0024-host-detection-must-not-read-the-process-home.deadend.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0025-one-plugin-hook-manifest-two-hosts-two-root-variables.landmine.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0026-path-anchor-breadth-drives-the-review-due-threshold.landmine.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0027-slug-and-display-cleaning-are-different-jobs.landmine.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/0028-violation-evidence-must-not-persist-raw-edits.fence.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/README.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/.scars/candidates/.gitkeep +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/AGENTS.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/CONTRIBUTING.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/IDEA.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/LICENSE +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/README.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/ROADMAP.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/STRESS-TEST.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/action.yml +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/codecov.yml +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/experiments/anchor-survival/PROTOCOL.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/experiments/anchor-survival/RESULTS.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/experiments/anchor-survival/long_replay.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/experiments/anchor-survival/replay.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/experiments/anchor-survival/replay_shipped.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/experiments/anchor-survival/test_replay_shipped.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/experiments/auto-authorship/FINDINGS.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/experiments/auto-authorship/PROTOCOL.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/experiments/fence-honor/.gitignore +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/experiments/fence-honor/PROTOCOL.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/experiments/fence-honor/RESULTS.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/experiments/fence-honor/fixture/.scars/0001-vendor-retry-window.fence.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/experiments/fence-honor/fixture/.scars/0002-evicting-session-store.deadend.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/experiments/fence-honor/fixture/.scars/0003-export-column-order.landmine.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/experiments/fence-honor/fixture/README.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/experiments/fence-honor/fixture/payments/retry.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/experiments/fence-honor/fixture/reports/export.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/experiments/fence-honor/fixture/services/sessions.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/experiments/fence-honor/grade.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/experiments/harvest/PROTOCOL.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/experiments/harvest/harvest.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/hook/scar-hooks.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/plugin/hooks/run.sh +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/release-please-config.json +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/__init__.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/agent.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/cascade.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/codex.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/draftcheck.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/evidence.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/firing_log.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/hosts.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/installer.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/match.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/orphan.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/output.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/reanchor.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/renames.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/render.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/review.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/symbols.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/src/scar/violation_evidence.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/conftest.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_action_yml.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_anchor_kind.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_block_capability.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_cascade.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_codex.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_compliance_stats.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_context_size.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_docs.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_draftcheck.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_evidence.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_firing_log.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_gc.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_git_hook.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_harvest.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_hooks.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_hosts.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_installer.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_json_contract.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_match.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_matched_by.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_orphan.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_output.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_plugin.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_precommit_hooks.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_reanchor.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_renames.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_render.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_review.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_review_queue.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_skill.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_sweep.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_symbols.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_verdict_observability.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/tests/test_violation_evidence.py +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/website/.gitignore +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/website/docs/index.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/website/docs/methodology.md +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/website/docusaurus.config.ts +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/website/package-lock.json +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/website/package.json +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/website/scripts/sync-changelog.mjs +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/website/sidebars.ts +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/website/src/css/custom.css +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/website/static/img/favicon.svg +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/website/static/img/social-card.png +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/website/static/llms.txt +0 -0
- {scar_cli-0.28.0 → scar_cli-0.29.0}/website/tsconfig.json +0 -0
|
@@ -106,6 +106,39 @@ jobs:
|
|
|
106
106
|
- name: ruff check
|
|
107
107
|
run: uv run ruff check src/scar tests
|
|
108
108
|
|
|
109
|
+
# The signed promotion against the real external checker (#397). Every other
|
|
110
|
+
# presence test runs against a fake program. The tools come from one pinned
|
|
111
|
+
# release and one pinned commit (hashes in tests/conformance_support.py), are
|
|
112
|
+
# checked by tests/conformance_fetch.py before use, and are never built here.
|
|
113
|
+
# CONFORMANCE_REQUIRED=1 (set by that script) turns "tools missing" into a
|
|
114
|
+
# test failure, so this job cannot go green by skipping. Upgrading the pinned
|
|
115
|
+
# tag is a deliberate change of the pins, never automatic. No secrets.
|
|
116
|
+
conformance:
|
|
117
|
+
name: conformance round trip
|
|
118
|
+
runs-on: ubuntu-latest
|
|
119
|
+
steps:
|
|
120
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
121
|
+
|
|
122
|
+
# The checker needs Python 3.11 or newer; this job is independent of the
|
|
123
|
+
# 3.10 floor the matrix measures.
|
|
124
|
+
- name: Install uv
|
|
125
|
+
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
|
|
126
|
+
with:
|
|
127
|
+
python-version: "3.13"
|
|
128
|
+
enable-cache: true
|
|
129
|
+
cache-dependency-glob: uv.lock
|
|
130
|
+
|
|
131
|
+
- name: Sync dependencies
|
|
132
|
+
run: uv sync --locked
|
|
133
|
+
|
|
134
|
+
- name: Fetch and verify the pinned tools
|
|
135
|
+
run: uv run python tests/conformance_fetch.py "$RUNNER_TEMP/conformance-tools"
|
|
136
|
+
|
|
137
|
+
- name: Run the round trip
|
|
138
|
+
run: |
|
|
139
|
+
mkdir -p "$RUNNER_TEMP/fake-home"
|
|
140
|
+
HOME="$RUNNER_TEMP/fake-home" uv run pytest tests/test_conformance_round_trip.py -q -rs
|
|
141
|
+
|
|
109
142
|
# Aggregator. Branch protection requires the context "Tests + scar lint", so
|
|
110
143
|
# that name must survive: renaming it would leave every PR waiting on a check
|
|
111
144
|
# that no longer exists, and giving both matrix legs the same name would let a
|
|
@@ -114,7 +147,7 @@ jobs:
|
|
|
114
147
|
# required check can be treated as satisfied.
|
|
115
148
|
test:
|
|
116
149
|
name: Tests + scar lint
|
|
117
|
-
needs: [matrix-tests, lint]
|
|
150
|
+
needs: [matrix-tests, lint, conformance]
|
|
118
151
|
if: always()
|
|
119
152
|
runs-on: ubuntu-latest
|
|
120
153
|
steps:
|
|
@@ -122,5 +155,6 @@ jobs:
|
|
|
122
155
|
run: |
|
|
123
156
|
tests="${{ needs.matrix-tests.result }}"
|
|
124
157
|
lint="${{ needs.lint.result }}"
|
|
125
|
-
|
|
126
|
-
|
|
158
|
+
conformance="${{ needs.conformance.result }}"
|
|
159
|
+
echo "matrix-tests: $tests / lint: $lint / conformance: $conformance"
|
|
160
|
+
[ "$tests" = "success" ] && [ "$lint" = "success" ] && [ "$conformance" = "success" ] || exit 1
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
---
|
|
2
|
-
id:
|
|
2
|
+
id: 29
|
|
3
3
|
type: landmine
|
|
4
4
|
title: Pooled stats must key a scar by (repo, id); a bare id fuses different scars and a pooled rate must be recomputed, never averaged
|
|
5
5
|
severity: high
|
|
6
6
|
confidence: 0.8
|
|
7
7
|
created: 2026-11-07
|
|
8
8
|
authors: ["claude-code"]
|
|
9
|
+
promoted_by: Kibukx
|
|
10
|
+
promoted_by_source: git-config-interactive
|
|
9
11
|
anchors:
|
|
10
12
|
- path: src/scar/cli.py
|
|
11
13
|
- pattern: "def _compliance_block"
|
|
@@ -15,7 +17,7 @@ evidence:
|
|
|
15
17
|
expires:
|
|
16
18
|
condition: "compliance pooling stops spanning more than one repository"
|
|
17
19
|
review_after: 2027-05-07
|
|
18
|
-
status:
|
|
20
|
+
status: active
|
|
19
21
|
---
|
|
20
22
|
|
|
21
23
|
Scar ids are per-repo sequential integers, so #1 in one repo is a different
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: 30
|
|
3
|
+
type: landmine
|
|
4
|
+
title: The presence signer reads a canonical subset of JSON, so a draft with a number, a boolean or default json.dumps whitespace is refused
|
|
5
|
+
severity: medium
|
|
6
|
+
confidence: 0.8
|
|
7
|
+
created: 2026-11-18
|
|
8
|
+
authors: ["claude-code"]
|
|
9
|
+
promoted_by: Kibukx
|
|
10
|
+
promoted_by_source: git-config-interactive
|
|
11
|
+
promoted_from: candidates/presence-signer-input-canonical-subset.md
|
|
12
|
+
anchors:
|
|
13
|
+
- path: src/scar/presence.py
|
|
14
|
+
- pattern: "expires_in_s"
|
|
15
|
+
evidence:
|
|
16
|
+
- issue: 392
|
|
17
|
+
- note: Profile ACT-04 and SG-04 (signer v0.4.0): no numbers, no true/false, no whitespace outside strings; expires_in_s is a decimal string.
|
|
18
|
+
expires:
|
|
19
|
+
condition: "the signer accepts general JSON on stdin"
|
|
20
|
+
review_after: 2027-05-18
|
|
21
|
+
status: active
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
The signer and the checker are fed through one canonical-subset recognizer.
|
|
25
|
+
A JSON number, a `true` or `false`, or the spaces `json.dumps` adds after
|
|
26
|
+
separators makes the input `schema_refused` before any prompt. That is why
|
|
27
|
+
`presence.EXPIRES_IN_S` is the string `"3600"` and not an int, and why
|
|
28
|
+
`presence._canonical` writes compact sorted ASCII.
|
|
29
|
+
|
|
30
|
+
Changing the window to a number, or building a request with plain
|
|
31
|
+
`json.dumps`, still looks fine in a unit test against a fake that parses
|
|
32
|
+
loosely. It fails only against the real signer, after the person has been
|
|
33
|
+
asked nothing, as `schema_refused`. Keep every value a string, an object or
|
|
34
|
+
an array, and keep the fake in tests/presence_fakes.py as strict as the
|
|
35
|
+
profile when you add a field.
|
|
@@ -10,7 +10,8 @@ title: One line, searchable, says the constraint
|
|
|
10
10
|
severity: medium # low | medium | high | critical
|
|
11
11
|
confidence: 0.7 # 0..1 — how sure are we this still holds
|
|
12
12
|
created: 1970-01-01
|
|
13
|
-
authors
|
|
13
|
+
# authors = the RUNTIME that DRAFTED it (claude-code, codex, cursor...). Replace the placeholder; never the human reviewer (promoted_by, written by promote).
|
|
14
|
+
authors: ["<your-runtime>"]
|
|
14
15
|
anchors:
|
|
15
16
|
- path: src/module/ # file or directory this protects
|
|
16
17
|
- pattern: "regex" # optional: fires when matching code appears in ANY new/edited file
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.29.0](https://github.com/Daily-Nerd/Scar/compare/v0.28.0...v0.29.0) (2026-11-18)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **lint:** --verify-promotion checks each active scar's promotion act ([#387](https://github.com/Daily-Nerd/Scar/issues/387)) ([ce1f3ba](https://github.com/Daily-Nerd/Scar/commit/ce1f3ba46c5f9ad15428590395b23f4a40457555))
|
|
9
|
+
* **promote:** record the source candidate as promoted_from ([#390](https://github.com/Daily-Nerd/Scar/issues/390)) ([c1e337e](https://github.com/Daily-Nerd/Scar/commit/c1e337eefc01a0e9be8ed92a36b6c67b13bf70e5))
|
|
10
|
+
* **promote:** sign each promotion with the presence signer when the config names an org ([#393](https://github.com/Daily-Nerd/Scar/issues/393)) ([92ebd72](https://github.com/Daily-Nerd/Scar/commit/92ebd72c7368eeff838e3b86cf6fbf7d623ecc20))
|
|
11
|
+
* **record:** one function builds the bytes of a promoted scar ([#384](https://github.com/Daily-Nerd/Scar/issues/384)) ([e73caf0](https://github.com/Daily-Nerd/Scar/commit/e73caf0636e83e026b121c329da5274b788ea2d4)), closes [#382](https://github.com/Daily-Nerd/Scar/issues/382)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **authors:** record the drafting runtime, refuse placeholders and role words ([#391](https://github.com/Daily-Nerd/Scar/issues/391)) ([55dae17](https://github.com/Daily-Nerd/Scar/commit/55dae17ee987cc28f364d48fbb9a0b29354a9cbf))
|
|
17
|
+
* **model:** every frontmatter scalar drops its YAML quotes ([#385](https://github.com/Daily-Nerd/Scar/issues/385)) ([5fc62fc](https://github.com/Daily-Nerd/Scar/commit/5fc62fc7fcc65baef5c0e251e896574d744ebfa5))
|
|
18
|
+
* **promote:** accept the candidate path however it is typed ([#396](https://github.com/Daily-Nerd/Scar/issues/396)) ([474bcf3](https://github.com/Daily-Nerd/Scar/commit/474bcf3c15a81c37a548b90eeefc065894fd4a82)), closes [#394](https://github.com/Daily-Nerd/Scar/issues/394)
|
|
19
|
+
* **store:** one lifecycle table gates promote and transition ([#378](https://github.com/Daily-Nerd/Scar/issues/378)) ([8773a6b](https://github.com/Daily-Nerd/Scar/commit/8773a6b85706815281f2bd5f7a3e19507c2dc304)), closes [#377](https://github.com/Daily-Nerd/Scar/issues/377)
|
|
20
|
+
|
|
3
21
|
## [0.28.0](https://github.com/Daily-Nerd/Scar/compare/v0.27.3...v0.28.0) (2026-11-07)
|
|
4
22
|
|
|
5
23
|
|
|
@@ -45,9 +45,10 @@ is deliberate: consumers in hook hot-paths parse with zero dependencies.
|
|
|
45
45
|
| `severity` | yes | `low` \| `medium` \| `high` \| `critical` | ranking input |
|
|
46
46
|
| `confidence` | yes | float 0..1 | static authored ranking weight; dynamic decay deferred (SPEC §5, issue #95) |
|
|
47
47
|
| `created` | yes | ISO date | |
|
|
48
|
-
| `authors` | yes | inline list |
|
|
48
|
+
| `authors` | yes | inline list | the runtime that drafted it, e.g. `"claude-code"`, `"codex"`, `"cursor"`. Never the human reviewer (that is `promoted_by`) and never a role word such as `agent` or `maintainer`. The template carries the placeholder `"<your-runtime>"`; `scar lint` refuses a candidate that still holds it or a role word. `scar_draft` fills it from the connected MCP client |
|
|
49
49
|
| `promoted_by` | active scars | string | the human who promoted it. Written only by `scar promote`, which overwrites anything a candidate carried. Empty on scars promoted before the field existed, and never inferred from `authors` |
|
|
50
50
|
| `promoted_by_source` | optional | `explicit` \| `git-config-interactive` \| `git-config` | how strongly `promoted_by` is evidenced. `explicit` = a name was typed with `--reviewer`. `git-config-interactive` = no name typed, but `promote` ran at a terminal, so a person was there. `git-config` = no name typed and no terminal recorded, which is the unattended shape `lint` warns on. Written only alongside `promoted_by`, never on its own. Absent on scars promoted before the field existed, and plain `git-config` on scars promoted before interactivity was recorded, so neither absence proves an agent did it |
|
|
51
|
+
| `promoted_from` | active scars | path relative to `.scars/` | the candidate file this scar was promoted from, e.g. `candidates/tried-x.md`. Written only by `scar promote`, which overwrites anything a candidate carried, so a reader links scar to candidate without re-deriving the active filename. Part of the promotion record when present. Absent on scars promoted before the field existed, which are not rewritten |
|
|
51
52
|
| `anchors` | yes, ≥1 | list of `- path:`, `- pattern:`, `- symbol:`, and/or `- command:` | §4 |
|
|
52
53
|
| `evidence` | recommended | list of `- commit:`/`- pr:`/`- issue:`/`- incident:`/`- note:`/`- url:` | absent ⇒ challengeable on sight; `issue:`/`url:` are durable forms that survive squash-merge |
|
|
53
54
|
| `expires.condition` | recommended | quoted string | what change obsoletes this scar |
|
|
@@ -365,7 +365,8 @@ result are how a result gets laundered into a finding.
|
|
|
365
365
|
|
|
366
366
|
`stats --since` / `--until` filter records **before** any metric is computed,
|
|
367
367
|
so every number is window-scoped by the same code that computes it unwindowed.
|
|
368
|
-
Timestamps in the firing log are **naive local time** (`
|
|
368
|
+
Timestamps in the firing log are **naive local time** (read through `scar.clock`,
|
|
369
|
+
the one owner of the wall clock), and the
|
|
369
370
|
bounds are interpreted in that same frame — a window is therefore local-time,
|
|
370
371
|
never UTC. A bare date means `00:00:00` as `--since` and the END of that day as
|
|
371
372
|
`--until`, so `--since D --until D` is the whole of day D. Records whose `ts` is
|
|
@@ -75,6 +75,13 @@ A file without `---`-fenced YAML frontmatter is **not a scar at all** — it nev
|
|
|
75
75
|
fires. Minimum valid block: `type`, `title`, `severity`, `confidence`,
|
|
76
76
|
`created`, `authors`, at least one `anchors` entry, and `status: candidate`.
|
|
77
77
|
|
|
78
|
+
`authors` is the runtime that drafted the scar (`claude-code`, `codex`,
|
|
79
|
+
`cursor`, `windsurf`, `opencode`), replacing the template's `<your-runtime>`
|
|
80
|
+
placeholder. It must never hold the human reviewer: the reviewer is recorded
|
|
81
|
+
in `promoted_by` by `scar promote`. Role words such as `agent` or
|
|
82
|
+
`maintainer` name no runtime. `scar lint` rejects a candidate that keeps the
|
|
83
|
+
placeholder or uses a role word.
|
|
84
|
+
|
|
78
85
|
Write `anchors` as a block list, one `- kind: value` line per anchor. A flow-style
|
|
79
86
|
list (`anchors: [...]`) is not read, so the scar loads with no anchors.
|
|
80
87
|
|
|
@@ -10,7 +10,8 @@ title: One line, searchable, says the constraint
|
|
|
10
10
|
severity: medium # low | medium | high | critical
|
|
11
11
|
confidence: 0.7 # 0..1 — how sure are we this still holds
|
|
12
12
|
created: 1970-01-01
|
|
13
|
-
authors
|
|
13
|
+
# authors = the RUNTIME that DRAFTED it (claude-code, codex, cursor...). Replace the placeholder; never the human reviewer (promoted_by, written by promote).
|
|
14
|
+
authors: ["<your-runtime>"]
|
|
14
15
|
anchors:
|
|
15
16
|
- path: src/module/ # file or directory this protects
|
|
16
17
|
- pattern: "regex" # optional: fires when matching code appears in ANY new/edited file
|
|
@@ -12,7 +12,6 @@ import json
|
|
|
12
12
|
import os
|
|
13
13
|
import re
|
|
14
14
|
import sys
|
|
15
|
-
import time
|
|
16
15
|
from datetime import datetime
|
|
17
16
|
from importlib.metadata import PackageNotFoundError, version as _dist_version
|
|
18
17
|
from pathlib import Path
|
|
@@ -54,7 +53,7 @@ from .render import injection_context, label_line, rule_line
|
|
|
54
53
|
from .renames import apply_anchor_rewrite, apply_rename_fix
|
|
55
54
|
from .store import ScarStore, init_scars, sanitize_signal_text, slugify
|
|
56
55
|
from .violation_evidence import is_violation_summary
|
|
57
|
-
from . import output
|
|
56
|
+
from . import clock, config, output, signedpromote
|
|
58
57
|
|
|
59
58
|
|
|
60
59
|
def _require_store(start: Path | None = None) -> ScarStore | None:
|
|
@@ -218,6 +217,8 @@ def _init_rich(data: dict) -> None:
|
|
|
218
217
|
def _promote_rich(data: dict) -> None:
|
|
219
218
|
from rich.panel import Panel
|
|
220
219
|
lines = [f"[green]promoted[/] -> [bold]{data['promoted']}[/]"]
|
|
220
|
+
lines.append("signed: a person's presence was proven" if data.get("signed")
|
|
221
|
+
else "[yellow]not signed:[/] no org in .scars/config.json")
|
|
221
222
|
if data["reviewer_from_git"]:
|
|
222
223
|
lines.append(f"reviewer: {data['reviewer']} [dim](from git config)[/]")
|
|
223
224
|
if data["born_orphan"]:
|
|
@@ -347,6 +348,10 @@ def _lint_rich(data: dict) -> None:
|
|
|
347
348
|
for ue in data["unreachable_evidence"]:
|
|
348
349
|
console.print(f"[yellow]WARNING evidence-unreachable:[/] scar #{ue['scar_id']} — "
|
|
349
350
|
f"commit {ue['sha']} {ue['reason']}")
|
|
351
|
+
for row in data.get("promotion", []):
|
|
352
|
+
verified = row["state"] == "verified"
|
|
353
|
+
console.print(f"[{'green' if verified else 'yellow'}]promotion:[/] "
|
|
354
|
+
f"scar #{row['scar_id']}: {row['state']}")
|
|
350
355
|
style = "red" if data["failed"] else "green"
|
|
351
356
|
console.print(f"[{style}]lint:[/] {data['files']} file(s), {data['failed']} with errors, "
|
|
352
357
|
f"{len(data['orphans'])} orphan(s), {len(data['partial_rot'])} partial-rot, "
|
|
@@ -550,7 +555,7 @@ def _firing_reviews(store):
|
|
|
550
555
|
def _review_due(store) -> list[Scar]:
|
|
551
556
|
"""Firing scars whose review_after date has passed. The one definition
|
|
552
557
|
shared by `status` and `lint` so the two JSON surfaces cannot disagree."""
|
|
553
|
-
today =
|
|
558
|
+
today = clock.today()
|
|
554
559
|
return [s for _f, s in store.firing() if s.review_after and s.review_after < today]
|
|
555
560
|
|
|
556
561
|
|
|
@@ -710,6 +715,20 @@ def _cmd_lint(args) -> int:
|
|
|
710
715
|
"error", f"duplicate id {scar_id} also carried by {others}; "
|
|
711
716
|
f"renumber one of them (next free id is {next_free})")]))
|
|
712
717
|
failed_files.add(rel)
|
|
718
|
+
# #392: the downgrade guard. Signing is switched off by editing files (drop
|
|
719
|
+
# the org, drop an act), so lint refuses that structurally. An unreadable
|
|
720
|
+
# config is an error here, never "no org".
|
|
721
|
+
from .lint import CONFIG_REL, downgrade_findings
|
|
722
|
+
try:
|
|
723
|
+
cfg = config.load(store.scars_dir)
|
|
724
|
+
except config.ConfigError as exc:
|
|
725
|
+
findings_by_file.append((CONFIG_REL, [Finding("error", str(exc))]))
|
|
726
|
+
failed_files.add(CONFIG_REL)
|
|
727
|
+
else:
|
|
728
|
+
numbered_scars = [(rel, parsed) for rel, parsed in parsed_files if rel in numbered]
|
|
729
|
+
for rel, finding in downgrade_findings(numbered_scars, cfg, store.next_id()):
|
|
730
|
+
findings_by_file.append((rel, [finding]))
|
|
731
|
+
failed_files.add(rel)
|
|
713
732
|
failed = len(failed_files)
|
|
714
733
|
|
|
715
734
|
author_files: dict[str, dict[str, list[str]]] = {}
|
|
@@ -879,6 +898,14 @@ def _cmd_lint(args) -> int:
|
|
|
879
898
|
"failed_files": sorted(failed_files),
|
|
880
899
|
"review_due": _review_due_json(review_due),
|
|
881
900
|
}
|
|
901
|
+
if getattr(args, "verify_promotion", False):
|
|
902
|
+
from .verify import verify_store
|
|
903
|
+
# Reported, never a lint error: a runner without the verifier's local
|
|
904
|
+
# trust setup can never produce `verified`, so gating on it would keep
|
|
905
|
+
# CI permanently red.
|
|
906
|
+
data["promotion"] = [
|
|
907
|
+
{"scar_id": sc.id, "file": str(f.relative_to(store.root)), "state": state}
|
|
908
|
+
for f, sc, state in verify_store(store)]
|
|
882
909
|
|
|
883
910
|
def plain():
|
|
884
911
|
for rel, findings in findings_by_file:
|
|
@@ -920,6 +947,8 @@ def _cmd_lint(args) -> int:
|
|
|
920
947
|
for ue in unreachable:
|
|
921
948
|
print(f"WARNING evidence-unreachable: scar #{ue.scar_id} — commit "
|
|
922
949
|
f"{ue.sha} {ue.reason}, not reachable from HEAD")
|
|
950
|
+
for row in data.get("promotion", []):
|
|
951
|
+
print(f"promotion: scar #{row['scar_id']}: {row['state']}")
|
|
923
952
|
print(f"lint: {len(files)} file(s), {failed} with errors, "
|
|
924
953
|
f"{len(orphans)} orphan(s), {len(partial)} partial-rot, "
|
|
925
954
|
f"{len(unreachable)} unreachable-evidence, "
|
|
@@ -948,7 +977,7 @@ def _cmd_status(args) -> int:
|
|
|
948
977
|
store = _require_store()
|
|
949
978
|
if store is None:
|
|
950
979
|
return 1
|
|
951
|
-
active, broken, cands = store.active(), store.broken(), store.
|
|
980
|
+
active, broken, cands = store.active(), store.broken(), store.pending_candidates()
|
|
952
981
|
challenged = [(f, s) for f, s in store.parsed() if s.status == "challenged"]
|
|
953
982
|
due = _review_due(store)
|
|
954
983
|
|
|
@@ -1034,15 +1063,64 @@ def _stdin_is_a_terminal() -> bool:
|
|
|
1034
1063
|
return False
|
|
1035
1064
|
|
|
1036
1065
|
|
|
1066
|
+
def _resolve_candidate(store: ScarStore, arg: str) -> tuple[Path | None, str]:
|
|
1067
|
+
"""An existing file path is taken as given (the store then refuses it if
|
|
1068
|
+
it lives outside candidates/); otherwise *arg* is a filename or unique
|
|
1069
|
+
substring among the candidates. Returns (path, error)."""
|
|
1070
|
+
given = Path(arg)
|
|
1071
|
+
if given.is_file():
|
|
1072
|
+
return given, ""
|
|
1073
|
+
matches = [c for c in store.candidates() if arg in c.name]
|
|
1074
|
+
if len(matches) != 1:
|
|
1075
|
+
opts = ", ".join(c.name for c in store.candidates()) or "(none)"
|
|
1076
|
+
return None, f"need exactly one candidate matching '{arg}'; have: {opts}"
|
|
1077
|
+
return matches[0], ""
|
|
1078
|
+
|
|
1079
|
+
|
|
1037
1080
|
def _cmd_promote(args) -> int:
|
|
1038
1081
|
store = _require_store()
|
|
1039
1082
|
if store is None:
|
|
1040
1083
|
return 1
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1084
|
+
# #377: validate EVERY file before promoting ANY. One refused file means
|
|
1085
|
+
# nothing moves, every refusal is reported, and the exit code is non-zero.
|
|
1086
|
+
targets: list[Path] = []
|
|
1087
|
+
problems: list[str] = []
|
|
1088
|
+
for arg in args.candidate:
|
|
1089
|
+
path, err = _resolve_candidate(store, arg)
|
|
1090
|
+
if path is None:
|
|
1091
|
+
problems.append(err)
|
|
1092
|
+
continue
|
|
1093
|
+
try:
|
|
1094
|
+
store.check_promotable(path)
|
|
1095
|
+
except ValueError as exc:
|
|
1096
|
+
problems.append(str(exc))
|
|
1097
|
+
continue
|
|
1098
|
+
targets.append(path)
|
|
1099
|
+
if targets and not problems:
|
|
1100
|
+
# Destinations too (#352 collisions), so no refusal can come mid-batch.
|
|
1101
|
+
_, problems = store.plan_promotions(targets)
|
|
1102
|
+
if problems:
|
|
1103
|
+
for line in problems:
|
|
1104
|
+
print(line)
|
|
1105
|
+
if targets:
|
|
1106
|
+
print(f"nothing promoted: {len(problems)} of {len(args.candidate)} "
|
|
1107
|
+
"file(s) refused")
|
|
1045
1108
|
return 1
|
|
1109
|
+
# #392: an org in .scars/config.json means every promotion needs a person's
|
|
1110
|
+
# signature. A config that exists but cannot be read is a refusal, never "no
|
|
1111
|
+
# org": reading it as unsigned would turn signing off by accident.
|
|
1112
|
+
try:
|
|
1113
|
+
cfg = config.load(store.scars_dir)
|
|
1114
|
+
except config.ConfigError as exc:
|
|
1115
|
+
print(f"refusing to promote: {exc}")
|
|
1116
|
+
return 1
|
|
1117
|
+
org = cfg.org
|
|
1118
|
+
if org is not None:
|
|
1119
|
+
# The repository must be in a state lint accepts, before any touch.
|
|
1120
|
+
problem = config.signing_problem(cfg, store.next_id())
|
|
1121
|
+
if problem:
|
|
1122
|
+
print(f"refusing to promote: {problem}")
|
|
1123
|
+
return 1
|
|
1046
1124
|
# Promote is human-run by contract; when --reviewer is omitted the git
|
|
1047
1125
|
# identity of whoever runs it is the reviewer. Unset identity degrades to
|
|
1048
1126
|
# the old behavior (no reviewer appended).
|
|
@@ -1062,10 +1140,44 @@ def _cmd_promote(args) -> int:
|
|
|
1062
1140
|
else "git-config")
|
|
1063
1141
|
else:
|
|
1064
1142
|
reviewer_source = "explicit" if reviewer else None
|
|
1143
|
+
if org is not None:
|
|
1144
|
+
# Nothing that can be refused without a person is left for mid-batch.
|
|
1145
|
+
try:
|
|
1146
|
+
signedpromote.preflight(store, org, targets, reviewer, reviewer_source)
|
|
1147
|
+
except signedpromote.SignedPromoteError as exc:
|
|
1148
|
+
print(f"cannot sign: {exc}")
|
|
1149
|
+
print("nothing promoted: no touch was requested")
|
|
1150
|
+
return 1
|
|
1151
|
+
total = len(targets)
|
|
1152
|
+
for done, target in enumerate(targets):
|
|
1153
|
+
if org is not None:
|
|
1154
|
+
print(f"signing {done + 1} of {total}: {target.name}")
|
|
1155
|
+
rc = _promote_one(store, target, args, reviewer, from_git, reviewer_source, org)
|
|
1156
|
+
if rc:
|
|
1157
|
+
if org is not None:
|
|
1158
|
+
# A batch is a guided queue: what was accepted stays promoted,
|
|
1159
|
+
# the rest stay candidates.
|
|
1160
|
+
print(f"promoted {done} of {total}")
|
|
1161
|
+
return rc
|
|
1162
|
+
if org is not None:
|
|
1163
|
+
print(f"promoted {total} of {total}")
|
|
1164
|
+
return 0
|
|
1165
|
+
|
|
1166
|
+
|
|
1167
|
+
def _promote_one(store: ScarStore, target: Path, args, reviewer: str,
|
|
1168
|
+
from_git: bool, reviewer_source: str | None,
|
|
1169
|
+
org: str | None = None) -> int:
|
|
1065
1170
|
try:
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1171
|
+
if org is None:
|
|
1172
|
+
new_path = store.promote(target, reviewer=reviewer,
|
|
1173
|
+
reviewer_source=reviewer_source)
|
|
1174
|
+
else:
|
|
1175
|
+
new_path = signedpromote.promote_one(
|
|
1176
|
+
store,
|
|
1177
|
+
store.prepare_promotion(target, reviewer=reviewer,
|
|
1178
|
+
reviewer_source=reviewer_source),
|
|
1179
|
+
org)
|
|
1180
|
+
except (ValueError, signedpromote.SignedPromoteError) as exc:
|
|
1069
1181
|
print(str(exc))
|
|
1070
1182
|
return 1
|
|
1071
1183
|
# Non-blocking advisory: a freshly promoted scar whose anchors already
|
|
@@ -1082,10 +1194,13 @@ def _cmd_promote(args) -> int:
|
|
|
1082
1194
|
and git_name.casefold() == args.reviewer.casefold())
|
|
1083
1195
|
data = {"promoted": str(rel), "reviewer": reviewer or None,
|
|
1084
1196
|
"reviewer_from_git": from_git, "born_orphan": born_orphan,
|
|
1085
|
-
"reviewer_case_warning": bool(case_warning)
|
|
1197
|
+
"reviewer_case_warning": bool(case_warning),
|
|
1198
|
+
"signed": org is not None}
|
|
1086
1199
|
|
|
1087
1200
|
def plain():
|
|
1088
1201
|
print(f"promoted -> {rel}")
|
|
1202
|
+
print(" signed: a person's presence was proven" if org is not None
|
|
1203
|
+
else " not signed: no org in .scars/config.json")
|
|
1089
1204
|
if from_git:
|
|
1090
1205
|
print(f" reviewer: {reviewer} (from git config)")
|
|
1091
1206
|
if case_warning:
|
|
@@ -1233,16 +1348,41 @@ def _cmd_challenge(args) -> int:
|
|
|
1233
1348
|
|
|
1234
1349
|
|
|
1235
1350
|
def _cmd_archive(args) -> int:
|
|
1351
|
+
if not str(args.id).isdigit():
|
|
1352
|
+
return _archive_candidate(args)
|
|
1353
|
+
args.id = int(args.id)
|
|
1236
1354
|
return _cmd_transition(args, "archived")
|
|
1237
1355
|
|
|
1238
1356
|
|
|
1357
|
+
def _archive_candidate(args) -> int:
|
|
1358
|
+
"""Archive a candidate in place (#377): the file keeps its name and sits
|
|
1359
|
+
in candidates/ with status archived, so history stays and promote refuses
|
|
1360
|
+
it. The date and reason land in an evidence note."""
|
|
1361
|
+
store = _require_store()
|
|
1362
|
+
if store is None:
|
|
1363
|
+
return 1
|
|
1364
|
+
path, err = _resolve_candidate(store, args.id)
|
|
1365
|
+
if path is None:
|
|
1366
|
+
print(err)
|
|
1367
|
+
return 1
|
|
1368
|
+
try:
|
|
1369
|
+
store.archive_candidate(path, reason=args.reason,
|
|
1370
|
+
date=clock.today())
|
|
1371
|
+
except ValueError as exc:
|
|
1372
|
+
print(str(exc))
|
|
1373
|
+
return 1
|
|
1374
|
+
print(f"archived -> {path.name} (candidate kept in place; scar promote "
|
|
1375
|
+
"will refuse it)")
|
|
1376
|
+
return 0
|
|
1377
|
+
|
|
1378
|
+
|
|
1239
1379
|
def _cmd_transition(args, new_status: str) -> int:
|
|
1240
1380
|
store = _require_store()
|
|
1241
1381
|
if store is None:
|
|
1242
1382
|
return 1
|
|
1243
1383
|
try:
|
|
1244
1384
|
path = store.transition(args.id, new_status, reason=args.reason,
|
|
1245
|
-
date=
|
|
1385
|
+
date=clock.today())
|
|
1246
1386
|
except ValueError as exc:
|
|
1247
1387
|
print(str(exc))
|
|
1248
1388
|
return 1
|
|
@@ -1372,7 +1512,7 @@ def _cmd_orphan(args) -> int:
|
|
|
1372
1512
|
note = f"{args.reason} [orphan: {_orphan_reason(target)}]"
|
|
1373
1513
|
try:
|
|
1374
1514
|
path = store.transition(args.id, "orphaned", reason=note,
|
|
1375
|
-
date=
|
|
1515
|
+
date=clock.today())
|
|
1376
1516
|
except ValueError as exc:
|
|
1377
1517
|
print(str(exc))
|
|
1378
1518
|
return 1
|
|
@@ -1524,7 +1664,7 @@ def _reanchor_apply(store: ScarStore, ctx, repo: Path, args) -> int:
|
|
|
1524
1664
|
# One note per applied rewrite, formatted before the file is touched so
|
|
1525
1665
|
# the confidence tier is read off the proposal, not re-derived later.
|
|
1526
1666
|
notes: list[str] = []
|
|
1527
|
-
apply_date =
|
|
1667
|
+
apply_date = clock.today()
|
|
1528
1668
|
for kind, dead in dead_anchors:
|
|
1529
1669
|
plist = groups.get((kind, dead), [])
|
|
1530
1670
|
if not plist:
|
|
@@ -2879,7 +3019,7 @@ def _harvest_label(repo: Path, args) -> int:
|
|
|
2879
3019
|
"id": cid,
|
|
2880
3020
|
"label": label,
|
|
2881
3021
|
"note": args.note,
|
|
2882
|
-
"date":
|
|
3022
|
+
"date": clock.today(),
|
|
2883
3023
|
"repo": repo.name,
|
|
2884
3024
|
}
|
|
2885
3025
|
path = _labels_path(repo)
|
|
@@ -3031,7 +3171,7 @@ def _harvest_write(repo: Path, args) -> int:
|
|
|
3031
3171
|
flat = [(key, c) for key, cands in result.items() for c in cands]
|
|
3032
3172
|
flat.sort(key=lambda kc: kc[1]["score"], reverse=True)
|
|
3033
3173
|
|
|
3034
|
-
today =
|
|
3174
|
+
today = clock.today()
|
|
3035
3175
|
written: list[str] = []
|
|
3036
3176
|
skipped_dead: list[str] = []
|
|
3037
3177
|
skipped_existing: list[str] = []
|
|
@@ -3410,6 +3550,9 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
3410
3550
|
p.add_argument("--fail-firing-review", action="store_true",
|
|
3411
3551
|
help="exit non-zero when any scar has crossed its "
|
|
3412
3552
|
"review_after_firings threshold")
|
|
3553
|
+
p.add_argument("--verify-promotion", action="store_true",
|
|
3554
|
+
help="report each active scar's promotion act state via the "
|
|
3555
|
+
"presence verifier (reported only, never changes the exit code)")
|
|
3413
3556
|
fmt = p.add_mutually_exclusive_group()
|
|
3414
3557
|
fmt.add_argument("--json", action="store_true", help="emit machine-readable JSON")
|
|
3415
3558
|
fmt.add_argument("--review-queue", action="store_true",
|
|
@@ -3419,7 +3562,9 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
3419
3562
|
p.add_argument("--json", action="store_true", help="emit machine-readable JSON")
|
|
3420
3563
|
|
|
3421
3564
|
p = _add(sub, "promote", _cmd_promote, help="review a candidate into an active scar")
|
|
3422
|
-
p.add_argument("candidate",
|
|
3565
|
+
p.add_argument("candidate", nargs="+",
|
|
3566
|
+
help="candidate filename (or unique substring); several are "
|
|
3567
|
+
"validated together and promoted all-or-nothing")
|
|
3423
3568
|
p.add_argument("--reviewer", default="",
|
|
3424
3569
|
help="the human vouching for this scar, recorded as promoted_by "
|
|
3425
3570
|
"(default: git config user.name)")
|
|
@@ -3478,8 +3623,8 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
3478
3623
|
p.add_argument("id", type=int)
|
|
3479
3624
|
p.add_argument("--reason", required=True, help="why the scar may no longer hold")
|
|
3480
3625
|
|
|
3481
|
-
p = _add(sub, "archive", _cmd_archive, help="retire a scar (never fires; history kept)")
|
|
3482
|
-
p.add_argument("id",
|
|
3626
|
+
p = _add(sub, "archive", _cmd_archive, help="retire a scar or a candidate (never fires; history kept)")
|
|
3627
|
+
p.add_argument("id", help="scar id, or a candidate file/name to archive in place")
|
|
3483
3628
|
p.add_argument("--reason", required=True, help="why it is retired (e.g. expiry condition met)")
|
|
3484
3629
|
|
|
3485
3630
|
p = _add(sub, "orphan", _cmd_orphan, help="list scars whose anchors all went dead")
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""The one reader of the wall clock (#380).
|
|
2
|
+
|
|
3
|
+
"What day is it" has exactly one owner so every surface agrees and a test can
|
|
4
|
+
fix the date in a single place. The frame is local time of the machine running
|
|
5
|
+
the command: dates written into scars stay in the author's calendar and the
|
|
6
|
+
firing log is naive local time (SPEC section on stats windows).
|
|
7
|
+
|
|
8
|
+
Callers use `clock.today()` / `clock.now()` through the module (not
|
|
9
|
+
`from .clock import today`) so a test can monkeypatch the owner once.
|
|
10
|
+
Stdlib-only and cheap to import: hooks.py loads this on the hot path.
|
|
11
|
+
"""
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import time
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def today() -> str:
|
|
18
|
+
"""Local date as YYYY-MM-DD."""
|
|
19
|
+
return time.strftime("%Y-%m-%d")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def now() -> str:
|
|
23
|
+
"""Firing-log timestamp: local naive YYYY-MM-DDTHH:MM:SS."""
|
|
24
|
+
return time.strftime("%Y-%m-%dT%H:%M:%S")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def month_index() -> int:
|
|
28
|
+
"""Current year*12+month in local time, derived from today()."""
|
|
29
|
+
year, month, _day = today().split("-")
|
|
30
|
+
return int(year) * 12 + int(month)
|