evidence-binder/docs/extraction-inventory.md
tegwick a10f080f12
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 2s
Extract binder package from citation-evidence (EBIND-WP-0001)
Extracts citation-evidence/src/binder/ into this repo as the standalone
@citation-evidence/evidence-binder package: headless binding service +
in-memory link repo, active-state machine, the SharedContracts §7
rect-registry contract (registry, change pumps, hooks, SVG overlay), and
the target-neutral reference FormRenderer.

- toolchain mirrors sibling extracted repos (pnpm/tsc/vitest/eslint);
  imports rewritten from @shared/@engine aliases to the engine's
  @citation-evidence/engine package specifiers
- dependency boundary (engine + anchor only; no source/work/umbrella)
  enforced via eslint no-restricted-imports
- docs: extraction inventory + contract deltas, ADR-0001 (reference UI
  kept as supported exports), refreshed README/SCOPE/INTENT, populated
  capabilities index
- typecheck + lint green, 37 tests passing

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-09 01:36:33 +02:00

73 lines
3.8 KiB
Markdown

# Extraction inventory & contract deltas (EBIND-WP-0001-T01)
Locks the extraction boundary for pulling `citation-evidence/src/binder/` into
this repository. Authority for the shared contracts remains the umbrella wiki
(`../citation-evidence/wiki/SharedContracts.md`,
`../citation-evidence/wiki/DependencyMap.md`) until the cutover is complete.
## 1. Files that extract into this repo
All of `citation-evidence/src/binder/` moves to `evidence-binder/src/`:
| Concern | Files |
| --- | --- |
| Headless link repo | `repos/in-memory-links.ts`, `repos/index.ts` |
| Binding service | `services/bindings.ts` (+ `.test.ts`), `services/index.ts` |
| Active-state machine | `state/active.ts` (+ `.test.ts`), `state/index.ts` |
| Provider composition | `BinderProvider.tsx` |
| Visual guide (rect registry) | `visual-guide/rect-registry.ts` (+ `.test.ts`), `visual-guide/events.ts`, `visual-guide/react-hooks.ts` (+ `.dom.test.tsx`), `visual-guide/Overlay.tsx` (+ `.dom.test.tsx`), `visual-guide/index.ts` |
| Reference UI | `FormRenderer.tsx` (+ `FormRenderer.dom.test.tsx`), `FieldDefinitionForm.tsx` |
| Barrel | `index.ts` |
The upstream `src/binder/README.md` is **not** carried over — this repo's
top-level `README.md` supersedes it.
## 2. Files that remain umbrella-only
Everything that composes binder with the rest of the app stays in the umbrella
(`citation-evidence/src/app/**`): `FormsApp.tsx`, `HighlightRectBridge.tsx`,
`ActiveEvidenceChips.tsx`, `CaptureLinkPersister.tsx`, `capture-persistence.ts`,
`App.tsx`. These are consumers of the binder, not part of it.
## 3. Import-alias rewrite
Upstream binder files used the umbrella's internal path aliases. On extraction
they are rewritten to the engine's published package specifiers (the same
convention `evidence-anchor` uses):
| Upstream alias | Extracted specifier |
| --- | --- |
| `@shared/evidence-link`, `@shared/ids` | `@citation-evidence/engine/shared` |
| `@engine/events` | `@citation-evidence/engine` |
No source imported `@binder/*`, `@work/*`, `@source/*`, or `@app/*`, so no
forbidden edge existed in the slice. The binder MVP slice imports **only** from
`citation-engine` (shared types + event bus). It does not currently import
`evidence-anchor`, which is an *allowed but unused* edge (DependencyMap §2).
## 4. Contract deltas resolved
- **`EvidenceTarget` naming / target vocabulary.** No drift. The engine's
`EvidenceTarget` (`{ targetType, targetId }`) and the closed
`EvidenceTargetType` catalogue (`form-field`, `claim`, `requirement`,
`decision`, `document-section`) are canonical and consumed as-is. The MVP only
exercises `form-field`. `INTENT.md` previously listed extra target kinds
("tasks, or other information objects"); that is aspirational prose, not a
competing enum, and is left as narrative.
- **Dropped relation values `derived-from` / `needs-check`.** These are **not**
members of the canonical `EvidenceRelation` enum (`supports`, `contradicts`,
`explains`, `qualifies`, `source-for`, `context-for`). The extracted package
does **not** reintroduce them; any earlier INTENT mention of them is dropped
from the implemented surface.
- **Event vocabulary / removal semantics.** The binding service emits only
canonical bus events: `EvidenceLinkCreated`, `EvidenceLinkUpdated`,
`EvidenceLinkRemoved` (hard-delete; rejected-status path deferred), and
`EvidenceItemActivated` / `FormFieldActivated`. All are members of the engine's
`EngineEvent` union — no local event vocabulary is introduced.
## 5. Forbidden dependency edges (called out before copy)
Per DependencyMap §2, `evidence-binder` may depend on `citation-engine` and
`evidence-anchor`, and must **not** depend on `evidence-source`,
`citation-work`, or the umbrella `citation-evidence`. This boundary is enforced
mechanically by `eslint.config.js` (`no-restricted-imports`).