[K4] Bind candidate acceptance to exact verification evidence #21
No reviewers
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Creatidy/creatidy-kernel!21
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-7-evidence-verification"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes neither issue before integration. Implements #7 against
develop.Validation:
uv run --locked pytest -q tests/test_verification.py(10 passed);make check(179 passed, lint/type/import/secret/diff checks);make package-check(isolated wheel install passed). No live service or worker execution claimed. Issue remains open pending owner integration.PR Review: [K4] Bind candidate acceptance to exact verification evidence (#21)
Repository: Creatidy/creatidy-kernel
Branch: issue-7-evidence-verification -> develop
Frozen head:
06f14f217dLinked issue: #7 ([K4] Evidence-based verification, acceptance, remediation, and outcomes)
Independent read-only review in a fresh reviewer context. Local checkout verified clean at the exact frozen head; base
develop@e41f692equals the merge base (no drift). 5 files, +1221, all additive (core/verification.py,core/context.py,core/outcomes.py,tests/test_verification.py,tests/test_context_outcomes.py). No prior reviews or comments existed.Platform identity limitation: this review is submitted by the Forgejo account
kilo, which is also the PR author. A formal APPROVED submission was attempted and rejected by the platform ("approve your own pull is not allowed"), so this review persists as COMMENT. The substantive independent verdict below is APPROVE and must not be inferred from the persisted COMMENT state.Summary
Implements the K4 verification/acceptance seam: strict untrusted-candidate parsing bound to a collected artifact manifest, finished Attempt, current approved spec, pinned policy and exact repository/base/head; fresh exact-subject deterministic and cold-review evidence required before a
TrustedSatisfactionis created and revalidated at admission; bounded remediation with progress/oscillation/pause/HumanGate distinction; boundedContextPackagemanifests; and a pure local outcome export with identity attribution, unknown-usage preservation and superseding correction lineage.Intent / Acceptance Evidence
verify_candidaterequires per-checkitem.subject == subject(candidate digest + attempt digest + spec digest + policy digest + repo/base/head) andobserved_at <= now <= fresh_until; missing/failing/stale/mismatched evidence yields findings andRejectedResult(tests/test_verification.py::test_schema_valid_proposal_is_not_accepted_without_exact_fresh_evidence, incl. worker-produced and subject-override variants). Claimed verdict fields are never parsed (parse_candidaterejects any extra field such aspass).assess_remediation+test_f_new_blockers_progress_oscillation_pause_and_authority_gate: retry within budget, PAUSE on exhausted/unauthorized budget, HUMAN_GATE only forowner_decision_required; fingerprints tracked across changed subjects without relabeling.test_c_malformed_extra_duplicate_candidate_data(5 parametrized cases: non-JSON, non-object, duplicate top-level key, extra field, duplicate output key). D/E:test_d_e_transport_success_is_not_domain_or_review_acceptancemodels domain rejection (failing review) and unaccepted wait (missing review) with no satisfaction and dependent unit still PENDING. F: test above.test_two_node_acceptance_and_stale_subject_preserves_old_evidence: acceptance yields predecessorInputBindingwith satisfaction id and output provenance; second node accepted ->COMPLETED; re-verifying the stale first candidate raisesStaleRevision; prior aggregate state unchanged; finding history preserved across remediation subjects.ContextPackage.digestcovers pinned sources/revisions/digests/policies/compiler/budgets andmatchesbinds attempt + spec +context_reference;UsageObservationpreservesquantity=None,Provenancedistinctions, quota freshness; corrections require exact superseding lineage and duplicate receipts fail closed (tests/test_context_outcomes.py).trusted_satisfaction_issuersmember and differ from the attempt actor; every evidence producer must differ from the attempt actor; independent review additionally requires a distinct reviewer session and producer != verifier. `rg "M5Architecture / Information Flow
Dependencies point inward only: the three new core modules import
core.domain,core.execution,core.resourcesand stdlib;lint-importsreports contracts kept (1 kept, 0 broken). Parsing, decision and admission are separated from evidence production via theCheckProducerprotocol, matching the "Verification" row ofdocs/architecture/contracts.mdand ADR 0005 (schema eligibility != acceptance; missing evidence is not a pass; cold reviewer seam; no implementer-context reuse).admit_acceptedreplays stored evidence against the recomputed current subject, so changed head/base/policy/spec or tampered/empty evidence fails closed withStaleRevisionbeforeSatisfyWorkUnitis applied — consistent with the acceptance/merge-race contract.ContextPackage/outcome export match ADR 0006 (bounded manifest, no vector store, unknown-not-zero usage, superseding corrections, remediation cost linked to accepted outcome viacost_attempt_ids). All fixtures are synthetic; no private, live or cloud services are touched.Blocking Issues
None.
Non-blocking Suggestions
Findingis the only new public record without__post_init__invariant validation (its siblings all validate). It is constructed internally from validated inputs today; adding the same guard would keep the value style uniform.assess_remediationreportsprogress=Truefor a single-rejection history (no baseline). Reasonable policy choice, but worth one docstring sentence so callers do not read it as measured progress.reviewer_session != spec.attempt_idguard compares a session identity to an attempt ID; it is a weak degenerate-identity check. Real separation currently comes fromproducer != attempt.actor_idandproducer != verifier_id; consider strengthening once reviewer-session identity semantics are defined.admit_acceptedanAcceptedResultwhosesatisfactionwas tampered (e.g. swapped output bindings); the recompute-and-compare (checked != result) path covers it indirectly via theevidence=()test only.Questions for the Author
None blocking. D/E are exercised at the verification seam (missing/failing review evidence) rather than through a transport-status path; transport-vs-domain separation conformance belongs to the Runtime port cases in
docs/architecture/contracts.md. Confirm that reading, or state the intended split.Security / Privacy Notes
parse_candidateuses anobject_pairs_hookthat rejects duplicate keys, requires an exact field set, string-only outputs, and never interprets claimed verdicts. Worker/verifier/reviewer separation is enforced in code, not prose. Candidate output paths must exist in the trusted collected manifest with unique paths and a workspace key pinned to the Attempt. No secrets, credentials or network access are introduced; the secret scan is clean.Test / Documentation Gaps
Minor: the tampered-satisfaction admission test above;
docs/architecture/successor.mdK4 row still reads as plan text now that the kernel-side implementation exists (an implemented-status annotation would keep the plan document aligned, non-urgent). Validation claims in the PR body were independently re-run at the frozen head and all reproduced (below).Follow-Up Candidates
docs/architecture/contracts.md; owner triage only).Validation (re-run by reviewer at frozen head
06f14f2)uv run --locked pytest -q tests/test_verification.py tests/test_context_outcomes.py— 15 passed.make check— uv lock ok; ruff format/check ok; basedpyright 0 errors; lint-imports contracts kept; 179 passed; secret scan clean;git diff --checkclean.make package-check— wheel metadata/license, sdist rebuild and isolated install passed.Overall Recommendation
APPROVE — no blocking findings against the frozen head; issue #7 acceptance criteria are met within the declared K4 scope and constraints. Per the review contract, this substantive verdict stands independently of the persisted Forgejo COMMENT state caused by the shared PR-author identity noted above.