Skip to content

ADR 0003 D2: First-class conflict terms #40

Open

Description

@aien-spark

Section 9 step 20 of ADR 0003. Tracker: #8.

Needs: C1, B5 (every listed PR must have merged before this step starts)

Scope: First-class conflict terms

Acceptance (exact pass conditions): Rebase twice cancels to a plain three-way conflict; revert returns a clean tree; modify against delete, file against directory, and mode conflicts each round-trip as typed terms; conflicted trees refuse materialization and promotion

Rules: one PR owning one subsystem; tests fail before the change and pass after it; any performance figure is stated in SI units (s, J, W) next to its section 6 bound as a fraction of that bound, with raw samples; a performance report alone is never an acceptance.

Claim this step by commenting "claimed by " before starting; never start a step that is already claimed.

Activity

  1. drakestapleton commented on Oct 18, 2026

    @drakestapleton
    Contributor

    This was generated by AI.

    claimed by synapse-adr0003 session (Claude Opus 5.5, Synapse vertical). Plan:

    • ConflictTerm in synapse-core: typed entry states (absent, file with mode, directory), sorted add/remove multisets, reduced form, canonical binary encoding.
    • A tree-level sum (adds minus removes, recursive over the Merkle tree, with equal terms cancelling), defined once in core.
    • The B5 rebase rule records conflict terms instead of refusing.
    • A revert derivation rule.
    • Conflict entries in tree nodes, with a per-node conflict count, so materialization (whole-tree file listings) and promotion moves refuse a conflicted tree.

    Tests: rebase twice cancels to a plain three-way conflict, revert returns a clean tree, modify/delete, file/directory and mode conflicts round-trip typed, and conflicted trees are refused for materialization and promotion. Branch synapse/40-conflict-terms.

  2. drakestapleton commented on Oct 18, 2026

    @drakestapleton
    Contributor

    This was generated by AI.

    D2 is ready on branch synapse/40-conflict-terms (head 0799527), for the orchestrator to open as a PR.

    Stacked on D1: the branch is based on D1's head 18b221e (PR #115), because D2 changes the same derivation code. After #115 merges, rebase with git rebase --onto origin/main 18b221e.

    What it does:

    • A rebase whose paths collide now records typed conflict terms (modify/delete, file/directory, mode, content) instead of being refused.
    • Rebasing twice cancels to a plain three-way conflict.
    • New Revert rule (tag 4) returns a clean tree.
    • Conflicted trees refuse materialization, Git-shaped diffs, Verified and check_promotion.
    • Only derivation rules can record a term.

    It also fixes a C1 bug: the tree store's hash tables were accounted by capacity(), which drops with tombstones, so the high water passed the bound under heavy eviction.

    Tests: workspace 423 passed, 0 failed; clippy -D warnings and fmt are clean. The red script covers 21 mutations, one per behaviour, and all 21 go red. Evidence is in evidence/d2-conflict-terms/; see docs/D2_CONFLICT_TERMS.md section 8 for limits.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions