smd-engine 0.7.2__tar.gz → 0.7.3__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.
- {smd_engine-0.7.2 → smd_engine-0.7.3}/CHANGELOG.md +8 -2
- {smd_engine-0.7.2 → smd_engine-0.7.3}/PKG-INFO +1 -1
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/commands.md +1 -1
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/deal-mode.md +2 -2
- {smd_engine-0.7.2 → smd_engine-0.7.3}/procedures/task-diff.md +1 -1
- {smd_engine-0.7.2 → smd_engine-0.7.3}/pyproject.toml +1 -1
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/deal/ledger.py +8 -2
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/deal/verify.py +5 -4
- smd_engine-0.7.3/src/smd_engine/deal/verify_diff.py +224 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/deal/verify_extra.py +0 -37
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/deal_labels.py +24 -0
- smd_engine-0.7.3/tests/test_deal_verify_diff.py +168 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/uv.lock +1 -1
- {smd_engine-0.7.2 → smd_engine-0.7.3}/.claude/agents/smd-game-technician.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/.claude/agents/smd-methodologist.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/.claude/agents/smd-visionary.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/.claude/commands/procedure.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/.flake8 +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/.github/workflows/ci.yml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/.github/workflows/release.yml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/.gitignore +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/.python-version +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/CONTRIBUTING.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/LICENSE +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/README.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/README_ru.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example/bakeries-c1.board.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example/bakeries-c2.board.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example/deal/answers_boris.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example/deal/answers_gleb.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example/deal/answers_vera.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example/deal/pack.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example/golden/README.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example/golden/bakeries-c2-expected.board.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example/golden/s3_transcript.txt +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example/patches/bakeries-c2-1.patch.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example/sources.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example/task/answers_ana.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example/task/answers_ben.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example/task/answers_cy.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example/task/pack.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example/task/replies_ana.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example/task/replies_ben.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example/task/transcript_ben.txt +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example/two-boards-c1.board.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example_ru/pekarni-c1.board.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example_ru/pekarni-c2.board.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example_ru/pekarni-oru-c1.board.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example_ru/pekarnya-holding-c1.board.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/example_ru/sources.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/spectra_coffee/README.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/spectra_coffee/bank.story.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/spectra_coffee/buyer.story.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/spectra_coffee/owner.story.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/spectra_coffee/sources.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/spectra_coffee/spectra-coffee-c1.board.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/spectra_coffee/successor-premortem.story.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/cases/spectra_coffee/taxonomies.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/README.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/changelog-0.2-0.5.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/checks.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/data-model.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/first-board.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/glossary.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/hypotheses.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/method/README.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/method/encodable.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/method/formal-stance.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/method/odi-problematization.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/method/reconciliation.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/method/robustness-rules.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/method/roles-and-actors.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/method/smd-classic.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/method/sources.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/method/structural-moves.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/method/triz-systems.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/plan.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/profiles.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/red-lines.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/stages.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/stories.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/docs/task-packs.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/lenses/README.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/lenses/beer-viable-system.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/lenses/design-chain.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/lenses/fliamer-diamond.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/lenses/khaprov-levels.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/lenses/khaprov-ontology.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/lenses/scamper-check.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/lenses/schukin-boundaries.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/lenses/schukin-interface-tax.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/lenses/three-positions.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/lenses/triz-contradictions.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/procedures/README.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/procedures/field-result.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/procedures/functional-plan.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/procedures/ingest-transcript.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/procedures/positional-construction.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/procedures/problematization.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/procedures/qualification-pass.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/procedures/reflexive-protocol.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/procedures/small-situation.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/procedures/solo-session.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/procedures/stakeholder-ontology.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/procedures/story.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/procedures/task-pack.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/procedures/theses-to-board.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/procedures/visionary-tract.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/profiles/classic-two-boards.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/profiles/management-four-boards.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/profiles/program-three-boards.yaml +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/roles/README.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/roles/actors.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/roles/game-technician.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/roles/methodologist.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/roles/researcher.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/roles/visionary.md +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/__init__.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/agree.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/apply.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/cli.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/compare.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/deal/__init__.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/deal/agenda_views.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/deal/cli.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/deal/consent.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/deal/overlap.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/deal/seal_cmd.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/deal/sealed.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/deal/signing.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/deal/verdict.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/deal/verdict_cmd.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/deal/verify_cmd.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/deal/verify_report.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/deal/views.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/eval.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/leverage.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/migrate.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/nextstep.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/pack.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/profile.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/records.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/redline.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/render/__init__.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/render/assets/frames.css +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/render/assets/frames.js +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/render/assets/graph.css +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/render/assets/graph.js +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/render/frames.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/render/frames_page.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/render/frames_text.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/render/graph.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/render/graph_ui.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/render/html.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/render/index.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/render/layout.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/render/light.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/render/markdown.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/render/mermaid.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/render/sessionflow.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/render/svg.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/render/text.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/render/vault.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/revise.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/scaffold.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/schemas/__init__.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/schemas/board_patch.schema.json +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/schemas/board_set.schema.json +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/schemas/source_manifest.schema.json +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/schemas/story.schema.json +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/schemas/task_acceptance.schema.json +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/schemas/task_answers.schema.json +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/schemas/task_pack.schema.json +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/schemas/task_replies.schema.json +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/schemas/task_sealed.schema.json +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/schemas/task_verdicts.schema.json +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/schemas/taxonomies.schema.json +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/screen.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/sources.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/status.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/story/__init__.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/story/check.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/story/gaps.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/story/model.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/story/numbers.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/story/paths.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/story/render.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/__init__.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/acceptance.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/agenda.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/asking.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/assets/task.css +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/assets/task.js +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/bounds.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/check.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/cli.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/deal_check.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/deal_items.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/deal_render.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/deal_web.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/diff.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/diff_html.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/diff_md.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/labels.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/model.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/names.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/overwrite.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/pack_html.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/pack_md.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/pairs.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/positions.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/ranges.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/refs.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/svg.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/task/web.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/validate/__init__.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/validate/ai.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/validate/context.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/validate/graph.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/validate/hints.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/validate/hypotheses.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/validate/management.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/validate/manifest.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/validate/ontology.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/validate/redlines.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/validate/signoffs.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/validate/structure.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/validate/taxonomies.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/validate/theses.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/validate/tract.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/src/smd_engine/verdict.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/conftest.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/deal_helpers.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/story_helpers.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_action_program.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_agree.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_ai_roles.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_apply.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_beer_layer.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_beer_render.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_compare.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_deal_acceptance.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_deal_added.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_deal_agenda_leaks.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_deal_bindings.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_deal_golden.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_deal_items.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_deal_positions.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_deal_ranges.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_deal_sealed.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_deal_signed.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_deal_verdict.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_deal_verify.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_deal_verify_forged.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_deal_views.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_eval.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_export.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_frames.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_graph.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_hypothesis_standard.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_ingestion.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_lenses.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_management.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_migrate.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_nextstep.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_ontology_continuum.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_procedure_checks.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_procedures.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_profile.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_publish.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_record_boards.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_red_lines.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_render_and_cli.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_render_carries.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_render_fields.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_render_ru_pages.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_render_ru_values.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_revise.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_robustness.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_scaffold.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_status.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_story_case.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_story_check.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_story_numbers.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_story_paths.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_task.py +0 -0
- {smd_engine-0.7.2 → smd_engine-0.7.3}/tests/test_validate.py +0 -0
|
@@ -2,11 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Dates are those of the tag. All tags v0.2.1 to v0.3.5 were made on 2026-10-29. The version in `pyproject.toml` stayed at 0.2.0 through v0.2.4 and at 0.3.0 from v0.3.0 to v0.3.5; 0.3.6 is the first release whose package version equals its tag.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 0.7.3 - 2026-11-03
|
|
6
|
+
|
|
7
|
+
`smd deal verify --diff` now catches a holder who hides a logged verdict from the parties' diff (the case owner, dz02#l=79; release go dz03#l=7). Schema 0.1 stays; no file format changes, and every 0.7.2 pack, answers file, ledger and diff still loads.
|
|
8
|
+
|
|
9
|
+
- Changelog: the 0.7.2 entry cites the case owner's go as dz02#l=71 (it said #l=69, a line that is the heading of that message).
|
|
10
|
+
- `smd deal verify --diff` checks a sealed point shown `not_tested` against the ledger (the case owner, dz02#l=79). Before, a point shown `not_tested` with any `changed_since_run` passed, so a holder could hide a logged verdict from the parties' diff. Now, over a counted run, each member named in `changed_since_run` must commit a side of the topic, the answers file the diff read for him (`answers_files`) must not be the one the run recorded, and, when that file is given with `--answers`, its commitment must differ from the one the run used; without the file the line is `skipped`, and with that member's files given but none of them the one the diff names it fails. A counted run logged after the diff's head (or at all, with no head) on the very answers files the diff read fails the diff, so an old or removed head cannot hide a verdict either. A view must name a position of the pack. Every bound item the diff (or view) should show must be there as one sealed point of its topic and side, and the sealed points must name one ledger head or none. New check codes `diff_missing`, `diff_not_bound`, `diff_point_shape`, `diff_head_mixed`, `diff_changed_who`, `diff_changed_same`, `diff_changed_nofile`, `diff_changed_ok`, `diff_changed_file`, `diff_stale`, `diff_view`, `diff_view_bad` (labels in English and Russian); `ledger.last_run`. The diff checks moved to `src/smd_engine/deal/verify_diff.py`. Tests: `tests/test_deal_verify_diff.py`.
|
|
11
|
+
- `procedures/task-diff.md`: the example model-pass line names `task-diff 0.2.1`, the procedure's version.
|
|
6
12
|
|
|
7
13
|
## 0.7.2 - 2026-11-02
|
|
8
14
|
|
|
9
|
-
The sealed floor audited and bound to the pack text (the case owner, dz02#l=
|
|
15
|
+
The sealed floor audited and bound to the pack text (the case owner, dz02#l=71). Schema 0.1 stays; every new field is optional, and 0.7.0 and 0.7.1 packs, answers, consent files and ledgers still load (old entries are reported `unbound`). Packs without positions give the same bytes as before.
|
|
10
16
|
|
|
11
17
|
- `smd deal verify pack.yaml --ledger verdicts.yaml [--answers ...] [--sealed dir] [--diff diff.yaml] [--json]`: an audit of the ledger any party can run (`src/smd_engine/deal/verify.py`, `verify_extra.py`, `verify_report.py`, `verify_cmd.py`). It checks the chain and head; each consent entry (signature over its stored text with the member's key, hash, bindings to the deal, topic, run, buyer, core sha256 and key list); each counted verdict (the consents it names are earlier, valid, current, for the same topic, run and buyer, with its commitments; seller, and buyer for a second run; run number and cap of two; answers sha256 against the files given, their signatures and commitments); with `--sealed` the outcome recomputed from the sealed files (signatures checked, no number printed); with `--diff` its head and verdicts. Lines are `ok`, `FAIL` or `unbound (old entry)` (labels in English and Russian, `VERIFY_LABELS` in `deal_labels.py`); exit 1 on a `FAIL` or an `unbound` entry (fail closed; `--allow-unbound` for a ledger known to be old); the last line says "all checks passed" only when nothing is `unbound` (else "no check failed, but not fully verified"), and `--json` has `complete`. A counted verdict whose `consents` list is empty is a `FAIL` (the consents it needs are not among them). A counted verdict whose `answers` lack the floor or the ceiling party, or name a non-member, is a `FAIL`. Entries from before 0.7.2 are `unbound`; after the first 0.7.2 entry a later one without the new fields is `FAIL`. `consent.binding_code` is new (the codes behind `binding_problem`). Tests: `tests/test_deal_verify.py`, `tests/test_deal_verify_forged.py` (an empty `consents` list, replaced or replayed inputs, `--allow-unbound`).
|
|
12
18
|
- Bindings of the sealed floor (packs with `deal.sealed_floor: true`; schema 0.1, new fields optional). The `task_consent` file names `pack.sha256` (the core sha256) and `keys` (`key_list_sha` in `signing.py`: sha256 of the sorted `<member> <key>` lines); `smd deal consent` and `smd deal verdict` refuse a consent whose values differ from the pack, and a 0.7.1 consent without them (re-sign; it stays readable in an old ledger and a verdict does not count it). The answers files of members with an `ssh_key` are signed (`answers_<member>.yaml.sig`, namespace `smd-deal`); `smd deal verdict` refuses an unsigned or badly signed one, `smd task diff` only warns. The verdict entry records `answers: {member: sha256}` and, when counted, `consents: [entry sha256, ...]` (schema `task_verdicts`; the chain covers them, older entries without them still verify). A swapped-back older answers file is caught by the signed consents (`commitment_changed`) and its sha256 is on record. Packs without positions give the same bytes as before. Tests: `tests/test_deal_bindings.py`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: smd-engine
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.3
|
|
4
4
|
Summary: Records, checks and renderings for SMD-style thinking sessions (three boards, cycles, qualifications)
|
|
5
5
|
Project-URL: Homepage, https://github.com/viberesearch/smd-engine
|
|
6
6
|
Project-URL: Repository, https://github.com/viberesearch/smd-engine
|
|
@@ -38,7 +38,7 @@ uv run smd deal views cases/example/deal/pack.yaml out/diff/diff.yaml -o out/vie
|
|
|
38
38
|
uv run smd deal seal cases/example/deal/pack.yaml price-floor -o ~/sealed # deal pack: seal a number for a bound item on your own machine; asks for the number unseen (or --value), writes sealed_<member>_<item>.yaml (private, outside every repo) and prints the commitment to put in your answers file; the number and the salt are never printed; with `--key <private key>` it also signs the file with ssh-keygen (`<file>.sig`), else it prints the command to run; docs/task-packs.md
|
|
39
39
|
uv run smd deal verdict cases/example/deal/pack.yaml price --answers answers_vera.yaml answers_boris.yaml --floor sealed_vera_price-floor.yaml --ceiling sealed_boris_price-ceiling.yaml --ledger verdicts.yaml # the holder (--new for the first entry of a ledger when no consent started it): compare a sealed floor and ceiling (holder.method, local-v1) and append met, not_met or not_tested to the hash-chained ledger; prints the verdict in the pack language and never a number; every run needs the seller's consent naming the buyer, a second also the buyer's, two runs at most; with deal.sealed_floor it verifies the signatures of the counted consents (bound to the pack's core sha256 and key list), of the answers files of key holders (`<file>.sig`) and of the sealed files (`--floor-sig`, `--ceiling-sig`) and refuses the run if one is missing or bad, and the entry records `answers` and `consents`; docs/task-packs.md
|
|
40
40
|
uv run smd deal consent cases/example/deal/pack.yaml price --member vera --evidence consent_vera.yaml --ledger verdicts.yaml --new # log one party consent to the next run: his task_consent file (this deal, topic, run, member, buyer and the two commitments); the seller's for every run (the first consent of a deal takes --new), the buyer's too for a second run; with deal.sealed_floor the file needs his SSH signature (`--signature`, default `<evidence>.sig`), kept in the entry
|
|
41
|
-
uv run smd deal verify cases/example/deal/pack.yaml --ledger verdicts.yaml --answers answers_vera.yaml answers_boris.yaml answers_gleb.yaml --sealed safe/ --diff out/diff.yaml # audit a ledger (any party; exit 1 on a FAIL, else 0): chain and head; each consent's signature, hash, bindings (this deal, topic, run, buyer, core sha256, key list); each counted verdict's consents (earlier, valid, current, seller and for a second run buyer), run number and cap, recorded answers sha256 against the files given; with --sealed (the holder's folder of sealed files and .sig) the outcome is recomputed, no number printed; with --diff its head and verdicts; entries from before 0.7.2 read unbound (the last line then says not fully verified, and the exit is 1 unless --allow-unbound); a counted verdict that names no consents (consents: []) is a FAIL; --json for a report; docs/deal-mode.md
|
|
41
|
+
uv run smd deal verify cases/example/deal/pack.yaml --ledger verdicts.yaml --answers answers_vera.yaml answers_boris.yaml answers_gleb.yaml --sealed safe/ --diff out/diff.yaml # audit a ledger (any party; exit 1 on a FAIL, else 0): chain and head; each consent's signature, hash, bindings (this deal, topic, run, buyer, core sha256, key list); each counted verdict's consents (earlier, valid, current, seller and for a second run buyer), run number and cap, recorded answers sha256 against the files given; with --sealed (the holder's folder of sealed files and .sig) the outcome is recomputed, no number printed; with --diff its head and verdicts, every sealed point present, and a not_tested point over a counted run only when the answers show the commitment changed; entries from before 0.7.2 read unbound (the last line then says not fully verified, and the exit is 1 unless --allow-unbound); a counted verdict that names no consents (consents: []) is a FAIL; --json for a report; docs/deal-mode.md
|
|
42
42
|
uv run smd sources cases/example/sources.yaml --clean-room --deny-lineage earlier-concept
|
|
43
43
|
uv run smd sources path/to/sources.yaml --folder /local/folder
|
|
44
44
|
uv run smd sources path/to/sources.yaml --folder /local/folder --refresh [ids] # recompute sha256 of the named sources (default: every decision_log); a source that already carries `lines` gets its count rewritten, one that does not is not given one; edit only those lines of the manifest
|
|
@@ -137,10 +137,10 @@ Still open:
|
|
|
137
137
|
- **Each consent entry.** The signed text hashes to `evidence`; its signature is the member's, made with the key the pack lists, namespace `smd-deal`; the text names this deal, pack id, topic, run, member and buyer, and the commitments of the entry; its `pack.sha256` and `keys` are the pack's. The member is a party to the topic, the buyer is the one who commits the ceiling, and the seller alone consents to the first run.
|
|
138
138
|
- **Each counted verdict entry.** The run is the next counted run of the topic and at most two (a `not_tested` entry is not counted). The consents it names (`consents`) are consent entries earlier in the chain, valid by the rule above, for the same topic, run and buyer, with the commitments the verdict recorded, each the latest of its member before the verdict; the seller consented, and for a second run the buyer too (a verdict that names no consents, `consents: []`, is `FAIL` for the same reason: the consents it needs are not among them). The answers sha256 it recorded (`answers`) is matched to the files given with `--answers`: each file is for this text of the pack and signed by its member, and the commitment in it is the one the run used. A recorded file that is not among those given is `FAIL` only for the latest run that read that member's answers, since an earlier run may have read a version nobody passed; for the rest it is `skipped`.
|
|
139
139
|
- **`--sealed`, the holder's check.** The folder holds the sealed files and their `.sig`. Each is found by its commitment, checked against the pack (deal, pack core sha256, member, item, side, unit) and its signature, and the comparison of the method the entry names is run again in memory; a result other than the logged one is `FAIL`. A run whose sealed file is not in the folder is `skipped`. No number, salt or gap is ever printed; the report says only `met` or `not_met`. Without `--sealed` the step is skipped and the report says so.
|
|
140
|
-
- **`--diff`.** The diff is for this text of the pack; its `
|
|
140
|
+
- **`--diff`.** The diff (or a position's view of it) is for this text of the pack. Every bound item it should show (all of them, or for a view those of the position's audience) is there as one sealed point of the item's topic and side; a point left out, shown twice or stripped of its `sealed` block is `FAIL`. Its sealed points name one `ledger_head`, an entry of the ledger, or none (a diff made without the ledger: `not_tested` points are `skipped`, any other verdict is `FAIL`); a mix is `FAIL`. Each sealed point's `verdict` is the one the ledger had at that entry. A point shown `not_tested` over a counted run must carry `changed_since_run`, and the claim is checked: each member it names commits a side of the topic; the answers file the diff read for him (`answers_files`) is not the one the run recorded; and when that file is given with `--answers`, its commitment differs from the one the run used. Without the file the line is `skipped`, not `ok`: give the answers files the diff names to check it; files of that member given, none of them the one the diff names, is `FAIL`. A counted run logged after the diff's head (or at all, for a diff with no head) that read the same answers files of both committers as the diff is `FAIL`: the diff does not show a verdict on its own answers, so an old or a removed head cannot hide one. A view must name a position of the pack, and the report says which. Otherwise a diff made earlier, before more entries were added, still passes. (0.7.3; before it a holder could show a logged verdict as `not_tested` with any `changed_since_run`, point the head before the run, or leave a sealed point out, and `--diff` passed.)
|
|
141
141
|
- **Entries from before 0.7.2** (an unsigned or unbound consent, a verdict that names no consents or answers) cannot be checked in full and are `unbound`; for a verdict the engine still looks for the earlier consent entries it needed. Once any entry has the 0.7.2 fields, a later entry without them is `FAIL`: the engine always writes them, so such an entry was written by hand. (A 0.7.1 holder program that keeps adding to a ledger a 0.7.2 program has begun is therefore also `FAIL`.)
|
|
142
142
|
|
|
143
|
-
What it cannot show: an operator who writes a whole ledger of the old kind, with no signed bound consent in it, or who rewrites the entries before the first 0.7.2 entry into the old kind, gets those lines `unbound`, the summary "not fully verified" and exit 1; only `--allow-unbound`, which a party gives for a ledger he knows to be old, turns that into exit 0. The comparison of two numbers is verified only by someone with the sealed files. A ledger that is a consistent forgery from its first entry is caught only by a party who kept a diff or the head. Code: `src/smd_engine/deal/verify.py`, `verify_extra.py`, `verify_report.py`, `verify_cmd.py`; tests: `tests/test_deal_verify.py`.
|
|
143
|
+
What it cannot show: an operator who writes a whole ledger of the old kind, with no signed bound consent in it, or who rewrites the entries before the first 0.7.2 entry into the old kind, gets those lines `unbound`, the summary "not fully verified" and exit 1; only `--allow-unbound`, which a party gives for a ledger he knows to be old, turns that into exit 0. The comparison of two numbers is verified only by someone with the sealed files. A ledger that is a consistent forgery from its first entry is caught only by a party who kept a diff or the head. Code: `src/smd_engine/deal/verify.py`, `verify_extra.py`, `verify_diff.py`, `verify_report.py`, `verify_cmd.py`; tests: `tests/test_deal_verify.py`, `tests/test_deal_verify_forged.py`, `tests/test_deal_verify_diff.py`.
|
|
144
144
|
|
|
145
145
|
## Holder and model consent
|
|
146
146
|
|
|
@@ -92,7 +92,7 @@ Set `route` from the table; `smd task agenda` reads it.
|
|
|
92
92
|
Edit `diff.yaml` in place. For each point you changed: `class`, `subtype` where it applies, `route`, `class_by: model`, and `rationale`. Add at the top level:
|
|
93
93
|
|
|
94
94
|
```yaml
|
|
95
|
-
model_pass: {voice: ai, status: AI draft, procedure: task-diff 0.2.
|
|
95
|
+
model_pass: {voice: ai, status: AI draft, procedure: task-diff 0.2.1, model: <model name>, date: <date>}
|
|
96
96
|
```
|
|
97
97
|
|
|
98
98
|
Do not change `answers`, `silent`, `sets`, `alpha`, `labels` or `pack`. Then render again; the replies refer to the sha256 of this file:
|
|
@@ -122,10 +122,16 @@ def topic_verdict(ledger: dict[str, Any] | None, topic: str) -> str:
|
|
|
122
122
|
return str(done[-1]["verdict"]) if done else "not_tested"
|
|
123
123
|
|
|
124
124
|
|
|
125
|
+
def last_run(ledger: dict[str, Any] | None, topic: str) -> dict[str, Any] | None:
|
|
126
|
+
"""The entry of the latest counted run of the topic, if any."""
|
|
127
|
+
done = _tested(ledger, topic) if ledger else []
|
|
128
|
+
return done[-1] if done else None
|
|
129
|
+
|
|
130
|
+
|
|
125
131
|
def last_commitments(ledger: dict[str, Any] | None, topic: str) -> dict[str, str]:
|
|
126
132
|
"""The commitments ({"floor", "ceiling"}) the latest counted run used."""
|
|
127
|
-
|
|
128
|
-
return dict(
|
|
133
|
+
run = last_run(ledger, topic)
|
|
134
|
+
return dict(run["commitments"]) if run else {}
|
|
129
135
|
|
|
130
136
|
|
|
131
137
|
def has_entry(ledger: dict[str, Any], sha: str) -> bool:
|
|
@@ -14,7 +14,7 @@ What is checked (see `docs/deal-mode.md`, "Verifying the ledger"):
|
|
|
14
14
|
(and the buyer for a second run); the run is the next counted one and within
|
|
15
15
|
the cap; the answers files it recorded match those given, with their signatures
|
|
16
16
|
and commitments; with the holder's sealed files the outcome is recomputed; with
|
|
17
|
-
a diff its head and verdicts match.
|
|
17
|
+
a diff its head and verdicts match (`verify_diff.py`).
|
|
18
18
|
|
|
19
19
|
Entries from before 0.7.2 (unsigned or unbound consents, verdicts that name no
|
|
20
20
|
consents or answers) cannot be checked in full and are reported `unbound`. After
|
|
@@ -38,13 +38,13 @@ from smd_engine.deal.verify_extra import (
|
|
|
38
38
|
SealedFolder,
|
|
39
39
|
Topic,
|
|
40
40
|
check_answers,
|
|
41
|
-
check_diff,
|
|
42
41
|
latest_answers,
|
|
43
42
|
load_answers_files,
|
|
44
43
|
)
|
|
44
|
+
from smd_engine.deal.verify_diff import check_diff
|
|
45
45
|
from smd_engine.deal.verify_report import FAIL, OK, UNBOUND, Report
|
|
46
46
|
from smd_engine.records import RecordError
|
|
47
|
-
from smd_engine.task.bounds import committer
|
|
47
|
+
from smd_engine.task.bounds import committer, topics
|
|
48
48
|
from smd_engine.task.model import schema_issues, sha256_bytes
|
|
49
49
|
|
|
50
50
|
BIND_CODES = {"pack": "consent_bind_pack", "keys": "consent_bind_keys"}
|
|
@@ -361,5 +361,6 @@ def verify_ledger(
|
|
|
361
361
|
if diff is None:
|
|
362
362
|
rep.add("diff_not_given", "skip")
|
|
363
363
|
else:
|
|
364
|
-
|
|
364
|
+
known = {n: t for n in topics(pack) if (t := _topic(pack, n)) is not None}
|
|
365
|
+
check_diff(rep, pack, pack_sha, ledger, diff, known, files)
|
|
365
366
|
return rep
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"""`smd deal verify --diff`: a diff (or a position's view of it) against the
|
|
2
|
+
ledger, so that the holder cannot hide a logged verdict from the parties.
|
|
3
|
+
|
|
4
|
+
- The diff is for this text of the pack, and every bound item the diff (or the
|
|
5
|
+
view's position) should show is there, as a sealed point of its own topic and
|
|
6
|
+
side: a point left out or stripped of its `sealed` block is a `FAIL`.
|
|
7
|
+
- The sealed points name one ledger head, an entry of the ledger, or none at all
|
|
8
|
+
(a diff made without the ledger); a mix is a `FAIL`.
|
|
9
|
+
- Each sealed point's verdict is the one the ledger had at that head. A point
|
|
10
|
+
shown `not_tested` over a counted run must carry `changed_since_run`, and that
|
|
11
|
+
claim is checked: each member it names commits a side of the topic, the answers
|
|
12
|
+
file the diff read for him is not the one the run recorded, and, when that file
|
|
13
|
+
is given with `--answers`, its commitment differs from the one the run used.
|
|
14
|
+
Without the file the claim is `skip`, never `ok`; with files of that member
|
|
15
|
+
given and none of them the one the diff names, it is a `FAIL`.
|
|
16
|
+
- A counted run logged after the head (or at all, with no head) that read the
|
|
17
|
+
same answers files of both committers as the diff is a `FAIL`: the diff does
|
|
18
|
+
not show a verdict on its own answers, so an old or missing head cannot hide
|
|
19
|
+
one.
|
|
20
|
+
- A view names a position of the pack, which is reported."""
|
|
21
|
+
|
|
22
|
+
from __future__ import annotations
|
|
23
|
+
|
|
24
|
+
from typing import Any
|
|
25
|
+
|
|
26
|
+
from smd_engine.deal.ledger import last_run, topic_verdict
|
|
27
|
+
from smd_engine.deal.verify_extra import AnswersFiles, Topic
|
|
28
|
+
from smd_engine.deal.verify_report import FAIL, OK, SKIP, Report
|
|
29
|
+
from smd_engine.task.bounds import bound_items
|
|
30
|
+
from smd_engine.task.positions import in_audience
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _expected(
|
|
34
|
+
rep: Report, pack: dict[str, Any], diff: dict[str, Any]
|
|
35
|
+
) -> list[dict[str, Any]]:
|
|
36
|
+
"""The bound items the diff should show: all of them, or for a view those of
|
|
37
|
+
its position's audience. The view's position is reported, so the party sees
|
|
38
|
+
whose view he checked; one that is not a position of the pack fails, and
|
|
39
|
+
then every bound item is required."""
|
|
40
|
+
if "view" not in diff:
|
|
41
|
+
return bound_items(pack)
|
|
42
|
+
view = diff["view"]
|
|
43
|
+
position = view.get("position") if isinstance(view, dict) else None
|
|
44
|
+
if position not in {pos["id"] for pos in pack.get("positions") or []}:
|
|
45
|
+
rep.add("diff_view_bad", FAIL, position=position)
|
|
46
|
+
return bound_items(pack)
|
|
47
|
+
rep.add("diff_view", OK, position=position)
|
|
48
|
+
return [i for i in bound_items(pack) if in_audience(i, position)]
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _points(
|
|
52
|
+
rep: Report, pack: dict[str, Any], diff: dict[str, Any]
|
|
53
|
+
) -> list[dict[str, Any]]:
|
|
54
|
+
"""The sealed points of the diff that are a bound item of the pack, with the
|
|
55
|
+
item's topic and side. A bound item missing from the diff, or shown as
|
|
56
|
+
another kind of point or for another topic or side, fails."""
|
|
57
|
+
by_id: dict[str, list[dict[str, Any]]] = {}
|
|
58
|
+
for p in diff["points"]:
|
|
59
|
+
by_id.setdefault(str(p.get("id")), []).append(p)
|
|
60
|
+
items = {i["id"]: i for i in bound_items(pack)}
|
|
61
|
+
out: list[dict[str, Any]] = []
|
|
62
|
+
for item in _expected(rep, pack, diff):
|
|
63
|
+
if item["id"] not in by_id:
|
|
64
|
+
rep.add("diff_missing", FAIL, point=item["id"])
|
|
65
|
+
for pid, found in by_id.items():
|
|
66
|
+
sealed = [p for p in found if "sealed" in p]
|
|
67
|
+
if pid not in items:
|
|
68
|
+
for p in sealed:
|
|
69
|
+
rep.add("diff_not_bound", FAIL, point=pid)
|
|
70
|
+
continue
|
|
71
|
+
b = items[pid]["bound"]
|
|
72
|
+
if len(found) != 1 or len(sealed) != 1:
|
|
73
|
+
rep.add("diff_point_shape", FAIL, point=pid)
|
|
74
|
+
continue
|
|
75
|
+
p = sealed[0]
|
|
76
|
+
if (p["sealed"].get("topic"), p["sealed"].get("side")) != (
|
|
77
|
+
b["topic"],
|
|
78
|
+
b["side"],
|
|
79
|
+
):
|
|
80
|
+
rep.add("diff_point_shape", FAIL, point=pid)
|
|
81
|
+
continue
|
|
82
|
+
out.append(p)
|
|
83
|
+
return out
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _diff_file(diff: dict[str, Any], member: str) -> str | None:
|
|
87
|
+
for f in diff.get("answers_files") or []:
|
|
88
|
+
if f.get("member") == member:
|
|
89
|
+
return str(f.get("sha256"))
|
|
90
|
+
return None
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def _changed_claim(
|
|
94
|
+
rep: Report,
|
|
95
|
+
p: dict[str, Any],
|
|
96
|
+
run: dict[str, Any],
|
|
97
|
+
topic: Topic,
|
|
98
|
+
diff: dict[str, Any],
|
|
99
|
+
files: AnswersFiles | None,
|
|
100
|
+
) -> None:
|
|
101
|
+
"""Check a point shown `not_tested` over the counted run `run` because a
|
|
102
|
+
commitment changed since it."""
|
|
103
|
+
changed = p.get("changed_since_run")
|
|
104
|
+
if not isinstance(changed, list) or not changed:
|
|
105
|
+
rep.add(
|
|
106
|
+
"diff_verdict",
|
|
107
|
+
FAIL,
|
|
108
|
+
point=p["id"],
|
|
109
|
+
diff="not_tested",
|
|
110
|
+
ledger=run["verdict"],
|
|
111
|
+
)
|
|
112
|
+
return
|
|
113
|
+
used = run.get("commitments") or {}
|
|
114
|
+
unchecked = False
|
|
115
|
+
for member in changed:
|
|
116
|
+
side = topic.side_of(str(member))
|
|
117
|
+
sha = _diff_file(diff, str(member))
|
|
118
|
+
if side is None or side not in used or sha is None:
|
|
119
|
+
rep.add("diff_changed_who", FAIL, point=p["id"], member=member)
|
|
120
|
+
return
|
|
121
|
+
if sha == (run.get("answers") or {}).get(member):
|
|
122
|
+
rep.add("diff_changed_same", FAIL, run["seq"], point=p["id"], member=member)
|
|
123
|
+
return
|
|
124
|
+
mine = (files or {}).get(str(member), [])
|
|
125
|
+
hit = next((f for f in mine if f.sha == sha), None)
|
|
126
|
+
if hit is None and mine:
|
|
127
|
+
rep.add("diff_changed_file", FAIL, point=p["id"], member=member)
|
|
128
|
+
return
|
|
129
|
+
if hit is None:
|
|
130
|
+
unchecked = True
|
|
131
|
+
continue
|
|
132
|
+
given = (hit.answers.get(topic.items[side]["id"]) or {}).get("value")
|
|
133
|
+
if given == used[side]:
|
|
134
|
+
rep.add("diff_changed_same", FAIL, run["seq"], point=p["id"], member=member)
|
|
135
|
+
return
|
|
136
|
+
if unchecked:
|
|
137
|
+
rep.add("diff_changed_nofile", SKIP, point=p["id"])
|
|
138
|
+
else:
|
|
139
|
+
rep.add("diff_changed_ok", OK, point=p["id"], verdict=run["verdict"])
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def _stale(
|
|
143
|
+
rep: Report,
|
|
144
|
+
p: dict[str, Any],
|
|
145
|
+
later: list[dict[str, Any]],
|
|
146
|
+
topic: Topic | None,
|
|
147
|
+
diff: dict[str, Any],
|
|
148
|
+
) -> bool:
|
|
149
|
+
"""Whether a counted run of the point's topic logged after the diff's head (or
|
|
150
|
+
anywhere, for a diff with no head) read the very answers files of the
|
|
151
|
+
committers that the diff read: the diff then does not show a verdict on its
|
|
152
|
+
own answers, whatever head it names. Reported as a `FAIL`."""
|
|
153
|
+
if topic is None:
|
|
154
|
+
return False
|
|
155
|
+
who = [m for m in topic.members.values() if m]
|
|
156
|
+
read = {m: _diff_file(diff, m) for m in who}
|
|
157
|
+
if not who or None in read.values():
|
|
158
|
+
return False
|
|
159
|
+
for e in reversed(later):
|
|
160
|
+
if (
|
|
161
|
+
e["type"] == "verdict"
|
|
162
|
+
and e["topic"] == p["sealed"]["topic"]
|
|
163
|
+
and e["verdict"] in ("met", "not_met")
|
|
164
|
+
and all((e.get("answers") or {}).get(m) == read[m] for m in who)
|
|
165
|
+
):
|
|
166
|
+
rep.add("diff_stale", FAIL, e["seq"], point=p["id"], verdict=e["verdict"])
|
|
167
|
+
return True
|
|
168
|
+
return False
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def check_diff(
|
|
172
|
+
rep: Report,
|
|
173
|
+
pack: dict[str, Any],
|
|
174
|
+
pack_sha: str,
|
|
175
|
+
ledger: dict[str, Any],
|
|
176
|
+
diff: dict[str, Any],
|
|
177
|
+
topics: dict[str, Topic],
|
|
178
|
+
files: AnswersFiles | None,
|
|
179
|
+
) -> None:
|
|
180
|
+
"""The diff against the ledger (see the module text). `topics` are the pack's
|
|
181
|
+
topics, `files` the answers files given with `--answers`."""
|
|
182
|
+
entries = ledger["entries"]
|
|
183
|
+
if (diff.get("pack") or {}).get("sha256") != pack_sha:
|
|
184
|
+
rep.add("diff_pack", FAIL)
|
|
185
|
+
return
|
|
186
|
+
points = _points(rep, pack, diff)
|
|
187
|
+
heads = {p.get("ledger_head") for p in points}
|
|
188
|
+
if len(heads) > 1:
|
|
189
|
+
rep.add("diff_head_mixed", FAIL, heads=len(heads))
|
|
190
|
+
return
|
|
191
|
+
head = next(iter(heads), None)
|
|
192
|
+
if head is None:
|
|
193
|
+
for p in points:
|
|
194
|
+
if _stale(rep, p, entries, topics.get(p["sealed"]["topic"]), diff):
|
|
195
|
+
continue
|
|
196
|
+
if p.get("verdict") == "not_tested" and not p.get("changed_since_run"):
|
|
197
|
+
rep.add("diff_nohead", SKIP, point=p["id"])
|
|
198
|
+
else:
|
|
199
|
+
rep.add(
|
|
200
|
+
"diff_verdict",
|
|
201
|
+
FAIL,
|
|
202
|
+
point=p["id"],
|
|
203
|
+
diff=p.get("verdict"),
|
|
204
|
+
ledger="-",
|
|
205
|
+
)
|
|
206
|
+
return
|
|
207
|
+
at = next((e["seq"] for e in entries if e["sha256"] == head), None)
|
|
208
|
+
if at is None:
|
|
209
|
+
rep.add("diff_head", FAIL, point=points[0]["id"], head=str(head)[:12])
|
|
210
|
+
return
|
|
211
|
+
rep.add("diff_head_ok", OK, head=str(head)[:12], at=at, later=len(entries) - at)
|
|
212
|
+
then = {"entries": entries[:at]}
|
|
213
|
+
for p in points:
|
|
214
|
+
name = p["sealed"]["topic"]
|
|
215
|
+
if _stale(rep, p, entries[at:], topics.get(name), diff):
|
|
216
|
+
continue
|
|
217
|
+
shown, logged = p.get("verdict"), topic_verdict(then, name)
|
|
218
|
+
run = last_run(then, name)
|
|
219
|
+
if shown == "not_tested" and run is not None and name in topics:
|
|
220
|
+
_changed_claim(rep, p, run, topics[name], diff, files)
|
|
221
|
+
elif shown == logged and not p.get("changed_since_run"):
|
|
222
|
+
rep.add("diff_verdict_ok", OK, point=p["id"], verdict=shown)
|
|
223
|
+
else:
|
|
224
|
+
rep.add("diff_verdict", FAIL, point=p["id"], diff=shown, ledger=logged)
|
|
@@ -8,7 +8,6 @@ from dataclasses import dataclass
|
|
|
8
8
|
from pathlib import Path
|
|
9
9
|
from typing import Any
|
|
10
10
|
|
|
11
|
-
from smd_engine.deal.ledger import topic_verdict
|
|
12
11
|
from smd_engine.deal.overlap import comparator_for
|
|
13
12
|
from smd_engine.deal.sealed import commitment_of, read_sealed
|
|
14
13
|
from smd_engine.deal.signing import key_holders, signatures_on, verify_file
|
|
@@ -183,39 +182,3 @@ class SealedFolder:
|
|
|
183
182
|
)
|
|
184
183
|
else:
|
|
185
184
|
rep.add("sealed_ok", OK, seq, verdict=recomputed)
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
def check_diff(
|
|
189
|
-
rep: Report, pack_sha: str, ledger: dict[str, Any], diff: dict[str, Any]
|
|
190
|
-
) -> None:
|
|
191
|
-
"""The ledger head and the verdict of each sealed point of a diff against the
|
|
192
|
-
ledger: the head must be an entry of it, and the verdict the one the ledger
|
|
193
|
-
had at that entry (`not_tested` also when a commitment changed since the run)."""
|
|
194
|
-
entries = ledger["entries"]
|
|
195
|
-
if (diff.get("pack") or {}).get("sha256") != pack_sha:
|
|
196
|
-
rep.add("diff_pack", FAIL)
|
|
197
|
-
return
|
|
198
|
-
seen: set[str] = set()
|
|
199
|
-
for p in diff["points"]:
|
|
200
|
-
if "sealed" not in p:
|
|
201
|
-
continue
|
|
202
|
-
head, shown = p.get("ledger_head"), p.get("verdict")
|
|
203
|
-
topic = p["sealed"]["topic"]
|
|
204
|
-
if head is None:
|
|
205
|
-
if shown == "not_tested":
|
|
206
|
-
rep.add("diff_nohead", SKIP, point=p["id"])
|
|
207
|
-
else:
|
|
208
|
-
rep.add("diff_verdict", FAIL, point=p["id"], diff=shown, ledger="-")
|
|
209
|
-
continue
|
|
210
|
-
at = next((e["seq"] for e in entries if e["sha256"] == head), None)
|
|
211
|
-
if at is None:
|
|
212
|
-
rep.add("diff_head", FAIL, point=p["id"], head=head[:12])
|
|
213
|
-
continue
|
|
214
|
-
if head not in seen:
|
|
215
|
-
seen.add(head)
|
|
216
|
-
rep.add("diff_head_ok", OK, head=head[:12], at=at, later=len(entries) - at)
|
|
217
|
-
then = topic_verdict({"entries": entries[:at]}, topic)
|
|
218
|
-
if shown == then or (shown == "not_tested" and p.get("changed_since_run")):
|
|
219
|
-
rep.add("diff_verdict_ok", OK, point=p["id"], verdict=shown)
|
|
220
|
-
else:
|
|
221
|
-
rep.add("diff_verdict", FAIL, point=p["id"], diff=shown, ledger=then)
|
|
@@ -247,6 +247,18 @@ VERIFY_LABELS: dict[str, dict[str, Any]] = {
|
|
|
247
247
|
"diff_head": "diff point {point}: ledger head {head} is not an entry of the ledger",
|
|
248
248
|
"diff_head_ok": "diff ledger head {head} is entry {at} of the ledger ({later} later)",
|
|
249
249
|
"diff_verdict_ok": "diff point {point}: verdict {verdict} matches the ledger",
|
|
250
|
+
"diff_missing": "bound item {point} is not in the diff as a point",
|
|
251
|
+
"diff_not_bound": "diff point {point} is shown sealed but is no bound item of the pack",
|
|
252
|
+
"diff_point_shape": "diff point {point}: not one sealed point of the item's topic and side",
|
|
253
|
+
"diff_head_mixed": "the sealed points of the diff name {heads} different ledger heads (or some none)",
|
|
254
|
+
"diff_changed_who": "diff point {point}: {member} is shown as having changed a commitment, but commits no side of the topic or has no answers file in the diff",
|
|
255
|
+
"diff_changed_same": "diff point {point}: shown not tested because {member} changed a commitment, but the answers file the diff read keeps the one run {seq} used",
|
|
256
|
+
"diff_changed_nofile": "diff point {point}: shown not tested since a commitment changed; the answers file the diff read is not given, the change is not checked",
|
|
257
|
+
"diff_changed_ok": "diff point {point}: not tested since a commitment changed after the run ({verdict}); the answers files given show the change",
|
|
258
|
+
"diff_changed_file": "diff point {point}: the answers file of {member} that the diff names is none of those given for {member}",
|
|
259
|
+
"diff_stale": "diff point {point}: entry {seq} logged {verdict} on the very answers files this diff read, and the diff does not show it",
|
|
260
|
+
"diff_view": "the diff is the view for position {position}",
|
|
261
|
+
"diff_view_bad": "the diff calls itself a view for {position}, which is no position of the pack",
|
|
250
262
|
"consent_party": "entry {seq}: consent of {by} to run {run} of {topic} is not one the cap allows (a party, the buyer named, the seller alone for run 1)",
|
|
251
263
|
"consent_text": "entry {seq}: the consent keeps no signed text and signature, or a text that is not a consent file",
|
|
252
264
|
"consent_sha": "entry {seq}: the signed text of the consent of {by} is not the one whose sha256 is logged",
|
|
@@ -324,6 +336,18 @@ VERIFY_LABELS: dict[str, dict[str, Any]] = {
|
|
|
324
336
|
"diff_head": "точка сравнения {point}: головы журнала {head} нет среди записей журнала",
|
|
325
337
|
"diff_head_ok": "голова журнала в сравнении {head} — запись {at} журнала (после неё записей: {later})",
|
|
326
338
|
"diff_verdict_ok": "точка сравнения {point}: вердикт {verdict} совпадает с журналом",
|
|
339
|
+
"diff_missing": "привязанного вопроса {point} в сравнении нет",
|
|
340
|
+
"diff_not_bound": "точка сравнения {point} показана закрытой, но в пакете это не привязанный вопрос",
|
|
341
|
+
"diff_point_shape": "точка сравнения {point}: не одна закрытая точка темы и стороны вопроса",
|
|
342
|
+
"diff_head_mixed": "закрытые точки сравнения называют разные головы журнала ({heads}) или часть не называет никакой",
|
|
343
|
+
"diff_changed_who": "точка сравнения {point}: {member} показан изменившим обязательство, но не даёт обязательства ни по одной стороне темы или его файла ответов в сравнении нет",
|
|
344
|
+
"diff_changed_same": "точка сравнения {point}: показано «не проверено», так как {member} изменил обязательство, но файл ответов, по которому сделано сравнение, хранит то, что использовано в записи {seq}",
|
|
345
|
+
"diff_changed_nofile": "точка сравнения {point}: показано «не проверено» из-за изменённого обязательства; файл ответов, по которому сделано сравнение, не дан, изменение не сверено",
|
|
346
|
+
"diff_changed_ok": "точка сравнения {point}: не проверено, так как обязательство изменено после прогона ({verdict}); данные файлы ответов подтверждают изменение",
|
|
347
|
+
"diff_changed_file": "точка сравнения {point}: файл ответов {member}, названный в сравнении, не совпадает ни с одним из данных файлов {member}",
|
|
348
|
+
"diff_stale": "точка сравнения {point}: запись {seq} содержит вердикт {verdict} по тем же файлам ответов, что прочитаны в сравнении, а сравнение его не показывает",
|
|
349
|
+
"diff_view": "сравнение — вид для позиции {position}",
|
|
350
|
+
"diff_view_bad": "сравнение названо видом для {position}, но такой позиции в пакете нет",
|
|
327
351
|
"consent_party": "запись {seq}: согласие {by} на прогон {run} темы {topic} не такое, какое допускает правило (участник темы, названный покупатель, для первого прогона только продавец)",
|
|
328
352
|
"consent_text": "запись {seq}: у согласия нет подписанного текста и подписи, либо текст не является файлом согласия",
|
|
329
353
|
"consent_sha": "запись {seq}: подписанный текст согласия {by} не тот, чей sha256 записан",
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"""`smd deal verify --diff` against the ledger: a point shown `not_tested` over a
|
|
2
|
+
counted run is accepted only when the commitment really changed since the run,
|
|
3
|
+
and every bound item must be in the diff, so a holder cannot hide a logged
|
|
4
|
+
verdict from the parties' diff."""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import shutil
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from typing import Any, Callable
|
|
11
|
+
|
|
12
|
+
import yaml
|
|
13
|
+
|
|
14
|
+
from deal_helpers import needs_ssh, seal, set_answer, sign_answers
|
|
15
|
+
from smd_engine.task.model import load_task
|
|
16
|
+
from test_deal_verdict import diff_with_ledger, work # noqa: F401 (the fixture)
|
|
17
|
+
from test_deal_verify import codes, made, run # noqa: F401 (the fixture)
|
|
18
|
+
|
|
19
|
+
pytestmark = needs_ssh
|
|
20
|
+
|
|
21
|
+
PRICE = ("price-floor", "price-ceiling")
|
|
22
|
+
Run = Callable[..., tuple[int, str]]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def forged(
|
|
26
|
+
tmp_path: Path, src: Path, change: Callable[[dict[str, Any]], None], n: int = 0
|
|
27
|
+
) -> Path:
|
|
28
|
+
"""A copy of the diff at `src` changed by the holder."""
|
|
29
|
+
diff = load_task(src)
|
|
30
|
+
change(diff)
|
|
31
|
+
out = tmp_path / f"forged{n}.yaml"
|
|
32
|
+
out.write_text(yaml.safe_dump(diff, sort_keys=False), encoding="utf-8")
|
|
33
|
+
return out
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def answers(work: Path, *more: Path) -> list[str]:
|
|
37
|
+
"""`--answers` with the parties' current files and `more` (one flag: a second
|
|
38
|
+
`--answers` would replace the first list)."""
|
|
39
|
+
now = [work / f"answers_{m}.yaml" for m in ("vera", "boris", "gleb")]
|
|
40
|
+
return ["--answers", *(str(p) for p in (*now, *more))]
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def hide(diff: dict[str, Any], who: list[str]) -> None:
|
|
44
|
+
for p in diff["points"]:
|
|
45
|
+
if p["id"] in PRICE:
|
|
46
|
+
p["verdict"], p["changed_since_run"] = "not_tested", who
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def test_a_logged_verdict_hidden_as_changed_since_run_fails(
|
|
50
|
+
work: Path, tmp_path: Path, run: Run # noqa: F811
|
|
51
|
+
) -> None:
|
|
52
|
+
_, ledger = made(work, tmp_path)
|
|
53
|
+
assert diff_with_ledger(work, ledger, tmp_path / "out") == 0
|
|
54
|
+
bad = forged(tmp_path, tmp_path / "out/diff.yaml", lambda d: hide(d, ["vera"]))
|
|
55
|
+
for plain in (False, True): # the diff names the file the run recorded
|
|
56
|
+
code, out = run(work, ledger, "--diff", str(bad), "--json", plain=plain)
|
|
57
|
+
assert code == 1 and "diff_changed_same" in codes(out, "fail")
|
|
58
|
+
broker = forged(
|
|
59
|
+
tmp_path, tmp_path / "out/diff.yaml", lambda d: hide(d, ["gleb"]), 1
|
|
60
|
+
)
|
|
61
|
+
code, out = run(work, ledger, "--diff", str(broker), "--json")
|
|
62
|
+
assert code == 1 and "diff_changed_who" in codes(out, "fail")
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def test_a_new_answers_file_with_the_same_commitment_does_not_hide_the_verdict(
|
|
66
|
+
work: Path, tmp_path: Path, run: Run # noqa: F811
|
|
67
|
+
) -> None:
|
|
68
|
+
_, ledger = made(work, tmp_path)
|
|
69
|
+
shutil.copy(work / "answers_vera.yaml", tmp_path / "answers_vera_run.yaml")
|
|
70
|
+
shutil.copy(work / "answers_vera.yaml.sig", tmp_path / "answers_vera_run.yaml.sig")
|
|
71
|
+
set_answer(work, "vera", "sale-reason", {"value": "Health."})
|
|
72
|
+
sign_answers(work)
|
|
73
|
+
assert diff_with_ledger(work, ledger, tmp_path / "out") == 0
|
|
74
|
+
bad = forged(tmp_path, tmp_path / "out/diff.yaml", lambda d: hide(d, ["vera"]))
|
|
75
|
+
old = answers(work, tmp_path / "answers_vera_run.yaml")
|
|
76
|
+
code, out = run(work, ledger, "--diff", str(bad), *old, "--json", plain=True)
|
|
77
|
+
assert code == 1 and "diff_changed_same" in codes(out, "fail")
|
|
78
|
+
code, out = run(work, ledger, "--diff", str(bad), "--json", plain=True)
|
|
79
|
+
assert code == 0 and "diff_changed_nofile" in codes(out, "skip")
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def test_a_real_change_since_the_run_passes(
|
|
83
|
+
work: Path, tmp_path: Path, run: Run # noqa: F811
|
|
84
|
+
) -> None:
|
|
85
|
+
_, ledger = made(work, tmp_path)
|
|
86
|
+
shutil.copy(work / "answers_vera.yaml", tmp_path / "answers_vera_run.yaml")
|
|
87
|
+
shutil.copy(work / "answers_vera.yaml.sig", tmp_path / "answers_vera_run.yaml.sig")
|
|
88
|
+
_, commit = seal(work, tmp_path / "again", "price-floor", "100000")
|
|
89
|
+
set_answer(work, "vera", "price-floor", {"value": commit})
|
|
90
|
+
sign_answers(work)
|
|
91
|
+
assert diff_with_ledger(work, ledger, tmp_path / "out") == 0
|
|
92
|
+
diff = str(tmp_path / "out/diff.yaml")
|
|
93
|
+
old = answers(work, tmp_path / "answers_vera_run.yaml")
|
|
94
|
+
code, out = run(work, ledger, "--diff", diff, *old, "--json", plain=True)
|
|
95
|
+
assert code == 0, out
|
|
96
|
+
assert codes(out, "ok").count("diff_changed_ok") == 2
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def test_a_sealed_point_left_out_stripped_or_with_mixed_heads_fails(
|
|
100
|
+
work: Path, tmp_path: Path, run: Run # noqa: F811
|
|
101
|
+
) -> None:
|
|
102
|
+
_, ledger = made(work, tmp_path)
|
|
103
|
+
assert diff_with_ledger(work, ledger, tmp_path / "out") == 0
|
|
104
|
+
src = tmp_path / "out/diff.yaml"
|
|
105
|
+
|
|
106
|
+
def drop(d: dict[str, Any]) -> None:
|
|
107
|
+
d["points"] = [p for p in d["points"] if p["id"] != "price-floor"]
|
|
108
|
+
|
|
109
|
+
def strip(d: dict[str, Any]) -> None:
|
|
110
|
+
for p in d["points"]:
|
|
111
|
+
if p["id"] == "price-floor":
|
|
112
|
+
del p["sealed"]
|
|
113
|
+
|
|
114
|
+
def mix(d: dict[str, Any]) -> None:
|
|
115
|
+
for p in d["points"]:
|
|
116
|
+
if p["id"] == "price-floor":
|
|
117
|
+
del p["ledger_head"]
|
|
118
|
+
p["verdict"] = "not_tested"
|
|
119
|
+
|
|
120
|
+
for n, (change, code_name) in enumerate(
|
|
121
|
+
((drop, "diff_missing"), (strip, "diff_point_shape"), (mix, "diff_head_mixed"))
|
|
122
|
+
):
|
|
123
|
+
code, out = run(
|
|
124
|
+
work, ledger, "--diff", str(forged(tmp_path, src, change, n)), "--json"
|
|
125
|
+
)
|
|
126
|
+
assert code == 1 and code_name in codes(out, "fail"), (code_name, out)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def test_a_made_up_answers_file_an_old_or_no_head_or_a_false_view_fails(
|
|
130
|
+
work: Path, tmp_path: Path, run: Run # noqa: F811
|
|
131
|
+
) -> None:
|
|
132
|
+
_, ledger = made(work, tmp_path)
|
|
133
|
+
assert diff_with_ledger(work, ledger, tmp_path / "out") == 0
|
|
134
|
+
src = tmp_path / "out/diff.yaml"
|
|
135
|
+
first = load_task(ledger)["entries"][0]["sha256"] # the consent, before the run
|
|
136
|
+
|
|
137
|
+
def fake_file(d: dict[str, Any]) -> None:
|
|
138
|
+
hide(d, ["vera"])
|
|
139
|
+
for f in d["answers_files"]:
|
|
140
|
+
if f["member"] == "vera":
|
|
141
|
+
f["sha256"] = "e" * 64
|
|
142
|
+
|
|
143
|
+
def old_head(d: dict[str, Any]) -> None:
|
|
144
|
+
for p in d["points"]:
|
|
145
|
+
if p["id"] in PRICE:
|
|
146
|
+
p["verdict"], p["ledger_head"] = "not_tested", first
|
|
147
|
+
|
|
148
|
+
def no_head(d: dict[str, Any]) -> None:
|
|
149
|
+
for p in d["points"]:
|
|
150
|
+
if p["id"] in PRICE:
|
|
151
|
+
p["verdict"] = "not_tested"
|
|
152
|
+
del p["ledger_head"]
|
|
153
|
+
|
|
154
|
+
def ghost_view(d: dict[str, Any]) -> None:
|
|
155
|
+
d["view"] = {"position": "ghost", "diff": "0" * 64}
|
|
156
|
+
d["points"] = [p for p in d["points"] if p["id"] not in PRICE]
|
|
157
|
+
|
|
158
|
+
for n, (change, code_name) in enumerate(
|
|
159
|
+
(
|
|
160
|
+
(fake_file, "diff_changed_file"),
|
|
161
|
+
(old_head, "diff_stale"),
|
|
162
|
+
(no_head, "diff_stale"),
|
|
163
|
+
(ghost_view, "diff_view_bad"),
|
|
164
|
+
)
|
|
165
|
+
):
|
|
166
|
+
bad = str(forged(tmp_path, src, change, n))
|
|
167
|
+
code, out = run(work, ledger, "--diff", bad, "--json")
|
|
168
|
+
assert code == 1 and code_name in codes(out, "fail"), (code_name, out)
|
|
File without changes
|
|
File without changes
|