Files
shard-wiki/workplans/SHARD-WP-0010-derived-views.md
tegwick d2c73b02d9 workplans: register follow-up implementation roadmap (WP-0009..0012)
WP-0009 git-backed DecisionLog + per-space append authority (keystone backing);
WP-0010 derived views (wikilinks, BackLinks, RecentChanges, AllPages/SiteMap);
WP-0011 incremental union + equivalence index + I-2 verification;
WP-0012 second adapter (git-IS-store) validating the contract on a new substrate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 14:05:21 +02:00

110 lines
3.3 KiB
Markdown

---
id: SHARD-WP-0010
type: workplan
title: "derived views — wikilinks, BackLinks, RecentChanges, AllPages/SiteMap"
domain: whynot
repo: shard-wiki
status: active
owner: tegwick
topic_slug: whynot
created: "2026-06-15"
updated: "2026-06-15"
depends_on:
- SHARD-WP-0007
---
# SHARD-WP-0010 — Derived views
## Goal
Implement the **core derived views** over the union (`FederationRequirements` ADR-03): the
wikilink/red-link model (ADR-06), **BackLinks** (the strongest core view), **RecentChanges**,
and **AllPages / SiteMap**. All are derived-tier (recomputable; incrementally maintainable
later by SHARD-WP-0011) and carry provenance. Presentation stays out of core (L6).
**Non-goal:** full-text Search (hybrid delegate-or-derive — a later workplan); ranking; a UI.
## Context
- Views decision: `FederationRequirements.md` ADR-03; links: ADR-06. Blueprint §8.4.
- Builds on the union (`src/shard_wiki/union/`) + coordination journal.
---
## Wikilink + red-link model
```task
id: SHARD-WP-0010-T1
status: todo
priority: high
```
A CommonMark **wikilink extension** parser (`[[Target]]` / `[[Target|label]]`) that extracts
link targets from a page body and resolves each via the union (ADR-01): resolved → link;
unresolved → **red-link** (createable, UC-23). CamelCase auto-link off by default (opt-in per
space). The link **model + resolution is core**; rendering is L6. Tests: extraction, resolve vs
red-link, CamelCase opt-in.
## BackLinks (core)
```task
id: SHARD-WP-0010-T2
status: todo
priority: high
```
A derived **BackLinks** index over the union link graph: for any identity, the set of pages
linking to it (UC-18). Built from T1 link extraction across attached shards; entries carry
source provenance. Tests: A→B link yields B.backlinks ⊇ {A}; red-links don't create backlinks;
chorus pages aggregate.
## RecentChanges (core)
```task
id: SHARD-WP-0010-T3
status: todo
priority: medium
```
A **RecentChanges** view merging the coordination journal (overlay/apply/alias/fork events)
with shard change signals (mtime/`current_rev`; `notify` later), ordered, across the union
(UC-17). Each entry carries provenance (which shard / which decision). Tests: an edit and an
alias both appear, newest-first; per-shard attribution present.
## AllPages / SiteMap (core)
```task
id: SHARD-WP-0010-T4
status: todo
priority: low
```
**AllPages** (enumerate union identities, de-duplicated by equivalence/chorus) and a simple
**SiteMap** (namespace tree from placements). Tests: union enumeration spans shards; chorus
collapses to one entry with divergence noted; sitemap reflects paths.
## Wiring + integration
```task
id: SHARD-WP-0010-T5
status: todo
priority: medium
```
Expose `InformationSpace.backlinks(name)`, `recent_changes()`, `all_pages()`, `site_map()`.
Integration test over two shards. Update SCOPE; `pytest` + pyflakes green.
---
## Acceptance criteria
- Wikilink resolution + red-link detection work via the union (ADR-01/ADR-06).
- BackLinks, RecentChanges, AllPages, SiteMap computed over the union, provenance-carrying,
presentation-free (core only).
- Views are derived/recomputable; no canonical state introduced.
- `pytest` + pyflakes green; each task committed; state-hub synced.
## Suggested task order
T1 wikilinks → T2 BackLinks → T3 RecentChanges → T4 AllPages/SiteMap → T5 wiring.