# Topology Module — Codex (per FVW v8 §22 + §39)

**Module ID:** `oscar.topology`
**Status:** Constitutional (per §39 + latent doctrine, locally ratified).

---

## C1 — Behaviour Inventory
- `app/src/topology/TopologyContext.tsx`
- `app/src/data/models/Tag.ts`, `Link.ts`, `Version.ts`
- IDB stores: tags, links, versions (DB v4 → v5)
- Wraps app via TopologyProvider

## C2 — State Machine
Tag: exists → label change → delete
Link: create → query → delete
Version: saveVersion (auto-increment) → restore (not impl)

## C3 — Side Effect List
- IDB writes via tagsRepo, linksRepo, versionsRepo
- Topology state refresh on mount

## C4 — Input Validation Contract
- Tag.label non-empty
- Link.source_id != link.target_id

## C5 — Failure Modes
- IDB error → caught

## C6 — User Simulation List
1. Create tag
2. Create link between two artefacts
3. Save version
4. Query links for an artefact

## C7 — Reproducibility Test
Deterministic.

## C8 — Shape Matrix
| Surface | Modes | Chips | States |
|---|---|---|---|
| Tag chip | create, show, filter | label, parent, scope | — |
| Link relationship | create, list, delete | type, source, target | — |
| Version timeline | save, list, restore | number, note | — |

## C9 — State Shape Inventory
### C9.1 localStorage
None
### C9.2 In-memory
- TopologyContext: tags[] (from IDB), links[] (from IDB)
### C9.3 IDB
- tags store (added in C3, DB v5)
- links store (added in C3, DB v5)
- versions store (added in C3, DB v5)

---

## END OF TOPOLOGY CODEX
