Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.
Output-form descriptor and a payload schema on the output contract (#1186)
Thomas Hebrard0819388d10e4
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 8a9e2f1b1..d739b0cc8 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,6 +7,19 @@- **`make test-ts-gates`** (alias `make ttg`): the TypeScript emission gates, provisioned and made mandatory. The `ts-zod` target promises its bytes are already what prettier would write — a codegen stamp is a hash over those bytes, so anything less has a consumer's first `prettier --write` report an untouched artifact as hand-edited. Two tests actually read the emission rather than measuring its lines: `prettier --check` over it, which is also the only thing that parses it, and running the emitted schema under a real zod against the runtime's own payload. Both were written to skip when node was absent, which in a Python repo meant they skipped in CI and on every developer machine, so the emitter's whole content contract was guarded by nothing. This target installs a pinned prettier and zod into the gitignored `.ts-toolchain/` and runs the codegen suite with `PIPELEX_REQUIRE_TS_GATES=1`, under which a missing binary is a failure instead of a skip; the new `Tests (ts emission gates)` CI job runs the same target behind a node step and blocks through the `Tests (all)` aggregate. An ordinary run on a machine with no node still skips, and now says which command would provision the toolchain. Moving the pinned prettier version is an emitter change rather than a dependency bump: the emitter models that formatter's exact break, quote and object-literal behaviour, so the gate is expected to red and the emitter to be taught what moved. See [TypeScript Emission Gates](contribute/typescript-emission-gates.md).- **`.worktreeinclude`**: the gitignored files a fresh worktree of this repo needs — `.env`, the three `.pipelex/*.toml` overrides and `.pipelex-dev/test_profiles_override.toml` — are now declared in a tracked file at the repo root instead of living in one contributor's shell script. Claude Code reads it when it creates a worktree with git, and the workspace's `wt` tool reads it for the durable ones, so a fresh worktree of `pipelex` arrives configured either way. The file holds only the names of untracked files this repo's `.gitignore` already discloses, never their contents; it was previously gitignored here, which made the mechanism personal and untracked before anyone had used it.++- **`build_output_form` — the output-form descriptor, and a payload schema on the output contract.** The validate report now carries a third artifact, `output_form`, beside `pipe_io_contracts` and `input_form`, and the output contract carries a `json_schema` where it carried none. Both are the MTHDS change the standard landed in the same version, and both close the one real asymmetry between a pipe's two halves: an input had a presentation view and a payload schema; an output had neither, so a tool registry had no return type and a result renderer had to infer a payload's shape by inspecting it.++ **The builder is a projection, not a new derivation.** `InputFormDeriver.derive_concept` — the public method the input derivation already calls for every nested concept-typed field of every input — is what describes an output, because an output is a concept reference exactly like an input is. It stamps no slot facts (`presence` and `gating` are facts of an input slot, and an output is not one), and it iterates the same `result.pipes` as the two builders beside it, so all three artifacts share one key set by construction rather than by intent.++ **The plural wrap is the one place the builder does real work.** Plurality is not on the concept: `concept_ref` is the element with the multiplicity suffix stripped on both sides of the contract, so `derive_concept` describes a concept alone and cannot know it. `build_output_form` reads `pipe.output.multiplicity` and wraps a plural output as a `list` node whose `item` is the element — skipping it would describe one item where a run returns many, silently.++ **The output schema is the PAYLOAD's, which is where it departs from its input twin.** An input's schema states what a caller *sends*, so a plural slot's is a bare array. An output's states what *comes back*, which is a `StuffContent` — so the single arm goes through the same `render_stuff_spec` call the inputs do (a `native.Text` input and a `native.Text` output carry byte-identical schemas), and the plural arm is `ListContent[structure_class]`, asked of pydantic rather than hand-built: a hand-built envelope is a second declaration of a runtime type and stops tracking it the moment it changes. On the fixed arm the element array carries `minItems`/`maxItems` equal to `item_count`, since `ListContent` states no bounds of its own and a `Concept[N]` output would otherwise be indistinguishable from a `Concept[]` one by schema alone.++ `generate-projection-corpus` emits `output_form.json` alongside its two siblings, and a new corpus bundle covers outputs specifically — flat and nested structures, both plural arms, an optional output, a wrapping native scalar and a file-bearing one. It exists because every bundle before it resolved to `Text`: a corpus whose every pipe outputs one native scalar can only capture one output descriptor and one output schema.++ Requires `mthds` 0.12.0.+- **`pipelex-dev generate-projection-corpus`**: The generator of the shared fixture corpus that pins the two client-side inputs-template projections — the TypeScript one in `mthds` and its Python twin — against each other. Each client SDK now renders a pipe's fill-in template from the input-form descriptor it already has instead of asking a server for one, so the two renderings have to agree exactly, TOML `# concept:` comment lines included. The command pairs each pipe's descriptor with the expected template in both shapes (compact and explicit) and both formats (JSON and TOML), and records where that expectation deliberately differs from this engine's own inputs-template renderer: the expectation is authored from a reference projection that walks the descriptor, where the engine reflects the runtime content classes. Each class of difference is declared rather than discovered — an undeclared one fails the run, and so does a declared one that no longer occurs, so an engine fix retires its entry deliberately. A new corpus bundle covers what the existing probe bundles did not: a text field merely named `url` beside a real file position, optional file fields nested inside a structure, and both a fixed `[N]` and a variable `[]` slot over a structured concept. See [Projection Fixture Corpus](contribute/generate-projection-corpus.md).- **The projection corpus round-trips every template it pins through the input shaper**: `pipelex-dev generate-projection-corpus` now hands each projected template straight back to the runtime — both shapes, assembled exactly as an entry-pipe run assembles a caller's inputs — because a fill-in template exists to be filled in and run, and nothing checked that before. Twice the corpus pinned slots the runtime rejects outright and a human review round caught it rather than the capture; the second time the divergence gate absorbed the broken sites into a declared class and exited zero, since "differs from the engine" and "the engine refuses this value" are different questions. The verdict follows the same declared-never-discovered discipline as the divergence record, through an `EXPECTED_UNSHAPEABLE` registry mapping a pipe and shape to the item tracking the gap: an undeclared refusal fails the command naming the pipe, shape and error, a declared entry whose template has started shaping fails it too so a fix retires its declaration deliberately, and a declared one is stated in the manifest as an `unshapeable` entry carrying the contract-stable error class and its ledger item — so a known-open gap is recorded rather than blocking the capture. See [Projection Fixture Corpus](contribute/generate-projection-corpus.md).- **Include a method by address — fetch-on-miss**: a bundle referencing another method by address (`github.com/...->domain.pipe`) that misses the installed methods now fetches the package by reference — honoring an `@<tag>` pin, through the same grammar, bounds, and tags-only rules as a direct fetch, with the same hosted-parity warning for Python structure classes locally and a hard refusal on sandbox-hosted deployments — installs it into `~/.mthds/methods/` (atomic staging write, `.git/` stripped, fetch provenance recorded beside the manifest in a `.provenance.json` sidecar: address, tag, and the resolved commit SHA), and loads it so resolution proceeds. Once installed, the method is reused and the network is never touched again — including for a reference pinning a different tag, which warns and uses the installed copy. The former silent-miss warning in the library manager is now a real diagnostic: a miss that cannot be bridged (fetch disabled via the new `[interpreter.methods] fetch_on_miss` config or the `PIPELEX_METHODS_FETCH_ON_MISS` environment variable, an unfetchable address, or a failed fetch) raises an error naming the address and the remedy, never a silent pass. The install target is guarded by identity: two packages sharing a bare directory name but coming from different addresses collide with a loud error naming both addresses (never a silent load of the wrong package, never an overwrite), a concurrent install of the same package is tolerated (each attempt stages under a unique dot-prefixed directory, and losing the final rename race to a matching occupant uses the winner's copy), and a fetched package containing a symlink is refused outright, since a link's target would bypass the content scans. Installed-method lookup by full address is now case-insensitive, matching GitHub's owner/repository semantics and the fetch path's manifest-identity matching, and discovery skips dot-prefixed directories. See [Packages → Include by Address](building-methods/packages.md) and [Methods Configuration](configuration/config-practical/methods-config.md).@@ -34,6 +47,11 @@- **A `native.JSON` input produced a fill-in template the runtime refused**: the input-form deriver grouped `native.JSON` with the three natives the standard calls structureless — `Dynamic`, `Anything` and `Composite` — so its descriptor node was `unknown`, which every inputs-template projection renders as the empty object. But `JSON` is not structureless: its pinned blueprint carries a required `json_obj`, and `JSONContent` refuses a payload without it, so the template a caller was handed for a `JSON` input could never be filled in and submitted. It now expands through the same pinned-structure arm as `Date`, `Html`, `Page`, `TextAndImages` and `SearchResult`, rendering `{"json_obj": {}}`, which the input shaper takes back. The engine's own `_pinned_structure` already drew the line in exactly this place — it returns a structure for `JSON` and `None` for the other three — so the deriver is now consistent with it, and the empty object stays the honest rendering for the natives that genuinely withhold their shape. The shared projection corpus gained a pipe covering all three of the natives it can reach at a slot position, which is where the defect had been sitting unmeasured. See [Projection Fixture Corpus](contribute/generate-projection-corpus.md).- **A `native.Dynamic` input referenced in a `PipeLLM` prompt no longer fails dry-run validation demanding `ImageContent`**: the prompt analyzers decided whether a variable is a direct image (or document) by asking `is_compatible`, and `Dynamic`'s universal compatibility short-circuits that to `True` — so the analyzer recorded a direct image reference for a slot whose content the caller decides, and every legal bundle mentioning a `Dynamic` input in a prompt was refused at validation. A dynamic root concept now gets no static classification in either analyzer — the question is "is this definitely an X", which universal compatibility cannot answer — matching the guard shape the codebase already used in `PipeLLM.validate_output_with_library` and the input shaper. A `Dynamic` prompt variable renders as text, as it already did in `PipeCompose` templates; authors who want image or document attachment declare `Image`/`Document` (or a refining concept), and `| with_images` on a `Dynamic` variable stays refused. The document analyzer carried the identical latent bug, previously masked by the image misclassification, and gets the same guard. The same analyzer serves `PipeImgGen`'s positive and negative prompts, so the rule lands there too. One live behaviour is given up deliberately and is worth knowing: a `Dynamic` slot does not force `DynamicContent` — the input shaper hands the raw value to the bottom-up factory, so a caller passing an `ImageContent` into a `Dynamic` slot produced a `native.Image` stuff, which the direct reference then attached to the prompt. Attachment is now decided from the declared concept alone, so that image renders as text instead; declare the slot `Image` to keep it reaching the model. See [PipeLLM](building-methods/pipes/pipe-operators/PipeLLM.md).- **A bad pipeline-input url survives STRICT disclosure as caller-facing copy**: `PipelineInputContentError` declared `caller_facing_message = True`, which is the name of the *report field*, not of the class-level flag that sets it (`_authors_caller_facing_message`). The declaration therefore did nothing, and the message a caller who simply omitted a url needs to see — the one listing the accepted schemes — was replaced by the generic internal-error placeholder on any surface serializing in STRICT mode, exactly the redaction the declaration was written to prevent. Repairing the flag also revealed why the class could not carry it as it stood: its other raise site reports an unreadable local path, and that message names the resolved path and the `OSError` subclass that rejected it, which would have made STRICT answer "does this server-side path exist, and may the runner read it?" for any authenticated caller of a deployment leaving `is_upload_local_content_enabled` on. The family is therefore split: `PipelineInputUrlMissingError` carries the blank-url message and is caller-facing, while `PipelineInputContentError` keeps the unreadable-path message and stays redacted. Both are pinned in the class-level-metadata sweep, in both directions.++- **`HtmlContent`'s JSON rendering emitted a member the standard does not define, and omitted the one it requires.** `rendered_json` renamed `inner_html` to `html`, so a `native.Html` result serialized as `{"html": …}` while the concept — pinned by the standard, projected into the output contract's schema, and described by the output-form descriptor — states `inner_html`, required. A consumer reading the contract found the required member absent and an undefined one in its place. The override is deleted: the JSON rendering is now the model's own dump, member for member, like every other content class.++ Found by a real run, and only findable by one: the payload is what a run produced, so no projection of a declaration could have disagreed with itself. It became a *bug* rather than a quirk the moment the output contract started carrying a schema — before that, nothing published the shape the payload was failing to match.+- **The projection corpus's divergence gate sees every engine/projection difference**: `pipelex-dev generate-projection-corpus` states that every difference between the reference projection and the engine's own renderer lands in a declared class, and that an undeclared one fails the command — but the walk missed differences in one direction and absorbed regressions into existing classes in the other, so a projection defect could pass generation green and be committed into `mthds-js` and `mthds-python` as contract bytes. The dict walk iterated only the projected keys, so a field the projection stopped rendering was never compared at all; it is now recorded under an id deliberately absent from the declared reasons, which makes the record refuse rather than pass. The file-leaf arm returned on the expansion without ever comparing the URL both sides carry, where plain recursion would have handed a regressed placeholder to the url-named-text class that absorbs it; the shared keys are now compared strictly. And `fixed-count-honoured` fired on any list longer than the engine's single element, which cannot tell an honoured `Concept[N]` from a wrong count or from a variable `[]` slot wrongly duplicated; it now consults the slot's declared `item_count`, taken from the descriptor. Separately, a pipe declaring no inputs used to abort the whole capture — an empty input form is valid and the projection renders it as `{}`, but the engine's renderer refuses one — and is now captured from the projection alone, with no engine half and nothing compared. Re-measuring the same corpus produces bytes identical to the committed capture, with the same classes at the same counts. See [Projection Fixture Corpus](contribute/generate-projection-corpus.md).- **`--help` works again on every `method` subcommand**: `pipelex validate method`, `pipelex run method`, the three `pipelex build ... method` commands and their agent-CLI twins all crashed with a rich `MarkupError` traceback instead of printing their help. The method-address example in each command's `NAME` argument help — `github.com/owner/repo[/name][@tag]` — reaches rich's markup parser through typer, which read `[/name]` as a closing tag with no opening one. The brackets are escaped at each of the sites, so the example renders as written and the help exits zero.- **Class-backed concepts reflect field by field in the input-form descriptor**: a concept declaring `structure = "SomeClass"` used to collapse to `kind: "unknown"` the moment one field annotation could not be mapped, taking every sibling field with it — and a nested non-native pydantic model was reported as an opaque payload rather than walked into. Every `document` and `image` position beneath such a concept disappeared from the descriptor, so a consumer preparing inputs from it passed a local file path at one of those positions through un-uploaded and the run failed on the unresolved path. Reflection is now partial: each annotation is mapped on its own, an unmappable one is `unknown` at that field alone, a nested model is an `object` the reflection walks into, a `list[X]` reports its element node, and a class that holds itself is cut at the revisit instead of recursing. A `RootModel` is reported as its root annotation's node wherever it appears — as a field of a reflected class, and as the registered class backing the concept itself — because the value it accepts is the root value, so the descriptor no longer states an object over a synthetic `root` key that contradicts the `json_schema` derived beside it. The native consistency probe keeps its faithful-or-absent rule — it is compared against a normative pinned blueprint, where a plausible-looking partial answer would be the failure — and the two reflections now share one annotation vocabulary (`pipelex/core/concepts/annotation_shapes.py`) instead of one calling the other. See [Input-Form Descriptor](under-the-hood/input-form-descriptor.md).diff --git a/pipelex/cli/dev_cli/commands/generate_projection_corpus_cmd.py b/pipelex/cli/dev_cli/commands/generate_projection_corpus_cmd.pyindex c389b0a7f..887cb4487 100644--- a/pipelex/cli/dev_cli/commands/generate_projection_corpus_cmd.py+++ b/pipelex/cli/dev_cli/commands/generate_projection_corpus_cmd.py@@ -8,9 +8,10 @@ measured property rather than an aspiration.What this command writes into the output directory:-- ``input_form.json`` / ``pipe_io_contracts.json`` — the descriptor and contract capture, byte for- byte what ``trace-input-semantics`` dumps at hop 5. This command is the sole producer of the- committed copies; the tracer stays a debugging tool.+- ``input_form.json`` / ``output_form.json`` / ``pipe_io_contracts.json`` — the descriptor and+ contract capture, byte for byte what ``trace-input-semantics`` dumps at hop 5. This command is the+ sole producer of the committed copies; the tracer stays a debugging tool. All three share one key+ set, because all three iterate the same ``result.pipes``.- ``inputs_template/<pipe_ref>.<shape>.<format>`` — the expected template, from the referenceprojection in ``projection_reference.py``.- ``inputs_template/manifest.json`` — the pipes covered and the declared divergences from the@@ -63,7 +64,7 @@ from pipelex.pipe_machinery.rendering.input_renderer import ()from pipelex.pipelex import Pipelexfrom pipelex.pipeline.exceptions import ValidateBundleError-from pipelex.pipeline.input_form import ListField, PipeInputFormDescriptor, build_input_form+from pipelex.pipeline.input_form import ListField, PipeInputFormDescriptor, build_input_form, build_output_formfrom pipelex.pipeline.pipe_io_contracts import build_pipe_io_contractsfrom pipelex.pipeline.validate_bundle import validate_bundlefrom pipelex.runtime_hub import get_console@@ -73,6 +74,7 @@ if TYPE_CHECKING:from mthds.protocol.pipeline_inputs import PipelineInputsINPUT_FORM_FILE_NAME = "input_form.json"+OUTPUT_FORM_FILE_NAME = "output_form.json"PIPE_IO_CONTRACTS_FILE_NAME = "pipe_io_contracts.json"TEMPLATES_DIR_NAME = "inputs_template"ENGINE_DIR_NAME = "engine"@@ -604,6 +606,11 @@ async def generate_projection_corpus(*, bundle_paths: list[Path], output_dir: Papath=output_dir / INPUT_FORM_FILE_NAME,payload={pipe_ref: descriptor.model_dump(mode="json") for pipe_ref, descriptor in input_form.items()},)+ output_form = build_output_form(result.pipes)+ _write_json(+ path=output_dir / OUTPUT_FORM_FILE_NAME,+ payload={pipe_ref: descriptor.model_dump(mode="json") for pipe_ref, descriptor in output_form.items()},+ )io_contracts = build_pipe_io_contracts(result.pipes)_write_json(path=output_dir / PIPE_IO_CONTRACTS_FILE_NAME,diff --git a/pipelex/core/stuffs/html_content.py b/pipelex/core/stuffs/html_content.pyindex 915be5235..ce9f478f8 100644--- a/pipelex/core/stuffs/html_content.py+++ b/pipelex/core/stuffs/html_content.py@@ -1,5 +1,3 @@-import json-from pydantic import Fieldfrom typing_extensions import override@@ -41,9 +39,3 @@ class HtmlContent(StuffContent):@overridedef rendered_markdown(self, *, level: int = 1, is_pretty: bool = False) -> str:return self.inner_html-- @override- def rendered_json(self) -> str:- if self.css_class is None:- return json.dumps({"html": self.inner_html})- return json.dumps({"html": self.inner_html, "css_class": self.css_class})diff --git a/pipelex/pipeline/input_form.py b/pipelex/pipeline/input_form.pyindex 2cd4a91b0..7b732eede 100644--- a/pipelex/pipeline/input_form.py+++ b/pipelex/pipeline/input_form.py@@ -74,6 +74,7 @@ from mthds.protocol.input_form import (UnknownField,UnknownItem,)+from mthds.protocol.output_form import OutputForm, PipeOutputFormDescriptorfrom pydantic import BaseModel, TypeAdapterfrom pydantic.fields import FieldInfofrom pydantic_core import PydanticUndefined@@ -123,7 +124,9 @@ __all__ = ["NumberItem","ObjectField","ObjectItem",+ "OutputForm","PipeInputFormDescriptor",+ "PipeOutputFormDescriptor","ProseField","ProseItem","TextField",@@ -132,10 +135,22 @@ __all__ = ["UnknownField","UnknownItem","build_input_form",+ "build_output_form","qualify_current_library_crate",]+_OUTPUT_NODE_NAME = "output"+"""The `name` an output node carries.++An input's name is authored by the method; an output has none. The node type requires one+because it is the named half of the union — the nameless half is what a `list`'s `item`+holds — so a producer must state something, and the standard fixes this. Nothing displays+it: a result is labelled by its concept, a list entry by its index, exactly as the+input-form page already rules for list items. It is an address, not a label.+"""++def build_input_form(pipes: Sequence[PipeAbstract], *, qualified_crate: QualifiedCrateContent | None = None) -> InputForm:"""Derive the `input_form` descriptors of loaded pipes from the authored blueprints of the current library.@@ -172,6 +187,62 @@ def build_input_form(pipes: Sequence[PipeAbstract], *, qualified_crate: Qualifiereturn input_form+def build_output_form(pipes: Sequence[PipeAbstract], *, qualified_crate: QualifiedCrateContent | None = None) -> OutputForm:+ """Derive the `output_form` descriptors of loaded pipes — what each pipe RESOLVES TO, described.++ The twin of `build_input_form`, iterating the same pipes in the same order so all three+ validate artifacts share one key set, and reusing the same deriver: an output is a concept ref+ exactly like an input is, so its kinds, its nesting and its constraints are the same questions+ with the same answers. `derive_concept` is the entry point that describes a concept on its own,+ which is precisely what an output is — a node belonging to no slot. It is not a new code path+ either: it is what runs for every nested concept field of every input.++ Two things this does that `derive_slot` does for an input, and one it deliberately does not.++ It performs the **plural wrap**, because plurality is not on the concept: `concept_ref` is the+ element with the multiplicity suffix stripped, on both sides of the contract, so a `Concept[]`+ output must become a `list` node whose `item` is the element. `derive_slot` knows the slot's+ multiplicity and does this; `derive_concept` describes a concept alone and cannot. Skipping it+ fails silently — the descriptor would say one item where a run produces many — so it is here,+ read off `pipe.output.multiplicity`, the same source the contract's `multiplicity` comes from.++ It names the node `output`. An input's name is authored; an output has none, and the node type+ requires one because it is the named half of the union. Nothing reads it: a result is labelled+ by its concept and a list entry by its index.++ It stamps **no slot facts**. `presence` and `gating` are facts of an input slot — `!` may not+ appear on an output, `?` is stated by the contract's `optional`, and nothing waits on a result.+ Both members are optional on the node for exactly this reason, and+ `PipeOutputFormDescriptor` rejects a producer that fills them in anyway.++ Args:+ pipes: The loaded pipes to describe (typically `ValidateBundleResult.pipes`).+ qualified_crate: The current library's already-qualified crate, when the caller holds one —+ the same optimisation, and the same reason, as `build_input_form`.++ Returns:+ `pipe_ref` → `PipeOutputFormDescriptor` for every given pipe.+ """+ qualified = qualified_crate if qualified_crate is not None else qualify_current_library_crate()+ deriver = InputFormDeriver(concepts=qualified.concepts)+ output_form: OutputForm = {}+ for pipe in pipes:+ node = deriver.derive_concept(name=_OUTPUT_NODE_NAME, concept_ref=pipe.output.concept.concept_ref)+ if pipe.output.is_multiple():+ node = ListField(+ name=_OUTPUT_NODE_NAME,+ concept_ref=node.concept_ref,+ refines=node.refines,+ description=node.description,+ required=True,+ hints=node.hints,+ item=_as_list_item(node=node),+ item_count=fixed_item_count(multiplicity=pipe.output.multiplicity),+ )+ output_form[pipe.pipe_ref] = PipeOutputFormDescriptor(field=node)+ return output_form++def qualify_current_library_crate() -> QualifiedCrateContent:"""The current library's accumulated crate, qualified — empty when the library holds none.diff --git a/pipelex/pipeline/pipe_io_contracts.py b/pipelex/pipeline/pipe_io_contracts.pyindex 52969f576..880c4f463 100644--- a/pipelex/pipeline/pipe_io_contracts.py+++ b/pipelex/pipeline/pipe_io_contracts.py@@ -28,14 +28,16 @@ the library that defined them. They still do — what changed is that this buildreaches them behind the library's back. (Registry teardown hygiene is tracked separately.)"""-from typing import Any, Sequence+from typing import Any, Sequence, castfrom mthds.protocol.pipe_io_contracts import IOMultiplicity, PipeInputContract, PipeIOContract, PipeIOContracts, PipeOutputContract-from pydantic import PydanticUndefinedAnnotation, PydanticUserError+from pydantic import BaseModel, PydanticUndefinedAnnotation, PydanticUserError+from pipelex.core.concepts.concept_provider_abstract import ConceptProviderAbstractfrom pipelex.core.concepts.concept_representation_generator import ConceptRepresentationFormatfrom pipelex.core.concepts.exceptions import ConceptValueErrorfrom pipelex.core.pipes.variable_multiplicity import VariableMultiplicity, fixed_item_count, is_multiple_multiplicity+from pipelex.core.stuffs.list_content import ListContentfrom pipelex.interpreter_hub import get_concept_libraryfrom pipelex.pipe_machinery.pipe_abstract import PipeAbstractfrom pipelex.pipeline.exceptions import PipeIOContractError@@ -65,6 +67,71 @@ def make_io_multiplicity(*, multiplicity: VariableMultiplicity | None) -> tuple[return IOMultiplicity.SINGLE, None+def _render_output_schema(*, pipe: PipeAbstract, concept_provider: ConceptProviderAbstract) -> dict[str, Any]:+ """The JSON Schema of the payload a pipe resolves to — its concept's content model.++ **This is where the output side departs from the input side, and the departure is the point.**+ An input's schema describes what a CALLER SENDS, so a plural slot's is a bare array: that is+ the shape the caller hands over. An output's schema describes what COMES BACK, and what comes+ back is a `StuffContent` — so a plural output's payload is a `ListContent`, an object holding+ its elements under `items`, never a bare array. Emitting the input side's plural rule here+ would state a shape no run produces, which is worse than stating none: a consumer reading it+ would unwrap by a property that is not there.++ On the single arm the two sides agree exactly, and deliberately so — the same+ `render_stuff_spec` call the inputs go through, so a `native.Text` output and a `native.Text`+ input carry byte-identical schemas.++ On the plural arm the envelope is asked of pydantic (`ListContent[structure_class]`) rather+ than hand-built. A hand-built copy would be a second declaration of a runtime type, and it+ would stop tracking that type the moment it changed — silently, because a wrong envelope still+ parses as a schema.+ """+ try:+ if not pipe.output.is_multiple():+ # The single arm needs no structureless special case: `render_stuff_spec` handles+ # `native.Anything` itself, publishing the permissive schema with the concept's+ # identity annotations. Short-circuiting to a bare `{}` here would be strictly+ # worse — it would drop the `title`/`description` every rendered schema is+ # supposed to carry.+ rendered = pipe.output.render_stuff_spec(concept_provider=concept_provider, output_format=ConceptRepresentationFormat.SCHEMA)+ return cast("dict[str, Any]", rendered["content"])+ if not pipe.output.concept.declares_a_structure_class:+ # The plural arm is where structureless still needs saying, because the envelope+ # is parametrized by a class and `native.Anything` deliberately has none. The+ # envelope is still the right answer — a plural output's payload IS a+ # `ListContent` — so it is asked of pydantic UNPARAMETRIZED, whose `items` are+ # then bounded by nothing. That states exactly what is true: a list envelope+ # holding values no schema constrains.+ return ListContent.model_json_schema()+ structure_class = concept_provider.get_structure_class(concept=pipe.output.concept)+ # Parametrizing a generic with a class held in a variable is a runtime operation both type+ # checkers read as a type expression, so both are told to stand down here rather than the+ # envelope being hand-built to please them.+ list_content_model = cast(+ "type[BaseModel]",+ ListContent[structure_class], # type: ignore[valid-type] # pyright: ignore[reportInvalidTypeArguments]+ )+ schema = list_content_model.model_json_schema()+ item_count = fixed_item_count(multiplicity=pipe.output.multiplicity)+ if item_count is not None:+ # The fixed arm's bounds, stated on the ELEMENT array inside the envelope — the input+ # side puts them on its bare array, and the same fact belongs in the same place+ # relative to the elements. `ListContent` states no bounds of its own (its field is a+ # plain `list`), so a `Concept[N]` output would otherwise be indistinguishable from a+ # `Concept[]` one by schema alone.+ #+ # The property is looked up rather than spelled: it is the envelope model's own field+ # name, and hardcoding it would fail SILENTLY — a renamed field would leave the bounds+ # written onto a key nothing reads.+ elements_key = next(iter(ListContent.model_fields))+ schema["properties"][elements_key] |= {"minItems": item_count, "maxItems": item_count}+ return schema+ except (ConceptValueError, KeyError, PydanticUserError, PydanticUndefinedAnnotation) as exc:+ msg = f"Failed to render the JSON Schema for the output of pipe '{pipe.pipe_ref}' (concept '{pipe.output.concept.concept_ref}'): {exc}"+ raise PipeIOContractError(message=msg) from exc++def build_pipe_io_contracts(pipes: Sequence[PipeAbstract]) -> PipeIOContracts:"""Project loaded pipes into `pipe_io_contracts` entries keyed by namespaced `pipe_ref`.@@ -134,6 +201,7 @@ def build_pipe_io_contracts(pipes: Sequence[PipeAbstract]) -> PipeIOContracts:multiplicity=output_multiplicity,item_count=output_item_count,optional=pipe.output.presence.is_optional,+ json_schema=_render_output_schema(pipe=pipe, concept_provider=concept_provider),)io_contracts[pipe.pipe_ref] = PipeIOContract(inputs=pipe_inputs, output=pipe_output)return io_contractsdiff --git a/pipelex/pipeline/validate_in_process.py b/pipelex/pipeline/validate_in_process.pyindex 0c90d635b..b44a9fc3f 100644--- a/pipelex/pipeline/validate_in_process.py+++ b/pipelex/pipeline/validate_in_process.py@@ -30,7 +30,7 @@ from pipelex.pipe_run.dry_run_in_process import best_effort_graph_specfrom pipelex.pipeline.advisory_warnings import build_advisory_warningsfrom pipelex.pipeline.blueprint_selection import collect_entry_pipe_refs, select_primary_blueprintfrom pipelex.pipeline.controller_taint import collect_controller_taint_analyses-from pipelex.pipeline.input_form import InputForm, build_input_form, qualify_current_library_crate+from pipelex.pipeline.input_form import InputForm, OutputForm, build_input_form, build_output_form, qualify_current_library_cratefrom pipelex.pipeline.liftable_pipes import LiftablePipeEntry, build_liftable_pipesfrom pipelex.pipeline.pipe_io_contracts import PipeIOContracts, build_pipe_io_contractsfrom pipelex.pipeline.validate_bundle import validate_bundle@@ -110,6 +110,9 @@ async def validate_bundles_in_process(# One crate qualification per validate pass — the descriptors and the hint lint read the same one.qualified_crate = qualify_current_library_crate()input_form: InputForm = build_input_form(result.pipes, qualified_crate=qualified_crate)+ # The output half, off the same qualification and the same pipe order — all three+ # artifacts share one key set because all three iterate `result.pipes`.+ output_form: OutputForm = build_output_form(result.pipes, qualified_crate=qualified_crate)# One taint walk per validate pass — both report projections read the same analyses.taint_analyses = collect_controller_taint_analyses(result.pipes)liftable_pipes: list[LiftablePipeEntry] = build_liftable_pipes(taint_analyses)@@ -151,6 +154,7 @@ async def validate_bundles_in_process(blueprints=result.blueprints,pipe_io_contracts=pipe_io_contracts,input_form=input_form,+ output_form=output_form,liftable_pipes=liftable_pipes,dry_run_result=result.dry_run_result,pending_signatures=result.pending_signatures,diff --git a/pipelex/pipeline/validation_report.py b/pipelex/pipeline/validation_report.pyindex f94a4d909..be51dffc8 100644--- a/pipelex/pipeline/validation_report.py+++ b/pipelex/pipeline/validation_report.py@@ -22,7 +22,7 @@ from pipelex.graph.graphspec import GraphSpecfrom pipelex.mthds_parsing.pipelex_bundle_blueprint import PipelexBundleBlueprintfrom pipelex.pipeline.blueprint_selection import select_primary_blueprintfrom pipelex.pipeline.bundle_validator import DryRunOutput-from pipelex.pipeline.input_form import InputForm+from pipelex.pipeline.input_form import InputForm, OutputFormfrom pipelex.pipeline.liftable_pipes import LiftablePipeEntryfrom pipelex.pipeline.pipe_io_contracts import PipeIOContractsfrom pipelex.pipeline.validate_bundle import ValidatedPipeEntry, build_validated_pipes@@ -56,6 +56,15 @@ class PipelexValidationReport(ValidationReport):so a backend that forgets it fails loudly instead of shipping an empty view. The HTTP routedecides whether the field travels on the wire (absent unless a caller opts in via `views`)."""+ output_form: OutputForm+ """Per-pipe output-form descriptors — what each pipe RESOLVES TO, described with the same node+ vocabulary the input form uses, because an output is a concept ref exactly like an input is.+ Keyed exactly like `pipe_io_contracts`. Required and defaultless for the same reason+ `input_form` is: a backend that forgets it must fail loudly rather than ship an empty view.+ Read with `pipe_io_contracts[...].output.json_schema`, which states the payload's shape — the+ descriptor says what the field IS, the schema names the property it arrives under, and neither+ is sufficient alone."""+liftable_pipes: list[LiftablePipeEntry] = Field(default_factory=empty_list_factory_of(LiftablePipeEntry))"""Pipes that may be skipped (lifted) when an optional slot resolves absent — thebuild-time visibility that the implicit-lifting design (D3) commits to."""@@ -84,6 +93,7 @@ def build_validation_report(blueprints: Sequence[PipelexBundleBlueprint],pipe_io_contracts: PipeIOContracts,input_form: InputForm,+ output_form: OutputForm,dry_run_result: dict[str, DryRunOutput],pending_signatures: list[str],graph_spec: GraphSpec | None = None,@@ -100,6 +110,7 @@ def build_validation_report(blueprints: The validated batch's blueprints, in declaration order (non-empty).pipe_io_contracts: Per-pipe contracts from `build_pipe_io_contracts`, keyed by `pipe_ref`.input_form: Per-pipe input-form descriptors from `build_input_form`, keyed by `pipe_ref`.+ output_form: Per-pipe output-form descriptors from `build_output_form`, keyed the same way.dry_run_result: The sweep's per-pipe status map (`ValidateBundleResult.dry_run_result`).pending_signatures: Library-wide unsatisfied signature refs.graph_spec: Best-effort graph of the declared main pipe, when one was produced.@@ -113,6 +124,7 @@ def build_validation_report(bundle_blueprint=select_primary_blueprint(blueprints).blueprint,pipe_io_contracts=pipe_io_contracts,input_form=input_form,+ output_form=output_form,liftable_pipes=liftable_pipes or [],graph_spec=graph_spec,validated_pipes=build_validated_pipes(dry_run_result),diff --git a/pyproject.toml b/pyproject.tomlindex 2ab7ef1a9..64b04f9e8 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -31,7 +31,7 @@ dependencies = ["json2html>=1.3.0","kajson==0.7.1","markdown>=3.6",- "mthds==0.11.1",+ "mthds==0.13.0","networkx>=3.4.2","openai>=2.0.0","opentelemetry-api",@@ -502,6 +502,7 @@ runtime-evaluated-base-classes = [[tool.uv]required-version = ">=0.7.2"+[tool.hatch.build.targets.wheel]packages = ["pipelex"]exclude = ["pipelex/cli/dev_cli"]diff --git a/subject_grants.toml b/subject_grants.tomlindex 2a7493224..5933b6d4f 100644--- a/subject_grants.toml+++ b/subject_grants.toml@@ -4632,6 +4632,10 @@ rationale = "Verb-object read: the slot value whose hints are extracted."param = "pipes"rationale = "Reads as a verb-object sentence over the loaded pipes, mirroring build_pipe_io_contracts."+["pipelex/pipeline/input_form.py::build_output_form"]+param = "pipes"+rationale = "The output twin of build_input_form; the two are called side by side and must read alike."+["pipelex/pipeline/input_normalizer.py::_normalize_list"]param = "items"rationale = "Verb-object: normalizes the items; context stays keyword."diff --git a/tests/data/input_semantics/output_bundle.mthds b/tests/data/input_semantics/output_bundle.mthdsnew file mode 100644index 000000000..e90aa95ab--- /dev/null+++ b/tests/data/input_semantics/output_bundle.mthds@@ -0,0 +1,121 @@+domain = "input_semantics_output"+description = "OUTPUT_bundle_desc: the cases an output-form descriptor and an output payload schema must get right — every authored fact carries an OUTPUT_ sentinel so its survival is greppable in every capture"+main_pipe = "output_structured"++# The three bundles beside this one all resolve to `Text`, which is why this one exists: a corpus+# whose every pipe outputs the same native scalar can only ever capture one output descriptor and+# one output schema, and the two facts most likely to be got wrong — the plural wrap on the+# descriptor, and the list content model on the schema — would never appear in it at all.++[concept.Verdict]+description = "OUTPUT_desc_concept_Verdict: a flat structured result, so an output descriptor recurses at least once"++[concept.Verdict.structure]+label = { type = "text", description = "OUTPUT_desc_field_label: the verdict itself", required = true, choices = [+ "accepted",+ "rejected",+ "deferred",+] }+confidence = { type = "number", description = "OUTPUT_desc_field_confidence: how sure, 0 to 1", required = true }+rationale = { type = "text", description = "OUTPUT_desc_field_rationale: why it landed there" }++[concept.Finding]+description = "OUTPUT_desc_concept_Finding: one element of a plural result"++[concept.Finding.structure]+summary = { type = "text", description = "OUTPUT_desc_field_summary: what was found", required = true }+severity = { type = "integer", description = "OUTPUT_desc_field_severity: how bad, 1 to 5", required = true }++[concept.Dossier]+description = "OUTPUT_desc_concept_Dossier: a nested structured result carrying a date and a list of concepts"++[concept.Dossier.structure]+reference = { type = "text", description = "OUTPUT_desc_field_reference: the dossier reference", required = true }+opened_on = { type = "date", description = "OUTPUT_desc_field_opened_on: when it was opened", required = true }+settled = { type = "boolean", description = "OUTPUT_desc_field_settled: whether it is closed" }+findings = { type = "list", item_type = "concept", item_concept_ref = "Finding", description = "OUTPUT_desc_field_findings: a NESTED list, which stays a bare array on the wire", required = true }++# A single structured output: the descriptor recurses, and the payload schema is the structure+# itself — a structured concept IS its own content model, so nothing wraps it.+[pipe.output_structured]+type = "PipeLLM"+description = "OUTPUT_pipe_output_structured: a flat structured output"+inputs = { note = "Text" }+output = "Verdict"+prompt = """+OUTPUT_prompt_output_structured+@note+"""++# A nested structured output. The interesting half is `opened_on`: a `date` FIELD inside a+# structure is not a `native.Date` value, and `findings` is a nested list, which is a bare array+# on the wire where a top-level plural output is not.+[pipe.output_nested]+type = "PipeLLM"+description = "OUTPUT_pipe_output_nested: a structured output nesting a date and a list of concepts"+inputs = { note = "Text" }+output = "Dossier"+prompt = """+OUTPUT_prompt_output_nested+@note+"""++# The one that used to be impossible to get right from the contract alone. `concept_ref` names+# `Finding` with the suffix stripped, on BOTH sides, so a producer that does not read+# `multiplicity` describes one finding where a run returns many. The descriptor must be a `list`,+# and the payload schema must be the list content model rather than a bare array.+[pipe.output_plural]+type = "PipeLLM"+description = "OUTPUT_pipe_output_plural: a variable plural output"+inputs = { note = "Text" }+output = "Finding[]"+prompt = """+OUTPUT_prompt_output_plural+@note+"""++# The fixed arm of the same wrap: `item_count` rides the descriptor's list node and the contract's+# `item_count` alike, and the schema's element array carries the matching bounds.+[pipe.output_fixed_plural]+type = "PipeLLM"+description = "OUTPUT_pipe_output_fixed_plural: a fixed-count plural output"+inputs = { note = "Text" }+output = "Finding[3]"+prompt = """+OUTPUT_prompt_output_fixed_plural+@note+"""++# An optional output. `optional: true` says a SUCCESSFUL run may leave it absent — so the schema+# describes the shape when present, and carries no null arm.+[pipe.output_optional]+type = "PipeLLM"+description = "OUTPUT_pipe_output_optional: an output a successful run may resolve as an absence"+inputs = { note = "Text" }+output = "Verdict?"+prompt = """+OUTPUT_prompt_output_optional+@note+"""++# A native scalar output whose content model wraps: the payload sits under `text`, which is the+# property a consumer unwraps by — read off this schema, never worked out by inspecting a value.+[pipe.output_native_text]+type = "PipeLLM"+description = "OUTPUT_pipe_output_native_text: a native scalar output, whose content model wraps"+inputs = { note = "Text" }+output = "Text"+prompt = """+OUTPUT_prompt_output_native_text+@note+"""++# A file-bearing output. Its content model is multi-property (`url` and friends), so nothing+# unwraps, and a renderer told `kind = "image"` reads the pinned members. A PipeLLM may not resolve+# to a concept containing images, so the carrier is the operator that produces one.+[pipe.output_native_image]+type = "PipeImgGen"+description = "OUTPUT_pipe_output_native_image: a file-bearing output, whose content model does NOT wrap"+inputs = { subject = "Text" }+output = "Image"+prompt = "$subject"diff --git a/tests/integration/pipelex/pipeline/test_pipe_io_contracts.py b/tests/integration/pipelex/pipeline/test_pipe_io_contracts.pyindex 9c72fa597..78e7463e2 100644--- a/tests/integration/pipelex/pipeline/test_pipe_io_contracts.py+++ b/tests/integration/pipelex/pipeline/test_pipe_io_contracts.py@@ -1,10 +1,13 @@"""Pin the D6 `build_pipe_io_contracts` builder: typed `PipeIOContract` entries keyed by `pipe_ref`.-Covers the two combinations the hosted builder it was ported from never saw:+Covers the combinations the hosted builder it was ported from never saw:- **`PipeSignature` pipes in a lenient batch** — a forward-declared header validated with``allow_signatures=True`` gets an IO-contract entry like any concrete pipe (its declaredcontract is exactly what a top-down build needs), keyed by its namespaced ``pipe_ref``.+- **The structureless concept** — `native.Anything` deliberately has no content class, so+ asking a provider for one is a category error rather than a missing registration. Both+ sides of the contract report the empty schema instead of failing the whole build.- **Multiplicity entry shapes** — a single output reports ``multiplicity="single"``, avariable list output (``Concept[]``) reports ``multiplicity="variable"``, and a fixed-countoutput (``Concept[N]``) reports ``multiplicity="fixed"`` with ``item_count=N``; list-typed@@ -43,6 +46,33 @@ def _teardown_validation_library(outer_library_id: str) -> None:clear_current_library()+_ANYTHING_OUTPUT_MTHDS = """+domain = "anything_output_test"+description = "Bundle whose router RESOLVES TO the structureless native concept"++[concept.Verdict]+description = "A verdict"++[concept.Verdict.structure]+matched = { type = "boolean", description = "Whether it matched", required = true }++[pipe.say_yes]+type = "PipeLLM"+description = "Say yes"+inputs = { payload = "Anything" }+output = "Text"+prompt = "Say yes about $payload"++[pipe.route]+type = "PipeCondition"+description = "Route on a verdict, resolving to whatever the chosen branch produced"+inputs = { verdict = "Verdict", payload = "Anything" }+output = "Anything"+expression = "verdict.matched"+outcomes = { yes = "say_yes" }+default_outcome = "say_yes"+"""+_SIGNATURE_ONLY_DIR = Path(__file__).parents[3] / "e2e" / "pipelex" / "pipes" / "additive_multi_file_library" / "signature_only"_MULTIPLICITY_MTHDS = """@@ -152,6 +182,43 @@ class TestBuildPipeIOContracts:gate = io_contracts["optional_contracts_test.gate"]assert gate.output.optional is True+ async def test_structureless_output_renders_permissively(self, load_empty_library: Callable[[], str]) -> None:+ """A pipe RESOLVING TO `native.Anything` carries a permissive schema rather than failing the build.++ `Anything` is the untyped vehicle: `structure_class` is `None` for it, so the+ `AnythingContent` name derived mechanically from its code has no class behind it+ and never will. Asking a provider for that class is a category error rather than a+ missing registration, and it used to be treated as the second: the contract build+ raised `PipeIOContractError` naming a class that never existed, taking every OTHER+ pipe in the bundle down with it.++ **The schema is permissive, not empty**, and the difference is the point. It carries+ no constraint keyword — "any JSON value" is what an untyped vehicle means — but it+ does carry the concept's identity annotations, because every rendered schema does+ and an exception for this one would be a second rule. A bare `{}` would read the+ same to a validator and tell a reader nothing about what they are looking at.++ Scoped to the OUTPUT side: the input side is covered by+ `test_anything_input_publishes_permissive_schema` below, which reaches the plural+ arms too. This one exists because an `Anything`-resolving `PipeCondition` — a router+ that resolves to whatever branch it took — is ordinary in a real method, and the+ output contract gained its schema after that test was written.+ """+ outer_library_id = load_empty_library()+ try:+ result = await validate_bundle(mthds_contents=[_ANYTHING_OUTPUT_MTHDS])+ io_contracts = build_pipe_io_contracts(result.pipes)+ finally:+ _teardown_validation_library(outer_library_id)++ route = io_contracts["anything_output_test.route"]+ assert route.output.concept_ref == "native.Anything"+ # The concept's identity, and nothing that constrains a value.+ json_schema = route.output.json_schema+ assert json_schema["title"] == "native.Anything"+ assert "description" in json_schema+ assert not {"type", "properties", "required", "enum", "items"} & set(json_schema)+async def test_multiplicity_entry_shapes(self, load_empty_library: Callable[[], str]) -> None:"""Entries are keyed by namespaced pipe_ref; output multiplicity is single vs variable."""outer_library_id = load_empty_library()diff --git a/tests/unit/pipelex/core/stuffs/html_content/test_data.py b/tests/unit/pipelex/core/stuffs/html_content/test_data.pyindex 371ac5dc7..315cf5171 100644--- a/tests/unit/pipelex/core/stuffs/html_content/test_data.py+++ b/tests/unit/pipelex/core/stuffs/html_content/test_data.py@@ -14,8 +14,13 @@ class TestData:EXPECTED_RENDERED_PLAIN = "<p>Hello World</p>"EXPECTED_RENDERED_MARKDOWN = "<p>Hello World</p>"EXPECTED_RENDERED_HTML = '<div class="my-class"><p>Hello World</p></div>'- EXPECTED_RENDERED_JSON = '{"html": "<p>Hello World</p>", "css_class": "my-class"}'- EXPECTED_RENDERED_JSON_NO_CLASS = '{"html": "<p>Hello World</p>"}'+ # The JSON rendering is the MODEL's, member for member. It used to rename+ # `inner_html` to `html`, which made a payload that did not satisfy the schema+ # its own output contract publishes - `native.Html` pins `inner_html` and pins+ # it required, so a consumer reading the contract found the member absent and+ # a member the standard does not define in its place.+ EXPECTED_RENDERED_JSON: ClassVar[dict[str, Any]] = {"inner_html": "<p>Hello World</p>", "css_class": "my-class"}+ EXPECTED_RENDERED_JSON_NO_CLASS: ClassVar[dict[str, Any]] = {"inner_html": "<p>Hello World</p>", "css_class": None}EXPECTED_RENDERED_HTML_NO_CLASS = "<p>Hello World</p>"EXPECTED_RENDERED_FOR_PROMPT = "<p>Hello World</p>"diff --git a/tests/unit/pipelex/core/stuffs/html_content/test_html_content_renders.py b/tests/unit/pipelex/core/stuffs/html_content/test_html_content_renders.pyindex 4c99902e4..d101769cc 100644--- a/tests/unit/pipelex/core/stuffs/html_content/test_html_content_renders.py+++ b/tests/unit/pipelex/core/stuffs/html_content/test_html_content_renders.py@@ -1,3 +1,5 @@+import json+import pytestfrom pipelex.core.stuffs.html_content import HtmlContent@@ -32,15 +34,21 @@ class TestHtmlContentRenders:content = HtmlContent(inner_html=TestData.SAMPLE_INNER_HTML)assert content.rendered_html() == TestData.EXPECTED_RENDERED_HTML_NO_CLASS- def test_rendered_json(self):- """Verify rendered_json returns JSON string with html and css_class keys."""+ def test_rendered_json_states_the_models_own_members(self):+ """The JSON rendering is the model's, member for member — `inner_html`, never a rename.++ It used to emit `html`, which made a payload that did not satisfy the schema its own output+ contract publishes: `native.Html` pins `inner_html` and pins it required, so a consumer+ reading the contract found the required member absent and one the standard does not define+ beside it. Caught by a real run once the output contract started carrying a schema.+ """content = HtmlContent(inner_html=TestData.SAMPLE_INNER_HTML, css_class=TestData.SAMPLE_CSS_CLASS)- assert content.rendered_json() == TestData.EXPECTED_RENDERED_JSON+ assert json.loads(content.rendered_json()) == TestData.EXPECTED_RENDERED_JSONdef test_rendered_json_without_css_class(self):- """An unset css_class is omitted from the JSON rendering, never emitted as null."""+ """An unset optional member is stated as null, exactly as the model dumps it."""content = HtmlContent(inner_html=TestData.SAMPLE_INNER_HTML)- assert content.rendered_json() == TestData.EXPECTED_RENDERED_JSON_NO_CLASS+ assert json.loads(content.rendered_json()) == TestData.EXPECTED_RENDERED_JSON_NO_CLASSdef test_rendered_for_prompt(self):"""Verify rendered_for_prompt returns markdown format (which is inner_html for HtmlContent)."""@@ -73,4 +81,4 @@ class TestHtmlContentRenders:"""Verify async rendered_json returns the same as sync version."""content = HtmlContent(inner_html=TestData.SAMPLE_INNER_HTML, css_class=TestData.SAMPLE_CSS_CLASS)result = await content.rendered_json_async()- assert result == TestData.EXPECTED_RENDERED_JSON+ assert json.loads(result) == TestData.EXPECTED_RENDERED_JSONdiff --git a/tests/unit/pipelex/pipeline/test_validation_report.py b/tests/unit/pipelex/pipeline/test_validation_report.pyindex 8829ef661..9368f80ac 100644--- a/tests/unit/pipelex/pipeline/test_validation_report.py+++ b/tests/unit/pipelex/pipeline/test_validation_report.py@@ -47,7 +47,15 @@ class TestBuildValidationReport:pipe_io_contracts = {"beta.do_it": PipeIOContract(inputs={},- output=PipeOutputContract(concept_ref="native.Text", multiplicity=IOMultiplicity.SINGLE, item_count=None, optional=False),+ output=PipeOutputContract(+ concept_ref="native.Text",+ multiplicity=IOMultiplicity.SINGLE,+ item_count=None,+ optional=False,+ # The payload's schema: `native.Text` resolves to its content model, which+ # wraps the value under `text`.+ json_schema={"type": "object", "properties": {"text": {"type": "string"}}},+ ),),}dry_run_result: dict[str, DryRunOutput] = {@@ -58,6 +66,7 @@ class TestBuildValidationReport:blueprints=blueprints,pipe_io_contracts=pipe_io_contracts,input_form={},+ output_form={},dry_run_result=dry_run_result,pending_signatures=["beta.still_pending"],)@@ -79,6 +88,7 @@ class TestBuildValidationReport:blueprints=blueprints,pipe_io_contracts={},input_form={},+ output_form={},dry_run_result={},pending_signatures=[],)@@ -105,6 +115,7 @@ class TestBuildValidationReport:blueprints=blueprints,pipe_io_contracts={},input_form={},+ output_form={},dry_run_result={},pending_signatures=[],warnings=[warning_item],diff --git a/uv.lock b/uv.lockindex 82a7e516c..090b4b438 100644--- a/uv.lock+++ b/uv.lock@@ -2552,7 +2552,7 @@ wheels = [[[package]]name = "mthds"-version = "0.11.1"+version = "0.13.0"source = { registry = "https://pypi.org/simple" }dependencies = [{ name = "httpx" },@@ -2561,9 +2561,9 @@ dependencies = [{ name = "tomlkit" },{ name = "typing-extensions" },]-sdist = { url = "https://files.pythonhosted.org/packages/44/9a/93d688320010ad14a31c863c3882fabc2f8637622f69fd8e4aed64a3f2bb/mthds-0.11.1.tar.gz", hash = "sha256:5f52b703835abe9e40a000d76023e2bd29124655c049b1ef9eeab4a8761b6e2c", size = 170790, upload-time = "2026-08-28T11:17:02.146Z" }+sdist = { url = "https://files.pythonhosted.org/packages/e4/b6/6c67b86693d01d473444523db0aeadc1afdffaa1748a264dfab9c1c77b1c/mthds-0.13.0.tar.gz", hash = "sha256:ef59ffa94902da72371390cc39d8c0d85dfd2a524dbca2a8909a0a1ba6255607", size = 216142, upload-time = "2026-09-02T15:09:15.937Z" }wheels = [- { url = "https://files.pythonhosted.org/packages/e5/1c/74abc1b8b63813c0de69218b003e777cc92a7327d21b90911c10502b2e69/mthds-0.11.1-py3-none-any.whl", hash = "sha256:760cd7d3f7e86b8f962e1d3a4e87e6146b94968b9422ddfc22e006a3fc305ba3", size = 71954, upload-time = "2026-08-28T11:17:00.67Z" },+ { url = "https://files.pythonhosted.org/packages/89/26/f73e625b54cfba2e09a29df5e7173e508c25d3f7ce106be69fae6065d76c/mthds-0.13.0-py3-none-any.whl", hash = "sha256:606fef7978bbc8a5b249882c0b9377fed37123f618f8183f29e89b71a4eadac0", size = 85993, upload-time = "2026-09-02T15:09:14.334Z" },][[package]]@@ -3472,7 +3472,7 @@ requires-dist = [{ name = "mkdocs-meta-manager", marker = "extra == 'docs'", specifier = ">=1.1.0" },{ name = "mkdocs-redirects", marker = "extra == 'docs'", specifier = "==1.2.2" },{ name = "moto", extras = ["dynamodb", "s3"], marker = "extra == 'dev'", specifier = ">=5.0.0" },- { name = "mthds", specifier = "==0.11.1" },+ { name = "mthds", specifier = "==0.13.0" },{ name = "mypy", marker = "extra == 'dev'", specifier = "==1.19.1" },{ name = "networkx", specifier = ">=3.4.2" },{ name = "openai", specifier = ">=2.0.0" },