Extensible canonical internal processing refactoring

This commit is contained in:
2026-05-04 11:06:11 +02:00
parent 4a16ccf1e1
commit d977f9e67c
20 changed files with 1815 additions and 16 deletions

View File

@@ -3,7 +3,7 @@ id: MKTT-WP-0013
type: workplan
title: "Internal Extension Framework and Canonical Processing Model"
domain: markitect
status: todo
status: done
owner: markitect-tool
topic_slug: markitect
planning_priority: P1
@@ -81,7 +81,7 @@ discovery without forcing dynamic loading or external dependency installation.
```task
id: MKTT-WP-0013-T001
status: todo
status: done
priority: high
state_hub_task_id: "ba106001-c953-435a-8012-0dd83533d309"
```
@@ -101,11 +101,16 @@ Define the internal extension taxonomy:
Output: architecture note explaining extension boundaries, lifecycle,
registration semantics, and relationship to `MKTT-WP-0011`.
Implemented: `docs/internal-extension-framework.md` defines the internal
extension boundary, extension taxonomy, canonical lifecycle, descriptor shape,
processing model, registration strategy, compatibility rules, and
characterization coverage.
## P13.2 - Add characterization tests before refactor
```task
id: MKTT-WP-0013-T002
status: todo
status: done
priority: high
state_hub_task_id: "a270cb7a-4dbf-4562-b0ab-d5dda5124086"
```
@@ -124,11 +129,17 @@ Lock down current behavior before moving code behind registries:
Output: focused characterization tests that can fail loudly if refactoring
changes public behavior.
Implemented: `tests/test_extension_characterization.py` covers selector
query/extraction, JSONPath optional-dependency diagnostics, processor
provenance and diagnostics, backend manifest/capability behavior, local
snapshot/index/search behavior, content references, and representative CLI
output envelopes.
## P13.3 - Define canonical processing model
```task
id: MKTT-WP-0013-T003
status: todo
status: done
priority: high
state_hub_task_id: "8c88b9a7-1e8d-401c-ad09-8b5a19ccba14"
```
@@ -148,11 +159,17 @@ operations without making every extension depend on every subsystem.
Output: framework module, tests, and migration guide for current subsystems.
Implemented: `markitect_tool.extension.processing` defines
`ProcessingRequest`, `ProcessingContext`, `ProcessingResult`,
`ProcessingDiagnostic`, `ProcessingCapability`, `ProcessingProvenance`, and
`ProcessingTrace`, with serialization, cache-key, validity, provenance, trace,
and error normalization tests.
## P13.4 - Implement extension descriptors and registries
```task
id: MKTT-WP-0013-T004
status: todo
status: done
priority: high
state_hub_task_id: "3fb2fe81-9819-4679-99d0-ad60ac9e8277"
```
@@ -176,11 +193,17 @@ and, later, package entry points.
Output: descriptor schema, registry API, duplicate/missing dependency
diagnostics, and tests.
Implemented: `markitect_tool.extension.registry` defines
`ExtensionDescriptor`, `OptionalDependency`, `ExtensionRegistry`,
`ExtensionDependencyCheck`, and `ExtensionRegistryError`, with descriptor
serialization, kind/capability lookup, duplicate-id diagnostics, dependency
checks, and factory instantiation tests.
## P13.5 - Add callback hooks and execution lifecycle
```task
id: MKTT-WP-0013-T005
status: todo
status: done
priority: medium
state_hub_task_id: "be8f2056-f413-44f9-be9c-6046c34e307e"
```
@@ -200,11 +223,15 @@ hidden global behavior.
Output: callback model and tests with fake extensions.
Implemented: `ExtensionLifecycle` and `ExtensionExecutor` provide explicit
before/success/failure/after callbacks, dependency checks before execution,
result type normalization, execution trace emission, and fake-extension tests.
## P13.6 - Refactor query engines behind registry
```task
id: MKTT-WP-0013-T006
status: todo
status: done
priority: high
state_hub_task_id: "0226c1d1-f583-43ad-8e20-f75f9790e17d"
```
@@ -215,11 +242,16 @@ compatibility.
Output: registered selector/jsonpath engines, compatibility shims, and tests.
Implemented: selector and JSONPath engines now live behind
`QueryEngineRegistry` descriptors, with compatibility shims for
`query_document`, `extract_document`, `query_document_jsonpath`, and
`extract_document_jsonpath`; CLI behavior remains unchanged.
## P13.7 - Refactor processors and local backend as registered extensions
```task
id: MKTT-WP-0013-T007
status: todo
status: done
priority: medium
state_hub_task_id: "a966dcbb-3ae8-47bf-85c8-4ba6ddcf7a31"
```
@@ -237,11 +269,16 @@ Focus areas:
Output: extension-backed processor/backend registration and regression tests.
Implemented: `builtin_extension_registry()` now exposes built-in query engines,
deterministic processors, and the local SQLite backend as extension
descriptors with capabilities, safety flags, CLI affordances, docs/examples,
diagnostic namespaces, and provenance prefixes.
## P13.8 - Refactor CLI composition to reduce central wiring
```task
id: MKTT-WP-0013-T008
status: todo
status: done
priority: medium
state_hub_task_id: "3e88ca62-8dba-4632-b5d0-29827d102322"
```
@@ -253,11 +290,17 @@ point.
Output: CLI extension hook, migrated command group examples, and unchanged
public CLI behavior.
Implemented first integration point: `markitect_tool.cli.extensions` derives
`CliCommandSpec` declarations from extension descriptors. Built-in query,
processor, and backend descriptors now expose command affordances such as
`mkt query`, `mkt process`, `mkt cache index`, and `mkt search` without making
the CLI module the only source of command metadata.
## P13.9 - Document extension authoring conventions
```task
id: MKTT-WP-0013-T009
status: todo
status: done
priority: medium
state_hub_task_id: "848e2a5e-c32b-4a94-906b-dc6aced4c71b"
```
@@ -275,6 +318,11 @@ Document how a new internal extension should be structured:
Output: extension authoring guide and one small template/example extension.
Implemented: `docs/extension-authoring.md` documents extension layout,
descriptor template, optional dependency declarations, processing envelopes,
diagnostics, provenance, safety/policy metadata, CLI affordances, tests, and
the boundary with business-facing workflows.
## Exit Criteria
- Existing behavior is covered by characterization tests before refactoring.