--- id: SHARD-WP-0010 type: workplan title: "derived views — wikilinks, BackLinks, RecentChanges, AllPages/SiteMap" domain: whynot repo: shard-wiki status: done owner: tegwick topic_slug: whynot created: "2026-06-15" updated: "2026-06-15" depends_on: - SHARD-WP-0007 state_hub_workstream_id: "2fe15330-ddf6-4b0f-8e55-ada341375d35" --- # 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: done priority: high state_hub_task_id: "792660c3-9be9-4771-9f51-69d01f0c7f13" ``` 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: done priority: high state_hub_task_id: "431a54c3-82b5-4b08-b3f0-762624d4c91d" ``` 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: done priority: medium state_hub_task_id: "270c1c31-0445-42b9-9a49-92d32c298eb2" ``` 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: done priority: low state_hub_task_id: "898ba43e-cdef-4ce8-9fa3-4ce60ebb4fdd" ``` **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: done priority: medium state_hub_task_id: "7157544b-5d3b-45a2-ba5a-c32244c59323" ``` 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.