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.
feature/Template-check-warnings · L-261011-edb3c8 (#1421)
Louis Choquel6bdc9a053bcd
diff --git a/.drift/acks/cli-docs.toml b/.drift/acks/cli-docs.tomlindex 8b6ea5482..070ef6036 100644--- a/.drift/acks/cli-docs.toml+++ b/.drift/acks/cli-docs.toml@@ -1,8 +1,8 @@contract = "cli-docs"-digest = "sha256:0d0482f20caaffbade6fb43ccf4f5c8aa3684c40f99b961699cea94bc3a8f30c"+digest = "sha256:051eca7283ff3508d8f7cdea3df9d9b2fea5ff3b7ad9ccd8d965084ec764c8d0"reviewed_by = "Louis Choquel"-reviewed_at = "2026-10-11T19:29:59Z"-rationale = "clean-pass: pipelex init now shows the usage statistics notice on stderr whenever they are on, and docs/tools/cli/init.md says so in this same change; pipelex-agent is untouched, so the agent CLI guide stands."+reviewed_at = "2026-10-12T01:17:29Z"+rationale = "clean-pass: both validate cores now ask the sweep to collect the dry-run warnings explicitly (collect_dry_run_warnings=True), which keeps what every validate surface carries exactly as docs/tools/cli/validate.md, docs/tools/cli/agent-cli.md and the agent CLI guide already describe; no CLI doc change needed."[trigger_files]"pipelex/cli/__init__.py" = "blob:8b137891791fe96927ad78e64b0aad7bded08bdc"@@ -44,7 +44,7 @@ rationale = "clean-pass: pipelex init now shows the usage statistics notice on s"pipelex/cli/agent_cli/commands/run/pipe_cmd.py" = "blob:f421c75ee696c18f85a7f63805455ef23637302f""pipelex/cli/agent_cli/commands/run/stdin_resolver.py" = "blob:c7c7d7495508f1c4e5a46eba336a4ab1694ebcf7""pipelex/cli/agent_cli/commands/validate/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"-"pipelex/cli/agent_cli/commands/validate/_validate_core.py" = "blob:a0adc62061077bd47725147becc34914c4a9c7d4"+"pipelex/cli/agent_cli/commands/validate/_validate_core.py" = "blob:c6eb0e986e0306fd5c8a9107792712a1a433b575""pipelex/cli/agent_cli/commands/validate/app.py" = "blob:d2d0ed19288c2d1c25be1650dd962189fcdb3b86""pipelex/cli/agent_cli/commands/validate/bundle_cmd.py" = "blob:6b02bb77dadf0ecd1814176580920962fcda2a42""pipelex/cli/agent_cli/commands/validate/method_cmd.py" = "blob:0f4cf76d99b39422610c5daf6b5a0500de234818"@@ -120,7 +120,7 @@ rationale = "clean-pass: pipelex init now shows the usage statistics notice on s"pipelex/cli/commands/update_cmd.py" = "blob:b2db6170ddd9c67f17d88096ba1f1796a897557d""pipelex/cli/commands/usage_stats_cmd.py" = "blob:b3723c64f911d1b69e1e1aa126610a132a16e3da""pipelex/cli/commands/validate/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"-"pipelex/cli/commands/validate/_validate_core.py" = "blob:fbdc9ab24e434b57d57959a8fdfad1f0ea39a20d"+"pipelex/cli/commands/validate/_validate_core.py" = "blob:7ed6ea06b1d99b850c530404531f69e1d1db042b""pipelex/cli/commands/validate/app.py" = "blob:33b6c2d374e456b2a47a27861f99c581945b21af""pipelex/cli/commands/validate/bundle_cmd.py" = "blob:1fbf3e0cf695db39101c83160a724df6468988e9""pipelex/cli/commands/validate/method_cmd.py" = "blob:f12ee233fc985d04a4512f1fef6b9ea02a1b9644"diff --git a/CHANGELOG.md b/CHANGELOG.mdindex fd6e5939d..2398f6b46 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,5 +1,15 @@# Changelog+## [Unreleased]++### Added++- **Template-check warnings in the validation verdict**: a warning the engine's template check finds in a `PipeDocGen` step's office template file, such as an Excel defined name or a PowerPoint shape name that matches no input field, now rides the verdict's advisory `warnings` on `pipelex validate`, `pipelex-agent validate` and the API server's `POST /v1/validate`, where it was only logged. It is a `dry_run` item with the new `error_type` `template_check_warning`, the step's `pipe_code` and `domain_code`, and two new optional locators of `ValidationErrorItem`, `template_file` and `template_location`, which the server's OpenAPI schema publishes, a step of the server's own library directories naming no file of theirs; an error finding still fails the validation, `validate pipe <code>` on both CLIs carries these warnings alone, and a dry run that returns no verdict, such as `pipelex run --dry-run`, `pipelex fix bundle` or `pipelex build inputs`, still logs them.++### Changed++- **`build_advisory_warnings` and `collect_advisory_warnings` take the sweep's `dry_run_result` (Breaking)**: the composition point of the advisory warnings reads what the dry runs found from the per-pipe status map, so a caller passes the map its validation sweep returned. `DryRunOutput` carries those findings in its new `warnings` when the sweep is asked to collect them with the new `collect_dry_run_warnings` of `validate_bundle`, `BundleValidator.validate_pipes` and `BundleValidator.validate_current_library`; a sweep that is not asked leaves them to the log, as before.+## [v0.84.0] - 2026-10-12### Highlightsdiff --git a/api/tests/unit/test_validate_template_check_warnings.py b/api/tests/unit/test_validate_template_check_warnings.pynew file mode 100644index 000000000..1f42e2eee--- /dev/null+++ b/api/tests/unit/test_validate_template_check_warnings.py@@ -0,0 +1,50 @@+from fastapi import FastAPI+from fastapi.testclient import TestClient+from pipelex.base_exceptions import ValidationErrorCategory, ValidationErrorItem+from pipelex.validation_error_types import TemplateCheckErrorType+from pytest_mock import MockerFixture++from pipelex_api.exception_handlers import register_exception_handlers+from pipelex_api.routes import router as api_router+from tests.unit._constants import VALID_MTHDS++_TEMPLATE_WARNING = ValidationErrorItem(+ category=ValidationErrorCategory.DRY_RUN,+ error_type=TemplateCheckErrorType.TEMPLATE_CHECK_WARNING,+ pipe_code="print_invoice",+ domain_code="invoicing",+ template_file="invoice.xlsx",+ template_location="the defined name Totl",+ message="PipeDocGen 'print_invoice', template file 'invoice.xlsx': The name Totl matches no field (the defined name Totl)",+)+++def _build_client() -> TestClient:+ app = FastAPI()+ app.include_router(api_router, prefix="/v1")+ register_exception_handlers(app)+ return TestClient(app)+++class TestValidateTemplateCheckWarnings:+ def test_a_template_check_warning_rides_the_valid_verdict(self, mocker: MockerFixture) -> None:+ """The dry-run family of the advisory composition reaches the 200 valid arm with its locators, and never flips it.++ Only the family's output is stubbed: the real validation runs, through the same composition point, and pipelex's+ own suite proves a stub engine's warning reaches that family through `validate_bundles_in_process`, which the+ route's direct path calls (`test_pipe_doc_gen_template_warnings.py`).+ """+ family = mocker.patch("pipelex.pipeline.advisory_warnings.build_dry_run_warnings", return_value=[_TEMPLATE_WARNING])++ response = _build_client().post("/v1/validate", json={"mthds_contents": [VALID_MTHDS], "render": ["markdown"]})++ assert response.status_code == 200, response.text+ body = response.json()+ assert body["is_valid"] is True+ family.assert_called_once()+ template_warnings = [warning for warning in body["warnings"] if warning["error_type"] == TemplateCheckErrorType.TEMPLATE_CHECK_WARNING]+ assert len(template_warnings) == 1+ assert {key: value for key, value in template_warnings[0].items() if value is not None} == _TEMPLATE_WARNING.model_dump(+ mode="json", exclude_none=True+ )+ assert f"- **{TemplateCheckErrorType.TEMPLATE_CHECK_WARNING}** — {_TEMPLATE_WARNING.message}" in body["rendered_markdown"]diff --git a/docs/api-server/error-responses.md b/docs/api-server/error-responses.mdindex 878818e31..174ad1f7c 100644--- a/docs/api-server/error-responses.md+++ b/docs/api-server/error-responses.md@@ -52,6 +52,7 @@ When a bundle fails validation, the `ValidateBundleError` carries a `validation_| `variable_names`, `missing_concept_code`, `missing_pipe_code`, `declared_concepts` | Extra context for specific failure shapes (undefined variables, an unresolved concept, pipe or package reference, the set of concepts that were declared). On an `unresolved_package_dependency` item, `missing_pipe_code` is the reference as written, `<address>->domain.code`, so the package's address is the part before `->`. || `line`, `column` | The 1-based position where the TOML parser stopped, on a TOML syntax error. || `model_reference`, `model_type`, `suggestions` | On an `unknown_model` item — a pipe naming a model the deployment's model deck does not define — the reference as the bundle wrote it, the kind of model the pipe needs (`llm`, `extract`, …), and the deck's close matches of that kind. With exactly one suggestion the item also carries an `unsafe` `suggested_fix` renaming the model. On an `llm_setting_refused_by_model` item — a `PipeLLM` or `PipeStructure` whose model setting the model it resolves to refuses, which its worker would refuse at the first call — `field_name` and `field_path` name the `model` or `model_to_structure` field holding the setting, and `model_reference` is the preset, alias or model that field names, absent when it writes the setting inline or the pipe leaves it to the deck's override or default. |+| `template_file`, `template_location` | On a `template_check_warning` item, which rides the valid verdict's `warnings` rather than `validation_errors`, the template file as the `PipeDocGen` step names it and the place in it the engine's finding names, in the engine's own words (a defined name, a Table, a cell, a shape, a tag); `template_location` is absent when the engine names no place. A step of the server's own library directories is named by its `pipe_code` and `domain_code` alone: its item carries no `template_file`, and its message reads `<host library file>` where it named the file. || `suggested_fix` | A structured, deterministic fix for this error — present only when the fix planner derived one. See [Suggested fixes](#suggested-fixes). |Items carry only the fields that apply to their category — absent fields are omitted, not null. `validation_errors` is **retained under STRICT disclosure** (it describes the caller's own submitted bundle, not server internals). It is present only on `ValidateBundleError`; other error types omit it.diff --git a/docs/api-server/openapi/pipelex-api.openapi.yaml b/docs/api-server/openapi/pipelex-api.openapi.yamlindex 9d1dfdb82..b29fc2b6b 100644--- a/docs/api-server/openapi/pipelex-api.openapi.yaml+++ b/docs/api-server/openapi/pipelex-api.openapi.yaml@@ -6975,6 +6975,25 @@ components:- llm_prompt- img_gen_prompttitle: TemplateCategory+ TemplateCheckErrorType:+ type: string+ enum:+ - template_check_warning+ title: TemplateCheckErrorType+ description: 'Advisory findings of a ``PipeDocGen`` step''s template check (the engine''s ``check_template``).+++ Every member is advisory-only: it rides the validation report''s ``warnings`` array and never makes a++ verdict invalid. An error finding of the same check fails the step''s dry run instead, and is reported as++ the ``DryRunError`` item every failed dry run is. A separate enum rather than a new++ ``PipeValidationErrorType`` member because the finding is not the pipe''s validation: the dry run hands the++ step''s template file to its engine, which reads it in a way only the engine can, and reports in its own++ words. Its locators are the template file and the place in it the engine names.'TemplatingStyle:properties:tag_style:@@ -7678,7 +7697,11 @@ components:or a type mismatch), and ``dry_run`` — one item per pipe whose dry run failed,- located at the innermost failing pipe.'+ located at the innermost failing pipe. On the report''s advisory ``warnings``,++ ``dry_run`` marks a finding a dry run made without failing, such as a warning of++ a ``PipeDocGen`` step''s template check.'ValidationErrorItem:properties:category:@@ -7692,6 +7715,7 @@ components:- $ref: '#/components/schemas/PipeFactoryErrorType'- $ref: '#/components/schemas/ValidationResidualErrorType'- $ref: '#/components/schemas/HintLintErrorType'+ - $ref: '#/components/schemas/TemplateCheckErrorType'- type: 'null'title: Error Typepipe_code:@@ -7775,6 +7799,16 @@ components:type: array- type: 'null'title: Suggestions+ template_file:+ anyOf:+ - type: string+ - type: 'null'+ title: Template File+ template_location:+ anyOf:+ - type: string+ - type: 'null'+ title: Template Locationsuggested_fix:anyOf:- $ref: '#/components/schemas/SuggestedFix'diff --git a/docs/api-server/pipe-validate.md b/docs/api-server/pipe-validate.mdindex d9ea508dd..8a80d3aeb 100644--- a/docs/api-server/pipe-validate.md+++ b/docs/api-server/pipe-validate.md@@ -66,6 +66,7 @@ The 200 body is one of two arms, discriminated on the mandatory `is_valid` field- `pipe_io_contracts` (object): per-pipe input/output contracts, keyed by the namespaced `pipe_ref` (`domain.code`). Each input carries its `concept_ref`, `presence`, `multiplicity` (`single` | `variable` | `fixed`), `item_count` and the JSON Schema of its content; the output carries its fully qualified `concept_ref`, `multiplicity`, `item_count`, `optional` and the JSON Schema of its payload. `item_count` is the exact count on `fixed`, always greater than one since `Concept[1]` reads as `single`, and `null` otherwise, so an output declared `Text[3]` reports `"multiplicity": "fixed", "item_count": 3`- `graph_spec` (object | null): best-effort execution graph of the pipe a selector-less run of this request would execute — the pipe [`default_pipe_ref`](#the-effective-entry-pipe) names — dry-run against the validated library; `null` when no entry pipe is determined or the graph dry-run degrades- `validated_pipes` (list): per-pipe sweep outcomes — `{pipe_ref, status}` entries with status `SUCCESS` | `FAILURE` | `SKIPPED`+- `warnings` (list): advisory findings that never flip `is_valid`, each with the same shape as a `validation_errors` item, so one parser reads both. Four families, always in this order: the useless-`!` lint (`optional_force_redundant`), the entry-pipe vacuous-presence lint (`input_presence_vacuous`), the intent-hint lints (`hint_unknown_key`, `hint_unknown_intent`, `hint_inapplicable_intent`), and the warnings a `PipeDocGen` step's template check found in its office template file during the dry run (`template_check_warning`, a `dry_run` item carrying `pipe_code`, `domain_code`, `template_file` and `template_location`). Unset locators are `null` on this arm. Empty when there is nothing to report- `pending_signatures` (list[str]): namespaced refs of pipes still declared as signatures (contract-only pipes — `inputs`/`output` with no `type` and no implementation) in the assembled library — what remains to implement- `is_runnable` (boolean): `pending_signatures` is empty — whether the validated library is complete enough to rundiff --git a/docs/building-methods/pipes/pipe-operators/PipeDocGen.md b/docs/building-methods/pipes/pipe-operators/PipeDocGen.mdindex 08e90f766..4c08aeba9 100644--- a/docs/building-methods/pipes/pipe-operators/PipeDocGen.md+++ b/docs/building-methods/pipes/pipe-operators/PipeDocGen.md@@ -135,6 +135,8 @@ Running the `PipeDocGen` step alone on inputs saved from an earlier run is the lA dry run composes for real against mock inputs, which checks the templates and the file's name, prints nothing, and outputs a mock `Document`.+When the plugin's engine checks an office template file, validation reports what it finds in two ways. An error, such as a Word tag that names no field, fails the step's dry run, and so the validation. A warning, such as an Excel defined name or a PowerPoint shape name that matches no field, leaves the bundle valid and rides the verdict's advisory `warnings` as a `template_check_warning` item naming the step (`pipe_code`, `domain_code`), the file (`template_file`) and the place in it (`template_location`). Read it all the same: a misspelled name fills nothing, so the document keeps the template's sample value there. The warning reaches every surface that returns the verdict: `pipelex validate`, `pipelex-agent validate` and the API server's `POST /v1/validate`. A dry run that returns no verdict, such as `pipelex run --dry-run`, `pipelex fix bundle` or `pipelex build inputs`, logs it instead.+## Related documentation- [PipeCompose](./PipeCompose.md), which renders a template into a `Text` or `Html` outputdiff --git a/docs/contribute/mthds-test-corpus.md b/docs/contribute/mthds-test-corpus.mdindex e20831557..0d0cf92e9 100644--- a/docs/contribute/mthds-test-corpus.md+++ b/docs/contribute/mthds-test-corpus.md@@ -92,7 +92,7 @@ An **exclusion** marks a registry code that no standalone focused entry could meNo native concept is excluded — every one of them turned out to support a real entry. `PipeFunc` is excluded: it names a Python function that the runtime resolves against its function registry *at validation time*, so an entry declaring one fails with `Function '<name>' not found in registry` in every consumer that has not registered that exact function — and a cross-language consumer cannot register a Python function at all. Exercise `PipeFunc` in a consumer's own fixtures, where the function exists.-`error.*` carries the rest of the exclusions, and the distinction they turn on is worth stating: **membership in the registry means a value is reachable on the wire, never that a focused entry can produce it.** A corpus entry is a `.mthds` bundle validated through `validate bundle`, so a fault the validate path cannot reach is excluded here rather than pruned from the runtime's own truth. One is unreachable by construction: `unknown_concept` fires in the pipe factory under exactly the condition the earlier concept-reference resolution has already rejected as `unresolved_concept`. Several have no shape an entry could take: the advisory-only codes — `optional_force_redundant`, `input_presence_vacuous`, and the three `hint_*` lints — ride the validation report's `warnings` array and never make a verdict invalid, so the bundle they fire on is valid and has no `expected_error` to carry, and the manifest models no warnings axis. The two `unknown_*` fallbacks are excluded because an entry pinning one would be pinning the absence of a diagnosis, and would have to be rewritten the moment the fault got a code of its own.+`error.*` carries the rest of the exclusions, and the distinction they turn on is worth stating: **membership in the registry means a value is reachable on the wire, never that a focused entry can produce it.** A corpus entry is a `.mthds` bundle validated through `validate bundle`, so a fault the validate path cannot reach is excluded here rather than pruned from the runtime's own truth. One is unreachable by construction: `unknown_concept` fires in the pipe factory under exactly the condition the earlier concept-reference resolution has already rejected as `unresolved_concept`. Several have no shape an entry could take: the advisory-only codes — `optional_force_redundant`, `input_presence_vacuous`, the three `hint_*` lints and `template_check_warning` — ride the validation report's `warnings` array and never make a verdict invalid, so the bundle they fire on is valid and has no `expected_error` to carry, and the manifest models no warnings axis. The two `unknown_*` fallbacks are excluded because an entry pinning one would be pinning the absence of a diagnosis, and would have to be rewritten the moment the fault got a code of its own.**Measure an exclusion, do not reason your way to one.** Every `error.*` exclusion reason above was established by writing the bundle that ought to trigger it and reading what the runtime actually said — which is how `unknown_concept` turned out to be shadowed rather than merely awkward, and how the two the registry made look unreachable (`missing_pipe_type`, `native_concept_redeclaration`) turned out to have entries after all.diff --git a/docs/tools/cli/agent-cli.md b/docs/tools/cli/agent-cli.mdindex f9ba2cd6f..a2d09d7b9 100644--- a/docs/tools/cli/agent-cli.md+++ b/docs/tools/cli/agent-cli.md@@ -96,7 +96,7 @@ For `bundle`, additional options are available:A refusal of your input raised while the bundle is loaded or validated is answered with the invalid-verdict envelope — `is_valid: false` and a `validation_errors` array — and exit code `1`, never the no-verdict envelope and exit code `2`, which is kept for failures of the tool or its environment. A pipe whose dry run fails gives one `dry_run` item per failing pipe, with `error_type: DryRunError`, the `pipe_code`, `domain_code` and `source` of the innermost pipe that failed and is not allowed to fail (its `source` whenever the pipe is in your files; a validator of submitted content beside a host's library directories names only that content's files), and a message that keeps the failure's own text only when it is caller-facing, on `validate bundle`, `validate pipe <code>` and `validate pipe --all` alike; a controller that failed because a pipe it runs failed is reported once, at that pipe. Every error found while parsing is its own item, so a misspelled field is reported beside the categorized errors as an item without an `error_type`, carrying its `pipe_code`, `source` and `field_path`. A TOML syntax error's item carries its 1-based `line` and `column`, and an `unresolved_concept` item lists the concepts the validated bundle declares in its domain in `declared_concepts`. A pipe naming a model the model deck does not define gives one `pipe_validation` item with `error_type: unknown_model`, carrying `pipe_code`, `domain_code`, `source`, `field_path` (`pipe.<code>.model`), `model_reference` (the reference as written), `model_type` and `suggestions` (the deck's close matches), plus a `rename-model` `suggested_fix` when there is exactly one suggestion. That fix's `safety` is `unsafe`, because a close name can still be a different model: `fix bundle` never applies it, and the Markdown labels it `💡 Suggested fix (unsafe, confirm before applying):` where a safe fix reads `💡 Suggested fix:`. Any other refusal of your input with no code of its own gives one item without an `error_type`, located on its pipe when it was raised while that pipe was built. A pipe factory's refusal, such as a `PipeExtract` whose input is neither an image nor a document, is one of these items, located on its pipe. See [Error Model](../../under-the-hood/error-model.md#validation_errors-structured-bundle-validation-diagnostics).!!! note "Advisory warnings on validate"- Whole-bundle and whole-library validate surfaces (`validate bundle`, `validate method`, `validate pipe --all`) also carry a `warnings` array — advisory optionality lints on a VALID bundle that never flip the verdict or the exit code. Each entry has the **same shape as a validation error item** (`category`, `error_type`, `pipe_code`, `domain_code`, `variable_names`, `message`) — this is a different shape from the `init`/`doctor` setup `warnings` (`{type, message}`) documented under Output Contract below. Three families ride the array, always in this order: the useless-`!` lint (`optional_force_redundant`), a `!` (force) input whose slot is guaranteed present in every analyzed flow, so the assertion can never fire; the vacuous-presence lint (`input_presence_vacuous`), an entry-pipe input that must be supplied but whose concept declares no required field, so the empty object satisfies it and a caller cannot tell what to fill in (see [Understanding Optionality](../../building-methods/pipes/understanding-optionality.md)); and the [intent-hint](../../building-methods/concepts/intent-hints.md) lints (`hint_unknown_key`, `hint_unknown_intent`, `hint_inapplicable_intent`). Every whole-bundle validate channel — this CLI, the bare CLI and the protocol validation report — assembles them from one composition point, so which advisories you see does not depend on which command you typed. Hint findings are bounded per site: a site naming many undefined keys reports the first few and then how many more there were, and a long authored key or value is elided in the message. In markdown, warnings render as a "Warnings" section. The array is empty when there is nothing to report; `validate pipe` omits it (no flow context to lint in). `validate bundle`/`validate method` with `--pipe` keep it, and it stays bundle-wide there — the slice narrows the dry run, not the validation.+ Whole-bundle and whole-library validate surfaces (`validate bundle`, `validate method`, `validate pipe --all`) also carry a `warnings` array — advisory findings on a VALID bundle that never flip the verdict or the exit code. Each entry has the **same shape as a validation error item** (`category`, `error_type`, `pipe_code`, `domain_code`, `variable_names`, `message`) — this is a different shape from the `init`/`doctor` setup `warnings` (`{type, message}`) documented under Output Contract below. Four families ride the array, always in this order: the useless-`!` lint (`optional_force_redundant`), a `!` (force) input whose slot is guaranteed present in every analyzed flow, so the assertion can never fire; the vacuous-presence lint (`input_presence_vacuous`), an entry-pipe input that must be supplied but whose concept declares no required field, so the empty object satisfies it and a caller cannot tell what to fill in (see [Understanding Optionality](../../building-methods/pipes/understanding-optionality.md)); the [intent-hint](../../building-methods/concepts/intent-hints.md) lints (`hint_unknown_key`, `hint_unknown_intent`, `hint_inapplicable_intent`); and the warnings of a [`PipeDocGen`](../../building-methods/pipes/pipe-operators/PipeDocGen.md#office-template-files) step's template check (`template_check_warning`), found by the engine in the step's office template file during the dry run, as a `dry_run` item that also carries `template_file` (the file as the step names it) and `template_location` (the place in it, in the engine's words, absent when the engine names none). Every whole-bundle validate channel — this CLI, the bare CLI and the protocol validation report — assembles them from one composition point, so which advisories you see does not depend on which command you typed. Hint findings are bounded per site: a site naming many undefined keys reports the first few and then how many more there were, and a long authored key or value is elided in the message. In markdown, warnings render as a "Warnings" section. The array is empty when there is nothing to report. `validate pipe <code>` carries the template-check warnings alone: one pipe has no flow context to lint in, but what its dry run found is about that pipe. `validate bundle`/`validate method` with `--pipe` keep it, and it stays bundle-wide there — the slice narrows the dry run, not the validation.### Fixdiff --git a/docs/tools/cli/validate.md b/docs/tools/cli/validate.mdindex 091f4baab..ad65b87e7 100644--- a/docs/tools/cli/validate.md+++ b/docs/tools/cli/validate.md@@ -158,11 +158,14 @@ See [Fix Commands](fix.md) for `pipelex fix bundle`, including the `--diff` prev## Advisory Warnings-A bundle can be valid and still be worth commenting on. When it is, `pipelex validate bundle` and `pipelex validate --all` print one yellow `Warning:` line per finding — advisory only: a warning never changes the verdict or the exit code. The lines come out ahead of the success message, and ahead of the strict pending-signature gate too, so a method still holding an unimplemented `PipeSignature` placeholder shows its warnings even though the command exits non-zero. Three families are reported, always in this order:+A bundle can be valid and still be worth commenting on. When it is, `pipelex validate bundle` and `pipelex validate --all` print one yellow `Warning:` line per finding — advisory only: a warning never changes the verdict or the exit code. The lines come out ahead of the success message, and ahead of the strict pending-signature gate too, so a method still holding an unimplemented `PipeSignature` placeholder shows its warnings even though the command exits non-zero. Four families are reported, always in this order:- `optional_force_redundant` — a `!` (force) input whose slot is guaranteed present in every analyzed flow, so the assertion can never fire.- `input_presence_vacuous` — a method input (an input of the bundle's declared `main_pipe`) that must be supplied, but whose concept declares no required field: the empty object satisfies it, so a caller cannot tell what to fill in.- `hint_unknown_key`, `hint_unknown_intent`, `hint_inapplicable_intent` — the [intent-hint](../../building-methods/concepts/intent-hints.md) lints. Hints are non-normative, so the entry is preserved and only named.+- `template_check_warning` — a warning the engine's template check found in a [`PipeDocGen`](../../building-methods/pipes/pipe-operators/PipeDocGen.md#office-template-files) step's office template file during the dry run, such as an Excel defined name or a PowerPoint shape name that matches no input field. The line names the step, the file and the place in it.++`pipelex validate pipe <PIPE_CODE>` prints only the last family: one pipe makes no bundle-wide claim, so the three lints have nothing to say about it, but what its dry run found is about that pipe.The same findings ride the `warnings` array of the [agent CLI](agent-cli.md)'s JSON envelope and of the validation report, built from one composition point, so the surfaces cannot disagree. See [Understanding Optionality](../../building-methods/pipes/understanding-optionality.md) for what each one means for your method.diff --git a/docs/under-the-hood/document-engine-plugins.md b/docs/under-the-hood/document-engine-plugins.mdindex b995dfaf4..5abef0fc7 100644--- a/docs/under-the-hood/document-engine-plugins.md+++ b/docs/under-the-hood/document-engine-plugins.md@@ -172,7 +172,7 @@ An office template names the fields it is filled with in its own way, which Pipedef check_template(self, *, request: TemplateCheckRequest) -> list[TemplateFinding]: ...```-The request carries the template file's bytes and name, the shape of each input as an `InputShape` tree (which fields exist, which are lists, and what their items hold), and the dry run's mock inputs as plain data, so the checker can also fill the template in memory. The dry run, and so `pipelex validate`, calls it for every step with an office template file: a finding of severity `error` fails the step with `PipeDocGenTemplateCheckError`, listing the findings, and a `warning` is logged. The default finds nothing. An HTML template, inline or in a `.html` template file, never reaches an engine's checker: Pipelex checks it itself, against the inputs' concepts, when the method loads. The built-in engine takes no template.+The request carries the template file's bytes and name, the shape of each input as an `InputShape` tree (which fields exist, which are lists, and what their items hold), and the dry run's mock inputs as plain data, so the checker can also fill the template in memory. The dry run, and so `pipelex validate`, calls it for every step with an office template file: a finding of severity `error` fails the step with `PipeDocGenTemplateCheckError`, listing the findings, and a `warning` leaves the step valid and joins the verdict's advisory `warnings` as a `template_check_warning` item, its `message` and `location` becoming the item's message and its `template_location`. A dry run that returns no verdict logs it instead: `pipelex run --dry-run`, and a validation run for something other than a verdict, such as `pipelex fix bundle`'s or `pipelex build inputs`'. Write a finding's `message` and `location` for the template's author: the item is returned to whoever validates the method, through the CLI or the API. The default finds nothing. An HTML template, inline or in a `.html` template file, never reaches an engine's checker: Pipelex checks it itself, against the inputs' concepts, when the method loads. The built-in engine takes no template.---diff --git a/docs/under-the-hood/error-model.md b/docs/under-the-hood/error-model.mdindex 47a8ff012..af31959d4 100644--- a/docs/under-the-hood/error-model.md+++ b/docs/under-the-hood/error-model.md@@ -87,9 +87,9 @@ A bundle-validation failure (`ValidateBundleError`) aggregates per-error data acThe **structured-info invariant is total**: every invalid verdict carries a non-empty `validation_errors[]`, never a bare message. The builder emits the categorized items and the `dry_run` items, then the `blueprint_validation` fallback only when nothing else produced an item.-Besides `category` and `message`, each item carries whatever identity fields its stage produced — `error_type`, `pipe_code`, `concept_code`, `domain_code`, `field_path`, `field_name`, `variable_names`, `missing_concept_code`, `declared_concepts` (on an `unresolved_concept` item, the bare codes of the concepts the validated bundle declares in the domain the reference was looked up in, native concepts excluded, and never those a library loaded before it, which may be a host's own), the TOML position `line` and `column`, the unknown-model locators `model_reference`, `model_type` and `suggestions`, and a `source` (the declaring file path, or the per-content source the in-memory load path was given) that hands a consumer the owning file for cross-file diagnostic placement. When the error has a deterministic remedy, the item also carries a [`suggested_fix`](#suggested_fix-structured-deterministic-fixes).+Besides `category` and `message`, each item carries whatever identity fields its stage produced — `error_type`, `pipe_code`, `concept_code`, `domain_code`, `field_path`, `field_name`, `variable_names`, `missing_concept_code`, `declared_concepts` (on an `unresolved_concept` item, the bare codes of the concepts the validated bundle declares in the domain the reference was looked up in, native concepts excluded, and never those a library loaded before it, which may be a host's own), the TOML position `line` and `column`, the unknown-model locators `model_reference`, `model_type` and `suggestions`, the template-check locators `template_file` and `template_location` (on a `template_check_warning`, which rides `warnings`), and a `source` (the declaring file path, or the per-content source the in-memory load path was given) that hands a consumer the owning file for cross-file diagnostic placement. When the error has a deterministic remedy, the item also carries a [`suggested_fix`](#suggested_fix-structured-deterministic-fixes).-**A verdict names no path on the host.** An item and the verdict's message are kept verbatim under STRICT disclosure, so neither names where the host keeps a file. A bundle of a package the method depends on by address is named by the package's address and the bundle's path inside the package, such as `github.com/acme/harbour-methods/tides/notices/tide_notices.mthds`, never by the directory the host installed the package in: that is the `source` of an item located inside the dependency and the file a duplicate declaration inside it names, on every surface, a local one included. When submitted content is validated or run, the library directories loaded beside it are the host's (installed libraries, the defaults, `PIPELEXPATH`) unless the caller says they are its own, so the verdict names none of their files: an item located in one carries no `source`, nor a `field_path` naming it, and is found by its `pipe_code` and `domain_code`, and a message that named one, or named the module a Python file of theirs was imported as (two `@pipe_func` functions of the same name, for instance), reads `<host library file>` in its place (`withholding_host_library_files` in `pipelex/pipeline/validate_bundle_translation.py`). A name only counts standing on its own, never inside a longer one, and a source the caller submitted is never withheld. A bundle validated from a file on the caller's own disk, and content validated or run against library directories that are the caller's (`library_dirs_are_callers`, an option of `validate_bundle`, of the in-process validator and of the local runtime `PipelexMTHDSProtocol`, whose `validate` and `execute` both read it), keep the full path of every file, since there the directories are the caller's own. `pipelex fix bundle --diff` leaves a dependency's address-named source as it is.+**A verdict names no path on the host.** An item and the verdict's message are kept verbatim under STRICT disclosure, so neither names where the host keeps a file. A bundle of a package the method depends on by address is named by the package's address and the bundle's path inside the package, such as `github.com/acme/harbour-methods/tides/notices/tide_notices.mthds`, never by the directory the host installed the package in: that is the `source` of an item located inside the dependency and the file a duplicate declaration inside it names, on every surface, a local one included. When submitted content is validated or run, the library directories loaded beside it are the host's (installed libraries, the defaults, `PIPELEXPATH`) unless the caller says they are its own, so the verdict names none of their files: an item located in one carries no `source`, nor a `field_path` naming it, and is found by its `pipe_code` and `domain_code`, a warning found at a pipe of theirs carries no `template_file` (the sweep withholds it, `BundleValidator`'s `source_pipe_refs`), and a message that named one, or named the module a Python file of theirs was imported as (two `@pipe_func` functions of the same name, for instance), reads `<host library file>` in its place (`withholding_host_library_files` in `pipelex/pipeline/validate_bundle_translation.py`). A name only counts standing on its own, never inside a longer one, and a source the caller submitted is never withheld. A bundle validated from a file on the caller's own disk, and content validated or run against library directories that are the caller's (`library_dirs_are_callers`, an option of `validate_bundle`, of the in-process validator and of the local runtime `PipelexMTHDSProtocol`, whose `validate` and `execute` both read it), keep the full path of every file, since there the directories are the caller's own. `pipelex fix bundle --diff` leaves a dependency's address-named source as it is.**Every refusal of the bundle is a verdict.** A validator answers either a verdict — valid, or invalid with located items — or *no verdict could be produced*, which is reserved for a failure of the tool or its environment. So a refusal raised while loading or validating a bundle becomes an item, never a no-verdict fault. After its class-specific arms, the shared cascade (`translate_to_validate_bundle_error` in `pipelex/pipeline/validate_bundle_translation.py`) turns any other `PipelexError` whose report is `input`-domained into a verdict with one item: `pipe_validation`, with the `pipe_code`, `domain_code` and `source`, when the library load located it on the pipe it was building, and `blueprint_validation` otherwise. That item carries no `error_type`, since a refusal with a closed code has an arm of its own. It keeps the refusal's message only when the refusal authored that message as caller-facing copy, and otherwise names the refusal's title, because the verdict as a whole is kept verbatim under STRICT disclosure. The location comes from the load loop in `LibraryManager.load_from_crate`, the one place that holds a pipe's code, domain and file when building it fails: it raises such a refusal again as a `PipeLoadRefusalError` naming the pipe and the file, `from` the original. A `config` or `runtime` fault, an unclassified one, a `SecurityError`, a `PipeNotFoundError` (which has its own not-found handler) and anything that is not a `PipelexError` still propagate as no verdict. The rule therefore reaches exactly the refusals whose class declares the `input` domain. The pipe factories' refusals do: `PipeLLMFactoryError`, `PipeComposeFactoryError`, `PipeExtractFactoryError`, `PipeConditionFactoryError` and `PipeParallelFactoryError` are raised only while a pipe is built, about its own blueprint, so each is `input`-domained and caller-facing, and a `PipeExtract` whose input is neither an image nor a document validates to one item on that pipe, saying which input to redeclare. `PipeImgGenFactoryError` is not among them: it is raised while an image-generation pipe runs, not while it is built.@@ -107,11 +107,11 @@ Besides `category` and `message`, each item carries whatever identity fields itsAn item's `error_type` names the fault it reports, and that vocabulary is closed: `pipelex/validation_error_types.py` holds it in full, enumerated as `VALIDATION_ERROR_TYPES`. A consumer that needs to know which faults the language surface can report — a coverage gate, a test corpus, a client mapping errors onto its own UI — reads that registry instead of collecting strings from whichever diagnostics it happens to have seen.-The registry is the union of the enums validation already reports through, never a second list beside them — "reports through", not "raises", because the advisory members ride `warnings` and are never raised as an exception at all: `PipeValidationErrorType` and `PipeFactoryErrorType` are the two stage vocabularies, `ValidationResidualErrorType` names the one residual channel with no stage enum of its own, and `HintLintErrorType` carries the intent-hint lints (which attach to concepts and structure fields too, so the pipe enum is the wrong home for them). A member added to any of them is in the registry the moment it is declared. `ValidationErrorItem.error_type` is typed against their union, so an unregistered string cannot be constructed or parsed onto an item — which is what makes the enumeration *closed* rather than merely documented, and what publishes the vocabulary into the OpenAPI schema `pipelex-api` serves for `/validate`.+The registry is the union of the enums validation already reports through, never a second list beside them — "reports through", not "raises", because the advisory members ride `warnings` and are never raised as an exception at all: `PipeValidationErrorType` and `PipeFactoryErrorType` are the two stage vocabularies, `ValidationResidualErrorType` names the one residual channel with no stage enum of its own, `HintLintErrorType` carries the intent-hint lints (which attach to concepts and structure fields too, so the pipe enum is the wrong home for them), and `TemplateCheckErrorType` carries the warnings a `PipeDocGen` step's template check finds during the dry run (the engine reads the template file and reports in its own words, which is not the pipe's validation). A member added to any of them is in the registry the moment it is declared. `ValidationErrorItem.error_type` is typed against their union, so an unregistered string cannot be constructed or parsed onto an item — which is what makes the enumeration *closed* rather than merely documented, and what publishes the vocabulary into the OpenAPI schema `pipelex-api` serves for `/validate`.Two spellings live in that one vocabulary, deliberately. The stage enums are snake_case codes (`missing_input_variable`); the dry-run items' code is `DryRunError`, the name of the exception that produced them, because a dry-run failure is raised as an error object rather than classified into a code. Normalizing it would be a wire break across every consumer that pins the string, and it would buy nothing — the enumeration is closed either way.-Membership means a value is *reachable on the wire*, not that it is a useful thing to exercise. Several members are advisory-only — `optional_force_redundant`, `input_presence_vacuous`, and the three `hint_*` lints — riding `warnings` and never an invalid verdict, and the two `unknown_*` fallbacks fire on states no author can ask for. A consumer building coverage over the registry excludes those on its own side with a stated reason, rather than pruning them from the runtime truth here — which is what the [MTHDS Test Corpus](../contribute/mthds-test-corpus.md) vocabulary generator already does, excluding each with its reason as it generates the `error.*` namespace from this registry.+Membership means a value is *reachable on the wire*, not that it is a useful thing to exercise. Several members are advisory-only — `optional_force_redundant`, `input_presence_vacuous`, the three `hint_*` lints and `template_check_warning` — riding `warnings` and never an invalid verdict, and the two `unknown_*` fallbacks fire on states no author can ask for. A consumer building coverage over the registry excludes those on its own side with a stated reason, rather than pruning them from the runtime truth here — which is what the [MTHDS Test Corpus](../contribute/mthds-test-corpus.md) vocabulary generator already does, excluding each with its reason as it generates the `error.*` namespace from this registry.`validation_errors` is one of the fields kept under STRICT disclosure (it is in `_STRICT_KEPT_FIELDS`): the items describe the caller's *own* submitted bundle, not server internals, so redacting them would gut the hosted path's diagnostics.diff --git a/pipelex/base_exceptions.py b/pipelex/base_exceptions.pyindex 853b28475..953800e49 100644--- a/pipelex/base_exceptions.py+++ b/pipelex/base_exceptions.py@@ -269,7 +269,9 @@ class ValidationErrorCategory(StrEnum):blueprint validation (from the interpreter), pipe-factory failures (e.g. amissing concept), pipe/concept validation (e.g. a missing input variableor a type mismatch), and ``dry_run`` — one item per pipe whose dry run failed,- located at the innermost failing pipe.+ located at the innermost failing pipe. On the report's advisory ``warnings``,+ ``dry_run`` marks a finding a dry run made without failing, such as a warning of+ a ``PipeDocGen`` step's template check."""BLUEPRINT_VALIDATION = "blueprint_validation"@@ -345,6 +347,11 @@ class ValidationErrorItem(BaseModel):model_reference: str | None = Nonemodel_type: str | None = Nonesuggestions: list[str] | None = None+ # The template-check locators, carried by a ``template_check_warning`` item: the template file as the+ # ``PipeDocGen`` step names it, and the place in it the engine's finding names, in the engine's own words+ # (a defined name, a Table, a cell, a shape, a tag). Optional and additive, like ``declared_concepts``.+ template_file: str | None = None+ template_location: str | None = None# Structured, deterministic fix for this error, when the fix planner derived one from the# enriched error data. Optional and additive: non-fixable items serialize unchanged under# ``exclude_none``.diff --git a/pipelex/cli/agent_cli/CLAUDE.md b/pipelex/cli/agent_cli/CLAUDE.mdindex ddae2998b..ac42fb36e 100644--- a/pipelex/cli/agent_cli/CLAUDE.md+++ b/pipelex/cli/agent_cli/CLAUDE.md@@ -18,7 +18,7 @@ Only the error format is backed by a module-level `ContextVar` in `agent_output.Markdown structure per command:- `run`: `# Pipeline run complete`, a `## Result` section (the rendered `main_stuff` markdown with `--with-memory`, otherwise the concept JSON in a fenced block), and output / graph file paths. With the graph on, the `graph_files` object of the `--with-memory` envelope names the viewer (`graph_html`), the graph on a live run (`graph_spec`, the graphspec renamed `live_run_graph.json`) and the graph's three companions written beside it under their canonical names (`pipe_io_contracts`, `input_form`, `output_form` — the validate artifacts describing the graph's data, keyed by `pipe_ref`); the agent CLI settles its graph inclusion (graphspec on, viewer on) before the run rather than at render time, since the companions are built inside the run's library window under that same flag; a viewer resolves them from the graph file's directory, so the rename never moves them. Cost is machine-first: on the local runner, when costs are on (`--costs`, the default) and the run did reportable work (any tokens or any cost), a best-effort `cost_report` object (`{total_cost, by_model: [...]}`, real USD) rides the JSON `--with-memory` envelope — there is **no** Rich cost table on stderr (unlike the human `pipelex run` CLI). The markdown renderer ignores the `cost_report` key, so it is JSON-only. A free/zero-price model still reports its token usage (with `total_cost` 0). The `cost_report` is **absent** when the run did no reportable work (dry runs), when `--no-costs` is passed, on a hosted run (which assembles no local usage), or if cost-summary aggregation fails (caught and skipped so it never fails an otherwise-successful run) — so consumers must treat it as optional.-- `validate`: `# Validation passed`, the bundle path when relevant, and a list of validated pipes with their status. Every entry in `validated_pipes` (markdown and JSON) identifies its pipe by the namespaced `pipe_ref` (`domain.code`) — the same unambiguous identity across `validate all`, `validate bundle`, and `validate pipe`, so the same pipe is never reported under two identifiers. `validate bundle`, `validate method`, and `validate all` carry `pending_signatures` — the library-wide list of pipes still declared as `PipeSignature` (unimplemented forward declarations), namespaced by `pipe_ref` — rendered as a "Pending signatures" section in markdown. They also carry a derived `is_runnable` boolean (`true` ⇔ `pending_signatures` is empty), and the markdown adds an explicit plain-English runnability verdict on those surfaces: a complete bundle/library states it is runnable, while one with pending signatures states it is NOT yet runnable immediately above the verbatim "Pending signatures" heading. These whole-bundle/whole-library surfaces are **strict by default**: they exit non-zero on `not is_runnable` unless `--allow-signatures` is passed (which both tolerates the placeholders for the exit code and mock-runs the signature pipes in the sweep). Single-pipe surfaces make no library-wide runnability claim and never gate the exit code on it: bare `validate pipe <code>` omits the key and emits no verdict, while `validate bundle`/`validate method` with `--pipe` still surface the library-wide `pending_signatures` for information but do not gate on it (the requested slice can be fully implemented even when unrelated placeholders remain elsewhere). The whole-bundle and whole-library surfaces also carry a `warnings` array — the advisory lints, rendered as a "Warnings" section in markdown — assembled by `pipelex/pipeline/advisory_warnings.py`, the ONE composition point every advisory-bearing channel calls (this CLI, the bare CLI and the protocol report). Bare `validate pipe <code>` carries none; `validate bundle` / `validate method` with `--pipe` DO carry them, because they validate the whole bundle and only narrow the dry run, so the array stays bundle-wide there. Add a new advisory family there, never at a call site: the sites used to assemble their own and disagreed about which families they carried.+- `validate`: `# Validation passed`, the bundle path when relevant, and a list of validated pipes with their status. Every entry in `validated_pipes` (markdown and JSON) identifies its pipe by the namespaced `pipe_ref` (`domain.code`) — the same unambiguous identity across `validate all`, `validate bundle`, and `validate pipe`, so the same pipe is never reported under two identifiers. `validate bundle`, `validate method`, and `validate all` carry `pending_signatures` — the library-wide list of pipes still declared as `PipeSignature` (unimplemented forward declarations), namespaced by `pipe_ref` — rendered as a "Pending signatures" section in markdown. They also carry a derived `is_runnable` boolean (`true` ⇔ `pending_signatures` is empty), and the markdown adds an explicit plain-English runnability verdict on those surfaces: a complete bundle/library states it is runnable, while one with pending signatures states it is NOT yet runnable immediately above the verbatim "Pending signatures" heading. These whole-bundle/whole-library surfaces are **strict by default**: they exit non-zero on `not is_runnable` unless `--allow-signatures` is passed (which both tolerates the placeholders for the exit code and mock-runs the signature pipes in the sweep). Single-pipe surfaces make no library-wide runnability claim and never gate the exit code on it: bare `validate pipe <code>` omits the key and emits no verdict, while `validate bundle`/`validate method` with `--pipe` still surface the library-wide `pending_signatures` for information but do not gate on it (the requested slice can be fully implemented even when unrelated placeholders remain elsewhere). The whole-bundle and whole-library surfaces also carry a `warnings` array — the advisory lints, then what the sweep's dry runs found without failing (a `PipeDocGen` template check's `template_check_warning`s), rendered as a "Warnings" section in markdown — assembled by `pipelex/pipeline/advisory_warnings.py`, the ONE composition point every advisory-bearing channel calls (this CLI, the bare CLI and the protocol report). Bare `validate pipe <code>` carries the dry-run findings alone (`pipelex/pipeline/dry_run_warnings.py`), since one pipe has no flow to lint but what its dry run found is about it; `validate bundle` / `validate method` with `--pipe` carry every family, because they validate the whole bundle and only narrow the dry run, so the array stays bundle-wide there. Add a new advisory family there, never at a call site: the sites used to assemble their own and disagreed about which families they carried.- `fix`: `# Fix applied - bundle is valid` after one or more fixes, `# Bundle already valid` when the loop had nothing to apply, or `# Bundle valid but not runnable` when pending `PipeSignature` placeholders remain. The JSON success envelope carries `is_valid`, `bundle_path`, `iterations`, `fixes_applied`, `files_written`, `remaining_errors`, and, on successful validation, `pending_signatures` plus `is_runnable`. Whole-bundle fix runs are strict by default: they emit the success envelope but exit 1 on `not is_runnable` unless `--allow-signatures` is passed. A still-invalid verdict exits 1 via `FixBundleError` on stderr with the same structured result fields plus any `bail_reason`.- `migrate`: `# Configuration migration`, the mode (applied / dry run) and verdict, the directories walked, a files-walked/changed/written count and, when a former release left something, its file count, then one `## <path>` section per file the former-release cleanup touches, listing its changes and its backup, a `## Pipelex still cannot start` section when the cleanup's check, run on every run, found something, and one per file that is not clean listing the entries applied, the entries blocked with their reason and guidance, and any unexplained paths. Paths, operation kinds, ledger-supplied values and the names of retired backends and profiles only — no value read from the user's file is ever rendered, in either format.- `init`: `# Pipelex initialized` with target directory and execution, then enabled backends and routing profile for a local setup, or whether a Pipelex API key is set for a hosted one.diff --git a/pipelex/cli/agent_cli/commands/validate/_validate_core.py b/pipelex/cli/agent_cli/commands/validate/_validate_core.pyindex a0adc6206..c6eb0e986 100644--- a/pipelex/cli/agent_cli/commands/validate/_validate_core.py+++ b/pipelex/cli/agent_cli/commands/validate/_validate_core.py@@ -17,6 +17,7 @@ from pipelex.interpreter_hub import (from pipelex.pipeline.advisory_warnings import collect_advisory_warnings, collect_current_library_entry_pipe_refsfrom pipelex.pipeline.blueprint_selection import collect_entry_pipe_refsfrom pipelex.pipeline.bundle_validator import BundleValidator+from pipelex.pipeline.dry_run_warnings import build_dry_run_warningsfrom pipelex.pipeline.execution_seams import acquire_libraryfrom pipelex.pipeline.usage_stats_reporting import MethodValidationReportfrom pipelex.pipeline.validate_bundle import build_pending_signatures, build_validated_pipes, validate_bundle@@ -65,7 +66,7 @@ async def validate_all_core(*, library_dirs: list[Path] | None = None, allow_sig# A pipe whose dry run fails is the invalid verdict, one located dry_run item per failing pipe,# through the same cascade and item builder as `validate bundle`.with translate_to_validate_bundle_error():- dry_run_results = await BundleValidator().validate_current_library(allow_signatures=allow_signatures)+ dry_run_results = await BundleValidator().validate_current_library(allow_signatures=allow_signatures, collect_dry_run_warnings=True)# pending_signatures is the library-wide set of still-unimplemented forward declarations;# is_runnable = not pending. `validate all` now makes a strict runnability claim (the consumer@@ -76,7 +77,11 @@ async def validate_all_core(*, library_dirs: list[Path] | None = None, allow_sig# Its entry pipes come off the blueprints the library manager accumulated on the way in;# there is no `ValidateBundleResult` on this path to read a `main_pipe` from.library_pipes = list(get_pipe_library().get_pipes_dict().values())- warnings = collect_advisory_warnings(pipes=library_pipes, entry_pipe_refs=collect_current_library_entry_pipe_refs())+ warnings = collect_advisory_warnings(+ pipes=library_pipes,+ entry_pipe_refs=collect_current_library_entry_pipe_refs(),+ dry_run_result=dry_run_results,+ )validation_report.count_warnings(count=len(warnings))return {"success": True,@@ -122,8 +127,13 @@ async def validate_bundle_core(mthds_file_path=bundle_path,library_dirs=library_dirs,allow_signatures=allow_signatures,+ collect_dry_run_warnings=True,+ )+ warnings = collect_advisory_warnings(+ pipes=result.pipes,+ entry_pipe_refs=collect_entry_pipe_refs(result.blueprints),+ dry_run_result=result.dry_run_result,)- warnings = collect_advisory_warnings(pipes=result.pipes, entry_pipe_refs=collect_entry_pipe_refs(result.blueprints))validation_report.describe(pipes=result.pipes)validation_report.count_warnings(count=len(warnings))@@ -185,13 +195,20 @@ async def validate_pipe_core(the_pipe = get_required_entry_pipe(pipe_code=pipe_code)validation_report.describe(pipes=get_own_pipes())with translate_to_validate_bundle_error():- dry_run_results = await BundleValidator().validate_pipes(pipes=[the_pipe], library_id=library_id, allow_signatures=allow_signatures)+ dry_run_results = await BundleValidator().validate_pipes(+ pipes=[the_pipe], library_id=library_id, allow_signatures=allow_signatures, collect_dry_run_warnings=True+ )+ # warnings: what the pipe's dry run found without failing, such as a template check's warnings. None+ # of the bundle-wide lints ride here: one pipe makes no bundle-wide claim, so there is no flow to lint.+ warnings = build_dry_run_warnings(dry_run_results)+ validation_report.count_warnings(count=len(warnings))return {"success": True,"is_valid": True,"validated_pipes": build_validated_pipes(dry_run_results),"total_pipes": len(dry_run_results),+ "warnings": [warning.model_dump(exclude_none=True) for warning in warnings],}finally:# validate_pipes is the D6 inner sweep and never tears the library down, and validate_pipe_core@@ -246,8 +263,13 @@ async def validate_pipe_in_bundle_core(library_dirs=library_dirs,allow_signatures=allow_signatures,dry_run_pipe_codes=[pipe_code],+ collect_dry_run_warnings=True,+ )+ warnings = collect_advisory_warnings(+ pipes=result.pipes,+ entry_pipe_refs=collect_entry_pipe_refs(result.blueprints),+ dry_run_result=result.dry_run_result,)- warnings = collect_advisory_warnings(pipes=result.pipes, entry_pipe_refs=collect_entry_pipe_refs(result.blueprints))validation_report.describe(pipes=result.pipes)validation_report.count_warnings(count=len(warnings))diff --git a/pipelex/cli/commands/validate/_validate_core.py b/pipelex/cli/commands/validate/_validate_core.pyindex fbdc9ab24..7ed6ea06b 100644--- a/pipelex/cli/commands/validate/_validate_core.py+++ b/pipelex/cli/commands/validate/_validate_core.py@@ -29,6 +29,7 @@ from pipelex.pipelex import Pipelexfrom pipelex.pipeline.advisory_warnings import collect_advisory_warnings, collect_current_library_entry_pipe_refsfrom pipelex.pipeline.blueprint_selection import collect_entry_pipe_refsfrom pipelex.pipeline.bundle_validator import BundleValidator+from pipelex.pipeline.dry_run_warnings import build_dry_run_warningsfrom pipelex.pipeline.exceptions import ValidateBundleErrorfrom pipelex.pipeline.execution_seams import load_libraries_and_activatefrom pipelex.pipeline.usage_stats_reporting import MethodValidationReport@@ -41,24 +42,31 @@ from pipelex.tools.misc.package_utils import get_package_versionfrom pipelex.tools.misc.string_utils import count_with_nounif TYPE_CHECKING:+ from collections.abc import Mappingfrom pathlib import Path+ from pipelex.base_exceptions import ValidationErrorItemfrom pipelex.pipe_machinery.pipe_abstract import PipeAbstract+ from pipelex.pipeline.bundle_validator import DryRunOutputCOMMAND = "validate"-def _echo_advisory_warnings(*, pipes: list[PipeAbstract], entry_pipe_refs: list[str]) -> int:- """Render every advisory lint family in yellow, in the composition point's fixed order, and return how many there were.+def _echo_warnings(*, warnings: list[ValidationErrorItem]) -> int:+ """Render advisory warnings in yellow, in the order given, and return how many there were."""+ for warning in warnings:+ typer.secho(f"Warning: {warning.message}", fg=typer.colors.YELLOW)+ return len(warnings)+++def _echo_advisory_warnings(*, pipes: list[PipeAbstract], entry_pipe_refs: list[str], dry_run_result: Mapping[str, DryRunOutput]) -> int:+ """Render every advisory family in yellow, in the composition point's fixed order, and return how many there were.Advisory only — a warning never changes the validation verdict or the exit code. Requires thevalidation library to still be loaded: the taint walk resolves child pipes via the hub, and thedescriptors and the hint lint read the library's accumulated crate."""- warnings = collect_advisory_warnings(pipes=pipes, entry_pipe_refs=entry_pipe_refs)- for warning in warnings:- typer.secho(f"Warning: {warning.message}", fg=typer.colors.YELLOW)- return len(warnings)+ return _echo_warnings(warnings=collect_advisory_warnings(pipes=pipes, entry_pipe_refs=entry_pipe_refs, dry_run_result=dry_run_result))def _format_signatures_summary_suffix(*, signature_count: int) -> str:@@ -103,13 +111,19 @@ def do_validate_all_libraries_and_dry_run(*, library_dirs: list[Path] | None = N# event — sweeping the library we just loaded, without teardown. A pipe whose dry run fails# raises DryRunError, which the cascade turns into the same invalid verdict.with translate_to_validate_bundle_error():- asyncio.run(BundleValidator().validate_current_library(allow_signatures=allow_signatures))+ dry_run_results = asyncio.run(+ BundleValidator().validate_current_library(allow_signatures=allow_signatures, collect_dry_run_warnings=True)+ )# Advisory lints over the whole loaded library (the optionality lint's cross-flow# aggregation needs every flow) — printed even when the signature gate below exits# non-zero. The entry pipes come off the blueprints the library manager accumulated.validation_report.count_warnings(- count=_echo_advisory_warnings(pipes=all_pipes, entry_pipe_refs=collect_current_library_entry_pipe_refs())+ count=_echo_advisory_warnings(+ pipes=all_pipes,+ entry_pipe_refs=collect_current_library_entry_pipe_refs(),+ dry_run_result=dry_run_results,+ ))# Gate-from-report (D-B consumer-decides): signatures are never a validation error, but a@@ -152,6 +166,7 @@ async def _validate_pipe_or_bundle(mthds_file_path=bundle_path,library_dirs=library_dirs,allow_signatures=allow_signatures,+ collect_dry_run_warnings=True,)# Advisory lints, printed BEFORE the signature gate below exits non-zero — same ordering# as `validate --all`. A method with an unimplemented placeholder is the state an author@@ -160,7 +175,11 @@ async def _validate_pipe_or_bundle(# the lints can still resolve the bundle's pipes.validation_report.describe(pipes=bundle_result.pipes)validation_report.count_warnings(- count=_echo_advisory_warnings(pipes=bundle_result.pipes, entry_pipe_refs=collect_entry_pipe_refs(bundle_result.blueprints))+ count=_echo_advisory_warnings(+ pipes=bundle_result.pipes,+ entry_pipe_refs=collect_entry_pipe_refs(bundle_result.blueprints),+ dry_run_result=bundle_result.dry_run_result,+ ))# Valid whatever the gate below decides: a bundle left unrunnable by its placeholders is still valid.validation_report.declare_valid()@@ -214,11 +233,15 @@ async def _validate_pipe_or_bundle(# dry-runs trivially (the placeholder mints a mock). validate pipe makes no library-wide# runnability claim — pending_signatures is a bundle-surface fact — so there is no gate here.with translate_to_validate_bundle_error():- await BundleValidator().validate_pipes(+ dry_run_results = await BundleValidator().validate_pipes(pipes=[pipe],library_id=library_id,allow_signatures=allow_signatures,+ collect_dry_run_warnings=True,)+ # No bundle-wide lint here, since one pipe makes no bundle-wide claim, but what its dry run found+ # without failing is about this pipe, such as a template check's warnings, so it is echoed.+ validation_report.count_warnings(count=_echo_warnings(warnings=build_dry_run_warnings(dry_run_results)))except ValidateBundleError as bundle_error:handle_validate_bundle_error(bundle_error, library_dirs=library_dirs, allow_signatures=allow_signatures)signature_count = len(collect_signature_refs(pipe=pipe))diff --git a/pipelex/cli/dev_cli/commands/generate_corpus_vocabulary_cmd.py b/pipelex/cli/dev_cli/commands/generate_corpus_vocabulary_cmd.pyindex 63dfb56e6..6e6053773 100644--- a/pipelex/cli/dev_cli/commands/generate_corpus_vocabulary_cmd.py+++ b/pipelex/cli/dev_cli/commands/generate_corpus_vocabulary_cmd.py@@ -27,6 +27,7 @@ from pipelex.validation_error_types import (HintLintErrorType,PipeFactoryErrorType,PipeValidationErrorType,+ TemplateCheckErrorType,ValidationErrorType,)@@ -186,6 +187,13 @@ _ERROR_TYPE_EXCLUSIONS: dict[ValidationErrorType, str] = {HintLintErrorType.HINT_UNKNOWN_KEY: _ADVISORY_HINT_LINT_EXCLUSION,HintLintErrorType.HINT_UNKNOWN_INTENT: _ADVISORY_HINT_LINT_EXCLUSION,HintLintErrorType.HINT_INAPPLICABLE_INTENT: _ADVISORY_HINT_LINT_EXCLUSION,+ TemplateCheckErrorType.TEMPLATE_CHECK_WARNING: (+ "Advisory-only, for the same reason as `optional_force_redundant`: a warning of a PipeDocGen step's template check rides "+ "the validation report's `warnings` array and never makes a verdict invalid. It also needs what a focused "+ "entry cannot carry: a template file beside the bundle, an office format, and an engine that reads that "+ "format, which no consumer but a runtime holding the document generation plugin has. Revisit if the manifest "+ "ever grows a warnings axis and an entry can carry its template files."+ ),PipeValidationErrorType.UNKNOWN_VALIDATION_ERROR: ("The generic fallback for a validation failure that matched no specific code. Reaching it on purpose ""would mean authoring a bundle that breaks in a way the categorizer does not recognize — which is a "diff --git a/pipelex/cogt/doc_gen/doc_gen_worker_abstract.py b/pipelex/cogt/doc_gen/doc_gen_worker_abstract.pyindex b4c9c8d86..039488c2c 100644--- a/pipelex/cogt/doc_gen/doc_gen_worker_abstract.py+++ b/pipelex/cogt/doc_gen/doc_gen_worker_abstract.py@@ -46,8 +46,9 @@ class DocGenWorkerAbstract(InferenceWorkerAbstract):An office template names its fields in its own way, which only its engine can read, so an engine that fillstemplate files overrides this. The default finds nothing: the built-in PDF engine takes no template, and- Pipelex checks HTML templates itself. An error finding fails the step, and a warning is logged. It raises- only for a fault of its own: a template it cannot read at all is an error finding.+ Pipelex checks HTML templates itself. An error finding fails the step, and a warning joins the validation+ verdict's advisory `warnings`, or is logged by a dry run that returns no verdict. It raises only for a fault+ of its own: a template it cannot read at all is an error finding."""_ = requestreturn []diff --git a/pipelex/cogt/doc_gen/template_check.py b/pipelex/cogt/doc_gen/template_check.pyindex 8de1efd10..47d7dafa3 100644--- a/pipelex/cogt/doc_gen/template_check.py+++ b/pipelex/cogt/doc_gen/template_check.py@@ -4,8 +4,10 @@ An office template names the fields it is filled with in its own way: an Excel wnames and Tables, a Word document through its tags, a PowerPoint deck through its shape names. Pipelex cannotread those, so an engine that fills a template file overrides its worker's `check_template`(`DocGenWorkerAbstract`). The dry run, and so `pipelex validate`, calls it for every `PipeDocGen` step with a-`template_file`, before anything is spent: an error finding fails the step, and a warning is logged. The-built-in PDF engine takes no template, and Pipelex checks HTML templates itself, so neither needs one.+`template_file`, before anything is spent: an error finding fails the step, and a warning joins the validation+verdict's advisory `warnings` as a `template_check_warning` item, or is logged by a dry run that returns no verdict.+Either way a finding's words reach whoever validates the method, so they are written for the template's author.+The built-in PDF engine takes no template, and Pipelex checks HTML templates itself, so neither needs one."""from enum import StrEnum@@ -23,7 +25,7 @@ class TemplateFindingSeverity(StrEnum):@propertydef is_error(self) -> bool:- """Whether a finding of this severity fails the step, rather than being logged."""+ """Whether a finding of this severity fails the step, rather than being reported as an advisory warning."""match self:case TemplateFindingSeverity.ERROR:return Truediff --git a/pipelex/pipe_operators/doc_gen/pipe_doc_gen.py b/pipelex/pipe_operators/doc_gen/pipe_doc_gen.pyindex c2afe7717..ccf4c273b 100644--- a/pipelex/pipe_operators/doc_gen/pipe_doc_gen.py+++ b/pipelex/pipe_operators/doc_gen/pipe_doc_gen.py@@ -8,6 +8,7 @@ from pydantic import Fieldfrom typing_extensions import overridefrom pipelex import log+from pipelex.base_exceptions import ValidationErrorCategory, ValidationErrorItemfrom pipelex.cogt.doc_gen.doc_gen_engine import require_doc_gen_engine_declared, resolve_doc_gen_settingfrom pipelex.cogt.doc_gen.doc_gen_format import DocGenFormat, DocGenSourcefrom pipelex.cogt.doc_gen.doc_gen_setting import DocGenModelChoice, DocGenSetting@@ -16,7 +17,7 @@ from pipelex.cogt.doc_gen.document_composition import DocumentCompositionfrom pipelex.cogt.doc_gen.input_shape import InputShape, shape_of_inputfrom pipelex.cogt.doc_gen.layout_builder import build_layout_document, humanizefrom pipelex.cogt.doc_gen.plain_data import plain_data-from pipelex.cogt.doc_gen.template_check import TemplateCheckRequest+from pipelex.cogt.doc_gen.template_check import TemplateCheckRequest, TemplateFindingfrom pipelex.cogt.model_backends.model_type import ModelTypefrom pipelex.cogt.models.model_deck_check import check_doc_gen_choice_with_deckfrom pipelex.cogt.templating.template_preprocessor import rewrite_template_sigils@@ -33,6 +34,7 @@ from pipelex.pipe_machinery.template_guard_lint import lint_authored_templatefrom pipelex.pipe_operators.doc_gen.exceptions import PipeDocGenRunError, PipeDocGenTemplateCheckError, PipeDocGenUndefinedValueErrorfrom pipelex.pipe_operators.doc_gen.template_field_check import check_template_field_pathsfrom pipelex.pipe_operators.pipe_operator import PipeOperator+from pipelex.pipe_run.dry_run_warning_collector import report_dry_run_warningfrom pipelex.pipe_run.pipe_run_params import PipeRunParamsfrom pipelex.runtime_hub import get_class_registry, get_content_generator, get_model_deck, get_report_delegatefrom pipelex.system.job_metadata import JobMetadata@@ -41,6 +43,7 @@ from pipelex.tools.jinja2.jinja2_required_variables import detect_jinja2_requirefrom pipelex.tools.jinja2.template_category import TemplateCategoryfrom pipelex.tools.misc.string_utils import get_root_from_dotted_pathfrom pipelex.tools.templating.templating_style import TemplatingStyle+from pipelex.validation_error_types import TemplateCheckErrorType_UNSAFE_FILENAME_CHARACTERS = re.compile(r"[^\w.\-]+")_MAX_FILENAME_STEM_LENGTH = 120@@ -278,6 +281,8 @@ class PipeDocGen(PipeOperator[PipeDocGenOutput]):"""Run the engine's template checker on the step's template file, when its engine has one.The inputs in memory are the dry run's mocks, so the checker can fill the template in memory with them.+ A warning finding is reported to the validation sweep, which puts it in the verdict's `warnings`, or logged+ when no sweep collects this dry run's warnings.Raises:PipeDocGenTemplateCheckError: the checker reported errors.@@ -298,15 +303,31 @@ class PipeDocGen(PipeOperator[PipeDocGenOutput]):errors = [finding for finding in findings if finding.severity.is_error]for finding in findings:if not finding.severity.is_error:- finding_fields: dict[str, str] = {"pipe_code": self.code, "template_file": self.template_file, "finding_message": finding.message}- if finding.location:- finding_fields["finding_location"] = finding.location- log.warning("The template check of a PipeDocGen found a warning in its template file", fields=finding_fields)+ self._report_template_warning(finding=finding, template_file=self.template_file)if errors:listed = "\n".join(f"- {finding.message}" + (f" ({finding.location})" if finding.location else "") for finding in errors)msg = f"PipeDocGen '{self.code}': the template file '{self.template_file}' does not fit the step's inputs:\n{listed}"raise PipeDocGenTemplateCheckError(msg)+ def _report_template_warning(self, *, finding: TemplateFinding, template_file: str) -> None:+ """Report a warning of the template check as an advisory item, located at this step, its file and the place in it."""+ location_suffix = f" ({finding.location})" if finding.location else ""+ warning = ValidationErrorItem(+ category=ValidationErrorCategory.DRY_RUN,+ error_type=TemplateCheckErrorType.TEMPLATE_CHECK_WARNING,+ pipe_code=self.code,+ domain_code=self.domain_code,+ template_file=template_file,+ template_location=finding.location,+ message=f"PipeDocGen '{self.code}', template file '{template_file}': {finding.message}{location_suffix}",+ )+ if report_dry_run_warning(warning=warning):+ return+ finding_fields: dict[str, str] = {"pipe_code": self.code, "template_file": template_file, "finding_message": finding.message}+ if finding.location:+ finding_fields["finding_location"] = finding.location+ log.warning("The template check of a PipeDocGen found a warning in its template file", fields=finding_fields)+##################################################################################################################### Runs####################################################################################################################diff --git a/pipelex/pipe_run/dry_run_warning_collector.py b/pipelex/pipe_run/dry_run_warning_collector.pynew file mode 100644index 000000000..745b15aa1--- /dev/null+++ b/pipelex/pipe_run/dry_run_warning_collector.py@@ -0,0 +1,71 @@+"""The warnings a validation sweep collects from the dry runs it makes.++A dry run can find something an author should hear about without failing: the warning findings of a+`PipeDocGen` step's template check are the first such thing. They belong in the verdict's advisory+`warnings`, beside the static lints, and the verdict is composed long after the pipe that found them has+returned. So a sweep whose caller reports them (`collect_dry_run_warnings`, which the validate surfaces pass)+collects them while each pipe's dry run is in flight, and keeps them on that pipe's `DryRunOutput`, from which+the composition point reads them (`pipelex.pipeline.advisory_warnings`).++The collector is a context variable, scoped by the sweep to one pipe's dry run, for the same reasons the+sweep's failure recorder is one: the asyncio tasks a controller's fan-out spawns inherit it, so a pipe run+deep inside a sequence or a batch reports to the same collector, and concurrent sweeps never mix.++A dry run that no sweep collects has no verdict to put a warning in, and its pipe logs the warning instead+(see :func:`report_dry_run_warning`): `pipelex run --dry-run`, and every sweep whose caller reports no verdict+of its own, such as `pipelex fix bundle` or `pipelex build inputs`, so no warning is dropped unseen. The graph arm of a validation dry-runs+its target again after the sweep, and collects what it finds only to drop it, since the sweep reported it.+"""++from collections.abc import Generator+from contextlib import contextmanager+from contextvars import ContextVar++from pipelex.base_exceptions import ValidationErrorItem+++class DryRunWarningCollector:+ """The warnings one pipe's dry run found, in the order they were found, each once.++ A pipe can be run several times within one dry run, such as a step a batch runs for each item, and each+ run finds the same warning again; it is kept once.+ """++ def __init__(self) -> None:+ self._warnings: list[ValidationErrorItem] = []++ def add(self, *, warning: ValidationErrorItem) -> None:+ if warning not in self._warnings:+ self._warnings.append(warning)++ @property+ def warnings(self) -> list[ValidationErrorItem]:+ return list(self._warnings)+++_dry_run_warning_collector: ContextVar[DryRunWarningCollector | None] = ContextVar("dry_run_warning_collector", default=None)+++@contextmanager+def collecting_dry_run_warnings() -> Generator[DryRunWarningCollector, None, None]:+ """Collect the warnings of the dry runs made inside this scope, for the sweep that opened it."""+ collector = DryRunWarningCollector()+ token = _dry_run_warning_collector.set(collector)+ try:+ yield collector+ finally:+ _dry_run_warning_collector.reset(token)+++def report_dry_run_warning(*, warning: ValidationErrorItem) -> bool:+ """Hand a warning to the sweep collecting this dry run's warnings.++ Returns:+ True when a sweep took it for its caller's verdict; False when no sweep collects this dry run's warnings,+ in which case the caller logs it, since nothing else will report it.+ """+ collector = _dry_run_warning_collector.get()+ if collector is None:+ return False+ collector.add(warning=warning)+ return Truediff --git a/pipelex/pipeline/advisory_warnings.py b/pipelex/pipeline/advisory_warnings.pyindex a74337b6c..3e226b8e5 100644--- a/pipelex/pipeline/advisory_warnings.py+++ b/pipelex/pipeline/advisory_warnings.py@@ -1,11 +1,13 @@"""The one composition point for the validation report's advisory `warnings`.A warning is a finding worth surfacing on a VALID bundle that must never flip `is_valid`. There are-three families of them today, each derived from a different substrate:+four families of them today, each derived from a different substrate:- **`optionality`** — the useless-`!` lint, from the controllers' taint analyses.- **`presence vacuity`** — the entry-pipe lint, from the input-form descriptors.- **`hints`** — the intent-hints lints, from the qualified crate.+- **`dry-run findings`** — what the sweep's dry runs found without failing, such as the warnings of a+ `PipeDocGen` step's template check, from the sweep's per-pipe status map.They used to be assembled site by site, and the sites disagreed: the protocol path carried theoptionality and hint lints, while the agent CLI, the builder ops and the bare CLI each carried the@@ -23,16 +25,23 @@ Two entry points, because the channels hold different things in hand:Both must run **inside the open validation window**: the descriptors' class-backed reflection readsthe class registry, and the crate is read off the current library.++The single-pipe surfaces (`validate pipe`) are the one place a channel carries less, and on purpose: they+dry-run one pipe and make no bundle-wide claim, so they carry the dry-run findings alone+(`pipelex.pipeline.dry_run_warnings.build_dry_run_warnings`), which are about the pipes they ran, and none+of the three lints, which have nothing to say about one pipe in isolation."""-from collections.abc import Iterable, Sequence+from collections.abc import Iterable, Mapping, Sequencefrom pipelex.base_exceptions import ValidationErrorItemfrom pipelex.interpreter_hub import get_current_library, get_library_managerfrom pipelex.libraries.crate_qualification import QualifiedCrateContentfrom pipelex.pipe_machinery.pipe_abstract import PipeAbstractfrom pipelex.pipeline.blueprint_selection import collect_entry_pipe_refs+from pipelex.pipeline.bundle_validator import DryRunOutputfrom pipelex.pipeline.controller_taint import ControllerTaintAnalysis, collect_controller_taint_analyses+from pipelex.pipeline.dry_run_warnings import build_dry_run_warningsfrom pipelex.pipeline.hint_warnings import build_hint_warningsfrom pipelex.pipeline.input_form import InputForm, build_input_form, qualify_current_library_cratefrom pipelex.pipeline.optionality_warnings import build_optionality_warnings@@ -45,6 +54,7 @@ def build_advisory_warnings(input_form: InputForm,entry_pipe_refs: Iterable[str],qualified_crate: QualifiedCrateContent,+ dry_run_result: Mapping[str, DryRunOutput],) -> list[ValidationErrorItem]:"""Every advisory family, concatenated in one fixed order.@@ -57,18 +67,23 @@ def build_advisory_warnings(input_form: The batch's input-form descriptors (`build_input_form`).entry_pipe_refs: The qualified refs of the batch's entry pipes (`collect_entry_pipe_refs`).qualified_crate: The current library's qualified crate (`qualify_current_library_crate`).+ dry_run_result: The sweep's per-pipe status map, carrying what each dry run found without failing,+ from a sweep run with `collect_dry_run_warnings`.Returns:- The advisory items: optionality, then presence vacuity, then hints.+ The advisory items: optionality, then presence vacuity, then hints, then the dry-run findings."""return [*build_optionality_warnings(taint_analyses),*build_vacuous_presence_warnings(input_form=input_form, entry_pipe_refs=entry_pipe_refs),*build_hint_warnings(qualified_crate),+ *build_dry_run_warnings(dry_run_result),]-def collect_advisory_warnings(*, pipes: Sequence[PipeAbstract], entry_pipe_refs: Iterable[str]) -> list[ValidationErrorItem]:+def collect_advisory_warnings(+ *, pipes: Sequence[PipeAbstract], entry_pipe_refs: Iterable[str], dry_run_result: Mapping[str, DryRunOutput]+) -> list[ValidationErrorItem]:"""Gather every advisory ingredient inside the validation window, then build the warnings.The crate is qualified ONCE here and handed to both consumers that need it — the descriptors and@@ -78,6 +93,8 @@ def collect_advisory_warnings(*, pipes: Sequence[PipeAbstract], entry_pipe_refs:pipes: The loaded pipes to judge (typically `ValidateBundleResult.pipes`, or every pipe ofthe current library on the library-wide path).entry_pipe_refs: The qualified refs of the batch's entry pipes (`collect_entry_pipe_refs`).+ dry_run_result: The sweep's per-pipe status map (`ValidateBundleResult.dry_run_result`, or what the+ library-wide sweep returned), from a sweep run with `collect_dry_run_warnings`.Returns:The advisory items, in the order :func:`build_advisory_warnings` fixes.@@ -88,6 +105,7 @@ def collect_advisory_warnings(*, pipes: Sequence[PipeAbstract], entry_pipe_refs:input_form=build_input_form(pipes, qualified_crate=qualified_crate),entry_pipe_refs=entry_pipe_refs,qualified_crate=qualified_crate,+ dry_run_result=dry_run_result,)diff --git a/pipelex/pipeline/bundle_validator.py b/pipelex/pipeline/bundle_validator.pyindex fd0b38615..b5e923f71 100644--- a/pipelex/pipeline/bundle_validator.py+++ b/pipelex/pipeline/bundle_validator.py@@ -27,16 +27,17 @@ activity later (D5)."""import time+from contextlib import AbstractContextManager, nullcontextfrom contextvars import ContextVarfrom enum import StrEnumfrom typing import TYPE_CHECKINGfrom polyfactory.exceptions import FactoryException-from pydantic import BaseModel, ValidationError+from pydantic import BaseModel, Field, ValidationErrorfrom typing_extensions import overridefrom pipelex import log-from pipelex.base_exceptions import PipelexError+from pipelex.base_exceptions import PipelexError, ValidationErrorItemfrom pipelex.cogt.content_generation.content_generator import ContentGeneratorfrom pipelex.config import get_configfrom pipelex.core.exceptions import DryRunFailureErrorData@@ -54,13 +55,16 @@ from pipelex.interpreter_hub import (from pipelex.libraries.pipe.exceptions import PipeNotFoundErrorfrom pipelex.observer.observer_protocol import ObserverNoOpfrom pipelex.pipe_machinery.pipe_abstract import PipeAbstract+from pipelex.pipe_run.dry_run_warning_collector import DryRunWarningCollector, collecting_dry_run_warningsfrom pipelex.pipe_run.exceptions import DryRunErrorfrom pipelex.pipe_run.located_failure import find_foreign_fault, find_root_faultfrom pipelex.pipe_run.pipe_job import PipeJobfrom pipelex.pipe_run.pipe_router import PipeRouterfrom pipelex.pipe_run.pipe_run import PipeRun+from pipelex.pipeline.exceptions import withhold_names_in_textfrom pipelex.pipeline.execution_seams import acquire_library, prepare_pipe_jobfrom pipelex.pipeline.pipeline_factory import PipelineFactory+from pipelex.pipeline.validate_bundle_translation import HOST_LIBRARY_FILE_PLACEHOLDERfrom pipelex.runtime_hub import get_telemetry_manager, scoped_content_generatorfrom pipelex.system.caller_identity import CallerIdentity, scoped_caller_identityfrom pipelex.system.configuration.configs import PipelineExecutionConfig@@ -68,7 +72,7 @@ from pipelex.system.pipe_run_mode import PipeRunModefrom pipelex.system.storage_scope import DRY_RUN_STORAGE_SCOPE, DRY_RUN_USER_IDfrom pipelex.system.telemetry.events import EventName, EventPropertyfrom pipelex.tools.log.error_fields import error_fields-from pipelex.tools.typing.pydantic_utils import format_pydantic_validation_error+from pipelex.tools.typing.pydantic_utils import empty_list_factory_of, format_pydantic_validation_errorif TYPE_CHECKING:from pipelex.pipe_run.pipe_run_protocol import PipeRunProtocol@@ -108,6 +112,11 @@ class DryRunOutput(BaseModel):# which is this pipe or one# it runs, with a message the disclosure rule allows onto a verdict item.failure: DryRunFailureErrorData | None = None+ # What the pipe's dry run found without failing, each item located at the pipe that found it, which is this+ # pipe or one it runs: today, the warnings of a PipeDocGen step's template check. The composition point of the+ # verdict's advisory `warnings` reads them from here (see `pipelex.pipeline.dry_run_warnings`). Empty unless+ # the sweep's caller asked for them (`collect_dry_run_warnings`): otherwise the dry run logged them.+ warnings: list[ValidationErrorItem] = Field(default_factory=empty_list_factory_of(ValidationErrorItem))# The foreign shapes a dry run can fail with (pydantic and polyfactory, while mock data is built) carry no@@ -195,6 +204,40 @@ def _dry_run_failure_text(*, error: Exception) -> str:return caller_facing_refusal_text(refusal=root_fault)+def _disclosed_warnings(*, warnings: list[ValidationErrorItem], source_pipe_refs: frozenset[str] | None) -> list[ValidationErrorItem]:+ """The warnings as the caller may read them: one found at a pipe outside ``source_pipe_refs`` names no file of it.++ A validator of submitted content beside a host's library directories passes that content's pipes, and a warning+ found at a pipe of the host's directories would otherwise name a file there: a ``PipeDocGen`` step's template+ file, which the step may even name by its absolute path on the host. Such a warning is still located at its pipe+ and domain, keeps the finding's own words, and carries no ``template_file`` nor ``source``, every text of it reading+ ``HOST_LIBRARY_FILE_PLACEHOLDER`` where it named one, as a verdict's failure located there carries no ``source``.+ ``None`` keeps every warning whole, as a sweep of one's own library does.+ """+ if source_pipe_refs is None:+ return warnings+ disclosed: list[ValidationErrorItem] = []+ for warning in warnings:+ named_files = [name for name in (warning.template_file, warning.source) if name is not None]+ if not named_files or f"{warning.domain_code}.{warning.pipe_code}" in source_pipe_refs:+ disclosed.append(warning)+ continue+ template_location = warning.template_location+ if template_location is not None:+ template_location = withhold_names_in_text(text=template_location, names=named_files, placeholder=HOST_LIBRARY_FILE_PLACEHOLDER)+ disclosed.append(+ warning.model_copy(+ update={+ "template_file": None,+ "source": None,+ "template_location": template_location,+ "message": withhold_names_in_text(text=warning.message, names=named_files, placeholder=HOST_LIBRARY_FILE_PLACEHOLDER),+ }+ )+ )+ return disclosed++class BundleValidator:"""Owns the validation sweep; composes the shared seams + a direct in-process ``PipeRun``."""@@ -251,7 +294,7 @@ class BundleValidator:get_library_manager().teardown(library_id=acquired_id)async def validate_current_library(- self, *, allow_signatures: bool = False, caller_identity: CallerIdentity | None = None+ self, *, allow_signatures: bool = False, caller_identity: CallerIdentity | None = None, collect_dry_run_warnings: bool = False) -> dict[str, DryRunOutput]:"""Sweep every pipe in the already-open **current** library, **without** tearing it down.@@ -262,12 +305,14 @@ class BundleValidator:by minting a mock). This is the loaded-library twin of :meth:`acquire_and_validate` (whichacquires + tears down) and the shared core both the ``validate --all`` CLI and downstreamconsumers (e.g. cocode) build on instead of re-deriving ``get_pipes`` + ``validate_pipes`` by hand.+ ``collect_dry_run_warnings`` is :meth:`validate_pipes`'."""return await self.validate_pipes(get_pipe_library().get_pipes(),library_id=get_current_library(),allow_signatures=allow_signatures,caller_identity=caller_identity,+ collect_dry_run_warnings=collect_dry_run_warnings,)async def validate_pipes(@@ -278,6 +323,7 @@ class BundleValidator:allow_signatures: bool = False,caller_identity: CallerIdentity | None = None,source_pipe_refs: frozenset[str] | None = None,+ collect_dry_run_warnings: bool = False,) -> dict[str, DryRunOutput]:"""Classify each pipe ``SUCCESS / FAILURE / SKIPPED`` against an already-open library.@@ -307,13 +353,20 @@ class BundleValidator:caller is already in scope, and with none — a local CLI sweep — the dry runs state``DRY_RUN_USER_ID`` and the event goes out under the fallback, as before.- ``source_pipe_refs`` names the pipes whose file a located failure may carry as its ``source``:- a validator of submitted content beside a host's library directories passes that content's- pipes, so a failure located at a pipe loaded from those directories never names a file on the- host. ``None`` lets every failure carry its pipe's file, as a local sweep of one's own library+ ``source_pipe_refs`` names the pipes whose file a located failure may carry as its ``source``,+ and whose files a warning may name: a validator of submitted content beside a host's library+ directories passes that content's pipes, so a failure or a warning located at a pipe loaded from+ those directories never names a file on the host. ``None`` lets every failure carry its pipe's file, as a local sweep of one's own librarydoes, and as submitted content validated beside directories that are the caller's own(``library_dirs_are_callers``) does.+ ``collect_dry_run_warnings`` is for a caller that reports what the dry runs find without failing,+ such as a template check's warnings, in a verdict of its own (the validate surfaces): each pipe's+ output then carries them in ``warnings``, and the dry runs log none of them. Any other caller leaves+ it ``False``, and the dry runs log what they find, as a dry run outside any sweep does, so no warning+ is dropped unseen. A sweep that raises keeps none: an invalid verdict carries its errors alone, as it+ carries none of the static lints.+Returns the per-pipe status map (carrying allowed failures + skips). Raises ``DryRunError``on ≥1 unexpected failure."""@@ -324,6 +377,7 @@ class BundleValidator:allow_signatures=allow_signatures,caller_identity=effective_caller_identity,source_pipe_refs=source_pipe_refs,+ collect_dry_run_warnings=collect_dry_run_warnings,)async def _validate_pipes_for_caller(@@ -334,6 +388,7 @@ class BundleValidator:allow_signatures: bool,caller_identity: CallerIdentity | None,source_pipe_refs: frozenset[str] | None,+ collect_dry_run_warnings: bool,) -> dict[str, DryRunOutput]:"""The body of :meth:`validate_pipes`, run inside the caller's scope."""start_time = time.time()@@ -408,6 +463,7 @@ class BundleValidator:dry_run_pipeline_id=dry_run_pipeline_id,caller_identity=caller_identity,source_pipe_refs=source_pipe_refs,+ collect_dry_run_warnings=collect_dry_run_warnings,)# 4. Aggregate + report.@@ -422,6 +478,7 @@ class BundleValidator:dry_run_pipeline_id: str,caller_identity: CallerIdentity | None,source_pipe_refs: frozenset[str] | None,+ collect_dry_run_warnings: bool,) -> DryRunOutput:"""Build the mock job and run the pipe DRY through the direct primitive; classify the outcome.@@ -440,19 +497,31 @@ class BundleValidator:fail: the sweep's router notes where each failure happened, so a controller failing because a pipeit runs failed reports that pipe, and ``_aggregate`` keeps the failure once. A failure met at a pipeallowed to fail is reported at the pipe around it that is not, the one whose failure is unexpected.++ With ``collect_dry_run_warnings``, whatever the outcome, the output carries the ``warnings`` the dry run+ found without failing, which the dry run's pipes report to a collector scoped to this pipe (see+ ``pipelex.pipe_run.dry_run_warning_collector``); without it no collector is installed, and they log them."""recorder = _FailingPipeRecorder(tolerated_pipe_refs=frozenset(get_config().inference.dry_run.allowed_to_fail_pipes))recorder_token = _failing_pipe_recorder.set(recorder)+ warning_collection: AbstractContextManager[DryRunWarningCollector | None] = (+ collecting_dry_run_warnings() if collect_dry_run_warnings else nullcontext()+ )try:- return await self._run_and_classify(- pipe=pipe,- library_id=library_id,- execution_config=execution_config,- dry_run_pipeline_id=dry_run_pipeline_id,- caller_identity=caller_identity,- recorder=recorder,- source_pipe_refs=source_pipe_refs,- )+ with warning_collection as warning_collector:+ dry_run_output = await self._run_and_classify(+ pipe=pipe,+ library_id=library_id,+ execution_config=execution_config,+ dry_run_pipeline_id=dry_run_pipeline_id,+ caller_identity=caller_identity,+ recorder=recorder,+ source_pipe_refs=source_pipe_refs,+ )+ if warning_collector is None:+ return dry_run_output+ warnings = _disclosed_warnings(warnings=warning_collector.warnings, source_pipe_refs=source_pipe_refs)+ return dry_run_output.model_copy(update={"warnings": warnings})finally:_failing_pipe_recorder.reset(recorder_token)diff --git a/pipelex/pipeline/dry_run_warnings.py b/pipelex/pipeline/dry_run_warnings.pynew file mode 100644index 000000000..ee2860e7c--- /dev/null+++ b/pipelex/pipeline/dry_run_warnings.py@@ -0,0 +1,38 @@+"""Advisory dry-run findings (`warnings`) for the validate surfaces.++A dry run can find something worth surfacing on a VALID bundle without failing: the first occupant is a+`PipeDocGen` step's template check, whose warning findings (`template_check_warning`) name a field of an+office template that matches no input, a Markdown field that would print its markup, and the like. A+sweep asked to collect them (`collect_dry_run_warnings`) keeps each pipe's findings on its `DryRunOutput`+(`pipelex.pipe_run.dry_run_warning_collector` explains how they get there), and this family projects them+into the report, so the map it reads must come from such a sweep.++Unlike the static lints, this family needs no bundle-wide view: a finding is about the step whose dry run+made it, so a surface that dry-runs a single pipe carries it too.+"""++from collections.abc import Mapping++from pipelex.base_exceptions import ValidationErrorItem+from pipelex.pipeline.bundle_validator import DryRunOutput+++def build_dry_run_warnings(dry_run_result: Mapping[str, DryRunOutput]) -> list[ValidationErrorItem]:+ """Project the sweep's per-pipe dry-run findings into advisory `warnings` items.++ One step is dry-run once for itself and once more inside every controller that runs it, and it finds the+ same thing each time, so a finding is kept once, at its first appearance in sweep order.++ Args:+ dry_run_result: The sweep's per-pipe status map (`ValidateBundleResult.dry_run_result`, or what+ `BundleValidator.validate_pipes` returned).++ Returns:+ The findings, deduplicated, in sweep order.+ """+ warnings: list[ValidationErrorItem] = []+ for dry_run_output in dry_run_result.values():+ for warning in dry_run_output.warnings:+ if warning not in warnings:+ warnings.append(warning)+ return warningsdiff --git a/pipelex/pipeline/exceptions.py b/pipelex/pipeline/exceptions.pyindex 57b938d49..e6fb8ab02 100644--- a/pipelex/pipeline/exceptions.py+++ b/pipelex/pipeline/exceptions.py@@ -199,6 +199,15 @@ class _FileWithholding(NamedTuple):return withheld+def withhold_names_in_text(*, text: str, names: Collection[str], placeholder: str) -> str:+ """``text`` reading ``placeholder`` where it named one of ``names`` standing on its own, never inside a longer name.++ The rule a verdict's messages are withheld by (:meth:`ValidateBundleError.withholding_files`), for a channel that+ is not a verdict's error data, such as an advisory warning.+ """+ return _FileWithholding.make_from_names(names=names, placeholder=placeholder).withheld_text(text=text)++class ValidateBundleError(PipelexError):"""Raised when a bundle is refused while it is loaded or validated: the invalid verdict, carrying onestructured item per refusal in ``validation_errors``. Every refusal of the bundle itself becomes one —diff --git a/pipelex/pipeline/validate_bundle.py b/pipelex/pipeline/validate_bundle.pyindex 6d2c547ac..6dc7f6d04 100644--- a/pipelex/pipeline/validate_bundle.py+++ b/pipelex/pipeline/validate_bundle.py@@ -123,6 +123,7 @@ async def validate_bundle(dry_run_pipe_codes: list[str] | None = None,caller_identity: CallerIdentity | None = None,library_dirs_are_callers: bool = False,+ collect_dry_run_warnings: bool = False,) -> ValidateBundleResult:"""Load one bundle into a fresh library and dry-run its pipes.@@ -136,6 +137,10 @@ async def validate_bundle(caller validating content against its own directories passes True and keeps every path. Abundle file is validated on the caller's own disk, among the caller's own directories, andkeeps every path whatever this says.++ ``collect_dry_run_warnings`` is for a caller that puts what the dry runs find without failing in a+ verdict of its own, as the validate surfaces do (see ``BundleValidator.validate_pipes``); any other+ caller, a fix loop or a builder, leaves it ``False`` and the dry runs log what they find."""provided_params = sum([@@ -217,6 +222,7 @@ async def validate_bundle(# never a pipe of the host's directories, which would put a path on the host into the# caller's verdict. Beside the caller's own directories, every failure names its file.source_pipe_refs=None if library_dirs_are_callers else frozenset(pipe.pipe_ref for pipe in loaded_pipes),+ collect_dry_run_warnings=collect_dry_run_warnings,)result = ValidateBundleResult(blueprints=loaded_blueprints,@@ -248,6 +254,7 @@ async def validate_bundle(# A file on the caller's own disk: every failure names its file, a sibling file of the# same method included, since the library directories are the caller's own too.source_pipe_refs=None,+ collect_dry_run_warnings=collect_dry_run_warnings,)result = ValidateBundleResult(blueprints=loaded_blueprints,diff --git a/pipelex/pipeline/validate_in_process.py b/pipelex/pipeline/validate_in_process.pyindex 4a0896917..bd36ae643 100644--- a/pipelex/pipeline/validate_in_process.py+++ b/pipelex/pipeline/validate_in_process.py@@ -27,6 +27,7 @@ from pipelex import logfrom pipelex.base_exceptions import PipelexError, ValidationErrorItemfrom pipelex.interpreter_hub import clear_current_library, get_current_library_id_or_none, get_library_manager, set_current_libraryfrom pipelex.pipe_run.dry_run_in_process import best_effort_graph_spec+from pipelex.pipe_run.dry_run_warning_collector import collecting_dry_run_warningsfrom pipelex.pipeline.advisory_warnings import build_advisory_warningsfrom pipelex.pipeline.blueprint_selection import collect_entry_pipe_refs, select_primary_blueprintfrom pipelex.pipeline.build_pipe_io_artifacts import build_pipe_io_artifacts@@ -139,6 +140,7 @@ async def _validate_bundles_in_scope(library_dirs=library_dirs,allow_signatures=allow_signatures,library_dirs_are_callers=library_dirs_are_callers,+ collect_dry_run_warnings=True,)# Capture the validation library id ONCE, right after validate_bundle leaves it# current — the graph arm and the finally must target the SAME library even if@@ -158,14 +160,18 @@ async def _validate_bundles_in_scope(input_form=artifacts.input_form,entry_pipe_refs=collect_entry_pipe_refs(result.blueprints),qualified_crate=qualified_crate,+ dry_run_result=result.dry_run_result,)validation_report.count_warnings(count=len(warnings))graph_target_ref = graph_pipe_code if graph_pipe_code is not None else select_primary_blueprint(result.blueprints).main_pipe_ref- graph_spec: GraphSpec | None = await best_effort_graph_spec(- pipe_ref=graph_target_ref,- library_id=validation_library_id,- log_context=log_context,- )+ # The graph arm dry-runs its target once more, and finds again what the sweep found, which `warnings`+ # already carries: it is collected and dropped here rather than logged as if nothing reported it.+ with collecting_dry_run_warnings():+ graph_spec: GraphSpec | None = await best_effort_graph_spec(+ pipe_ref=graph_target_ref,+ library_id=validation_library_id,+ log_context=log_context,+ )body_succeeded = Truefinally:if validation_library_id is not None and validation_library_id != prev_library_id:diff --git a/pipelex/pipeline/validation_report.py b/pipelex/pipeline/validation_report.pyindex be51dffc8..88b63a41e 100644--- a/pipelex/pipeline/validation_report.py+++ b/pipelex/pipeline/validation_report.py@@ -77,9 +77,9 @@ class PipelexValidationReport(ValidationReport):"""Per-pipe sweep outcomes (`{pipe_ref, status}`) — the same entries as the agent-CLI envelope."""warnings: list[ValidationErrorItem] = Field(default_factory=empty_list_factory_of(ValidationErrorItem))- """Advisory findings (lints) on a VALID bundle — same item shape as `validation_errors`,- but they never flip `is_valid`. First occupant: the useless-`!` lint- (`optional_force_redundant`)."""+ """Advisory findings on a VALID bundle — same item shape as `validation_errors`, but they never+ flip `is_valid`. Composed by `pipelex.pipeline.advisory_warnings`: the static lints, then what the+ sweep's dry runs found without failing, such as a `PipeDocGen` template check's warnings."""pending_signatures: list[str] = Field(default_factory=list)"""Qualified refs of pipes still declared as `PipeSignature` in the assembled library."""diff --git a/pipelex/test_extras/mthds_corpus/vocabulary.toml b/pipelex/test_extras/mthds_corpus/vocabulary.tomlindex 78a56b0e4..135f0ace6 100644--- a/pipelex/test_extras/mthds_corpus/vocabulary.toml+++ b/pipelex/test_extras/mthds_corpus/vocabulary.toml@@ -248,6 +248,10 @@ excluded = "Advisory-only: the intent-hints lint rides the validation report's `code = "hint_inapplicable_intent"excluded = "Advisory-only: the intent-hints lint rides the validation report's `warnings` array and never makes a verdict invalid (hints are non-normative; well-formed unknown content is preserved). Same shape problem as `optional_force_redundant`: an entry contract keyed on `expected_error` has nowhere to put a warning on a valid entry. Revisit if the manifest ever grows a warnings axis."+[error.template_check_warning]+code = "template_check_warning"+excluded = "Advisory-only, for the same reason as `optional_force_redundant`: a warning of a PipeDocGen step's template check rides the validation report's `warnings` array and never makes a verdict invalid. It also needs what a focused entry cannot carry: a template file beside the bundle, an office format, and an engine that reads that format, which no consumer but a runtime holding the document generation plugin has. Revisit if the manifest ever grows a warnings axis and an entry can carry its template files."+[feature.binding_step]description = "A PipeSequence step `{ from = \"invoice.total\", result = \"total_amount\" }` that binds the value at a path in working memory to a new name: its concept is derived from the declared structures the path walks, its value is a deep copy taken when the step runs, a path crossing a list binds a flat list, and a path reaching nothing records an absence."diff --git a/pipelex/validation_error_types.py b/pipelex/validation_error_types.pyindex 320d7f0a8..2c227375a 100644--- a/pipelex/validation_error_types.py+++ b/pipelex/validation_error_types.py@@ -10,7 +10,8 @@ whatever diagnostics it happens to have seen.The registry is a **union of the enums the runtime already raises**, never a second list besidethem. ``PipeValidationErrorType`` and ``PipeFactoryErrorType`` are the two vocabularies thevalidation stages produce, :class:`ValidationResidualErrorType` names the one residual channel-that has no stage enum of its own, and :class:`HintLintErrorType` carries the intent-hint lints.+that has no stage enum of its own, :class:`HintLintErrorType` carries the intent-hint lints, and+:class:`TemplateCheckErrorType` the warnings a template check finds during a dry run.Deriving the registry from them is what stops it from drifting: a member added to any of them isin the registry the moment it is declared, with nothing here to remember to update.@@ -466,7 +467,26 @@ class HintLintErrorType(StrEnum):HINT_INAPPLICABLE_INTENT = "hint_inapplicable_intent"-ValidationErrorType: TypeAlias = PipeValidationErrorType | PipeFactoryErrorType | ValidationResidualErrorType | HintLintErrorType+class TemplateCheckErrorType(StrEnum):+ """Advisory findings of a ``PipeDocGen`` step's template check (the engine's ``check_template``).++ Every member is advisory-only: it rides the validation report's ``warnings`` array and never makes a+ verdict invalid. An error finding of the same check fails the step's dry run instead, and is reported as+ the ``DryRunError`` item every failed dry run is. A separate enum rather than a new+ ``PipeValidationErrorType`` member because the finding is not the pipe's validation: the dry run hands the+ step's template file to its engine, which reads it in a way only the engine can, and reports in its own+ words. Its locators are the template file and the place in it the engine names.+ """++ # A warning finding of the template check: an Excel defined name or a PowerPoint shape name that matches no+ # input field, a Markdown field that would print its markup, a cell or a shape marked Markdown that is filled+ # from a value that is not text, or whatever else the engine reports as a warning.+ TEMPLATE_CHECK_WARNING = "template_check_warning"+++ValidationErrorType: TypeAlias = (+ PipeValidationErrorType | PipeFactoryErrorType | ValidationResidualErrorType | HintLintErrorType | TemplateCheckErrorType+)"""The type of a bundle-validation diagnostic's ``error_type``.``ValidationErrorItem.error_type`` is typed against this alias, which is what makes the registry@@ -480,6 +500,7 @@ VALIDATION_ERROR_TYPES: tuple[ValidationErrorType, ...] = (*PipeFactoryErrorType,*ValidationResidualErrorType,*HintLintErrorType,+ *TemplateCheckErrorType,)"""Every ``error_type`` a bundle-validation diagnostic can carry, in a deterministic order.@@ -493,7 +514,7 @@ alias above would resolve it to whichever enum pydantic tried first. It is gated``tests/unit/pipelex/errors/test_validation_error_types.py``.Membership says a value is *reachable on the wire*, never that it is a useful coverage target.-The advisory-only member rides the validation report's ``warnings`` array and never an invalid+The advisory-only members ride the validation report's ``warnings`` array and never an invalidverdict; the two ``unknown_*`` fallbacks fire on states no author can ask for. A consumer thatneeds to exercise each fault — the corpus's ``error.*`` axis — excludes those in its owngenerator, with a stated reason per exclusion, rather than pruning them from the runtime truth here.diff --git a/subject_grants.toml b/subject_grants.tomlindex 562a8c25d..f7568a117 100644--- a/subject_grants.toml+++ b/subject_grants.toml@@ -4432,6 +4432,10 @@ rationale = "Single-operand analysis over the pipes collection."param = "mthds_contents"rationale = "Verb-object: dry-runs the given .mthds contents; options stay keyword."+["pipelex/pipeline/dry_run_warnings.py::build_dry_run_warnings"]+param = "dry_run_result"+rationale = "Projects the sweep's per-pipe status map into warning items; reads as 'build dry-run warnings from the dry-run result', the one operand, as its sibling family builders take theirs."+["pipelex/pipeline/execution_seams.py::acquire_library"]param = "library_id"rationale = "Verb-object: acquires the library named by the id; single operand."diff --git a/tests/integration/pipelex/pipes/operator/pipe_doc_gen/test_pipe_doc_gen_template_files.py b/tests/integration/pipelex/pipes/operator/pipe_doc_gen/test_pipe_doc_gen_template_files.pyindex 3f893fe1a..e1cc36b8b 100644--- a/tests/integration/pipelex/pipes/operator/pipe_doc_gen/test_pipe_doc_gen_template_files.py+++ b/tests/integration/pipelex/pipes/operator/pipe_doc_gen/test_pipe_doc_gen_template_files.py@@ -1,9 +1,7 @@from pathlib import Pathimport pytest-from pytest_mock import MockerFixture-from pipelex import logfrom pipelex.cogt.doc_gen.input_shape import InputShapeKindfrom pipelex.cogt.doc_gen.template_check import TemplateFinding, TemplateFindingSeverityfrom pipelex.pipeline.exceptions import ValidateBundleError@@ -82,28 +80,22 @@ class TestPipeDocGenTemplateFiles:assert request.inputs["thing"].kind == InputShapeKind.ANYassert request.inputs["invoice"].kind == InputShapeKind.STRUCTURE- async def test_warnings_alone_pass_and_print_nothing(self, tmp_path: Path, stub_engines: StubEngines, mocker: MockerFixture) -> None:- """A warning is logged, not raised, and the dry run prints nothing.+ async def test_warnings_alone_pass_and_print_nothing(self, tmp_path: Path, stub_engines: StubEngines) -> None:+ """A warning is not raised and the dry run prints nothing: the step's dry run output carries it for the verdict.- The line is the same for every finding, and the finding's own words and place ride as fields beside the step and its file.+ `test_pipe_doc_gen_template_warnings.py` follows it from there to every validate surface, and to the log when the+ sweep's caller asks for no warnings."""- warning_spy = mocker.spy(log, "warning")(tmp_path / "invoice.docx").write_bytes(b"docx bytes")bundle_path = write_bundle(directory=tmp_path, step_fields=_DOCX_TEMPLATE_STEP)stub_engines.findings = [TemplateFinding(severity=TemplateFindingSeverity.WARNING, message="The notes are never printed", location="the field notes on page 2")]- await validate_bundle(mthds_file_path=bundle_path)+ result = await validate_bundle(mthds_file_path=bundle_path, collect_dry_run_warnings=True)assert len(stub_engines.check_requests) == 1assert stub_engines.engine.jobs == []- (finding_call,) = [- call for call in warning_spy.call_args_list if call.args[0] == "The template check of a PipeDocGen found a warning in its template file"+ assert [warning.message for warning in result.dry_run_result["doc_gen_tests.print_invoice"].warnings] == [+ "PipeDocGen 'print_invoice', template file 'invoice.docx': The notes are never printed (the field notes on page 2)"]- assert finding_call.kwargs["fields"] == {- "pipe_code": "print_invoice",- "template_file": "invoice.docx",- "finding_message": "The notes are never printed",- "finding_location": "the field notes on page 2",- }diff --git a/tests/integration/pipelex/pipes/operator/pipe_doc_gen/test_pipe_doc_gen_template_warnings.py b/tests/integration/pipelex/pipes/operator/pipe_doc_gen/test_pipe_doc_gen_template_warnings.pynew file mode 100644index 000000000..5f79a12db--- /dev/null+++ b/tests/integration/pipelex/pipes/operator/pipe_doc_gen/test_pipe_doc_gen_template_warnings.py@@ -0,0 +1,216 @@+from collections.abc import Iterator+from pathlib import Path+from typing import TYPE_CHECKING, Any++import pytest+from pytest_mock import MockerFixture++from pipelex import log+from pipelex.base_exceptions import ValidationErrorCategory, ValidationErrorItem+from pipelex.cli.agent_cli.commands.validate._validate_core import validate_bundle_core, validate_pipe_core+from pipelex.cli.commands.validate._validate_core import _validate_pipe_or_bundle # pyright: ignore[reportPrivateUsage]+from pipelex.cogt.doc_gen.template_check import TemplateFinding, TemplateFindingSeverity+from pipelex.interpreter_hub import (+ clear_current_library,+ get_current_library,+ get_current_library_id_or_none,+ get_library_manager,+ set_current_library,+)+from pipelex.pipe_run.dry_run_in_process import dry_run_pipe_in_process+from pipelex.pipeline.validate_bundle import validate_bundle, validate_bundles_from_directory+from pipelex.pipeline.validate_bundle_translation import HOST_LIBRARY_FILE_PLACEHOLDER+from pipelex.pipeline.validate_in_process import validate_bundles_in_process+from pipelex.pipeline.validation_render import format_validate_markdown+from pipelex.validation_error_types import TemplateCheckErrorType+from tests.integration.pipelex.pipes.operator.pipe_doc_gen.doc_gen_helpers import StubEngines, write_bundle++if TYPE_CHECKING:+ from pytest_mock import MockType++_DOCX_TEMPLATE_STEP = 'format = "docx"\ntemplate_file = "invoice.docx"'+_TEMPLATE_CHECK_LOG_LINE = "The template check of a PipeDocGen found a warning in its template file"++_NOTES_FINDING = TemplateFinding(+ severity=TemplateFindingSeverity.WARNING, message="The notes are never printed", location="the field notes on page 2"+)+_NOTES_WARNING = ValidationErrorItem(+ category=ValidationErrorCategory.DRY_RUN,+ error_type=TemplateCheckErrorType.TEMPLATE_CHECK_WARNING,+ pipe_code="print_invoice",+ domain_code="doc_gen_tests",+ template_file="invoice.docx",+ template_location="the field notes on page 2",+ message="PipeDocGen 'print_invoice', template file 'invoice.docx': The notes are never printed (the field notes on page 2)",+)+_NOTES_LOG_FIELDS = {+ "pipe_code": "print_invoice",+ "template_file": "invoice.docx",+ "finding_message": "The notes are never printed",+ "finding_location": "the field notes on page 2",+}++# A bundle of another domain whose sequence runs the templated step, which a library directory holds: the step is+# dry-run only inside the sequence, so its warning reaches the verdict from a pipe the sweep did not sweep itself.+_CALLER_MTHDS = """+domain = "doc_gen_caller"+description = "Billing a customer with a printed invoice"+main_pipe = "bill_customer"++[pipe.bill_customer]+type = "PipeSequence"+description = "Print the customer's invoice"+inputs = { invoice = "doc_gen_tests.Invoice" }+output = "doc_gen_tests.InvoicePdf"+steps = [{ pipe = "doc_gen_tests.print_invoice", result = "invoice_pdf" }]+"""++[email protected](autouse=True)+def restore_the_outer_library() -> Iterator[None]:+ """Tear down whatever library a channel left current, and restore the one the test started in.++ `validate_bundle` leaves its validation library open on success, and the bare CLI leaves the library it loaded+ current for the command that owns `Pipelex` teardown. Called directly, both leak into the next test.+ """+ outer_library_id = get_current_library_id_or_none()+ yield+ leaked_library_id = get_current_library_id_or_none()+ if leaked_library_id is not None and leaked_library_id != outer_library_id:+ get_library_manager().teardown(library_id=leaked_library_id)+ if outer_library_id is not None:+ set_current_library(library_id=outer_library_id)+ else:+ clear_current_library()+++def _write_templated_bundle(*, directory: Path, stub_engines: StubEngines) -> Path:+ (directory / "invoice.docx").write_bytes(b"docx bytes")+ stub_engines.findings = [_NOTES_FINDING]+ return write_bundle(directory=directory, step_fields=_DOCX_TEMPLATE_STEP)+++def _template_check_log_calls(warning_spy: "MockType") -> list[dict[str, Any]]:+ return [call.kwargs["fields"] for call in warning_spy.call_args_list if call.args and call.args[0] == _TEMPLATE_CHECK_LOG_LINE]++[email protected](loop_scope="class")+class TestPipeDocGenTemplateWarnings:+ async def test_the_protocol_report_carries_a_warning_found_inside_a_sequence(+ self, tmp_path: Path, stub_engines: StubEngines, mocker: MockerFixture+ ) -> None:+ """The report every backend returns, the runner's `/v1/validate` included, carries the warning once and stays valid.++ The graph arm dry-runs the sequence again and finds the warning again, and drops it rather than logging it. The+ library directory is the caller's own, so the step's template file is named as the step names it.+ """+ warning_spy = mocker.spy(log, "warning")+ _write_templated_bundle(directory=tmp_path, stub_engines=stub_engines)++ report = await validate_bundles_in_process(mthds_contents=[_CALLER_MTHDS], library_dirs=[tmp_path], library_dirs_are_callers=True)++ assert report.is_valid is True+ assert report.is_runnable is True+ assert [warning for warning in report.warnings if warning.error_type == TemplateCheckErrorType.TEMPLATE_CHECK_WARNING] == [_NOTES_WARNING]+ # Once in the sweep's dry run of the sequence, once more in the graph arm's.+ assert len(stub_engines.check_requests) == 2+ assert _template_check_log_calls(warning_spy) == []++ @pytest.mark.parametrize("spelling", ["relative", "absolute"])+ async def test_the_protocol_report_withholds_a_host_template_file(self, tmp_path: Path, stub_engines: StubEngines, spelling: str) -> None:+ """A step of the host's library directories is found by its code and domain, and its template file is not named.++ Submitted content beside library directories that are the host's names none of their files, so the warning carries+ no `template_file` and its message reads the placeholder where it named one, however the step spells it, its+ absolute path on the host included. The engine's own words about the template stay.+ """+ template_path = (tmp_path / "invoice.docx").resolve()+ template_path.write_bytes(b"docx bytes")+ stub_engines.findings = [_NOTES_FINDING]+ template_file = str(template_path) if spelling == "absolute" else "invoice.docx"+ write_bundle(directory=tmp_path, step_fields=f'format = "docx"\ntemplate_file = "{template_file}"')++ report = await validate_bundles_in_process(mthds_contents=[_CALLER_MTHDS], library_dirs=[tmp_path])++ assert report.is_valid is True+ template_warnings = [warning for warning in report.warnings if warning.error_type == TemplateCheckErrorType.TEMPLATE_CHECK_WARNING]+ assert template_warnings == [+ _NOTES_WARNING.model_copy(+ update={+ "template_file": None,+ "message": f"PipeDocGen 'print_invoice', template file '{HOST_LIBRARY_FILE_PLACEHOLDER}': "+ "The notes are never printed (the field notes on page 2)",+ }+ )+ ]+ assert all(str(template_path.parent) not in warning.model_dump_json() for warning in report.warnings)++ @pytest.mark.parametrize("sweep", ["validate_bundle", "validate_bundles_from_directory"])+ async def test_a_sweep_whose_caller_reports_no_warnings_logs_them(+ self, tmp_path: Path, stub_engines: StubEngines, mocker: MockerFixture, sweep: str+ ) -> None:+ """A caller that reports no verdict of its own, such as `pipelex fix` or `pipelex build inputs`, leaves the warning to the log.++ Only a caller that asks for the warnings has them collected, so no warning is ever dropped unseen.+ """+ bundle_path = _write_templated_bundle(directory=tmp_path, stub_engines=stub_engines)+ warning_spy = mocker.spy(log, "warning")++ match sweep:+ case "validate_bundle":+ result = await validate_bundle(mthds_file_path=bundle_path)+ case _:+ result = await validate_bundles_from_directory(tmp_path)++ assert result.dry_run_result["doc_gen_tests.print_invoice"].warnings == []+ assert _template_check_log_calls(warning_spy) == [_NOTES_LOG_FIELDS]++ async def test_the_agent_cli_bundle_envelope_carries_the_warning(self, tmp_path: Path, stub_engines: StubEngines) -> None:+ bundle_path = _write_templated_bundle(directory=tmp_path, stub_engines=stub_engines)++ result = await validate_bundle_core(bundle_path=bundle_path)++ assert result["is_valid"] is True+ assert result["warnings"] == [_NOTES_WARNING.model_dump(exclude_none=True)]+ assert f"- **{TemplateCheckErrorType.TEMPLATE_CHECK_WARNING}** — {_NOTES_WARNING.message}" in format_validate_markdown(result)++ async def test_the_agent_cli_pipe_envelope_carries_the_warning(self, tmp_path: Path, stub_engines: StubEngines) -> None:+ """`validate pipe` carries no bundle-wide lint, but what its dry run found is about the pipe it validated."""+ _write_templated_bundle(directory=tmp_path, stub_engines=stub_engines)++ result = await validate_pipe_core(pipe_code="print_invoice", library_dirs=[tmp_path])++ assert result["is_valid"] is True+ assert result["warnings"] == [_NOTES_WARNING.model_dump(exclude_none=True)]++ @pytest.mark.parametrize("target", ["bundle", "pipe"])+ async def test_the_bare_cli_echoes_the_warning(+ self, tmp_path: Path, stub_engines: StubEngines, mocker: MockerFixture, capsys: pytest.CaptureFixture[str], target: str+ ) -> None:+ """Both bare-CLI targets echo the warning once, in yellow beside the verdict, and log nothing more."""+ warning_spy = mocker.spy(log, "warning")+ bundle_path = _write_templated_bundle(directory=tmp_path, stub_engines=stub_engines)++ match target:+ case "bundle":+ await _validate_pipe_or_bundle(bundle_path=bundle_path)+ case _:+ await _validate_pipe_or_bundle(pipe_code="print_invoice", library_dirs=[tmp_path])++ echoed = [line for line in capsys.readouterr().out.splitlines() if line.startswith("Warning: ")]+ assert echoed == [f"Warning: {_NOTES_WARNING.message}"]+ assert _template_check_log_calls(warning_spy) == []++ async def test_a_dry_run_no_sweep_collects_logs_the_warning(self, tmp_path: Path, stub_engines: StubEngines, mocker: MockerFixture) -> None:+ """Outside a validation sweep, as on `pipelex run --dry-run`, there is no verdict to carry the warning, so it is logged.++ The line is the same for every finding, and the finding's own words and place ride as fields beside the step and its file.+ """+ bundle_path = _write_templated_bundle(directory=tmp_path, stub_engines=stub_engines)+ result = await validate_bundle(mthds_file_path=bundle_path)+ (pipe,) = result.pipes+ warning_spy = mocker.spy(log, "warning")++ await dry_run_pipe_in_process(pipe, library_id=get_current_library())++ assert _template_check_log_calls(warning_spy) == [_NOTES_LOG_FIELDS]diff --git a/tests/unit/pipelex/errors/test_validation_error_types.py b/tests/unit/pipelex/errors/test_validation_error_types.pyindex 8cca10099..5ce84d0c3 100644--- a/tests/unit/pipelex/errors/test_validation_error_types.py+++ b/tests/unit/pipelex/errors/test_validation_error_types.py@@ -17,6 +17,7 @@ from pipelex.validation_error_types import (HintLintErrorType,PipeFactoryErrorType,PipeValidationErrorType,+ TemplateCheckErrorType,ValidationErrorType,ValidationResidualErrorType,)@@ -29,7 +30,13 @@ class TestValidationErrorTypeRegistry:Written as a set comparison rather than a length check: a member dropped from the registryand a member added to a source enum are both failures, and both should name the member."""- contributed = set(PipeValidationErrorType) | set(PipeFactoryErrorType) | set(ValidationResidualErrorType) | set(HintLintErrorType)+ contributed = (+ set(PipeValidationErrorType)+ | set(PipeFactoryErrorType)+ | set(ValidationResidualErrorType)+ | set(HintLintErrorType)+ | set(TemplateCheckErrorType)+ )assert set(VALIDATION_ERROR_TYPES) == contributeddef test_registry_has_no_duplicate_wire_values(self) -> None:@@ -46,7 +53,13 @@ class TestValidationErrorTypeRegistry:def test_registry_order_is_deterministic(self) -> None:"""Two reads give the same order, so an artifact generated from the registry is stable."""assert tuple(VALIDATION_ERROR_TYPES) == VALIDATION_ERROR_TYPES- assert list(VALIDATION_ERROR_TYPES) == [*PipeValidationErrorType, *PipeFactoryErrorType, *ValidationResidualErrorType, *HintLintErrorType]+ assert list(VALIDATION_ERROR_TYPES) == [+ *PipeValidationErrorType,+ *PipeFactoryErrorType,+ *ValidationResidualErrorType,+ *HintLintErrorType,+ *TemplateCheckErrorType,+ ]# The three tests below hold that the registry is enforced when an item is parsed, not merely# documented. They go through ``model_validate`` rather than the constructor on purpose: thediff --git a/tests/unit/pipelex/pipe_run/test_dry_run_warning_collector.py b/tests/unit/pipelex/pipe_run/test_dry_run_warning_collector.pynew file mode 100644index 000000000..8977e39ca--- /dev/null+++ b/tests/unit/pipelex/pipe_run/test_dry_run_warning_collector.py@@ -0,0 +1,67 @@+import asyncio++import pytest++from pipelex.base_exceptions import ValidationErrorCategory, ValidationErrorItem+from pipelex.pipe_run.dry_run_warning_collector import collecting_dry_run_warnings, report_dry_run_warning+from pipelex.validation_error_types import TemplateCheckErrorType+++def _template_warning(*, message: str) -> ValidationErrorItem:+ return ValidationErrorItem(+ category=ValidationErrorCategory.DRY_RUN,+ error_type=TemplateCheckErrorType.TEMPLATE_CHECK_WARNING,+ pipe_code="print_invoice",+ domain_code="invoicing",+ template_file="invoice.xlsx",+ message=message,+ )+++class TestDryRunWarningCollector:+ def test_a_warning_outside_a_sweep_is_not_taken(self) -> None:+ assert report_dry_run_warning(warning=_template_warning(message="The name Totl matches no field")) is False++ def test_a_sweep_keeps_each_warning_once_in_the_order_found(self) -> None:+ first = _template_warning(message="The name Totl matches no field")+ second = _template_warning(message="The cell B4 prints Markdown markup")++ with collecting_dry_run_warnings() as collector:+ assert report_dry_run_warning(warning=first) is True+ assert report_dry_run_warning(warning=second) is True+ assert report_dry_run_warning(warning=first) is True++ assert collector.warnings == [first, second]++ def test_the_scope_ends_with_the_sweep(self) -> None:+ with collecting_dry_run_warnings():+ pass++ assert report_dry_run_warning(warning=_template_warning(message="The name Totl matches no field")) is False++ def test_nested_scopes_keep_their_own_warnings(self) -> None:+ outer_warning = _template_warning(message="Found by the outer dry run")+ inner_warning = _template_warning(message="Found by the inner dry run")++ with collecting_dry_run_warnings() as outer:+ report_dry_run_warning(warning=outer_warning)+ with collecting_dry_run_warnings() as inner:+ report_dry_run_warning(warning=inner_warning)++ assert outer.warnings == [outer_warning]+ assert inner.warnings == [inner_warning]++ @pytest.mark.asyncio+ async def test_the_tasks_of_a_fan_out_report_to_the_sweep(self) -> None:+ """A batch or a parallel step runs its pipes as asyncio tasks, which copy the context they were made in."""+ warnings = [_template_warning(message=f"Found by branch {branch_index}") for branch_index in range(3)]++ async def report(warning: ValidationErrorItem) -> bool:+ await asyncio.sleep(0)+ return report_dry_run_warning(warning=warning)++ with collecting_dry_run_warnings() as collector:+ taken = await asyncio.gather(*(asyncio.create_task(report(warning)) for warning in warnings))++ assert taken == [True, True, True]+ assert sorted(warning.message for warning in collector.warnings) == sorted(warning.message for warning in warnings)diff --git a/tests/unit/pipelex/pipeline/test_dry_run_warnings.py b/tests/unit/pipelex/pipeline/test_dry_run_warnings.pynew file mode 100644index 000000000..ee5ebfad7--- /dev/null+++ b/tests/unit/pipelex/pipeline/test_dry_run_warnings.py@@ -0,0 +1,49 @@+from pipelex.base_exceptions import ValidationErrorCategory, ValidationErrorItem+from pipelex.pipeline.bundle_validator import DryRunOutput, DryRunStatus+from pipelex.pipeline.dry_run_warnings import build_dry_run_warnings+from pipelex.validation_error_types import TemplateCheckErrorType+++def _template_warning(*, pipe_code: str, message: str) -> ValidationErrorItem:+ return ValidationErrorItem(+ category=ValidationErrorCategory.DRY_RUN,+ error_type=TemplateCheckErrorType.TEMPLATE_CHECK_WARNING,+ pipe_code=pipe_code,+ domain_code="invoicing",+ template_file="invoice.xlsx",+ template_location="the defined name Totl",+ message=message,+ )+++def _output(*, pipe_code: str, status: DryRunStatus, warnings: list[ValidationErrorItem]) -> DryRunOutput:+ return DryRunOutput(pipe_code=pipe_code, pipe_ref=f"invoicing.{pipe_code}", status=status, warnings=warnings)+++class TestBuildDryRunWarnings:+ def test_a_sweep_with_no_findings_has_no_warnings(self) -> None:+ dry_run_result = {"invoicing.print_invoice": _output(pipe_code="print_invoice", status=DryRunStatus.SUCCESS, warnings=[])}++ assert build_dry_run_warnings(dry_run_result) == []++ def test_a_step_found_again_inside_its_controller_is_reported_once(self) -> None:+ """The step is dry-run for itself and inside the sequence that runs it, and finds the same thing both times."""+ name_warning = _template_warning(pipe_code="print_invoice", message="The name Totl matches no field")+ markup_warning = _template_warning(pipe_code="print_invoice", message="The cell B4 prints Markdown markup")+ dry_run_result = {+ "invoicing.print_invoice": _output(pipe_code="print_invoice", status=DryRunStatus.SUCCESS, warnings=[name_warning]),+ "invoicing.bill_customer": _output(pipe_code="bill_customer", status=DryRunStatus.SUCCESS, warnings=[name_warning, markup_warning]),+ }++ assert build_dry_run_warnings(dry_run_result) == [name_warning, markup_warning]++ def test_findings_keep_the_sweep_order_whatever_the_outcome(self) -> None:+ """A pipe allowed to fail, or skipped, still carries what its dry run found before it stopped."""+ first = _template_warning(pipe_code="print_quote", message="The shape Title is filled from a number")+ second = _template_warning(pipe_code="print_invoice", message="The name Totl matches no field")+ dry_run_result = {+ "invoicing.print_quote": _output(pipe_code="print_quote", status=DryRunStatus.FAILURE, warnings=[first]),+ "invoicing.print_invoice": _output(pipe_code="print_invoice", status=DryRunStatus.SUCCESS, warnings=[second]),+ }++ assert build_dry_run_warnings(dry_run_result) == [first, second]diff --git a/tests/unit/pipelex/pipeline/test_runner_validate_plumbing.py b/tests/unit/pipelex/pipeline/test_runner_validate_plumbing.pyindex cd9242e99..a98ee7477 100644--- a/tests/unit/pipelex/pipeline/test_runner_validate_plumbing.py+++ b/tests/unit/pipelex/pipeline/test_runner_validate_plumbing.py@@ -79,7 +79,10 @@ class TestRunnerValidatePlumbing:)async def test_library_dirs_converted_to_paths_and_allow_signatures_passthrough(self, mocker: MockerFixture) -> None:- """Constructor library_dirs strings reach validate_bundle as Path objects; allow_signatures and their ownership forwarded verbatim."""+ """Constructor library_dirs strings reach validate_bundle as Path objects; allow_signatures and their ownership forwarded verbatim.++ The protocol validation returns a verdict, so it asks the sweep to collect the dry runs' warnings for it.+ """env = self._patch_env(mocker, library_ids=[None, "val-lib"])runner = PipelexMTHDSProtocol(library_dirs=["dir_alpha", "nested/dir_beta"], library_dirs_are_callers=True)@@ -91,6 +94,7 @@ class TestRunnerValidatePlumbing:library_dirs=[Path("dir_alpha"), Path("nested/dir_beta")],allow_signatures=True,library_dirs_are_callers=True,+ collect_dry_run_warnings=True,)async def test_no_library_dirs_passes_none_and_strict_default(self, mocker: MockerFixture) -> None:@@ -106,6 +110,7 @@ class TestRunnerValidatePlumbing:library_dirs=None,allow_signatures=False,library_dirs_are_callers=False,+ collect_dry_run_warnings=True,)async def test_validation_runs_with_the_protocols_caller_in_scope(self, mocker: MockerFixture) -> None: