Skip to content

feat(provenance): fork-first-class chain model — ADR-0010 (#31; supersedes #32)#109

Merged
hyperpolymath merged 2 commits into
mainfrom
feat/vsm31-adr0010-fork-first-class
May 18, 2026
Merged

feat(provenance): fork-first-class chain model — ADR-0010 (#31; supersedes #32)#109
hyperpolymath merged 2 commits into
mainfrom
feat/vsm31-adr0010-fork-first-class

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

Implements ADR-0010 (Proposed→Accepted). No UNIQUE(entity_id,previous_hash) (#32 superseded; hash PK is the dup guard); non-unique idx_provenance_predecessor; multi-head verisimdb_provenance_chain_heads + idempotent non-destructive migration; append_provenance linear fast-path; append_provenance_fork; fork_points; per-branch verify_chain; overlay.rs mirrored (ux_provenance_chain removed). provenance_fork_test rewritten to the 4 ADR-0010 cases + dup-rejection. Full suite green (107 lib + 9 + 4 + 2). Closes #31; supersedes #32.

🤖 Generated with Claude Code

…sedes #32)

Implements ADR-0010 (now Accepted). The provenance integrity property
is tamper-evidence + no-silent-loss, NOT linearity: legitimate
divergence (partitioned/replicated/offline writers, simulation
branches) must be representable, persisted, detectable and verifiable.

Schema
- NO `UNIQUE(entity_id, previous_hash)` (#32, superseded): it would
  reject a divergent writer's honest history at insert time. The `hash`
  PRIMARY KEY is the correct duplicate guard (domain-tagged preimage).
- Add non-unique `idx_provenance_predecessor` → O(log n) fork detection.
- `verisimdb_provenance_chain_heads(entity_id, head_hash)` multi-head
  tip set; legacy single-head table kept one release with an idempotent
  `INSERT … SELECT` migration (no destructive DROP ships here).

Behaviour
- `append_provenance`: linear fast-path — extends the unique head;
  errors (not silently collapses) if the entity has >1 head.
- `append_provenance_fork(from_hash)`: extends a specific ancestor,
  *adds* a head without removing one → the entity now has ≥2 tips.
- `fork_points()`: every predecessor with >1 child.
- `verify_chain`: per-branch walk (each tip → genesis) so a forked-
  but-honest entity verifies true while tampering any branch still fails.

codegen `overlay.rs` mirrors the schema (harmful `ux_provenance_chain`
removed); its DDL tests inverted to assert the ADR-0010 contract.

Tests: `tests/provenance_fork_test.rs` rewritten to the 4 ADR-0010
cases (the previously failing-by-design test now passes) +
`exact_duplicate_entry_is_rejected`. Full suite green (107 lib + 9 + 4
+ 2, 0 failed). ADR-0010 Proposed → Accepted.

Closes #31. Supersedes #32 (closed not-planned).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 21 issues detected

Severity Count
🔴 Critical 2
🟠 High 8
🟡 Medium 11

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Required file missing",
    "type": "missing",
    "file": "SECURITY.md",
    "action": "create",
    "rule_module": "root_hygiene",
    "severity": "high"
  },
  {
    "reason": "Issue in quality.yml",
    "type": "missing_workflow",
    "file": "quality.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in security-policy.yml",
    "type": "missing_workflow",
    "file": "security-policy.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Action actions/checkout@v4 needs attention",
    "type": "unpinned_action",
    "file": "rust-ci.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action Swatinem/rust-cache@v2 needs attention",
    "type": "unpinned_action",
    "file": "rust-ci.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action actions/checkout@v4 needs attention",
    "type": "unpinned_action",
    "file": "rust-ci.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action dtolnay/rust-toolchain@master needs attention",
    "type": "unpinned_action",
    "file": "rust-ci.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Action Swatinem/rust-cache@v2 needs attention",
    "type": "unpinned_action",
    "file": "rust-ci.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Required file missing (condition: public_repo)",
    "type": "missing_requirement",
    "file": "SECURITY.md",
    "action": "create",
    "rule_module": "cicd_rules",
    "severity": "high"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

@hyperpolymath hyperpolymath merged commit 1a73d3a into main May 18, 2026
11 of 12 checks passed
@github-actions
Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 21 issues detected

Severity Count
🔴 Critical 2
🟠 High 8
🟡 Medium 11

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Required file missing",
    "type": "missing",
    "file": "SECURITY.md",
    "action": "create",
    "rule_module": "root_hygiene",
    "severity": "high"
  },
  {
    "reason": "Issue in quality.yml",
    "type": "missing_workflow",
    "file": "quality.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in security-policy.yml",
    "type": "missing_workflow",
    "file": "security-policy.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Action actions/checkout@v4 needs attention",
    "type": "unpinned_action",
    "file": "rust-ci.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action Swatinem/rust-cache@v2 needs attention",
    "type": "unpinned_action",
    "file": "rust-ci.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action actions/checkout@v4 needs attention",
    "type": "unpinned_action",
    "file": "rust-ci.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action dtolnay/rust-toolchain@master needs attention",
    "type": "unpinned_action",
    "file": "rust-ci.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Action Swatinem/rust-cache@v2 needs attention",
    "type": "unpinned_action",
    "file": "rust-ci.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Required file missing (condition: public_repo)",
    "type": "missing_requirement",
    "file": "SECURITY.md",
    "action": "create",
    "rule_module": "cicd_rules",
    "severity": "high"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

V-L2-L1: per-entity serialisation prevents chain forks (write-path lock)

1 participant