source adapter framework

This commit is contained in:
2026-05-14 22:05:34 +02:00
parent f8f20c7c32
commit eb34c0d4fb
17 changed files with 1924 additions and 15 deletions

View File

@@ -3,10 +3,10 @@ id: MKTT-WP-0018
type: workplan
title: "Source Adapter Interface And Markdown Normalization Contract"
domain: markitect
status: active
status: done
owner: markitect-tool
topic_slug: markitect
planning_priority: P0
planning_priority: complete
planning_order: 145
depends_on_workplans:
- MKTT-WP-0013
@@ -108,7 +108,7 @@ preservation contract exists.
```task
id: MKTT-WP-0018-T001
status: todo
status: done
priority: high
state_hub_task_id: "a5d05b2a-b9d8-43c6-9e52-5a77094b49d1"
```
@@ -124,11 +124,16 @@ Output: architecture note covering responsibilities, extension package shape,
the `docs/source-adapter-contract.md` entry point contract, dependency policy,
and migration path from the current `infospace-bench` EPUB spike.
Implemented: `docs/source-adapter-contract.md` defines the contract boundary,
external package shape, dependency policy, entry point group, and
`markitect-filter` EPUB3 handoff. `docs/source-adapter-migration.md` documents
the sibling-repo migration path.
## P18.2 - Canonical source-to-markdown data model
```task
id: MKTT-WP-0018-T002
status: todo
status: done
priority: high
state_hub_task_id: "f8164264-a9c1-4c82-8617-76bbb84a51bb"
```
@@ -160,11 +165,17 @@ Output: public data model, serialization tests using
`examples/source-adapters/normalized-document.json`, and normalization contract
documentation matching the field-level v1 specification.
Implemented: `markitect_tool.source` exposes `SourceAsset`, `SourceMetadata`,
`NormalizedMarkdownDocument`, `NormalizedMarkdownSegment`,
`SourceProvenance`, and `NormalizationQuality`, with stable dictionary
serialization, round-trip tests, digest/cache-key support, diagnostics, and
fixture coverage.
## P18.3 - Source adapter protocol and capability descriptors
```task
id: MKTT-WP-0018-T003
status: todo
status: done
priority: high
state_hub_task_id: "5036ff34-49f4-4900-9e90-95c4555b4ce9"
```
@@ -189,11 +200,16 @@ Concrete EPUB3 implementation belongs in `markitect-filter`.
Output: protocol module, descriptor integration, tests for matching,
inspection, reading, diagnostics, and unsupported-format behavior.
Implemented: `SourceReadAdapter`, request/result types,
`SourceAdapterDescriptor`, deterministic selection, dependency diagnostics,
unsupported-format diagnostics, and read-only capability descriptors live in
`markitect_tool.source`.
## P18.4 - Adapter registry and discovery hooks
```task
id: MKTT-WP-0018-T004
status: todo
status: done
priority: high
state_hub_task_id: "391fb723-8990-4086-ac6c-656a3d637ba3"
```
@@ -210,11 +226,16 @@ Wire source adapters into the existing internal extension framework:
Output: registry implementation, package discovery tests, and compatibility
notes for `markitect-filter`.
Implemented: `SourceAdapterRegistry`, `discover_source_adapters`, and
`default_source_adapter_registry` discover descriptors through
`markitect_tool.source_adapters`, expose source adapter descriptors through the
extension catalog, and report missing optional dependencies deterministically.
## P18.5 - Normalization CLI and public API surface
```task
id: MKTT-WP-0018-T005
status: todo
status: done
priority: medium
state_hub_task_id: "c6233bd1-0403-498b-a6ed-c1874b172aa3"
```
@@ -231,11 +252,16 @@ Expose a small CLI/API surface:
Output: CLI commands, API exports, generated command/API docs updates, and
tests.
Implemented: `mkt source adapters`, `mkt source inspect`, and
`mkt source normalize` expose JSON/YAML/text/Markdown behavior. Public API
exports were added to `markitect_tool.__all__`, and generated CLI/API docs were
refreshed.
## P18.6 - Contract tests and fake adapter fixture
```task
id: MKTT-WP-0018-T006
status: todo
status: done
priority: high
state_hub_task_id: "263d0351-2942-4c2a-b333-b3aa96f2b8e3"
```
@@ -252,11 +278,16 @@ Add deterministic contract tests proving that an external read adapter can:
Output: fake adapter fixture, reusable contract-test helpers, and documentation
for `markitect-filter` adapter implementers.
Implemented: `tests/test_source_adapter_contract.py` provides fake adapter
coverage for model serialization, cache keys, registry selection, entry point
discovery, dependency diagnostics, CLI JSON/Markdown envelopes, and public API
exports. `examples/source-adapters/` contains expected-output fixtures.
## P18.7 - Cross-repo migration notes for infospace-bench and markitect-filter
```task
id: MKTT-WP-0018-T007
status: todo
status: done
priority: medium
state_hub_task_id: "dfc81c61-f7ca-4266-8908-56b221101fd4"
```
@@ -272,6 +303,10 @@ Document how the new contract affects sibling repos:
Output: migration note and follow-up workplan seeds for `markitect-filter` and
`infospace-bench`.
Implemented: `docs/source-adapter-migration.md` documents the migration path
for `markitect-filter`, `infospace-bench`, and `kontextual-engine`, including
follow-up workplan seeds.
## Acceptance
- `markitect-tool` exposes a stable source adapter protocol and canonical