history+workplan: CoreArchitectureBlueprint review; SHARD-WP-0005 hardening

Records the critical review (history/260615-...) and establishes SHARD-WP-0005
to fold its findings (A-1, B-1..B-3, C-1..C-3, D-1..D-4) into the blueprint:
correctness (state re-frame, identity/equivalence split, consistency model),
scale (incremental-first union, equivalence indexing, cache invalidation),
elegance (orthogonal spectra, layered provenance, common-case projection,
policy module), security/history scaling, and a known-open-problems section.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-15 01:01:19 +02:00
parent 9b5b393519
commit dd812abb81
3 changed files with 361 additions and 4 deletions

View File

@@ -0,0 +1,226 @@
---
id: SHARD-WP-0005
type: workplan
title: "core architecture hardening (blueprint review fixes)"
domain: whynot
repo: shard-wiki
status: active
owner: tegwick
topic_slug: whynot
created: "2026-06-15"
updated: "2026-06-15"
depends_on:
- SHARD-WP-0002
---
# SHARD-WP-0005 — Core architecture hardening
## Goal
Resolve the findings of the critical review
(`history/260615-core-architecture-blueprint-review.md`) by hardening
`spec/CoreArchitectureBlueprint.md` for **correctness, scale, and elegance** before
implementation. Close every *solvable* finding; record every *partially-open* finding
explicitly (consistency model, equivalence-at-scale strategy, axis-interaction subset) rather
than pretending it is solved.
Primary deliverable: a revised `spec/CoreArchitectureBlueprint.md` (the review's AF findings
folded in) plus a new **"Known scaling risks & open problems"** section.
## Context
- Review: `history/260615-core-architecture-blueprint-review.md` (findings A-1, B-1…B-3,
C-1…C-3, D-1…D-4; disposition F).
- Architecture under revision: `spec/CoreArchitectureBlueprint.md` @ 9b5b393.
- Constraints: `INTENT.md` (no amendment expected — all fixes live inside existing
boundaries); the synthesis inputs already folded into `SHARD-WP-0002`.
**Non-goal:** Implement anything. This workplan revises the architecture spec only.
## Guiding aims
- **Elegance:** prefer fewer, orthogonal concepts; make the common case trivial and the
exotic case possible (not the reverse).
- **No pretend-solved:** an honestly-open problem with a chosen direction beats a hand-wave.
- **INTENT-preserving:** every change must still honour the 12 invariants (or revise an
invariant deliberately and say so).
---
## Re-frame the state model: canonical (sharded + coordination) vs derived
```task
id: SHARD-WP-0005-T1
status: todo
priority: high
```
Fix finding **A-1** (and its I-2 contradiction). Replace the two-bucket thesis with **three
states**: **sharded-canonical** (shard content), **coordination-canonical** (journal:
overlays, curator equivalence bindings, alias tables, merge decisions — durable, born in the
middle), **derived-disposable** (union graph, indexes, projections). Re-frame §1 as
**canonical (sharded + coordination) vs derived (disposable)**; make `derived = f(canonical)`
literally true. Update I-2, the §3 dependency rule (only the disposable tier is rebuildable),
§4 abstractions (name coordination-canonical state), and move "alias table / curator binding"
out of L4-rebuildable into the coordination tier.
---
## Split page identity from content equivalence
```task
id: SHARD-WP-0005-T2
status: todo
priority: high
```
Fix bug **B-1**. Separate two concepts §7.2/§8.4 conflate: **page identity** = a *stable
handle* (shard-scoped uid, name-based, survives edits) used for references/placement; **content
equivalence** = fingerprint / span-set overlap used to *detect sameness*, never as identity.
State that a fingerprint identifies a *version/content*, not a *page*. Reconcile with
identity≠placement (I-9): identity (stable) → placements (N) → equivalence (cross-identity
sameness).
---
## Consistency, concurrency & conflict model
```task
id: SHARD-WP-0005-T3
status: todo
priority: high
```
Fix bug **B-2**. Add a new section stating shard-wiki's **consistency guarantee** (choose and
justify: e.g. causal consistency via the coordination journal; read-your-writes for local
overlays; eventual convergence for projected union). Specify **conflict detection +
representation as core mechanism** (divergence detection, keep-both/coexist representation),
keeping only *resolution* as policy (I-7). Define **overlay-apply semantics under source
drift** (rebase/refuse/three-way), and journal-commit vs shard-native-write ordering. Mark any
residual as open (→ T9).
---
## Scaling the union: incremental-first, equivalence indexing, rebuild-as-fallback
```task
id: SHARD-WP-0005-T4
status: todo
priority: high
```
Fix scaling findings **C-1, C-2**. Make **incremental, change-driven maintenance the primary
mechanism** for the derived tier: the `notify` capability (or poll/ETag fallback) drives
**delta updates** to union/index/projections; full rebuild is a rare fallback (and explicitly
*not required* to be cheap for rate-limited shards — reconcile with axis-10). Replace O(N²)
equivalence with a **blocking/indexing strategy** (normalised-title/path buckets, fingerprint
shingling/LSH, candidate generation then verify) and **incremental equivalence maintenance**.
Update §8.4 and I-2 (rebuildability is a *correctness property of the disposable tier*, not an
operational expectation).
---
## Cache freshness & invalidation protocol
```task
id: SHARD-WP-0005-T5
status: todo
priority: medium
```
Fix finding **C-2 (invalidation)**. Design the replication-projection **freshness/invalidation
protocol**: staleness semantics (TTL vs event-driven), push (notify/webhook/ActivityPub) vs
poll (ETag/If-Modified) vs hybrid per capability profile, single-flight / coalescing to avoid
thundering-herd refetch, and how freshness is surfaced in the provenance envelope. Tie to the
operational-envelope axis (rate-limited shards favour event-driven + long TTL).
---
## Capability spectra: orthogonal core, implied positions, interaction subset
```task
id: SHARD-WP-0005-T6
status: todo
priority: medium
```
Fix elegance finding **D-1**. Identify a **smaller orthogonal core** of capability axes and
mark the rest as **derived/implied** (e.g. attachment=git-IS-store ⟹ history=git-native ⟹
merge=git/text; opacity=encrypted ⟹ query/translation degrade). Explicitly enumerate the
**axis-interaction subset** the degradation function actually depends on (so "no per-backend
code" is a demonstrated claim, not an assertion), and forbid impossible profiles via the
implied-position rules. Update §6.
---
## Elegance pass: layered provenance, common-case projection, policy module & rails
```task
id: SHARD-WP-0005-T7
status: todo
priority: medium
```
Fix findings **D-2, D-3, D-4** together (the structural elegance/efficiency cluster):
- **Layered provenance** (D-2): page-level envelope + span-level *deltas* (the same
effective-vs-own pattern used for Trilium metadata), so per-span cost is near-zero when
uniform. Update §4/§7.2 and the provenance rail.
- **Common-case-trivial projection** (D-3): default = plain lazy replication-projection;
derivation/liveness/view-registry become an **extension point** invoked only for
computational/typed content — not a taxonomy every projection instantiates. Re-shape §8.48.5.
- **Policy module + rail discipline** (D-4): add a `policy/` module owning the §10 surface;
pin `provenance/` and capability types behind **stable narrow interfaces** to cap coupling.
Update §11 and the dependency rules.
---
## Security/multi-tenancy isolation & history scaling
```task
id: SHARD-WP-0005-T8
status: todo
priority: medium
```
Fix findings **B-3, C-3**:
- **Tenant isolation of derived state** (B-3): the persisted derived tier is **partitioned per
tenant/root-entity**; no cross-tenant union cache guarded only by read-time filtering.
Reconcile I-2 + L5; state the isolation invariant. Update §9/§13.
- **History scaling** (C-3): a strategy for unbounded open-L0 history — git packing/gc,
**compaction/squash policy for low-value churn**, per-shard history offload, and
rate-limiting/anti-abuse hooks — without weakening recoverability (I-10). Update §8.1.
---
## Known scaling risks & open problems; invariant + traceability refresh
```task
id: SHARD-WP-0005-T9
status: todo
priority: medium
```
Close out (finding **F**). Add a new **"Known scaling risks & open problems"** section listing
the partially-open items with their chosen direction and the trigger that would force a
revisit (consistency-model edge cases, equivalence-blocking false-negative rate,
axis-interaction completeness, persisted-cache cost ceiling). Refresh the **invariants table**
(any added/changed invariant), the **§13 decisions** (mark resolved vs still-open), and the
**§15 traceability** (link this review + SHARD-WP-0005). Final `check_repo_consistency` pass.
---
## Acceptance criteria
- Every review finding A-1, B-1B-3, C-1C-3, D-1D-4 is either **resolved in the blueprint**
or **listed as a known open problem with a chosen direction** (none silently dropped).
- The blueprint still honours all INTENT invariants, or revises one *deliberately and visibly*.
- `spec/CoreArchitectureBlueprint.md` reads as **more elegant**, not merely more detailed:
fewer/orthogonal core concepts; common case trivial; exotic case possible.
- Each task committed; SCOPE/spec-README updated where status changes; state-hub synced.
## Suggested task order
Correctness first (**T1 → T2 → T3**), then scale (**T4 → T5**), then elegance (**T6 → T7**),
then hardening (**T8**), then close-out (**T9**).