feat: project authoring contract choices

This commit is contained in:
lda
2026-08-14 14:33:11 +07:00 Verified
parent e0d48dc0ff
commit dc4682992b
5 changed files with 675 additions and 0 deletions
@@ -0,0 +1,60 @@
# Task 1 Report: Model Schema-Derived Authoring Choices
## Status
Implemented Task 1 of the workflow contract graph backend slice.
## Changes
- Added explicit transport payload types for path options, step contracts, and
revision-scoped authoring inventories.
- Added `schema_path_options`, which derives deterministic parent-before-child
choices from JSON Schema object properties.
- Preserved whole arrays as selectable paths without synthetic wildcard paths.
- Omitted invented child names for unconstrained or open-ended
`additionalProperties`.
- Reused `schema_fragment_at_location` and its bounded local-reference depth for
nested schema fragments and `$defs`/`definitions` references.
- Derived labels from schema titles or humanized path segments and copied only
string descriptions.
- Added pure inventory composition for input/state/context sources, selected
step targets and sources, state/output targets, entry steps, outcomes, and
warnings.
- Re-exported the new payload types through `wf_api.models`.
## Test-First Evidence
The required RED command was run before production implementation:
```text
uv run pytest tests/wf_api/test_authoring_contracts.py -q
```
It failed during collection with:
```text
ModuleNotFoundError: No module named 'wf_api.authoring_contracts'
```
After implementation, the focused authoring-contract tests passed.
## Verification
```text
uv run pytest tests/wf_api/test_authoring_contracts.py tests/wf_api/test_schema_projection.py -q
48 passed
uv run basedpyright --level error src/wf_api/authoring_contracts.py src/wf_api/models/authoring_contracts.py
0 errors, 0 warnings, 0 notes
uv run ruff check src/wf_api/authoring_contracts.py src/wf_api/models/authoring_contracts.py src/wf_api/models/__init__.py tests/wf_api/test_authoring_contracts.py
All checks passed!
uv run ruff format --check src/wf_api/authoring_contracts.py src/wf_api/models/authoring_contracts.py src/wf_api/models/__init__.py tests/wf_api/test_authoring_contracts.py
4 files already formatted
```
## Concerns
None for the Task 1 scope. Runtime-context analysis and persisted workspace or
capability loading remain intentionally deferred to Tasks 2 and 3.