6.8 KiB
id, type, title, domain, status, owner, topic_slug, planning_priority, planning_order, depends_on_workplans, related_workplans, created, updated, state_hub_workstream_id
| id | type | title | domain | status | owner | topic_slug | planning_priority | planning_order | depends_on_workplans | related_workplans | created | updated | state_hub_workstream_id | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| MKTT-WP-0015 | workplan | Document Function Value Contracts | markitect | done | markitect-tool | markitect | complete | 130 |
|
|
2026-05-04 | 2026-05-15 | a38f676a-0d0b-493c-9792-2e34480c3681 |
MKTT-WP-0015: Document Function Value Contracts
Purpose
Split the original render-and-function extension plan into a small, Markitect-native core slice: typed document-function values and deterministic value mapping.
The current document-function layer is intentionally small: deterministic functions, Markdown-native explicit syntax, local context variables, diagnostics, provenance, and capability metadata. This workplan should make function outputs more explicit without turning Markitect into a publishing language, renderer, or second workflow engine.
Split Decision - 2026-05-15
The previous MKTT-WP-0015 scope bundled typed values, syntax extensions,
document-local reusable functions, render/export adapters, render-aware
references/assets, and permission sandboxing. That was architecturally too
large for one workplan.
The split is now:
MKTT-WP-0015: typed document-function value contracts inmarkitect-tool.MKTT-WP-0020: render/export adapter contracts inmarkitect-tool.MKTT-WP-0021: render reference and asset manifest contracts inmarkitect-tool.MQD-WP-0001: concrete Quarkdown render adapter work inmarkitect-quarkdown.MKTF-WP-0003: read-side source attachment and asset metadata compatibility inmarkitect-filter.
markitect-filter remains a source normalization repository. It should not own
write/export adapters or renderer execution. Concrete Quarkdown invocation
belongs in markitect-quarkdown; durable render jobs, publication state, and
artifact storage belong outside markitect-tool.
Boundary
markitect-tool owns:
- typed document value contracts
- value-to-Markdown and value-to-JSON mapping
- function descriptor output validation
- deterministic diagnostics and provenance for value coercion
- compatibility notes for future syntax extensions
markitect-tool does not own in this workplan:
- nested function expression parsing
- document-local reusable functions
- render/export adapter execution
- Quarkdown invocation
- filesystem-writing render jobs
- publication lifecycle or durable artifact storage
- concrete source-format filtering
Implementation Summary - 2026-05-15
Implemented the narrowed value-contract slice:
DocumentValueandDOCUMENT_VALUE_KINDS.- Deterministic coercion and Markdown/JSON mapping helpers:
coerce_document_value,format_document_value, anddocument_value_to_json. DocumentFunctionRun.valuewhile preserving the legacy rawoutputfield.- Descriptor
output_typevalidation for string, markdown, dynamic, table, record, reference, content unit, and related value kinds. - Diagnostics for output type mismatches and reference/content-unit values that lack provenance.
- Conservative pipeline depth limit without adding nested function syntax.
- Docs, examples, API exports, extension descriptor metadata, and tests.
Render/export contracts remain in MKTT-WP-0020; render references and asset
manifests remain in MKTT-WP-0021; concrete Quarkdown execution remains in
MQD-WP-0001; read-side source attachment metadata remains in MKTF-WP-0003.
P15.1 - Define typed document values
id: MKTT-WP-0015-T001
status: done
priority: high
state_hub_task_id: "995945c5-6cec-435c-8943-b8da0a9ff89d"
Define a small DocumentValue model for function results:
- string, number, boolean, and none
- Markdown content
- lists and dictionaries
- records and tables
- references and content units
- diagnostics-friendly unknown or dynamic values
The model should serialize cleanly and stay independent of renderer-specific objects.
Output: value dataclasses or schema objects, serialization helpers, tests, and documentation.
P15.2 - Add deterministic value mapping
id: MKTT-WP-0015-T002
status: done
priority: high
state_hub_task_id: "bfce1388-e123-4e91-a5ab-ba67d21c22b8"
Define how each DocumentValue maps to:
- inline Markdown
- block Markdown
- JSON/YAML API output
- diagnostic fallback text for unknown or dynamic values
Mapping must be deterministic, inspectable, and safe to use from
mkt function render.
Output: mapper API, compatibility tests for existing function outputs, and diagnostics examples.
P15.3 - Validate function descriptor output contracts
id: MKTT-WP-0015-T003
status: done
priority: high
state_hub_task_id: "a8a8f017-3622-47f1-814e-0c71bd49a42f"
Extend DocumentFunctionDescriptor output metadata so functions can declare
their result type using the new value vocabulary.
Validation should catch:
- declared output type mismatches
- values that cannot be mapped to Markdown in the requested context
- unstable or dynamic values in deterministic contexts
- missing provenance for reference/content-unit values
Output: descriptor updates, evaluator checks, diagnostics, and tests.
P15.4 - Pin syntax extension boundaries
id: MKTT-WP-0015-T004
status: done
priority: medium
state_hub_task_id: "69e550a0-188b-4bc4-9658-47219b090904"
Document which syntax improvements are still acceptable without replacing the current conservative parser:
- clearer escaping rules
- fenced block-body argument refinements
- line/span reporting improvements
- cycle and depth limits for current pipeline evaluation
Explicitly defer:
- nested function expressions
- document-local function definitions
- conditionals, loops, lambdas, or Turing-complete scripting
- Quarkdown syntax compatibility as a core parser requirement
Output: syntax compatibility note and parser diagnostics tests for the retained scope.
P15.5 - Update examples and extension descriptor metadata
id: MKTT-WP-0015-T005
status: done
priority: medium
state_hub_task_id: "53eb9f94-830b-4fdf-bb47-3f549048c82a"
Update document-function docs, examples, and extension descriptor metadata to show typed outputs without advertising render/export behavior as core function execution.
Output: docs, examples, extension catalog assertions, and generated API/CLI reference updates if the public surface changes.
Exit Criteria
- Core deterministic document functions remain dependency-light.
- Function outputs use explicit typed value contracts.
- Existing Markdown rendering behavior remains compatible.
- Renderer-specific objects and Quarkdown invocation are outside this workplan.
- Richer syntax and reusable local functions are deferred until a concrete use case justifies a parser/evaluator redesign.