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/Refuse-dotted-inputs · L-261004-9e9daf (#1345)
Louis Choqueld8ac32271a4a
diff --git a/.drift/acks/pipelex-kernel-docs.toml b/.drift/acks/pipelex-kernel-docs.tomlindex 1917cdba0..e97c69d1d 100644--- a/.drift/acks/pipelex-kernel-docs.toml+++ b/.drift/acks/pipelex-kernel-docs.toml@@ -1,8 +1,8 @@contract = "pipelex-kernel-docs"-digest = "sha256:db78d8e45be9c93a67d013d0d1b9b09dbe9bb8f429deb6804db5ed678868afff"+digest = "sha256:3b0caaabd67aa654f0b4155d7cb463aa866d01f7ebc559d66cac181c9df3c888"reviewed_by = "Claude (Opus 5.5)"-reviewed_at = "2026-10-05T23:28:51Z"-rationale = "real-catch: docs/under-the-hood/pipelex-kernel.md said a keyless boot uses no credentials, which the code contradicted (it substituted every backend's credentials and dropped the backends missing one); it now says the boot loads every enabled backend and model and resolves no credential. The trigger, judgment_ops.resolve_judgment_setting, changed only its docstring example; re-read its body: on a dry run a model no backend serves still keeps the deck's handle, which the page's judgment paragraph states as is."+reviewed_at = "2026-10-06T03:07:41Z"+rationale = "clean-pass: re-acked on the merge of dev into the dotted-input branch, whose two acks each covered one side. The merged judgment_ops.py carries the branch's build_judgment_material (each entry one plain-named input's whole value, no path walk) and dev's resolve_judgment_setting docstring (a model whose backend is disabled keeps the deck's handle on a dry run); docs/under-the-hood/pipelex-kernel.md auto-merged both sides' sentences, the judgment paragraph stating plain names and the keyless-boot paragraph stating every enabled backend loaded with no credential resolved, and both still match the merged code."[trigger_files]"pipelex/kernel/__init__.py" = "blob:c4f1b0fe2ccc17db9110733f71b612f4ac1ba4ce"@@ -16,7 +16,7 @@ rationale = "real-catch: docs/under-the-hood/pipelex-kernel.md said a keyless bo"pipelex/kernel/img_gen_ops.py" = "blob:b85360f6c118e93be53bf8d1a04504ccb7552469""pipelex/kernel/img_gen_prompt.py" = "blob:e4f72040561929aa0d96ad5f00b1c4af652d3f77""pipelex/kernel/img_gen_results.py" = "blob:46b4ca11c70d906ae6d58ce66461f9b3414f1bfa"-"pipelex/kernel/judgment_ops.py" = "blob:efeae1fe68ad417ad98e0fe307d090a1b452f9e4"+"pipelex/kernel/judgment_ops.py" = "blob:fe66d7d00433a9924d60710e9bb25838197c52e0""pipelex/kernel/judgment_results.py" = "blob:40ba1258cc81d34df3e427d5511ccd40c6edf789""pipelex/kernel/llm_ops.py" = "blob:64a6d3d77a165f4f70614ced69876f56d873a8c7""pipelex/kernel/llm_prompt_content.py" = "blob:3fade4a660226e63ad4f916952ee37d34e7d2bbd"diff --git a/.pipelex/plxt.toml b/.pipelex/plxt.tomlindex f9b91157a..eda6fb249 100644--- a/.pipelex/plxt.toml+++ b/.pipelex/plxt.toml@@ -37,9 +37,9 @@ exclude = ["api/postman/sample-bundles/invalid/**",# The MTHDS Test Corpus's schema-fault entries, and ONLY those. Every other deliberately invalid# entry is linted like any other .mthds file in this repo: its fault needs the runtime to notice,- # so the schema has nothing to say about it and a clean lint is the correct outcome. The two below- # are the exceptions — their fault is structural, so the schema rejects them as the very error they- # were written to trigger, and linting them would report a defect that is the entry's whole point.+ # so the schema has nothing to say about it and a clean lint is the correct outcome. The entries+ # below are the exceptions — their fault is structural, so the schema rejects them as the very error+ # they were written to trigger, and linting them would report a defect that is the entry's whole point.## This list is not hand-maintained: it is gated against the corpus vocabulary's `fails_at` signal by# tests/unit/pipelex/test_extras/test_mthds_corpus_plxt_exclusions.py, which fails if the two@@ -48,9 +48,11 @@ exclude = [# `make plxt-lint` goes red naming it.## Excluded rather than schema-exempted because a per-rule `exclude` does not lift the schema, only- # narrows which rule applies. What guards these two instead is strictly stronger: the corpus's+ # narrows which rule applies. What guards these entries instead is strictly stronger: the corpus's# entry-validation gate runs the real validation engine over every entry in CI and is red both when# an invalid entry fails differently and when it accidentally validates.+ "**/mthds_corpus/entries/invalid_input_name_lone_dotted/*.mthds",+ "**/mthds_corpus/entries/invalid_input_name_redundant_dotted/*.mthds","**/mthds_corpus/entries/invalid_missing_pipe_type/*.mthds","**/mthds_corpus/entries/invalid_unknown_pipe_type/*.mthds",] # Glob patterns for files to ignore.diff --git a/CHANGELOG.md b/CHANGELOG.mdindex c95ef9321..2c6f19c1c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,6 +2,10 @@## [Unreleased]+### Added++- **`pipelex fix bundle` deletes a dotted input key beside its root**: the new rule `delete-redundant-dotted-input` removes a key such as `"page.page_view" = "Image"` from a pipe's `inputs` when the same table declares its root `page`, which already supplies every field a template reads through it. The fix is safe, and applied, only when the root keeps the presence marker and multiplicity the table gave it: a key that set them otherwise, such as `"data.text" = "Text!"` declared after `data = "Text?"`, gets an unsafe fix that `pipelex fix bundle` never applies, and both the fix and the refusal name only what differs, the multiplicity, the presence marker or both, with the edit that carries it onto the root (here, replace `?` with `!` on `data`). A lone dotted key gets no automatic fix, since nothing states its root's concept, and its refusal names the two remedies instead.+### Changed- **`GraphAnalysis.stuff_producers` lists every producer (Breaking)**: it maps a digest to a list of node ids, `get_producer` is replaced by `get_producers`, and the new `shared_stuff_controllers` names the controller a stuff with several writers belongs to, a parallel or batch controller combining or aggregating into the stuff counting as one of them. The Mermaid graph draws such a stuff once, inside that controller, with an edge from each producer.@@ -10,6 +14,7 @@- **A variable in a field that describes a model is refused on every boot (Breaking)**: a `${…}` placeholder may stand only in a value a call sends, which means `api_key`, `endpoint` and a backend's extra keys, or a model's `model_id`, `endpoint_path` and request headers. A placeholder in a field such as `model_type`, `sdk`, `thinking_mode` or the constraints is now refused with an error naming the field, where a boot with inference substituted it and a boot without inference could not, so the two gave different verdicts.- **An unknown variable prefix is refused wherever it stands in a fallback chain (Breaking)**: `${env:KEY|secrte:KEY}` is refused for its `secrte` prefix whether or not `KEY` is set, where a boot read the candidates in turn and accepted the chain whenever an earlier one resolved. A boot without inference, which resolves nothing, refuses it too, so a file gets the same verdict on its syntax on every boot and every machine.- **`pipelex show backends` lists every backend with its credential variables**: a backend whose key is unset is listed instead of hidden, a new column names the variables each backend reads its credentials from, and an endpoint read from a variable is shown as not resolved.+- **An input name is a plain name (Breaking)**: every key of a pipe's `inputs`, on every operator, controller and signature, and a PipeBatch's `input_list_name` must match `[a-z][a-z0-9_]*`, so a dotted name such as `"invoice.total" = "Number"` or a malformed one such as `InvoiceTotal` is refused when the bundle is parsed, as the new `PipeValidationErrorType` value `invalid_input_name`, which also replaces PipeJudge's own refusal that reached callers with no `error_type`. Its message names the remedies: declare the root with its whole concept (`invoice = "Invoice"`) and read the field in the template (`$invoice.total`), which every operator handles by the concept the path reaches, so `@page.page_view` with `page = "Page"` is still attached as an image, or have the calling sequence bind the field with a binding step (`{ from = "invoice.total", result = "total_amount" }`). The generated MTHDS JSON Schema refuses the same names, through `patternProperties` on every `inputs` table and a `pattern` on `input_list_name`, and the corpus vocabulary records `error.invalid_input_name` with `fails_at = "schema"`.### Fixed@@ -17,6 +22,10 @@- **Validation and dry runs no longer depend on which keys the machine holds**: a boot without inference (`Pipelex.make(needs_inference=False)`, used by `pipelex validate`, `pipelex run --dry-run`, `pipelex show` and the agent CLI's validation) now loads every enabled backend with its models and constraints and resolves none of their credentials, where it dropped every backend whose key was missing. A method using a search preset or pinning a bare handle such as `model = "gpt-4o-mini"` now validates on a machine or CI runner with no key, and such a boot no longer reads the backends' keys or requests a Vertex AI token.- **Linkup uses the key its backend names**: the Linkup search and fetch workers take the key from the `[linkup]` table's `api_key`, like every other provider, where they read `LINKUP_API_KEY` themselves and ignored a configuration naming another variable. A Linkup backend with no `api_key` is refused with `LinkupError` when its worker is built.+### Removed++- **The dotted-input fold (Breaking)**: `InputStuffSpecs` no longer rewrites an input key to its root, `NamedStuffSpec.requirement_expression` is gone, `pipelex.pipe_machinery.validation` drops `is_variable_satisfied_by_inputs`, `validate_input_name` and the `dotted_input_supplies_its_path` argument of `check_inputs_match_variables` and `check_variables_are_declared`, in favour of `validate_input_names` and `check_input_list_name`, and `build_judgment_material` no longer walks a dotted input name as a path.+## [v0.74.1] - 2026-10-05### Addeddiff --git a/docs/api-server/error-responses.md b/docs/api-server/error-responses.mdindex 2dafff46b..60da41009 100644--- a/docs/api-server/error-responses.md+++ b/docs/api-server/error-responses.md@@ -90,7 +90,7 @@ A validation error item may carry a `suggested_fix`: a deterministic repair the**Fields:**-- `fix_code` — the kebab-case rule id that produced the fix (`match-sequence-output`, `sync-controller-inputs`, `strip-native-concept-redecl`, `strip-namespace`, …). Stable; use it to allow-list or suppress rules.+- `fix_code` — the kebab-case rule id that produced the fix (`match-sequence-output`, `sync-controller-inputs`, `strip-native-concept-redecl`, `strip-namespace`, `delete-redundant-dotted-input`, …). Stable; use it to allow-list or suppress rules.- `description` — human-readable summary of what the fix does.- `safety` — `safe` or `unsafe`. Only apply an `unsafe` fix behind an explicit opt-in: it is a likely correction, such as the one close match for an unknown model, that a person or an agent must confirm, and `pipelex fix bundle` never applies one on its own.- `source` — the file the ops target, when known. **An applier must only apply ops to the file they target** — in a multi-file library the ops are meaningless against any other file.diff --git a/docs/api-server/openapi/pipelex-api.openapi.yaml b/docs/api-server/openapi/pipelex-api.openapi.yamlindex 1abc2f058..0074bb2d4 100644--- a/docs/api-server/openapi/pipelex-api.openapi.yaml+++ b/docs/api-server/openapi/pipelex-api.openapi.yaml@@ -5507,6 +5507,7 @@ components:- inadequate_output_multiplicity- llm_output_cannot_be_image- invalid_pipe_code_syntax+ - invalid_input_name- unknown_pipe_type- missing_pipe_type- batch_item_name_collisiondiff --git a/docs/building-methods/pipes/index.md b/docs/building-methods/pipes/index.mdindex 84a4cb4bf..20c5f566d 100644--- a/docs/building-methods/pipes/index.md+++ b/docs/building-methods/pipes/index.md@@ -86,6 +86,8 @@ Every pipe defines a **contract** through its `inputs` and `output` fields. This* **`inputs`**: This dictionary defines the **mandatory and necessary** data that must be present in the [Working Memory](working-memory.md) before the pipe can execute. Each key in the dictionary becomes a variable name that you can reference in your pipe's logic (e.g., in prompts), and each value specifies the concept type that the data must conform to. If any required input is missing or doesn't match the expected concept, the pipeline will fail a clear error message.You can specify multiple inputs by using a list of concepts. For example, `inputs = { description = "ProductDescription", keywords = "Keyword[]" }` will require a `ProductDescription` and a list of `Keyword`s. (See more about [Understanding Multiplicity](./understanding-multiplicity.md) for details.)+ An input name is a plain `snake_case` identifier, matching `[a-z][a-z0-9_]*`, and it names one whole value of the concept its slot declares. A dotted key such as `"invoice.total" = "Number"` does not declare a field of `invoice`: it is refused as `invalid_input_name`, on every pipe. A pipe that needs one field of a value declares the value with its whole concept, `invoice = "Invoice"`, and reads the field through it in its template, as `$invoice.total`. `pipelex fix bundle` deletes a dotted key whose root is declared beside it, since that root already supplies the field, unless the key, declared after its root, carries another presence marker or multiplicity than the root, such as `"data.text" = "Text!"` after `data = "Text?"`: deleting that key would change what the pipe requires, so the fix names only what differs, the multiplicity, the presence marker or both, with the edit that carries it onto the root (here, replace `?` with `!` on `data`), and is left for you to apply.+Each input slot can be written in two equivalent ways. The **plain form** gives the concept as a string — `topic = "Text"` — and is what you want almost always. The **expanded form** gives a table instead, so the slot can carry [intent hints](../concepts/intent-hints.md) beside its concept:```tomldiff --git a/docs/building-methods/pipes/pipe-controllers/PipeBatch.md b/docs/building-methods/pipes/pipe-controllers/PipeBatch.mdindex d941a58a9..b77216125 100644--- a/docs/building-methods/pipes/pipe-controllers/PipeBatch.md+++ b/docs/building-methods/pipes/pipe-controllers/PipeBatch.md@@ -49,7 +49,7 @@ This is the batch arm of the "route or skip" pattern: batch over items with a co| `inputs` | dictionary | The input concept(s) for the batch operation, as a dictionary mapping input names to concept codes. | Yes || `output` | string | The output concept produced by the batch operation. | Yes || `branch_pipe_code` | string | The name of the single pipe to execute for each item in the input list. | Yes |-| `input_list_name` | string | The name of the input list to iterate over. Must match one of the keys in `inputs`. Typically a plural noun (e.g. `articles`). | Yes |+| `input_list_name` | string | The name of the input list to iterate over. Must match one of the keys in `inputs`, so it is a plain input name, a `snake_case` identifier matching `[a-z][a-z0-9_]*`, and never a path into a field: a dotted name such as `catalog.pages` is refused as `invalid_input_name`. Typically a plural noun (e.g. `articles`). | Yes || `input_item_name` | string | The name that an individual item from the list will have inside its execution branch — this is how the branch pipe finds its input. Must differ from `input_list_name` and from every key in `inputs`. Typically the singular form of the list name (e.g. `article`). | Yes |### Example: Summarizing a list of articlesdiff --git a/docs/building-methods/pipes/pipe-operators/PipeImgGen.md b/docs/building-methods/pipes/pipe-operators/PipeImgGen.mdindex 45365643a..c6f423177 100644--- a/docs/building-methods/pipes/pipe-operators/PipeImgGen.md+++ b/docs/building-methods/pipes/pipe-operators/PipeImgGen.md@@ -200,7 +200,7 @@ prompt = "Combine the styles of these reference images into a single coherent scmodel = "$gen-image"```-Image references also work through a dotted path to a nested image field (e.g. `$page.page_view` when `page` is a `Page`), and through any of the `$var`, `@var`, or `{{ var }}` syntaxes.+Image references also work through a dotted path to a nested image field (e.g. `$page.page_view` when the pipe declares `page = "Page"`), and through any of the `$var`, `@var`, or `{{ var }}` syntaxes. The image is detected from the concept the path reaches, so only the root is declared: an input name is a plain name, and a key such as `"page.page_view" = "Image"` is refused as `invalid_input_name`.### Inputs and outputsdiff --git a/docs/building-methods/pipes/pipe-operators/PipeJudge.md b/docs/building-methods/pipes/pipe-operators/PipeJudge.mdindex b49117800..dbd8cf31e 100644--- a/docs/building-methods/pipes/pipe-operators/PipeJudge.md+++ b/docs/building-methods/pipes/pipe-operators/PipeJudge.md@@ -18,7 +18,7 @@ The fields a `PipeJudge` declares decide the kind of question it asks, and the kThe output must be that native or a concept refining it, and `Dynamic` is neither: a pipe declaring `options` whose output is `YesNo` is refused when the method loads, with a message naming both sides. A `PipeJudge` produces one verdict, so its output cannot be a list; to judge every item of a list, map the `PipeJudge` over it with a [`PipeBatch`](../pipe-controllers/PipeBatch.md).-**Every input is material to judge.** The model receives each input the pipe declares, by name, whether or not the question mentions it: a `Text` as its text, a `Number` as its number, a `YesNo` as its boolean, a list as a list, and a structured concept as its fields. An optional input that is absent is left out. Each input is sent whole, so an input name cannot reach into a field with a dot, as `invoice.total` would: declare `invoice` instead. So, unlike the other operators, a `PipeJudge` does not have to read its inputs in its `question`; it may still interpolate one, which suits a short parameter such as `"Is the message about $topic?"`, and every variable the question reads must be a declared input.+**Every input is material to judge.** The model receives each input the pipe declares, by name, whether or not the question mentions it: a `Text` as its text, a `Number` as its number, a `YesNo` as its boolean, a list as a list, and a structured concept as its fields. An optional input that is absent is left out. Each input is sent whole, under its plain name: an input name never reaches into a field with a dot, on any pipe, and `"invoice.total" = "Number"` is refused as `invalid_input_name`. To judge one field of a larger value without sending the rest of it, have the calling sequence bind the field under a plain name with a binding step, `{ from = "invoice.total", result = "total_amount" }`, and declare `total_amount = "Number"`. So, unlike the other operators, a `PipeJudge` does not have to read its inputs in its `question`; it may still interpolate one, which suits a short parameter such as `"Is the message about $topic?"`, and every variable the question reads must be a declared input.**Images and documents are sent as files.** An `Image` or a `Document` input, or a list of either, reaches the model as a file rather than as text. Whether a model reads files is stated in its model configuration, and a `PipeJudge` with an image or a document input is refused when the method loads if its model does not read that kind of file, with a message naming the input and what the model reads. An input declared `Dynamic` names no kind of value, so a file it holds is checked when the step runs instead. A document given to the run in a format the model does not read is refused when the run starts, before any step spends anything. TypeSafe's model reads text only, so turn a document into text with a [`PipeExtract`](PipeExtract.md) step first.diff --git a/docs/building-methods/pipes/pipe-operators/PipeLLM.md b/docs/building-methods/pipes/pipe-operators/PipeLLM.mdindex adc8b01c3..9158f656a 100644--- a/docs/building-methods/pipes/pipe-operators/PipeLLM.md+++ b/docs/building-methods/pipes/pipe-operators/PipeLLM.md@@ -59,25 +59,29 @@ Analyze this wedding photo and describe the key moments captured: $wedding_photo### Images as Sub-attributes of Structured Content-When working with structured content that contains image fields (like `PageContent` which has a `page_view` field), you need to specify the full path to the image attribute in the `inputs` section:+When working with structured content that contains image fields (like `Page`, which has a `page_view` field), declare the structured value with its whole concept in `inputs`, and read the image field through it in the prompt:```toml[pipe.analyze_page_view]type = "PipeLLM"description = "Analyze the visual layout of a page"-inputs = { "page_content.page_view" = "Image" }+inputs = { page = "Page" }output = "LayoutAnalysis"prompt = """-Analyze the visual layout and design elements of this page: $page_content.page_view+Analyze the visual layout and design elements of this page:[email protected]_view+Focus on typography, spacing, and overall composition."""```In this example:-- `page_content` is the input variable containing a `PageContent` object-- `page_view` is the `ImageContent` field within the `PageContent` structure-- The dot notation `page_content.page_view` tells Pipelex to extract the image from that specific field+- `page` is the input variable, declared with its whole concept, `Page`+- `page_view` is the `Image` field within the `Page` structure+- The path `page.page_view` reads that field through `page`, and because the concept the path reaches is `Image`, Pipelex attaches it to the model call as an image++An input name is always a plain name: a key such as `"page.page_view" = "Image"` is refused as `invalid_input_name`. When a pipe should receive only the field, under a name of its own, the calling sequence binds the field with a binding step, `{ from = "page.page_view", result = "page_view" }`, and the pipe declares `page_view = "Image"`.### Multiple Images@@ -229,7 +233,7 @@ The same rule governs `PipeImgGen` prompts (positive and negative), which use th| --------------------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- || `type` | string | The type of the pipe: `PipeLLM` | Yes || `description` | string | A description of the LLM operation. | Yes |-| `inputs` | dictionary | The input concept(s) for the LLM operation, as a dictionary mapping input names to concept codes. For images within structured content, use dot notation (e.g., `"page.image_argurment"`)+| `inputs` | dictionary | The input concept(s) for the LLM operation, as a dictionary mapping input names to concept codes. An input name is a plain `snake_case` name; for an image within structured content, declare the structured value (e.g., `page = "Page"`) and read the field through it in the prompt (`@page.page_view`). | No || `output` | string | The output concept produced by the LLM operation with multiplicity notation using brackets (e.g., `"Text"`, `"Text[]"`, `"Text[3]"`). | Yes || `model` | string or table | Specifies the LLM choice by name, setting, or preset to use. | No || `model_to_structure` | string or table | LLM choice used whenever this `PipeLLM` produces a structured output. Applies both to direct structured generation and to the structuring step when `structuring_method = "preliminary_text"` is set. | No |diff --git a/docs/tools/cli/fix.md b/docs/tools/cli/fix.mdindex 5c171b715..462f57bec 100644--- a/docs/tools/cli/fix.md+++ b/docs/tools/cli/fix.md@@ -60,7 +60,7 @@ pipelex fix bundle my_bundle.mthds --select match-sequence-output## What Gets Fixed-Only fixes classified as SAFE are applied — deterministic corrections derived from the structured validation errors, never from guesswork. Errors without a safe deterministic fix are left in place and reported as remaining errors. An unsafe fix, such as `rename-model` for a model name the deck only nearly matches, still shows on its error, labelled `💡 Suggested fix (unsafe, confirm before applying):`, for you to check and apply by hand, and is not a code `--select` or `--ignore` accepts. The available fix rule codes (for `--select`/`--ignore`) are listed in the error message when you pass an unknown code.+Only fixes classified as SAFE are applied — deterministic corrections derived from the structured validation errors, never from guesswork. Errors without a safe deterministic fix are left in place and reported as remaining errors. An unsafe fix, such as `rename-model` for a model name the deck only nearly matches, still shows on its error, labelled `💡 Suggested fix (unsafe, confirm before applying):`, for you to check and apply by hand, and is not a code `--select` or `--ignore` accepts. One rule is safe on some errors and unsafe on others: `delete-redundant-dotted-input` deletes a dotted input key such as `"page.page_view" = "Image"` whose root `page` is declared beside it, and it is safe when the root keeps its presence marker and multiplicity. When the key, declared after its root, carries another presence marker or multiplicity than the root, as `"data.text" = "Text!"` after `data = "Text?"` does, deleting it would change what a run requires, so that fix is unsafe and names only what differs, the multiplicity, the presence marker or both, with the edit that carries it onto the root; `--select` accepts the code and applies only its safe fixes. The available fix rule codes (for `--select`/`--ignore`) are listed in the error message when you pass an unknown code.## Related Documentationdiff --git a/docs/under-the-hood/pipelex-kernel.md b/docs/under-the-hood/pipelex-kernel.mdindex a268b574a..6dc558a52 100644--- a/docs/under-the-hood/pipelex-kernel.md+++ b/docs/under-the-hood/pipelex-kernel.md@@ -87,7 +87,7 @@ Both façade calls take the concept and the output class the caller wants, defauThe two `assemble_*` functions are there because `run_llm_text` and `run_img_gen` both take a *ready* prompt. A caller that could not build one would be holding an operator it cannot reach, which is what image generation was until `assemble_img_gen_prompt` existed: its only builder was an interpreter-layer blueprint. What they own is the part a caller must not re-derive — resolving `ImageReference` and `DocumentReference` out of working memory, and, on the image side, keeping the `[Image N]` tokens numbered from the same registry that orders `input_images`, since a mismatch mislabels which image the prompt is describing and nothing downstream can detect it.-`run_judgment` asks one question over the step's inputs by name, which it calls the material. `build_judgment_material` reads each input off its content's class, never off its concept, so the kernel stays free of the concept library: text is its string, a number its number, a yes/no its boolean, a date or a time its ISO string, a list the array of its items, any other structure its JSON object without its absent members, and an image or a document, or a list of either, travels beside that JSON state as prompt images and documents keyed by the input's name. An optional input that holds no value is left out, whether its absence was recorded or it was never written. A dotted input, such as `invoice.total`, is the value at its path, keyed by its full name, and is left out when the path holds nothing. `make_verdict_content` turns the answer into the verdict native: a yes/no answer's probability decides the verdict against the step's threshold, inclusive, or against 0.5 when none is declared; an answer with no probability keeps the model's own verdict, and when a threshold was declared a live run logs a warning and its `JudgmentResult` reports `threshold_applied` as false. A rating's distribution is keyed by the level index written as text. `judgment_setting_of_choice` gives the setting of the step's model, else of the deck's default, and raises `JudgmentModelMissingError` when neither names one, since the deck serves none by default. `served_judgment_model` gives the spec of the model a handle resolves to on this boot, or `None` when no backend serves one, a waterfall none of whose models is served included. `resolve_judgment_setting` then pins the setting to the handle the model resolves to; on a dry run, a model no backend serves on this boot keeps the deck's handle, since no judging worker is called.+`run_judgment` asks one question over the step's inputs by name, which it calls the material. `build_judgment_material` reads each input off its content's class, never off its concept, so the kernel stays free of the concept library: text is its string, a number its number, a yes/no its boolean, a date or a time its ISO string, a list the array of its items, any other structure its JSON object without its absent members, and an image or a document, or a list of either, travels beside that JSON state as prompt images and documents keyed by the input's name. An optional input that holds no value is left out, whether its absence was recorded or it was never written. An input name is a plain name, so each entry is one input's whole value, and the material holds exactly what the step declares: a field reaches a judgment only when the calling sequence binds it under a name of its own. `make_verdict_content` turns the answer into the verdict native: a yes/no answer's probability decides the verdict against the step's threshold, inclusive, or against 0.5 when none is declared; an answer with no probability keeps the model's own verdict, and when a threshold was declared a live run logs a warning and its `JudgmentResult` reports `threshold_applied` as false. A rating's distribution is keyed by the level index written as text. `judgment_setting_of_choice` gives the setting of the step's model, else of the deck's default, and raises `JudgmentModelMissingError` when neither names one, since the deck serves none by default. `served_judgment_model` gives the spec of the model a handle resolves to on this boot, or `None` when no backend serves one, a waterfall none of whose models is served included. `resolve_judgment_setting` then pins the setting to the handle the model resolves to; on a dry run, a model no backend serves on this boot keeps the deck's handle, since no judging worker is called.**Every entry point that renders a template takes a required `templating_style`** — `run_llm_text`, `run_llm_object`, `derive_structure_prompt`, `assemble_llm_prompt`, `assemble_img_gen_prompt`, `run_search`, `run_judgment`, `run_compose_template`. It is not nullable, and that is the contract: the Jinja2 filters that tag and format a value have no default of their own, so a call that omitted the style would render a prompt in a shape nobody chose. `resolve_templating_style(authored=...)` is what produces one — pass what the caller authored, or `None` to take the runtime default.diff --git a/pipelex/cli/dev_cli/commands/generate_corpus_vocabulary_cmd.py b/pipelex/cli/dev_cli/commands/generate_corpus_vocabulary_cmd.pyindex f8598f441..b2dbc0fd5 100644--- a/pipelex/cli/dev_cli/commands/generate_corpus_vocabulary_cmd.py+++ b/pipelex/cli/dev_cli/commands/generate_corpus_vocabulary_cmd.py@@ -219,6 +219,11 @@ _ERROR_TYPE_SCHEMA_FAULTS: frozenset[ValidationErrorType] = frozenset(# A `type` naming a pipe kind that does not exist, which the schema's closed enum of pipe# kinds rejects on sight.PipeValidationErrorType.UNKNOWN_PIPE_TYPE,+ # An input name that is not a plain snake_case identifier, a dotted `"page.page_view"` included,+ # which the schema's pattern on every `inputs` key and on `input_list_name` rejects. Measured on+ # both of its entries: plxt reports `error[schema]` on the lone dotted key and on the one beside+ # its declared root.+ PipeValidationErrorType.INVALID_INPUT_NAME,})diff --git a/pipelex/core/exceptions.py b/pipelex/core/exceptions.pyindex ddbaae9af..1bdd49768 100644--- a/pipelex/core/exceptions.py+++ b/pipelex/core/exceptions.py@@ -65,6 +65,22 @@ class PipelexBundleBlueprintValidationErrorData(BaseModel):# rename, ``None`` for a ``main_pipe`` value strip (which is a root ``set_key``, not a rename).stripped_pipe_code: str | None = None+ # A dotted input name whose root the same `inputs` table also declares (``delete-redundant-dotted-input``+ # enrichment), set on an ``invalid_input_name`` error only when it holds: the declared root already+ # supplies every field a template reads through it, so the planner can delete the key. A lone dotted+ # name or a malformed one leaves it unset, because its repair is the author's to choose.+ redundant_input_name: str | None = None++ # Set beside ``redundant_input_name`` only when deleting that key would change its root's contract: the marker+ # the key declares, as MTHDS writes it after the concept (``!``, ``[]``, or the empty string for a plain single+ # value). As the last declaration under its root, the key set the root's presence and multiplicity, so the+ # planner offers the deletion as unsafe. Unset, the deletion is safe.+ dropped_input_marker: str | None = None++ # Set together with ``dropped_input_marker``: the marker the root declares, written the same way. The planner's+ # warning compares the two markers' multiplicity and presence apart, and names only the part that differs.+ root_input_marker: str | None = None+class PipesAndConceptValidationErrorData(BaseModel):"""Structured validation error data for Pipe/Concept validation errors.diff --git a/pipelex/core/pipes/exceptions.py b/pipelex/core/pipes/exceptions.pyindex 47c86999d..70a92b415 100644--- a/pipelex/core/pipes/exceptions.py+++ b/pipelex/core/pipes/exceptions.py@@ -184,6 +184,9 @@ class PipeValidationError(ValueError):declared_inputs: dict[str, str] | None = None,file_path: str | None = None,explanation: str | None = None,+ redundant_input_name: str | None = None,+ dropped_input_marker: str | None = None,+ root_input_marker: str | None = None,):self.error_type = error_typeself.domain_code = domain_code@@ -203,6 +206,18 @@ class PipeValidationError(ValueError):# planner (pure, no file access) can emit a minimal diff instead of a table rewrite.self.expected_inputs = expected_inputsself.declared_inputs = declared_inputs+ # A dotted input name whose root the same `inputs` table also declares, set only at the+ # input-name check when that holds — the semantic fact the fix planner translates into+ # deleting the key, since the declared root already supplies every field a template reads.+ self.redundant_input_name = redundant_input_name+ # Set beside `redundant_input_name` only when deleting that key would change its root's contract: the+ # marker the key declares (`!`, `[]`, or the empty string for a plain single value), which, as the last+ # declaration under its root, set the root's presence and multiplicity. The fix planner then offers the+ # deletion as unsafe.+ self.dropped_input_marker = dropped_input_marker+ # Set together with `dropped_input_marker`: the marker the root declares, written the same way. The warning+ # compares the two markers' multiplicity and presence apart, so it names only the part the deletion drops.+ self.root_input_marker = root_input_markerself.file_path = file_pathself.explanation = explanationsuper().__init__(message)@@ -223,6 +238,12 @@ class PipeValidationError(ValueError):msg += f" • expected_inputs='{self.expected_inputs}'"if self.declared_inputs:msg += f" • declared_inputs='{self.declared_inputs}'"+ if self.redundant_input_name:+ msg += f" • redundant_input_name='{self.redundant_input_name}'"+ if self.dropped_input_marker is not None:+ msg += f" • dropped_input_marker='{self.dropped_input_marker}'"+ if self.root_input_marker is not None:+ msg += f" • root_input_marker='{self.root_input_marker}'"if self.file_path:msg += f" • file='{self.file_path}'"if self.explanation:diff --git a/pipelex/core/pipes/inputs/input_stuff_specs.py b/pipelex/core/pipes/inputs/input_stuff_specs.pyindex c68e10075..01b2034dc 100644--- a/pipelex/core/pipes/inputs/input_stuff_specs.py+++ b/pipelex/core/pipes/inputs/input_stuff_specs.py@@ -1,10 +1,8 @@import json-from collections.abc import Callablefrom typing import Any-from pydantic import Field, RootModel, field_validator+from pydantic import Field, RootModel-from pipelex import logfrom pipelex.core.concepts.concept import Conceptfrom pipelex.core.concepts.concept_provider_abstract import ConceptProviderAbstractfrom pipelex.core.concepts.concept_representation_generator import ConceptRepresentationFormat@@ -12,12 +10,10 @@ from pipelex.core.pipes.inputs.exceptions import InputStuffSpecNotFoundErrorfrom pipelex.core.pipes.stuff_spec.stuff_spec import StuffSpecfrom pipelex.core.pipes.variable_multiplicity import PresenceMarker, VariableMultiplicityfrom pipelex.core.stuffs.stuff_content import StuffContent-from pipelex.tools.misc.string_utils import get_root_from_dotted_pathclass NamedStuffSpec(StuffSpec):variable_name: str- requirement_expression: str | None = Noneclass TypedNamedStuffSpec(NamedStuffSpec):@@ -39,36 +35,6 @@ PipeInputsRoot = dict[str, StuffSpec]class InputStuffSpecs(RootModel[PipeInputsRoot]):root: PipeInputsRoot = Field(default_factory=dict)- @field_validator("root", mode="wrap")- @classmethod- def validate_concept_codes(- cls,- input_value: PipeInputsRoot,- handler: Callable[[PipeInputsRoot], PipeInputsRoot],- ) -> PipeInputsRoot:- # First let Pydantic handle the basic type validation- stuff_specs: PipeInputsRoot = handler(input_value)-- # Now we can transform and validate the keys and values- transformed_dict: PipeInputsRoot = {}- for input_name, stuff_spec in stuff_specs.items():- # in case of sub-attribute, the variable name is the object name, before the 1st dot- transformed_key: str = get_root_from_dotted_path(input_name)- if transformed_key != input_name:- log.verbose(f"Sub-attribute {input_name} detected, using {transformed_key} as variable name")-- if transformed_key in transformed_dict and transformed_dict[transformed_key] != stuff_spec:- log.verbose(- f"Variable {transformed_key} already exists with a different concept code: {transformed_dict[transformed_key]} -> {stuff_spec}",- )- transformed_dict[transformed_key] = StuffSpec(- concept=stuff_spec.concept,- multiplicity=stuff_spec.multiplicity,- presence=stuff_spec.presence,- )-- return transformed_dict-def set_default_domain(self, domain_code: str):for input_name, stuff_spec in self.root.items():input_concept_code = stuff_spec.concept.code@@ -121,40 +87,26 @@ class InputStuffSpecs(RootModel[PipeInputsRoot]):@propertydef declared_names(self) -> list[str]:"""Every declared input name, regardless of presence marker."""- the_declared_names: list[str] = []- for requirement_expression in self.root:- declared_variable_name = get_root_from_dotted_path(requirement_expression)- the_declared_names.append(declared_variable_name)- return the_declared_names+ return list(self.root)@propertydef required_names(self) -> list[str]:"""Declared input names whose value is required at run time: plain and forced (`!`)inputs. Optional (`?`) inputs are declared but may legitimately be absent."""- the_required_names: list[str] = []- for requirement_expression, stuff_spec in self.root.items():- if stuff_spec.presence.is_optional:- continue- required_variable_name = get_root_from_dotted_path(requirement_expression)- the_required_names.append(required_variable_name)- return the_required_names+ return [input_name for input_name, stuff_spec in self.root.items() if not stuff_spec.presence.is_optional]@propertydef named_stuff_specs(self) -> list[NamedStuffSpec]:- the_named_stuff_spec: list[NamedStuffSpec] = []- for requirement_expression, stuff_spec in self.root.items():- required_variable_name = get_root_from_dotted_path(requirement_expression)- the_named_stuff_spec.append(- NamedStuffSpec(- variable_name=required_variable_name,- requirement_expression=requirement_expression,- concept=stuff_spec.concept,- multiplicity=stuff_spec.multiplicity,- presence=stuff_spec.presence,- ),+ return [+ NamedStuffSpec(+ variable_name=input_name,+ concept=stuff_spec.concept,+ multiplicity=stuff_spec.multiplicity,+ presence=stuff_spec.presence,)- return the_named_stuff_spec+ for input_name, stuff_spec in self.root.items()+ ]@propertydef is_empty(self) -> bool:diff --git a/pipelex/kernel/judgment_ops.py b/pipelex/kernel/judgment_ops.pyindex efeae1fe6..fe66d7d00 100644--- a/pipelex/kernel/judgment_ops.py+++ b/pipelex/kernel/judgment_ops.py@@ -11,9 +11,7 @@ dispatch is on the content's class rather than on a concept, because the kernelconcept library."""-from typing import Any, cast--from pydantic_core import to_jsonable_python+from typing import Anyfrom pipelex import logfrom pipelex.cogt.content_generation.assignment_models import JudgmentAssignment@@ -54,7 +52,6 @@ from pipelex.kernel.memory_ops import store_resultfrom pipelex.runtime_hub import get_content_generator, get_model_deckfrom pipelex.system.job_metadata import JobMetadatafrom pipelex.tools.jinja2.template_category import TemplateCategory-from pipelex.tools.misc.string_utils import get_root_from_dotted_pathfrom pipelex.tools.templating.templating_style import TemplatingStyle# The one question a step asks travels under this key: the batch-first contract needs a key, and@@ -180,31 +177,22 @@ def build_judgment_material() -> tuple[JudgmentState, dict[str, list[PromptImage]], dict[str, list[PromptDocument]]]:"""The state and the files a judgment is asked over, one entry per input, keyed by its declared name.- An optional input that holds no value, whether its absence was recorded or it was never written, is+ An input name is a plain name, so each entry is one whole value: the step's material holds exactly+ what it declares, and a field reaches it only when the calling sequence binds it under a name of its+ own. An optional input that holds no value, whether its absence was recorded or it was never written, isleft out rather than sent as a null: a required input with no value never reaches the step, whose- presence scan refuses it. A dotted input, such as `invoice.total`, is the value at its path, keyed- by its full name, and is left out when the path holds nothing. An image or a document, or a list of- either, goes to the file channel; every other input is a member of the state. An image nested inside- a structured input is part of that input's JSON, its URL as text, which is the author's concern.+ presence scan refuses it. An image or a document, or a list of either, goes to the file channel; every+ other input is a member of the state. An image nested inside a structured input is part of that input's+ JSON, its URL as text, which is the author's concern."""state: JudgmentState = {}images: dict[str, list[PromptImage]] = {}documents: dict[str, list[PromptDocument]] = {}for input_name in input_names:- stuff = memory.get_optional_stuff(name=get_root_from_dotted_path(input_name))+ stuff = memory.get_optional_stuff(name=input_name)if stuff is None:continuecontent: StuffContent = stuff.content- if "." in input_name:- field_value = memory.get_typed_object_or_attribute(name=input_name, accept_list=True)- if field_value is None:- continue- if isinstance(field_value, list) and all(isinstance(item, StuffContent) for item in field_value): # pyright: ignore[reportUnknownVariableType]- field_value = ListContent[StuffContent](items=cast("list[StuffContent]", field_value))- if not isinstance(field_value, StuffContent):- state[input_name] = to_jsonable_python(field_value, exclude_none=True, serialize_as_any=True)- continue- content = field_valueif prompt_images := _prompt_images(content=content):images[input_name] = prompt_imageselif prompt_documents := _prompt_documents(content=content):diff --git a/pipelex/language/mthds_schema_generator.py b/pipelex/language/mthds_schema_generator.pyindex 7d536bf22..34c75dcfa 100644--- a/pipelex/language/mthds_schema_generator.py+++ b/pipelex/language/mthds_schema_generator.py@@ -11,6 +11,8 @@ import copyfrom typing import TYPE_CHECKING, Any, cast, get_argsfrom pipelex.mthds_parsing.pipelex_bundle_blueprint import PipeBlueprintUnion, PipelexBundleBlueprint+from pipelex.pipe_controllers.batch.pipe_batch_blueprint import PipeBatchBlueprint+from pipelex.pipe_machinery.validation import INPUT_NAME_PATTERNfrom pipelex.pipe_signature.pipe_signature_blueprint import PipeSignatureBlueprintfrom pipelex.tools.misc.package_utils import get_package_version@@ -56,6 +58,7 @@ def generate_mthds_schema() -> dict[str, Any]:schema = _normalize_type_on_pipe_definitions(schema)schema = _convert_to_draft4(schema)schema = _patch_construct_schema(schema)+ schema = _constrain_input_names(schema)return _add_taplo_metadata(schema)@@ -256,6 +259,38 @@ def _patch_construct_schema(schema: dict[str, Any]) -> dict[str, Any]:return schema+def _constrain_input_names(schema: dict[str, Any]) -> dict[str, Any]:+ """Constrain every input name to the plain-name grammar, so a structural check refuses a dotted one.++ An input name is a plain snake_case identifier (`INPUT_NAME_PATTERN`), on every pipe's `inputs` keys+ and on a PipeBatch's `input_list_name`; the runtime refuses anything else as `invalid_input_name`, and+ this makes the schema refuse it first, which is what that error type's `fails_at = "schema"` records.++ The keys are constrained with `patternProperties` plus `additionalProperties: false` rather than with+ `propertyNames`: the schema is Draft 4, which has no `propertyNames`, and a Draft-4 validator such as+ plxt's ignores the keyword silently. Moving the value schema under the pattern says the same thing in+ every draft: a key matching the pattern takes the slot schema, and any other key is refused.+ """+ schema = copy.deepcopy(schema)+ definitions = schema.get("definitions", {})++ for def_name in _PIPE_DEFINITION_NAMES:+ inputs_schema = definitions.get(def_name, {}).get("properties", {}).get("inputs")+ if inputs_schema is None:+ continue+ for arm in inputs_schema.get("anyOf", [inputs_schema]):+ if arm.get("type") != "object" or "additionalProperties" not in arm:+ continue+ arm["patternProperties"] = {INPUT_NAME_PATTERN: arm.pop("additionalProperties")}+ arm["additionalProperties"] = False++ input_list_name_schema = definitions.get(PipeBatchBlueprint.__name__, {}).get("properties", {}).get("input_list_name")+ if input_list_name_schema is not None:+ input_list_name_schema["pattern"] = INPUT_NAME_PATTERN++ return schema++def _build_construct_field_schema() -> dict[str, Any]:"""Build a JSON Schema for a construct field value as written in MTHDS files.diff --git a/pipelex/mthds_parsing/validation_error_categorizer.py b/pipelex/mthds_parsing/validation_error_categorizer.pyindex 30feee71e..d5a23c2fd 100644--- a/pipelex/mthds_parsing/validation_error_categorizer.py+++ b/pipelex/mthds_parsing/validation_error_categorizer.py@@ -356,6 +356,9 @@ def categorize_blueprint_validation_error(pipe_code=wrapped_pipe_error.pipe_code or pipe_code,message=wrapped_pipe_error.explanation or str(wrapped_pipe_error),variable_names=wrapped_pipe_error.variable_names,+ redundant_input_name=wrapped_pipe_error.redundant_input_name,+ dropped_input_marker=wrapped_pipe_error.dropped_input_marker,+ root_input_marker=wrapped_pipe_error.root_input_marker,)# A native-concept redeclaration: ``validate_concept_keys`` raised a typed ``ValueError``diff --git a/pipelex/pipe_controllers/batch/pipe_batch_blueprint.py b/pipelex/pipe_controllers/batch/pipe_batch_blueprint.pyindex ffa9344de..f761bf08d 100644--- a/pipelex/pipe_controllers/batch/pipe_batch_blueprint.py+++ b/pipelex/pipe_controllers/batch/pipe_batch_blueprint.py@@ -4,6 +4,7 @@ from typing_extensions import overridefrom pipelex.core.pipes.exceptions import PipeValidationErrorfrom pipelex.pipe_machinery.pipe_blueprint import PipeBlueprint+from pipelex.pipe_machinery.validation import check_input_list_namefrom pipelex.validation_error_types import PipeValidationErrorType@@ -22,6 +23,9 @@ class PipeBatchBlueprint(PipeBlueprint):@overridedef validate_inputs(self):+ # The list is one of the batch's own inputs, so its name is a plain input name: a list held in a+ # field is declared under a plain name and handed to the batch by the calling sequence.+ check_input_list_name(input_list_name=self.input_list_name)# The PipeBatch will iterate over a list and pass each item to the branch pipe,# so we must have the list's name as part of the batch inputs# and conversely, we must not have the item's name as part of the batch inputsdiff --git a/pipelex/pipe_machinery/pipe_abstract.py b/pipelex/pipe_machinery/pipe_abstract.pyindex f14685448..321d8218c 100644--- a/pipelex/pipe_machinery/pipe_abstract.py+++ b/pipelex/pipe_machinery/pipe_abstract.py@@ -27,7 +27,6 @@ from pipelex.graph.graph_tracer_manager import GraphTracerManager, IOSpec, NodeKfrom pipelex.graph.stuff_io_spec import make_stuff_io_specfrom pipelex.libraries.library_crate import LibraryCratefrom pipelex.pipe_machinery.pipe_blueprint import PipeCategory, PipeType, valid_pipe_type_tags-from pipelex.pipe_machinery.validation import is_variable_satisfied_by_inputsfrom pipelex.pipe_run.pipe_run_params import PipeRunParams, output_multiplicity_to_applyfrom pipelex.pipe_signature.exceptions import PipeSignatureNotExecutableErrorfrom pipelex.pipeline.pipeline_factory import PipelineFactory@@ -47,7 +46,7 @@ from pipelex.system.telemetry.otel_factory import OtelFactoryfrom pipelex.system.telemetry.telemetry_identity import make_run_identity_span_attributesfrom pipelex.system.telemetry.telemetry_manager_abstract import TelemetryManagerAbstractfrom pipelex.tools.misc.package_utils import get_package_version-from pipelex.tools.misc.string_utils import is_snake_case+from pipelex.tools.misc.string_utils import get_root_from_dotted_path, is_snake_casefrom pipelex.validation_error_types import PipeValidationErrorTypeif TYPE_CHECKING:@@ -331,10 +330,10 @@ class PipeAbstract(ABC, BaseModel):@finaldef generic_validate_inputs_with_library(self):- # First validate required variables are in the inputs (using prefix-based matching)+ # First validate required variables are in the inputs: a variable path reads the input its root namesinput_names = set(self.inputs.variables)for required_variable_path in self.required_variables():- if not is_variable_satisfied_by_inputs(required_variable_path, input_names=input_names):+ if get_root_from_dotted_path(required_variable_path) not in input_names:msg = (f"Required variable '{required_variable_path}' is not in the inputs of pipe '{self.code}'. "f"Current inputs: {self.inputs.format_for_display()}"@@ -371,7 +370,7 @@ class PipeAbstract(ABC, BaseModel):# Compare the essential parts of StuffSpec (concept code + multiplicity)# Skip validation if the needed stuff_spec is Dynamic or Anything (flexible output types)declared_stuff_spec = self.inputs.root[var_name]- needed_stuff_spec = the_needed_inputs.root[named_stuff_spec.requirement_expression or var_name]+ needed_stuff_spec = the_needed_inputs.root[var_name]# Allow mismatch if the needed stuff_spec is a flexible type (Dynamic or Anything).# Presence markers are deliberately NOT compared: a controller's boundary marker maydiff --git a/pipelex/pipe_machinery/pipe_blueprint.py b/pipelex/pipe_machinery/pipe_blueprint.pyindex 3454deb27..c294e468e 100644--- a/pipelex/pipe_machinery/pipe_blueprint.py+++ b/pipelex/pipe_machinery/pipe_blueprint.py@@ -19,7 +19,7 @@ from pipelex.core.pipes.variable_multiplicity import (presence_from_symbol,presence_symbol,)-from pipelex.pipe_machinery.validation import validate_input_name+from pipelex.pipe_machinery.validation import validate_input_namesfrom pipelex.validation_error_types import PipeValidationErrorType# A signature is NOT an executable pipe kind: it is deliberately absent from `PipeType` and@@ -356,8 +356,6 @@ class PipeBlueprint(ABC, BaseModel):def generic_validate_inputs(self):if self.inputs:for input_name, slot_value in self.inputs.items():- validate_input_name(input_name)-# One grammar, two spellings: the expanded slot form's `concept` value is validated# with the same ref+multiplicity+presence grammar as the plain string form.concept_spec = slot_concept_spec(slot_value)@@ -406,6 +404,12 @@ class PipeBlueprint(ABC, BaseModel):msg = f"Invalid concept string or code '{concept_ref_or_code}' when trying to validate the input of a pipe blueprint: {exc}"raise ValueError(msg) from exc+ # One check for every pipe, operator, controller or signature alike: an input name is a plain+ # snake_case name, never a dotted path into a field (`invalid_input_name`). It runs once every spec+ # is known to be valid, because whether deleting a redundant dotted key is safe depends on the+ # markers the specs carry.+ validate_input_names(input_specs={input_name: slot_concept_spec(slot_value) for input_name, slot_value in self.inputs.items()})+self.validate_inputs()@finaldiff --git a/pipelex/pipe_machinery/validation.py b/pipelex/pipe_machinery/validation.pyindex 5ceb7412b..51e832a11 100644--- a/pipelex/pipe_machinery/validation.py+++ b/pipelex/pipe_machinery/validation.py@@ -1,34 +1,33 @@-from pipelex.core.pipes.exceptions import PipeValidationError+import re+from collections.abc import Mapping+from typing import NamedTuple++from pipelex.base_exceptions import PipelexUnexpectedError+from pipelex.core.pipes.exceptions import PipeValidationError, PipeVariableMultiplicityError+from pipelex.core.pipes.variable_multiplicity import (+ PresenceMarker,+ VariableMultiplicity,+ fixed_item_count,+ format_concept_with_multiplicity,+ is_multiple_multiplicity,+ multiplicity_from_bracket_content,+ parse_concept_with_multiplicity,+ presence_from_symbol,+ presence_symbol,+)from pipelex.tools.misc.string_utils import get_root_from_dotted_path, is_snake_casefrom pipelex.validation_error_types import PipeValidationErrorType+# The grammar of an input name, the standard's `[a-z][a-z0-9_]*`: a plain snake_case identifier, which+# is never dotted. It applies to every key of a pipe's `inputs`, whatever the pipe, and to a PipeBatch's+# `input_list_name`. The MTHDS JSON Schema generator writes this same pattern on both, so a structural+# check refuses exactly what `validate_input_names` and `check_input_list_name` refuse.+INPUT_NAME_PATTERN = r"^[a-z][a-z0-9_]*$"-def is_variable_satisfied_by_inputs(variable_path: str, *, input_names: set[str]) -> bool:- """Check if a variable path is satisfied by the declared inputs.-- A variable path is satisfied if:- - It exactly matches an input name, OR- - Its root (or any prefix) matches an input name (attribute access on an input)-- Args:- variable_path: The full dotted variable path (e.g., 'page.text_and_images.text')- input_names: Set of declared input names-- Returns:- True if the variable path is satisfied by the inputs.- """- # Check for exact match- if variable_path in input_names:- return True-- # Check if any prefix of the path matches an input name- parts = variable_path.split(".")- for idx in range(1, len(parts)):- prefix = ".".join(parts[:idx])- if prefix in input_names:- return True-- return False+# The marker of an input declaration as `_input_marker` writes it after the concept: an optional multiplicity+# suffix (`[]` or `[N]`), then an optional presence symbol (`?` or `!`). Group 1 is the bracket content, group 2+# the presence symbol.+_INPUT_MARKER_PATTERN = r"^(?:\[(\d*)\])?([?!])?$"def is_input_used_by_variables(input_name: str, *, variable_paths: set[str]) -> bool:@@ -60,7 +59,6 @@ def check_inputs_match_variables(declared_inputs: set[str],variable_paths: set[str],reader: str,- dotted_input_supplies_its_path: bool,) -> None:"""Refuse a variable the templates read that no input declares, then a declared input no template reads.@@ -73,12 +71,7 @@ def check_inputs_match_variables(PipeValidationError: ``MISSING_INPUT_VARIABLE`` with the undeclared root names, or``EXTRANEOUS_INPUT_VARIABLE`` with the unread input names, each sorted."""- check_variables_are_declared(- declared_inputs=declared_inputs,- variable_paths=variable_paths,- reader=reader,- dotted_input_supplies_its_path=dotted_input_supplies_its_path,- )+ check_variables_are_declared(declared_inputs=declared_inputs, variable_paths=variable_paths, reader=reader)check_inputs_are_read(declared_inputs=declared_inputs, variable_paths=variable_paths, reader=reader)@@ -87,29 +80,18 @@ def check_variables_are_declared(declared_inputs: set[str],variable_paths: set[str],reader: str,- dotted_input_supplies_its_path: bool,) -> None:"""Refuse a variable the templates read that no input declares.``variable_paths`` are the full dotted paths the operator's templates read, already rid of theoperator's special names, and ``reader`` names the fields that read them, for the message- ("prompt or system_prompt", "template").-- ``dotted_input_supplies_its_path`` keeps each operator's own rule for a dotted input name such as- ``page.page_view`` declared without its root. PipeLLM takes it as supplying the path it names, a shape its- tests run; PipeCompose, PipeSearch, PipeImgGen and PipeJudge require every read's root to be declared.- Whether they should agree is a language question this check leaves open.+ ("prompt or system_prompt", "template"). A path reads the input its root names, on every operator+ alike: ``page.page_view`` reads ``page``, and the field is reached through that input's concept.Raises:PipeValidationError: ``MISSING_INPUT_VARIABLE`` with the undeclared root names, sorted."""- if dotted_input_supplies_its_path:- unsatisfied_paths = {- variable_path for variable_path in variable_paths if not is_variable_satisfied_by_inputs(variable_path, input_names=declared_inputs)- }- else:- unsatisfied_paths = {variable_path for variable_path in variable_paths if get_root_from_dotted_path(variable_path) not in declared_inputs}- missing_names = sorted({get_root_from_dotted_path(variable_path) for variable_path in unsatisfied_paths})+ missing_names = sorted({get_root_from_dotted_path(variable_path) for variable_path in variable_paths} - declared_inputs)if missing_names:quoted_names = _quoted_names(names=missing_names)if len(missing_names) == 1:@@ -120,7 +102,7 @@ def check_variables_are_declared(def check_inputs_are_read(*, declared_inputs: set[str], variable_paths: set[str], reader: str) -> None:- """Refuse a declared input no template reads. A dotted input name counts as read by the path it names.+ """Refuse a declared input no template reads: an input is read by a path equal to its name or rooted in it.Raises:PipeValidationError: ``EXTRANEOUS_INPUT_VARIABLE`` with the unread input names, sorted.@@ -140,73 +122,315 @@ def _quoted_names(*, names: list[str]) -> str:def is_valid_input_name(input_name: str) -> bool:- """Check if an input name is valid.+ """Whether a name is a plain input name: a snake_case identifier matching ``INPUT_NAME_PATTERN``, never dotted."""+ return re.fullmatch(INPUT_NAME_PATTERN, input_name) is not None- An input name is valid if:- - It's not empty- - It doesn't start or end with a dot- - All parts separated by dots are in snake_case- - There are no consecutive dots- Args:- input_name: The input name to validate+_PLAIN_NAME_RULE = (+ "an input name is a plain snake_case identifier, matching `[a-z][a-z0-9_]*`: a lowercase letter, then lowercase letters, digits and underscores"+)- Returns:- bool: True if the input name is valid, False otherwise-- Examples:- >>> is_valid_input_name("my_input")- True- >>> is_valid_input_name("my_input.field_name")- True- >>> is_valid_input_name("my_input.field_name.nested_field")- True- >>> is_valid_input_name("myInput")- False- >>> is_valid_input_name("my_input.fieldName")- False- >>> is_valid_input_name("")- False- >>> is_valid_input_name(".")- False- >>> is_valid_input_name(".my_input")- False- >>> is_valid_input_name("my_input.")- False- >>> is_valid_input_name("my_input..field")- False+def _is_dotted_field_path(*, name: str) -> bool:+ """Whether a name reads as a root followed by field names (``invoice.total``), each segment snake_case."""+ segments = name.split(".")+ return len(segments) > 1 and all(is_snake_case(segment) for segment in segments)+++def _binding_step(*, dotted_path: str) -> str:+ """The binding step a calling sequence writes to hand the field a dotted path reaches to a pipe under a plain name."""+ plain_name = dotted_path.rsplit(".", maxsplit=1)[-1]+ return f'`{{ from = "{dotted_path}", result = "{plain_name}" }}`'+++class _InputMarkerChange(NamedTuple):+ """What deleting a redundant dotted input would change in its root's contract, as the two markers it compares."""++ # The marker the key declares, which the deletion drops.+ dropped_input_marker: str+ # The marker of the declaration before the key, which takes over when the key is deleted: the root's own+ # whenever the change is reported (see `_input_marker_change`).+ root_input_marker: str+++class _InputMarkerParts(NamedTuple):+ """An input marker split into the two parts the old fold let the last declaration under a root set."""++ multiplicity: VariableMultiplicity | None+ presence: PresenceMarker++ @property+ def multiplicity_suffix(self) -> str:+ """The multiplicity part as MTHDS writes it: the empty string for a single value, else `[]` or `[N]`."""+ return format_concept_with_multiplicity("", multiplicity=self.multiplicity)++ @property+ def presence_suffix(self) -> str:+ """The presence part as MTHDS writes it: the empty string for plain, else `?` or `!`."""+ return presence_symbol(presence=self.presence)+++def _parse_input_marker(*, input_marker: str) -> _InputMarkerParts:+ """Split a marker written by `_input_marker` into its multiplicity and its presence.++ Raises:+ PipeVariableMultiplicityError: When the marker is not an optional multiplicity suffix followed by an+ optional presence symbol.+ """+ marker_match = re.fullmatch(_INPUT_MARKER_PATTERN, input_marker)+ if marker_match is None:+ msg = f"Invalid input marker '{input_marker}': expected an optional multiplicity suffix (`[]` or `[N]`), then an optional `?` or `!`."+ raise PipeVariableMultiplicityError(msg)+ return _InputMarkerParts(+ multiplicity=multiplicity_from_bracket_content(bracket_content=marker_match.group(1)),+ presence=presence_from_symbol(symbol=marker_match.group(2)),+ )+++def _with_symbol(*, phrase: str, symbol: str) -> str:+ """A phrase followed by the symbol MTHDS writes for it, in backticks, unless the symbol is empty."""+ if symbol:+ return f"{phrase} (`{symbol}`)"+ return phrase+++def _multiplicity_state(*, multiplicity: VariableMultiplicity | None) -> str:+ """What a multiplicity makes a declaration, without its suffix: a single value, a list, or a list of N."""+ if not is_multiple_multiplicity(multiplicity=multiplicity):+ return "a single value"+ item_count = fixed_item_count(multiplicity=multiplicity)+ if item_count is None:+ return "a list"+ return f"a list of {item_count}"+++def _multiplicity_form(*, multiplicity: VariableMultiplicity | None) -> str:+ """The name of a multiplicity as a form a key drops, without its suffix."""+ if not is_multiple_multiplicity(multiplicity=multiplicity):+ return "single-value form"+ if fixed_item_count(multiplicity=multiplicity) is None:+ return "list form"+ return "fixed-count form"+++def _presence_name(*, presence: PresenceMarker) -> str:+ """The name of a presence marker, as the docs on optionality give it."""+ match presence:+ case PresenceMarker.PLAIN:+ return "plain"+ case PresenceMarker.OPTIONAL:+ return "optional"+ case PresenceMarker.FORCE:+ return "forced"+++def _marker_edit(*, root_name: str, root_part: str, key_part: str) -> str:+ """The edit that makes the root carry the key's part where it carries its own, each written as MTHDS writes it."""+ if not root_part:+ return f"add `{key_part}` to '{root_name}'"+ if not key_part:+ return f"remove `{root_part}` from '{root_name}'"+ return f"replace `{root_part}` with `{key_part}` on '{root_name}'"+++def dropped_input_marker_warning(*, input_name: str, dropped_input_marker: str, root_input_marker: str) -> str:+ """The warning that deleting a redundant dotted input drops part of the marker it declares, and how to settle it on the root.++ Shared by the refusal's message and the fix planner's description, so a person reading either gets the same+ warning. Both markers are written as MTHDS writes them after the concept, the empty string standing for a plain+ single value: ``dropped_input_marker`` is the key's, and ``root_input_marker`` its root's. Their multiplicity and+ their presence are compared apart, and the warning names, and asks to change on the root, only the part that+ differs, or both when both do, so it never asks to add to the root a part the root already carries.++ Raises:+ PipelexUnexpectedError: When the two markers are equal, since deleting the key then drops nothing and no+ raise site reports it.+ """+ root_name = get_root_from_dotted_path(input_name)+ key_parts = _parse_input_marker(input_marker=dropped_input_marker)+ root_parts = _parse_input_marker(input_marker=root_input_marker)+ is_multiplicity_dropped = key_parts.multiplicity_suffix != root_parts.multiplicity_suffix+ is_presence_dropped = key_parts.presence != root_parts.presence++ dropped_multiplicity = "its " + _with_symbol(phrase=_multiplicity_form(multiplicity=key_parts.multiplicity), symbol=key_parts.multiplicity_suffix)+ root_multiplicity = _with_symbol(phrase=_multiplicity_state(multiplicity=root_parts.multiplicity), symbol=root_parts.multiplicity_suffix)+ wanted_multiplicity = f"must be {_multiplicity_state(multiplicity=key_parts.multiplicity)}"+ dropped_presence = "its " + _with_symbol(phrase=f"{_presence_name(presence=key_parts.presence)} presence", symbol=key_parts.presence_suffix)+ root_presence = _with_symbol(phrase=_presence_name(presence=root_parts.presence), symbol=root_parts.presence_suffix)+ wanted_presence: str+ if key_parts.presence.is_plain:+ wanted_presence = f"must not be {_presence_name(presence=root_parts.presence)}"+ else:+ wanted_presence = f"must be {_presence_name(presence=key_parts.presence)}"++ dropped: str+ held: str+ edit: str+ wanted: str+ match (is_multiplicity_dropped, is_presence_dropped):+ case (True, True):+ dropped = f"{dropped_multiplicity} and {dropped_presence}"+ held = f"{root_multiplicity} and {root_presence}"+ edit = _marker_edit(root_name=root_name, root_part=root_input_marker, key_part=dropped_input_marker)+ wanted = f"{wanted_multiplicity} and {wanted_presence}"+ case (True, False):+ dropped = dropped_multiplicity+ held = root_multiplicity+ edit = _marker_edit(root_name=root_name, root_part=root_parts.multiplicity_suffix, key_part=key_parts.multiplicity_suffix)+ wanted = wanted_multiplicity+ case (False, True):+ dropped = dropped_presence+ held = root_presence+ edit = _marker_edit(root_name=root_name, root_part=root_parts.presence_suffix, key_part=key_parts.presence_suffix)+ wanted = wanted_presence+ case (False, False):+ msg = (+ f"No marker to warn of for '{input_name}': it declares the marker `{dropped_input_marker}` its root '{root_name}' declares, "+ "so deleting it drops nothing."+ )+ raise PipelexUnexpectedError(msg)+ return f"Deleting '{input_name}' drops {dropped}, where '{root_name}' is {held}: {edit} if the root {wanted}"+++def _dotted_input_message(*, input_name: str, is_root_declared: bool, marker_change: _InputMarkerChange | None = None) -> str:+ """The refusal of a dotted input name, naming both remedies: read the field through the root, or bind it.++ When the root is declared and deleting the key would change the root's contract, the message warns of it+ as the fix does, so a person reading the message does not delete the key blind."""- if not input_name:- return False+ root_name = get_root_from_dotted_path(input_name)+ preamble = f"Input '{input_name}' is not a plain input name: an input names one whole value, so its name cannot reach into a field with a dot."+ binding_remedy = f"have the calling sequence bind the field to a plain name with a binding step ({_binding_step(dotted_path=input_name)})"+ if is_root_declared:+ marker_warning = ""+ if marker_change is not None:+ warning = dropped_input_marker_warning(+ input_name=input_name,+ dropped_input_marker=marker_change.dropped_input_marker,+ root_input_marker=marker_change.root_input_marker,+ )+ marker_warning = f" {warning}."+ return (+ f"{preamble} '{root_name}' is already declared, so delete this key and read the field through '{root_name}' in the template "+ f"(`${input_name}`).{marker_warning} To hand the field to this pipe under a name of its own instead, {binding_remedy} and declare "+ "that name."+ )+ return (+ f"{preamble} Either declare '{root_name}' with its whole concept and read the field through it in the template (`${input_name}`), "+ f"or {binding_remedy} and declare that name."+ )+++def _input_marker(*, input_spec: str) -> str:+ """The marker an input declaration carries, as MTHDS writes it after the concept: its multiplicity suffix, then its presence symbol.++ ``Text!`` carries ``!`` and ``Text[]`` carries ``[]``. A plain single value carries the empty string, and a count+ of one is the single form, so ``Text[1]!`` carries ``!`` as ``Text!`` does.+ """+ parsed_spec = parse_concept_with_multiplicity(input_spec)+ return format_concept_with_multiplicity("", multiplicity=parsed_spec.multiplicity, presence=parsed_spec.presence)- # Check for leading/trailing dots or consecutive dots- if input_name.startswith(".") or input_name.endswith(".") or ".." in input_name:- return False- # Split by dots and validate each part is snake_case- parts = input_name.split(".")- return all(is_snake_case(part) for part in parts)+def _input_marker_change(*, dotted_name: str, input_specs: Mapping[str, str]) -> _InputMarkerChange | None:+ """The markers deleting a redundant dotted input would trade on its root's contract, or ``None`` when deleting it keeps that contract.+ Before dotted names were refused, every declaration under a root, the root's own and each well-formed dotted+ key's, was folded onto the root in declaration order, so the last one set the root's presence marker and+ multiplicity. Deleting a key keeps that contract unless the key is the last declaration under its root and+ carries another marker than the declaration before it, which would take over. The key's own marker and that+ declaration's are then returned, for the fix and the message to name the part that differs. Concepts are never+ compared: a field's concept differs from its root's by nature, and typing the input by its root's whole concept+ is what refusing the dotted name is for.-def validate_input_name(input_name: str) -> None:- """Validate an input name and raise an error if invalid.+ When this is reported, the declaration before the key is the root itself, since a key followed by another under+ the same root is always safe to delete and is reported first.+ """+ root_name = get_root_from_dotted_path(dotted_name)+ names_under_root = [+ input_name+ for input_name in input_specs+ if input_name == root_name or (_is_dotted_field_path(name=input_name) and get_root_from_dotted_path(input_name) == root_name)+ ]+ if names_under_root[-1] != dotted_name:+ return None+ dotted_marker = _input_marker(input_spec=input_specs[dotted_name])+ previous_marker = _input_marker(input_spec=input_specs[names_under_root[-2]])+ if previous_marker == dotted_marker:+ return None+ return _InputMarkerChange(dropped_input_marker=dotted_marker, root_input_marker=previous_marker)+++def validate_input_names(*, input_specs: Mapping[str, str]) -> None:+ """Refuse an `inputs` table holding a name that is not a plain input name.++ An input names one whole value, of the concept its slot declares, so its name is a plain snake_case+ identifier and never a dotted path into a field. One name is reported, chosen so the fix loop can+ make progress: the first dotted name whose root the same table declares and whose deletion keeps the+ root's presence marker and multiplicity, which the fix planner deletes safely, else the first dotted+ name whose root the same table declares, else the first name that is not plain, in declaration order.Args:- input_name: The input name to validate+ input_specs: Each input name, in declaration order, mapped to its concept spec with its markers+ (``Text?``, ``Item[]``). The specs are already valid, as the blueprint checks them first.Raises:- ValueError: If the input name is invalid+ PipeValidationError: ``INVALID_INPUT_NAME`` naming the input, with ``redundant_input_name`` set+ when the name is dotted and its root is declared beside it, and ``dropped_input_marker`` and+ ``root_input_marker`` set besides when deleting it would change the root's contract: the marker+ the key declares, and the one its root declares.+ """+ invalid_names = [input_name for input_name in input_specs if not is_valid_input_name(input_name)]+ if not invalid_names:+ return+ redundant_names = [+ invalid_name+ for invalid_name in invalid_names+ if _is_dotted_field_path(name=invalid_name) and get_root_from_dotted_path(invalid_name) in input_specs+ ]+ if redundant_names:+ marker_changes = {+ redundant_name: _input_marker_change(dotted_name=redundant_name, input_specs=input_specs) for redundant_name in redundant_names+ }+ reported_name = next((redundant_name for redundant_name in redundant_names if marker_changes[redundant_name] is None), redundant_names[0])+ marker_change = marker_changes[reported_name]+ raise PipeValidationError(+ message=_dotted_input_message(input_name=reported_name, is_root_declared=True, marker_change=marker_change),+ error_type=PipeValidationErrorType.INVALID_INPUT_NAME,+ variable_names=[reported_name],+ redundant_input_name=reported_name,+ dropped_input_marker=marker_change.dropped_input_marker if marker_change is not None else None,+ root_input_marker=marker_change.root_input_marker if marker_change is not None else None,+ )+ first_invalid_name = invalid_names[0]+ if _is_dotted_field_path(name=first_invalid_name):+ msg = _dotted_input_message(input_name=first_invalid_name, is_root_declared=False)+ else:+ msg = f"Input '{first_invalid_name}' is not a valid input name: {_PLAIN_NAME_RULE}."+ raise PipeValidationError(message=msg, error_type=PipeValidationErrorType.INVALID_INPUT_NAME, variable_names=[first_invalid_name])++def check_input_list_name(*, input_list_name: str) -> None:+ """Refuse a PipeBatch's `input_list_name` that is not a plain input name.++ It names one of the batch's own inputs, so it follows the input-name grammar: a list held in a field+ of a larger value is declared by the batch under a plain name, and handed to it by the calling sequence.++ Raises:+ PipeValidationError: ``INVALID_INPUT_NAME`` naming the list."""- if not is_valid_input_name(input_name):+ if is_valid_input_name(input_list_name):+ return+ if _is_dotted_field_path(name=input_list_name):+ plain_name = input_list_name.rsplit(".", maxsplit=1)[-1]msg = (- f"Invalid input name syntax '{input_name}'. "- "Input names must be in snake_case. "- "Nested field access is allowed using dots (e.g., 'my_input.field_name'), "- "where each part must also be in snake_case."+ f"`input_list_name` '{input_list_name}' is not a plain input name: a PipeBatch maps over a list it declares as an input "+ f'of its own, under a plain name. Declare the list itself (`{plain_name} = "<Concept>[]"`, with '+ f'`input_list_name = "{plain_name}"`), and have the calling sequence bind the field to that name with a binding step '+ f"({_binding_step(dotted_path=input_list_name)}).")- raise ValueError(msg)+ else:+ msg = f"`input_list_name` '{input_list_name}' is not a valid input name: {_PLAIN_NAME_RULE}."+ raise PipeValidationError(message=msg, error_type=PipeValidationErrorType.INVALID_INPUT_NAME, variable_names=[input_list_name])def is_pipe_code_valid(pipe_code: str) -> bool:diff --git a/pipelex/pipe_operators/compose/construct_blueprint.py b/pipelex/pipe_operators/compose/construct_blueprint.pyindex bc2a4af56..57e023d94 100644--- a/pipelex/pipe_operators/compose/construct_blueprint.py+++ b/pipelex/pipe_operators/compose/construct_blueprint.py@@ -271,8 +271,8 @@ class ConstructBlueprint(BaseModel):- All variable paths read by templates, internal and special names excluded- The paths read by nested constructs (recursively)- The input check matches these paths against the declared inputs, so that a dotted input name- (`page.page_view`), declared next to its root `page`, counts as read by the path it names.+ The input check matches each path against the declared inputs by its root, so that+ `page.page_view` reads the input `page` and the field is reached through that input's concept.Returns:Set of full dotted variable paths read from working memorydiff --git a/pipelex/pipe_operators/compose/pipe_compose_blueprint.py b/pipelex/pipe_operators/compose/pipe_compose_blueprint.pyindex 70ac963bf..4b915d6a2 100644--- a/pipelex/pipe_operators/compose/pipe_compose_blueprint.py+++ b/pipelex/pipe_operators/compose/pipe_compose_blueprint.py@@ -127,9 +127,7 @@ class PipeComposeBlueprint(PipeBlueprint):root = get_root_from_dotted_path(path)if not root.startswith("_") and root != "place_holder":variable_paths.add(path)- check_inputs_match_variables(- declared_inputs=declared_inputs, variable_paths=variable_paths, reader="template", dotted_input_supplies_its_path=False- )+ check_inputs_match_variables(declared_inputs=declared_inputs, variable_paths=variable_paths, reader="template")def _validate_construct_inputs(self):"""Validate inputs for construct mode.@@ -147,7 +145,6 @@ class PipeComposeBlueprint(PipeBlueprint):declared_inputs=declared_inputs,variable_paths=construct_bp.get_required_variable_paths(),reader="construct",- dotted_input_supplies_its_path=False,)@overridediff --git a/pipelex/pipe_operators/img_gen/pipe_img_gen_blueprint.py b/pipelex/pipe_operators/img_gen/pipe_img_gen_blueprint.pyindex c5c84fd2a..cf2ca40c6 100644--- a/pipelex/pipe_operators/img_gen/pipe_img_gen_blueprint.py+++ b/pipelex/pipe_operators/img_gen/pipe_img_gen_blueprint.py@@ -60,7 +60,6 @@ class PipeImgGenBlueprint(PipeBlueprint):declared_inputs=declared_inputs,variable_paths=variable_paths,reader="prompt or negative_prompt",- dotted_input_supplies_its_path=False,)@classmethoddiff --git a/pipelex/pipe_operators/judge/pipe_judge_blueprint.py b/pipelex/pipe_operators/judge/pipe_judge_blueprint.pyindex 6e6911ea6..28eaad79f 100644--- a/pipelex/pipe_operators/judge/pipe_judge_blueprint.py+++ b/pipelex/pipe_operators/judge/pipe_judge_blueprint.py@@ -131,16 +131,6 @@ class PipeJudgeBlueprint(PipeBlueprint):def validate_inputs(self):template_category = TemplateCategory.BASICdeclared_inputs: set[str] = set(self.inputs.keys()) if self.inputs else set()- # A step's inputs are keyed by their root once loaded, so a dotted input would be judged as its whole- # root, fields the step never declared included: refused until the runtime keeps the path.- for input_name in sorted(declared_inputs):- if "." in input_name:- root_name = get_root_from_dotted_path(input_name)- msg = (- f"A PipeJudge sends each of its inputs whole, keyed by its name, so input '{input_name}' cannot name a field: "- f"declare '{root_name}' instead."- )- raise ValueError(msg)try:preprocessed_template = preprocess_template(self.question, declared_inputs=declared_inputs)except TemplateSigilSyntaxError as exc:@@ -163,9 +153,7 @@ class PipeJudgeBlueprint(PipeBlueprint):variable_paths = {path for path in full_paths if not get_root_from_dotted_path(path).startswith("_")}# Every declared input is material to judge, read whether the question names it or not: only# the variables the question does name must be declared.- check_variables_are_declared(- declared_inputs=declared_inputs, variable_paths=variable_paths, reader="question", dotted_input_supplies_its_path=False- )+ check_variables_are_declared(declared_inputs=declared_inputs, variable_paths=variable_paths, reader="question")@overridedef validate_output(self):diff --git a/pipelex/pipe_operators/llm/pipe_llm.py b/pipelex/pipe_operators/llm/pipe_llm.pyindex dcb0f9b47..971499e3b 100644--- a/pipelex/pipe_operators/llm/pipe_llm.py+++ b/pipelex/pipe_operators/llm/pipe_llm.py@@ -30,7 +30,7 @@ from pipelex.kernel.llm_ops import ()from pipelex.kernel.templating_style_ops import resolve_templating_stylefrom pipelex.pipe_machinery.template_guard_lint import lint_authored_template-from pipelex.pipe_machinery.validation import is_input_used_by_variables, is_variable_satisfied_by_inputs+from pipelex.pipe_machinery.validation import is_input_used_by_variablesfrom pipelex.pipe_operators.llm.llm_prompt_blueprint import LLMPromptBlueprintfrom pipelex.pipe_operators.pipe_operator import PipeOperatorfrom pipelex.pipe_run.pipe_run_params import (@@ -40,6 +40,7 @@ from pipelex.pipe_run.pipe_run_params import (from pipelex.runtime_hub import get_class_registryfrom pipelex.system.job_metadata import JobMetadatafrom pipelex.system.pipe_run_param_key import PipeRunParamKey+from pipelex.tools.misc.string_utils import get_root_from_dotted_pathfrom pipelex.tools.templating.templating_style import TemplatingStylefrom pipelex.tools.typing.pydantic_utils import format_pydantic_validation_errorfrom pipelex.validation_error_types import PipeValidationErrorType@@ -89,9 +90,9 @@ class PipeLLM(PipeOperator[PipeLLMOutput]):explanation=f"Input '{input_name}' is declared in inputs but not referenced in prompt/system_prompt.",)- # Check for missing inputs: variable paths in prompt/system_prompt not satisfied by any input+ # Check for missing inputs: variable paths in prompt/system_prompt whose root names no inputfor variable_path in required_variable_paths:- if not is_variable_satisfied_by_inputs(variable_path, input_names=input_names):+ if get_root_from_dotted_path(variable_path) not in input_names:msg = f"PipeLLM '{self.code}' uses variable '{variable_path}' in prompt/system_prompt but it is not declared in inputs."raise PipeValidationError(message=msg,diff --git a/pipelex/pipe_operators/llm/pipe_llm_blueprint.py b/pipelex/pipe_operators/llm/pipe_llm_blueprint.pyindex 1bfa35828..6813e8a4d 100644--- a/pipelex/pipe_operators/llm/pipe_llm_blueprint.py+++ b/pipelex/pipe_operators/llm/pipe_llm_blueprint.py@@ -114,7 +114,6 @@ class PipeLLMBlueprint(PipeBlueprint):declared_inputs=declared_inputs,variable_paths=filtered_variable_paths,reader="prompt or system_prompt",- dotted_input_supplies_its_path=True,)@overridediff --git a/pipelex/pipe_operators/search/pipe_search_blueprint.py b/pipelex/pipe_operators/search/pipe_search_blueprint.pyindex 6067290b8..ecffea507 100644--- a/pipelex/pipe_operators/search/pipe_search_blueprint.py+++ b/pipelex/pipe_operators/search/pipe_search_blueprint.py@@ -62,6 +62,4 @@ class PipeSearchBlueprint(PipeBlueprint):)# Names starting with an underscore are internal and never count as read inputsvariable_paths = {path for path in full_paths if not get_root_from_dotted_path(path).startswith("_")}- check_inputs_match_variables(- declared_inputs=declared_inputs, variable_paths=variable_paths, reader="prompt", dotted_input_supplies_its_path=False- )+ check_inputs_match_variables(declared_inputs=declared_inputs, variable_paths=variable_paths, reader="prompt")diff --git a/pipelex/pipeline/fixes/planner.py b/pipelex/pipeline/fixes/planner.pyindex 1f179667e..802a34359 100644--- a/pipelex/pipeline/fixes/planner.py+++ b/pipelex/pipeline/fixes/planner.py@@ -6,6 +6,7 @@ of the validation report — CLI, API, MCP — sees fixes with zero extra plumbi"""from pipelex.core.exceptions import PipelexBundleBlueprintValidationErrorData, PipesAndConceptValidationErrorData+from pipelex.pipe_machinery.validation import dropped_input_marker_warningfrom pipelex.suggested_fix import DeleteKeyOp, EnsureTableOp, FixOp, FixSafety, RemapValueOp, RenameTableKeyOp, SetKeyOp, SuggestedFixMATCH_SEQUENCE_OUTPUT_FIX_CODE = "match-sequence-output"@@ -13,18 +14,22 @@ SYNC_CONTROLLER_INPUTS_FIX_CODE = "sync-controller-inputs"STRIP_NATIVE_CONCEPT_REDECL_FIX_CODE = "strip-native-concept-redecl"STRIP_NAMESPACE_FIX_CODE = "strip-namespace"RENAME_MODEL_FIX_CODE = "rename-model"+DELETE_REDUNDANT_DOTTED_INPUT_FIX_CODE = "delete-redundant-dotted-input"# The codes `pipelex fix bundle --select/--ignore` accept: every SAFE rule the fix loop can apply. A new# SAFE rule constant above must be added here; the CLI rejects codes outside this set loudly (a typo'd# filter selects *behavior*, so lenient-ignore is wrong). An UNSAFE rule stays out: the loop never applies# it, so accepting it in `--select` would promise a fix the command then silently skips. `rename-model`-# is the one such rule today.+# is the one such rule today. A rule that is SAFE on some errors and UNSAFE on others, such as+# `delete-redundant-dotted-input`, stays in: `--select` picks its SAFE fixes, and its UNSAFE ones are+# skipped like any other.KNOWN_FIX_CODES: frozenset[str] = frozenset({MATCH_SEQUENCE_OUTPUT_FIX_CODE,SYNC_CONTROLLER_INPUTS_FIX_CODE,STRIP_NATIVE_CONCEPT_REDECL_FIX_CODE,STRIP_NAMESPACE_FIX_CODE,+ DELETE_REDUNDANT_DOTTED_INPUT_FIX_CODE,})@@ -181,9 +186,58 @@ def plan_fix_for_blueprint_validation_error(error_data: PipelexBundleBlueprintVareturn _plan_strip_native_concept_redecl(error_data)if error_data.error_type.is_invalid_pipe_code_syntax:return _plan_strip_namespace(error_data)+ if error_data.error_type.is_invalid_input_name:+ return _plan_delete_redundant_dotted_input(error_data=error_data)return None+def _plan_delete_redundant_dotted_input(*, error_data: PipelexBundleBlueprintValidationErrorData) -> SuggestedFix | None:+ """``delete-redundant-dotted-input``: an ``invalid_input_name`` carrying the enriched+ ``redundant_input_name`` becomes a ``delete_key`` of that key in the pipe's ``inputs`` table.++ The enrichment is set only when the same table declares the dotted name's root, which already+ supplies every field a template reads through it. The fix is ``SAFE`` when deleting the key also+ keeps the root's presence marker and multiplicity as the table's last declaration under the root set+ them. When it would not, ``dropped_input_marker`` and ``root_input_marker`` carry the marker the key+ declares and the one its root declares, and the fix is ``UNSAFE``: deleting the key would change what+ a run requires, so ``pipelex fix bundle`` never applies it, and its description names the part that+ differs, the multiplicity, the presence or both, and the edit that carries it onto the root. The two+ markers are set together; a dropped marker without its root's is an incomplete enrichment and yields+ no fix, never a ``SAFE`` one. A lone dotted name, whose root's concept nothing states, and a malformed+ name carry no enrichment and are suppressed here structurally; their message names the remedies for+ the author.+ """+ if error_data.redundant_input_name is None or error_data.pipe_code is None:+ return None+ description = (+ f"Delete the dotted input '{error_data.redundant_input_name}' of pipe '{error_data.pipe_code}': its root is declared "+ "beside it, and a template reads the field through the root"+ )+ safety = FixSafety.SAFE+ if error_data.dropped_input_marker is not None:+ if error_data.root_input_marker is None:+ return None+ marker_warning = dropped_input_marker_warning(+ input_name=error_data.redundant_input_name,+ dropped_input_marker=error_data.dropped_input_marker,+ root_input_marker=error_data.root_input_marker,+ )+ description = f"{description}. {marker_warning}"+ safety = FixSafety.UNSAFE+ return SuggestedFix(+ fix_code=DELETE_REDUNDANT_DOTTED_INPUT_FIX_CODE,+ description=description,+ safety=safety,+ source=error_data.source,+ ops=[+ DeleteKeyOp(+ table_path=["pipe", error_data.pipe_code, "inputs"],+ key=error_data.redundant_input_name,+ ),+ ],+ )++def _plan_strip_native_concept_redecl(error_data: PipelexBundleBlueprintValidationErrorData) -> SuggestedFix | None:"""``strip-native-concept-redecl``: a native-concept redeclaration carrying the enriched``concept_code`` becomes a ``delete_key`` of that key under ``["concept"]`` — the one op thatdiff --git a/pipelex/test_extras/mthds_corpus/entries/invalid_input_name_lone_dotted/bundle.mthds b/pipelex/test_extras/mthds_corpus/entries/invalid_input_name_lone_dotted/bundle.mthdsnew file mode 100644index 000000000..e0756b06f--- /dev/null+++ b/pipelex/test_extras/mthds_corpus/entries/invalid_input_name_lone_dotted/bundle.mthds@@ -0,0 +1,13 @@+domain = "catalog_proofing"+description = "Check how a page of a mail-order catalog looks once printed"+main_pipe = "describe_printed_page"++[pipe.describe_printed_page]+type = "PipeLLM"+description = "Describe how a catalog page looks once printed"+inputs = { "page.page_view" = "Image" }+output = "Text"+prompt = """+Describe how this catalog page looks once printed, and point out any picture cut off at the edge:[email protected]_view+"""diff --git a/pipelex/test_extras/mthds_corpus/entries/invalid_input_name_lone_dotted/entry.toml b/pipelex/test_extras/mthds_corpus/entries/invalid_input_name_lone_dotted/entry.tomlnew file mode 100644index 000000000..b0b091ab8--- /dev/null+++ b/pipelex/test_extras/mthds_corpus/entries/invalid_input_name_lone_dotted/entry.toml@@ -0,0 +1,12 @@+name = "invalid_input_name_lone_dotted"+description = "A printed catalog page described by a step that declares the picture of the page by its path in the page, and never the page itself"++validity = "invalid"+tier = "static"+granularity = "focused"++covers = [+ "error.invalid_input_name",+]++expected_error = "invalid_input_name"diff --git a/pipelex/test_extras/mthds_corpus/entries/invalid_input_name_redundant_dotted/bundle.mthds b/pipelex/test_extras/mthds_corpus/entries/invalid_input_name_redundant_dotted/bundle.mthdsnew file mode 100644index 000000000..80708c9cf--- /dev/null+++ b/pipelex/test_extras/mthds_corpus/entries/invalid_input_name_redundant_dotted/bundle.mthds@@ -0,0 +1,13 @@+domain = "catalog_proofing"+description = "Check how a page of a mail-order catalog looks once printed"+main_pipe = "describe_printed_page"++[pipe.describe_printed_page]+type = "PipeLLM"+description = "Describe how a catalog page looks once printed"+inputs = { "page.page_view" = "Image", page = "Page" }+output = "Text"+prompt = """+Describe how this catalog page looks once printed, and point out any picture cut off at the edge:[email protected]_view+"""diff --git a/pipelex/test_extras/mthds_corpus/entries/invalid_input_name_redundant_dotted/entry.toml b/pipelex/test_extras/mthds_corpus/entries/invalid_input_name_redundant_dotted/entry.tomlnew file mode 100644index 000000000..1d3192f78--- /dev/null+++ b/pipelex/test_extras/mthds_corpus/entries/invalid_input_name_redundant_dotted/entry.toml@@ -0,0 +1,12 @@+name = "invalid_input_name_redundant_dotted"+description = "A printed catalog page described by a step that declares the page, and the picture of the page a second time by its path in the page"++validity = "invalid"+tier = "static"+granularity = "focused"++covers = [+ "error.invalid_input_name",+]++expected_error = "invalid_input_name"diff --git a/pipelex/test_extras/mthds_corpus/vocabulary.toml b/pipelex/test_extras/mthds_corpus/vocabulary.tomlindex bbae073b8..ce22a92d7 100644--- a/pipelex/test_extras/mthds_corpus/vocabulary.toml+++ b/pipelex/test_extras/mthds_corpus/vocabulary.toml@@ -136,6 +136,10 @@ fails_at = "runtime"code = "invalid_pipe_code_syntax"fails_at = "runtime"+[error.invalid_input_name]+code = "invalid_input_name"+fails_at = "schema"+[error.unknown_pipe_type]code = "unknown_pipe_type"fails_at = "schema"diff --git a/pipelex/validation_error_types.py b/pipelex/validation_error_types.pyindex 9ae9935a8..c8a567be0 100644--- a/pipelex/validation_error_types.py+++ b/pipelex/validation_error_types.py@@ -48,6 +48,11 @@ class PipeValidationErrorType(StrEnum):LLM_OUTPUT_CANNOT_BE_IMAGE = "llm_output_cannot_be_image"INVALID_PIPE_CODE_SYNTAX = "invalid_pipe_code_syntax"+ # An input name that is not a plain snake_case identifier, a dotted name (`invoice.total`) included,+ # on any pipe's `inputs` or as a PipeBatch's `input_list_name`. Detected at blueprint parse time; a+ # dotted name whose root the same `inputs` table declares carries the enrichment the fix planner+ # turns into deleting the key.+ INVALID_INPUT_NAME = "invalid_input_name"UNKNOWN_PIPE_TYPE = "unknown_pipe_type"# A `[pipe.x]` section declared no `type` yet carries fields beyond the signature contract# (`description`, `inputs`, `output`). The author is describing an implementation without naming@@ -120,6 +125,7 @@ class PipeValidationErrorType(StrEnum):| PipeValidationErrorType.INADEQUATE_OUTPUT_MULTIPLICITY| PipeValidationErrorType.LLM_OUTPUT_CANNOT_BE_IMAGE| PipeValidationErrorType.INVALID_PIPE_CODE_SYNTAX+ | PipeValidationErrorType.INVALID_INPUT_NAME| PipeValidationErrorType.UNKNOWN_PIPE_TYPE| PipeValidationErrorType.MISSING_PIPE_TYPE| PipeValidationErrorType.BATCH_ITEM_NAME_COLLISION@@ -152,6 +158,7 @@ class PipeValidationErrorType(StrEnum):| PipeValidationErrorType.INPUT_STUFF_SPEC_MISMATCH| PipeValidationErrorType.LLM_OUTPUT_CANNOT_BE_IMAGE| PipeValidationErrorType.INVALID_PIPE_CODE_SYNTAX+ | PipeValidationErrorType.INVALID_INPUT_NAME| PipeValidationErrorType.UNKNOWN_PIPE_TYPE| PipeValidationErrorType.MISSING_PIPE_TYPE| PipeValidationErrorType.BATCH_ITEM_NAME_COLLISION@@ -191,6 +198,7 @@ class PipeValidationErrorType(StrEnum):| PipeValidationErrorType.INADEQUATE_OUTPUT_CONCEPT| PipeValidationErrorType.LLM_OUTPUT_CANNOT_BE_IMAGE| PipeValidationErrorType.INVALID_PIPE_CODE_SYNTAX+ | PipeValidationErrorType.INVALID_INPUT_NAME| PipeValidationErrorType.UNKNOWN_PIPE_TYPE| PipeValidationErrorType.MISSING_PIPE_TYPE| PipeValidationErrorType.BATCH_ITEM_NAME_COLLISION@@ -225,6 +233,7 @@ class PipeValidationErrorType(StrEnum):| PipeValidationErrorType.INADEQUATE_OUTPUT_MULTIPLICITY| PipeValidationErrorType.LLM_OUTPUT_CANNOT_BE_IMAGE| PipeValidationErrorType.INVALID_PIPE_CODE_SYNTAX+ | PipeValidationErrorType.INVALID_INPUT_NAME| PipeValidationErrorType.UNKNOWN_PIPE_TYPE| PipeValidationErrorType.MISSING_PIPE_TYPE| PipeValidationErrorType.BATCH_ITEM_NAME_COLLISION@@ -262,6 +271,46 @@ class PipeValidationErrorType(StrEnum):| PipeValidationErrorType.INADEQUATE_OUTPUT_CONCEPT| PipeValidationErrorType.INADEQUATE_OUTPUT_MULTIPLICITY| PipeValidationErrorType.LLM_OUTPUT_CANNOT_BE_IMAGE+ | PipeValidationErrorType.INVALID_INPUT_NAME+ | PipeValidationErrorType.UNKNOWN_PIPE_TYPE+ | PipeValidationErrorType.MISSING_PIPE_TYPE+ | PipeValidationErrorType.BATCH_ITEM_NAME_COLLISION+ | PipeValidationErrorType.OPTIONAL_MARKER_INVALID+ | PipeValidationErrorType.OPTIONAL_NOT_HANDLED+ | PipeValidationErrorType.OPTIONAL_OUTPUT_REQUIRED+ | PipeValidationErrorType.OPTIONAL_INPUT_UNGUARDED+ | PipeValidationErrorType.TEMPLATE_PRIVATE_NAME+ | PipeValidationErrorType.OPTIONAL_BRANCH_REQUIRED_FIELD+ | PipeValidationErrorType.OPTIONAL_FORCE_REDUNDANT+ | PipeValidationErrorType.INPUT_PRESENCE_VACUOUS+ | PipeValidationErrorType.NATIVE_CONCEPT_REDECLARATION+ | PipeValidationErrorType.UNRESOLVED_CONCEPT+ | PipeValidationErrorType.UNRESOLVED_PIPE_DEPENDENCY+ | PipeValidationErrorType.UNEXPORTED_PIPE_DEPENDENCY+ | PipeValidationErrorType.UNKNOWN_MODEL+ | PipeValidationErrorType.UNKNOWN_VALIDATION_ERROR+ ):+ return False++ @property+ def is_invalid_input_name(self) -> bool:+ """True for the invalid-input-name refusal, which the fix planner acts on when it is enriched.++ Gates entry to ``delete-redundant-dotted-input``; the planner still requires the+ ``redundant_input_name`` enrichment, so a lone dotted name or a malformed one, whose repair is the+ author's to choose, falls through as ``None`` even though it shares this ``error_type``.+ """+ match self:+ case PipeValidationErrorType.INVALID_INPUT_NAME:+ return True+ case (+ PipeValidationErrorType.MISSING_INPUT_VARIABLE+ | PipeValidationErrorType.EXTRANEOUS_INPUT_VARIABLE+ | PipeValidationErrorType.INPUT_STUFF_SPEC_MISMATCH+ | PipeValidationErrorType.INADEQUATE_OUTPUT_CONCEPT+ | PipeValidationErrorType.INADEQUATE_OUTPUT_MULTIPLICITY+ | PipeValidationErrorType.LLM_OUTPUT_CANNOT_BE_IMAGE+ | PipeValidationErrorType.INVALID_PIPE_CODE_SYNTAX| PipeValidationErrorType.UNKNOWN_PIPE_TYPE| PipeValidationErrorType.MISSING_PIPE_TYPE| PipeValidationErrorType.BATCH_ITEM_NAME_COLLISION@@ -296,6 +345,7 @@ class PipeValidationErrorType(StrEnum):| PipeValidationErrorType.INADEQUATE_OUTPUT_MULTIPLICITY| PipeValidationErrorType.LLM_OUTPUT_CANNOT_BE_IMAGE| PipeValidationErrorType.INVALID_PIPE_CODE_SYNTAX+ | PipeValidationErrorType.INVALID_INPUT_NAME| PipeValidationErrorType.UNKNOWN_PIPE_TYPE| PipeValidationErrorType.MISSING_PIPE_TYPE| PipeValidationErrorType.BATCH_ITEM_NAME_COLLISIONdiff --git a/subject_grants.toml b/subject_grants.tomlindex 0411976b6..5da239fea 100644--- a/subject_grants.toml+++ b/subject_grants.toml@@ -3552,6 +3552,10 @@ rationale = "Factory from source: builds the table from the template mapping; siparam = "schema"rationale = "Schema-pipeline stage transforming the schema dict; single operand."+["pipelex/language/mthds_schema_generator.py::_constrain_input_names"]+param = "schema"+rationale = "Schema-pipeline stage transforming the schema dict; single operand."+["pipelex/language/mthds_schema_generator.py::_convert_to_draft4"]param = "schema"rationale = "Schema-pipeline stage transforming the schema dict; single operand."@@ -4128,14 +4132,6 @@ rationale = "Predicate on the pipe code; single operand."param = "input_name"rationale = "Predicate on the input name; single operand."-["pipelex/pipe_machinery/validation.py::is_variable_satisfied_by_inputs"]-param = "variable_path"-rationale = "Predicate on the variable path; the inputs stay keyword."--["pipelex/pipe_machinery/validation.py::validate_input_name"]-param = "input_name"-rationale = "Verb-object: validates the input name; single operand."-["pipelex/pipe_operators/compose/construct_blueprint.py::ConstructBlueprint.make_from_raw"]param = "raw"rationale = "Factory from source: builds the blueprint from the raw value; single operand."diff --git a/tests/integration/pipelex/pipeline/test_fix_convergence_loop.py b/tests/integration/pipelex/pipeline/test_fix_convergence_loop.pyindex f4f4895ba..930021a3b 100644--- a/tests/integration/pipelex/pipeline/test_fix_convergence_loop.py+++ b/tests/integration/pipelex/pipeline/test_fix_convergence_loop.py@@ -418,6 +418,54 @@ steps = ["""+_REDUNDANT_DOTTED_INPUT_MTHDS = """domain = "dottedfix_redundant"+main_pipe = "describe_page"++# Wrong on purpose: a dotted input key beside its declared root, the form the bundles of the+# methods repository, the cookbook and the hub used to carry. The root already supplies the field.+[pipe.describe_page]+type = "PipeLLM"+description = "Describe the view of a catalog page."+inputs = { "page.page_view" = "Image", page = "Page" }+output = "Text"+prompt = \"\"\"+Describe this catalog page:[email protected]_view+\"\"\"+"""++_MARKER_DROPPING_DOTTED_INPUT_MTHDS = """domain = "dottedfix_marker"+main_pipe = "summarize_draft"++# Wrong on purpose: a dotted input key beside its declared root, declared after it with another presence+# marker. The key forces the root the author declared optional, so deleting it would change the contract.+[pipe.summarize_draft]+type = "PipeLLM"+description = "Summarize the text of a draft."+inputs = { draft = "Text?", "draft.text" = "Text!" }+output = "Text"+prompt = \"\"\"+Summarize this draft:+$draft.text+\"\"\"+"""++_LONE_DOTTED_INPUT_MTHDS = """domain = "dottedfix_lone"+main_pipe = "describe_page"++# Wrong on purpose: a lone dotted input key. Nothing says what concept `page` is, so no fix can write it.+[pipe.describe_page]+type = "PipeLLM"+description = "Describe the view of a catalog page."+inputs = { "page.page_view" = "Image" }+output = "Text"+prompt = \"\"\"+Describe this catalog page:[email protected]_view+\"\"\"+"""++@pytest.mark.asyncio(loop_scope="class")class TestFixConvergenceLoop:async def test_single_iteration_fixes_and_revalidates(@@ -913,3 +961,70 @@ class TestFixConvergenceLoop:assert result.iterations == 0assert result.fixes_applied == []assert bundle_path.read_text(encoding="utf-8") == valid_text++ async def test_redundant_dotted_input_is_deleted_in_one_iteration(+ self,+ tmp_path: Path,+ load_empty_library: Callable[[], str],+ ) -> None:+ """A dotted input whose root is declared beside it is deleted, and the bundle then validates."""+ load_empty_library()+ bundle_path = tmp_path / "redundant_dotted.mthds"+ bundle_path.write_text(_REDUNDANT_DOTTED_INPUT_MTHDS, encoding="utf-8")++ result = await fix_bundle_file(bundle_path)++ assert result.is_valid is True+ assert result.iterations == 1+ assert [fix.fix_code for fix in result.fixes_applied] == ["delete-redundant-dotted-input"]+ assert result.remaining_errors == []+ describe_page = _pipes(bundle_path)["describe_page"]+ assert describe_page["inputs"] == {"page": "Page"}+ assert "@page.page_view" in describe_page["prompt"]++ async def test_lone_dotted_input_is_left_to_the_author_with_the_remedies(+ self,+ tmp_path: Path,+ load_empty_library: Callable[[], str],+ ) -> None:+ """A lone dotted input has no safe fix, so the file is untouched and the error names both remedies."""+ load_empty_library()+ bundle_path = tmp_path / "lone_dotted.mthds"+ bundle_path.write_text(_LONE_DOTTED_INPUT_MTHDS, encoding="utf-8")++ result = await fix_bundle_file(bundle_path)++ assert result.is_valid is False+ assert result.fixes_applied == []+ assert bundle_path.read_text(encoding="utf-8") == _LONE_DOTTED_INPUT_MTHDS+ assert [item.error_type for item in result.remaining_errors] == ["invalid_input_name"]+ remaining = result.remaining_errors[0]+ assert remaining.suggested_fix is None+ assert remaining.message is not None+ assert "declare 'page' with its whole concept" in remaining.message+ assert '{ from = "page.page_view", result = "page_view" }' in remaining.message++ async def test_marker_dropping_dotted_input_is_offered_but_never_applied(+ self,+ tmp_path: Path,+ load_empty_library: Callable[[], str],+ ) -> None:+ """A dotted input whose deletion would drop its marker from the root gets an UNSAFE fix, which the loop leaves to the author."""+ load_empty_library()+ bundle_path = tmp_path / "marker_dropping_dotted.mthds"+ bundle_path.write_text(_MARKER_DROPPING_DOTTED_INPUT_MTHDS, encoding="utf-8")++ result = await fix_bundle_file(bundle_path)++ assert result.is_valid is False+ assert result.iterations == 0+ assert result.fixes_applied == []+ assert bundle_path.read_text(encoding="utf-8") == _MARKER_DROPPING_DOTTED_INPUT_MTHDS+ assert [item.error_type for item in result.remaining_errors] == ["invalid_input_name"]+ remaining = result.remaining_errors[0]+ assert remaining.suggested_fix is not None+ assert remaining.suggested_fix.fix_code == "delete-redundant-dotted-input"+ assert not remaining.suggested_fix.safety.is_safe+ assert "replace `?` with `!` on 'draft' if the root must be forced" in remaining.suggested_fix.description+ assert remaining.message is not None+ assert "Deleting 'draft.text' drops its forced presence (`!`), where 'draft' is optional (`?`)" in remaining.messagediff --git a/tests/integration/pipelex/pipeline/test_read_scope_routes.py b/tests/integration/pipelex/pipeline/test_read_scope_routes.pyindex 47094f154..13164b98b 100644--- a/tests/integration/pipelex/pipeline/test_read_scope_routes.py+++ b/tests/integration/pipelex/pipeline/test_read_scope_routes.py@@ -60,7 +60,7 @@ url = { template = "{{ where }}" }[pipe.describe_photo]type = "PipeLLM"description = "Describe the photo"-inputs = { "photo.picture" = "Image", photo = "Photo" }+inputs = { photo = "Photo" }output = "Text"prompt = \"\"\"Describe this image.diff --git a/tests/integration/pipelex/pipes/img_gen_prompt_inputs/test_img_gen_prompt_image_extraction.py b/tests/integration/pipelex/pipes/img_gen_prompt_inputs/test_img_gen_prompt_image_extraction.pyindex feba86a4f..dd2d1c17e 100644--- a/tests/integration/pipelex/pipes/img_gen_prompt_inputs/test_img_gen_prompt_image_extraction.py+++ b/tests/integration/pipelex/pipes/img_gen_prompt_inputs/test_img_gen_prompt_image_extraction.py@@ -39,7 +39,7 @@ class TestImgGenPromptImageExtraction:blueprint = PipeImgGenBlueprint(description="Test dotted path image in img_gen prompt",- inputs={"page.page_view": "Image", "page": "Page"},+ inputs={"page": "Page"},output="Image",prompt="Edit this image: {{ page.page_view }}",)@@ -95,7 +95,7 @@ class TestImgGenPromptImageExtraction:blueprint = PipeImgGenBlueprint(description="Test dollar dotted path image in img_gen prompt",- inputs={"page.page_view": "Image", "page": "Page"},+ inputs={"page": "Page"},output="Image",prompt="Edit this image: $page.page_view",)@@ -150,7 +150,7 @@ class TestImgGenPromptImageExtraction:blueprint = PipeImgGenBlueprint(description="Test at dotted path image in img_gen prompt",- inputs={"page.page_view": "Image", "page": "Page"},+ inputs={"page": "Page"},output="Image",prompt="Edit this image:\[email protected]_view",)diff --git a/tests/integration/pipelex/pipes/llm_prompt_inputs/test_prompt_image_extraction.py b/tests/integration/pipelex/pipes/llm_prompt_inputs/test_prompt_image_extraction.pyindex 4727478b8..3ec254698 100644--- a/tests/integration/pipelex/pipes/llm_prompt_inputs/test_prompt_image_extraction.py+++ b/tests/integration/pipelex/pipes/llm_prompt_inputs/test_prompt_image_extraction.py@@ -322,11 +322,12 @@ class TestPromptImageExtraction:pretty_print(llm_prompt.user_text, title="with_images | tag - images extracted AND wrapped in tags")async def test_direct_nested_image_via_dotted_path(self, load_test_library: Callable[[list[Path]], None]) -> None:- """Test that direct nested image reference via dotted path produces [Image N] token.+ """`@page.page_view`, read through the root `page = "Page"`, is attached as an image and produces an [Image N] token.This tests the case where:- - inputs declares a dotted path to an image field: {"page.page_view": "Image"}+ - inputs declare only the root, `page = "Page"`: an input name is a plain name, never a path into a field- prompt uses @page.page_view which becomes {{ page.page_view|tag("page.page_view") }}+ - the image is detected by the concept the path reaches, `Image`, through the pinned structure of `Page`- The tag filter should detect the registered image and return [Image N]This verifies that the tag filter correctly substitutes registered images,@@ -336,9 +337,9 @@ class TestPromptImageExtraction:pipe_llm_blueprint = PipeLLMBlueprint(description="Test direct nested image reference",- inputs={"page.page_view": "Image", "page": "Page"},+ inputs={"page": "Page"},output="Text",- prompt="Describe this image: $page.page_view",+ prompt="Describe this image:\[email protected]_view",)pipe_llm = PipeFactory[PipeLLM].make_from_blueprint(@@ -657,7 +658,7 @@ class TestPromptImageExtraction:pipe_llm_blueprint = PipeLLMBlueprint(description="Test bare Jinja2 dotted path image",- inputs={"page.page_view": "Image", "page": "Page"},+ inputs={"page": "Page"},output="Text",prompt="Describe this image: {{ page.page_view }}",)@@ -710,7 +711,7 @@ class TestPromptImageExtraction:pipe_llm_blueprint = PipeLLMBlueprint(description="Test dollar dotted path image",- inputs={"page.page_view": "Image", "page": "Page"},+ inputs={"page": "Page"},output="Text",prompt="Describe this image: $page.page_view",)@@ -751,3 +752,45 @@ class TestPromptImageExtraction:assert "[Image 1]" in llm_prompt.user_text, f"Expected '[Image 1]' in prompt, got: {llm_prompt.user_text}"assert ImageTestCases.IMAGE_FILE_PATH_PNG_1 not in llm_prompt.user_text, f"URL should not appear in prompt text: {llm_prompt.user_text}"pretty_print(llm_prompt.user_text, title="$page.page_view - should show [Image 1]")++ async def test_dotted_path_to_a_scalar_through_the_root_renders_its_value(self, load_test_library: Callable[[list[Path]], None]) -> None:+ """`{{ page.page_view.url }}` reads a text field through the root `page = "Page"`, so it renders as text and attaches no image."""+ load_test_library([Path("tests/integration/pipelex/pipes/pipelines")])++ pipe_llm_blueprint = PipeLLMBlueprint(+ description="Test a dotted path to a scalar field read through the root",+ inputs={"page": "Page"},+ output="Text",+ prompt="Where the page view is stored: {{ page.page_view.url }}",+ )++ pipe_llm = PipeFactory[PipeLLM].make_from_blueprint(+ domain_code="test_pipes",+ pipe_code="test_dotted_path_to_scalar",+ blueprint=pipe_llm_blueprint,+ )++ page_content = PageContent(+ text_and_images=TextAndImagesContent(+ text=TextContent(text="Some text content"),+ images=[],+ ),+ page_view=ImageContent(url=ImageTestCases.IMAGE_FILE_PATH_PNG_1),+ )+ working_memory = WorkingMemoryFactory.make_from_single_stuff(+ stuff=StuffFactory.make_stuff(+ concept=ConceptFactory.make_native_concept(native_concept_code=NativeConceptCode.PAGE),+ content=page_content,+ name="page",+ ),+ )++ llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),+ output_concept_ref="Text",+ context_provider=working_memory,+ )++ assert not llm_prompt.user_images+ assert llm_prompt.user_text is not None+ assert f"Where the page view is stored: {ImageTestCases.IMAGE_FILE_PATH_PNG_1}" in llm_prompt.user_textdiff --git a/tests/integration/pipelex/pipes/operator/pipe_llm/test_pipe_llm.py b/tests/integration/pipelex/pipes/operator/pipe_llm/test_pipe_llm.pyindex 2e451c595..69f72fc90 100644--- a/tests/integration/pipelex/pipes/operator/pipe_llm/test_pipe_llm.py+++ b/tests/integration/pipelex/pipes/operator/pipe_llm/test_pipe_llm.py@@ -165,15 +165,16 @@ class TestPipeLLMBasic:):load_test_library([Path("tests/integration/pipelex/pipes/operator/pipe_llm")])for attribute_path in attribute_paths:- stuff_name = attribute_path- if not stuff_name:+ # The pipe declares the stuff under its plain name, the path's root, and reads the attribute through it+ root_name = attribute_path.split(".", maxsplit=1)[0]+ if not root_name:pytest.fail(f"Cannot use nameless stuff in this test: {stuff}")working_memory = WorkingMemoryFactory.make_from_single_stuff(stuff=stuff)# Build prompt dynamically to include the input variable reference- prompt_with_input = f"Here is the input: ${stuff_name}\n{PipeTestCases.MULTI_IMG_DESC_PROMPT}"+ prompt_with_input = f"Here is the input: ${attribute_path}\n{PipeTestCases.MULTI_IMG_DESC_PROMPT}"pipe_llm_blueprint = PipeLLMBlueprint(description="LLM test for image processing with attributes",- inputs={stuff_name: "native.Image"},+ inputs={root_name: "native.Image"},output=NativeConceptCode.TEXT,system_prompt=PipeTestCases.SYSTEM_PROMPT,prompt=prompt_with_input,diff --git a/tests/integration/pipelex/pipes/pipelines/test_image_inputs.mthds b/tests/integration/pipelex/pipes/pipelines/test_image_inputs.mthdsindex a3474ba22..5da57f168 100644--- a/tests/integration/pipelex/pipes/pipelines/test_image_inputs.mthds+++ b/tests/integration/pipelex/pipes/pipelines/test_image_inputs.mthds@@ -21,7 +21,7 @@ $image[pipe.describe_page]type = "PipeLLM"description = "Describe a page"-inputs = { "page.page_view" = "Image", page = "Page" }+inputs = { page = "Page" }output = "Article"system_prompt = """You are an expert at describing page contents.diff --git a/tests/unit/pipelex/core/pipes/test_input_stuff_specs_presence.py b/tests/unit/pipelex/core/pipes/test_input_stuff_specs_presence.pyindex 852efe553..3356c6d0e 100644--- a/tests/unit/pipelex/core/pipes/test_input_stuff_specs_presence.py+++ b/tests/unit/pipelex/core/pipes/test_input_stuff_specs_presence.py@@ -49,9 +49,3 @@ class TestInputStuffSpecsPresence:specs = InputStuffSpecs(root={})specs.add_stuff_spec(variable_name="maybe_var", concept=_text_concept(), presence=PresenceMarker.OPTIONAL)assert specs.root["maybe_var"].presence == PresenceMarker.OPTIONAL-- def test_root_validator_preserves_presence(self):- """The wrap validator rebuilds StuffSpecs (dotted-path rooting) and must not drop presence."""- concept = _text_concept()- specs = InputStuffSpecs(root={"doc.summary": StuffSpec(concept=concept, presence=PresenceMarker.OPTIONAL)})- assert specs.root["doc"].presence == PresenceMarker.OPTIONALdiff --git a/tests/unit/pipelex/fix_ops/test_fix_applier_inputs_sync.py b/tests/unit/pipelex/fix_ops/test_fix_applier_inputs_sync.pyindex f893c2119..04433d565 100644--- a/tests/unit/pipelex/fix_ops/test_fix_applier_inputs_sync.py+++ b/tests/unit/pipelex/fix_ops/test_fix_applier_inputs_sync.py@@ -108,19 +108,3 @@ output = "Text"applications = apply_fix_ops(toml_doc=toml_doc, ops=_MISSING_TABLE_OPS)assert [application.outcome for application in applications] == [FixOpOutcome.SKIPPED, FixOpOutcome.APPLIED]assert _dumps(toml_doc) == once-- def test_dotted_input_key_survives_format(self) -> None:- """A quoted dotted input key (`"cv.name"`, a supported sub-attribute name) stays a flat- quoted entry through the format pass, not split into a nested table. Deleting an unrelated- sibling (with a bare ``cv`` root also present) must neither crash nor corrupt the file.- """- source = '[pipe.make_summary]\ntype = "PipeSequence"\ninputs = { "cv.name" = "Text", cv = "Curriculum", note = "Text" }\n'- toml_doc = tomlkit.loads(source)- applications = apply_fix_ops(toml_doc=toml_doc, ops=[DeleteKeyOp(table_path=_INPUTS_TABLE_PATH, key="note")])- assert [application.outcome for application in applications] == [FixOpOutcome.APPLIED]- formatted = serialize_and_format(toml_doc)- assert '"cv.name" = "Text"' in formatted- assert "note" not in formatted- # The dotted key stays a flat string entry, not a nested `cv = { name = ... }` table.- reloaded = tomlkit.loads(formatted).unwrap()- assert reloaded["pipe"]["make_summary"]["inputs"] == {"cv.name": "Text", "cv": "Curriculum"}diff --git a/tests/unit/pipelex/fix_ops/test_fix_applier_redundant_dotted_input.py b/tests/unit/pipelex/fix_ops/test_fix_applier_redundant_dotted_input.pynew file mode 100644index 000000000..5ad939b85--- /dev/null+++ b/tests/unit/pipelex/fix_ops/test_fix_applier_redundant_dotted_input.py@@ -0,0 +1,55 @@+import pytest+import tomlkit++from pipelex.fix_ops.applier import FixOpOutcome, apply_fix_ops, serialize_and_format+from pipelex.suggested_fix import DeleteKeyOp++_INPUTS_TABLE_PATH = ["pipe", "describe_page", "inputs"]++_INLINE_SOURCE = """[pipe.describe_page]+type = "PipeLLM"+description = "Describe the view of a catalog page"+# The dotted key is redundant: its root is declared beside it.+inputs = { "page.page_view" = "Image", page = "Page" }+output = "Text"+prompt = "Describe @page.page_view"+"""++_BLOCK_SOURCE = """[pipe.describe_page]+type = "PipeLLM"+description = "Describe the view of a catalog page"+output = "Text"+prompt = "Describe @page.page_view"++[pipe.describe_page.inputs]+"page.page_view" = "Image"+page = "Page"+"""+++class TestFixApplierRedundantDottedInput:+ @pytest.mark.parametrize("source", [_INLINE_SOURCE, _BLOCK_SOURCE], ids=["inline-table", "block-table"])+ def test_delete_drops_the_quoted_dotted_key_and_keeps_its_root(self, source: str) -> None:+ """At the applier, the `delete-redundant-dotted-input` op removes the quoted key as one flat key, never a nested path."""+ toml_doc = tomlkit.loads(source)++ applications = apply_fix_ops(toml_doc=toml_doc, ops=[DeleteKeyOp(table_path=_INPUTS_TABLE_PATH, key="page.page_view")])++ assert [application.outcome for application in applications] == [FixOpOutcome.APPLIED]+ formatted = serialize_and_format(toml_doc)+ assert 'page.page_view" =' not in formatted+ reloaded = tomlkit.loads(formatted).unwrap()+ assert reloaded["pipe"]["describe_page"]["inputs"] == {"page": "Page"}+ assert reloaded["pipe"]["describe_page"]["prompt"] == "Describe @page.page_view"++ def test_applying_twice_is_idempotent(self) -> None:+ """Re-applying finds the key already gone: the op is skipped and the bytes hold."""+ toml_doc = tomlkit.loads(_INLINE_SOURCE)+ ops = [DeleteKeyOp(table_path=_INPUTS_TABLE_PATH, key="page.page_view")]+ apply_fix_ops(toml_doc=toml_doc, ops=ops)+ once = serialize_and_format(toml_doc)++ applications = apply_fix_ops(toml_doc=toml_doc, ops=ops)++ assert [application.outcome for application in applications] == [FixOpOutcome.SKIPPED]+ assert serialize_and_format(toml_doc) == oncediff --git a/tests/unit/pipelex/kernel/test_judgment_material.py b/tests/unit/pipelex/kernel/test_judgment_material.pyindex 92ed34f79..7a0564a2a 100644--- a/tests/unit/pipelex/kernel/test_judgment_material.py+++ b/tests/unit/pipelex/kernel/test_judgment_material.py@@ -40,7 +40,7 @@ class _ReportWithNestedContents(StructuredContent):class _Invoice(StructuredContent):- """A structure a dotted input reaches into."""+ """A structured input, judged as one whole value under its plain name."""total: floatnote: str | None = None@@ -155,27 +155,23 @@ class TestJudgmentMaterial:state, _, _ = build_judgment_material(memory=_memory({"report": report}), input_names=["report"])assert state == {"report": {"payload": {"text": "The roof is on fire"}, "extras": [{"number": 3}]}}- def test_a_dotted_input_is_the_value_at_its_path_keyed_by_its_full_name(self) -> None:+ def test_a_structured_input_is_its_whole_value_keyed_by_its_plain_name(self) -> None:+ """The material holds each declared input whole, under its plain name, and nothing it did not declare."""invoice = _Invoice(total=1250.0, note="rush", lines=[TextContent(text="roof"), TextContent(text="gutter")])- memory = _memory({"invoice": invoice})+ memory = _memory({"invoice": invoice, "message": TextContent(text="help")})- state, images, documents = build_judgment_material(memory=memory, input_names=["invoice.total", "invoice.note", "invoice.lines"])+ state, images, documents = build_judgment_material(memory=memory, input_names=["invoice"])- assert state == {"invoice.total": 1250.0, "invoice.note": "rush", "invoice.lines": ["roof", "gutter"]}+ assert state == {"invoice": {"total": 1250.0, "note": "rush", "lines": [{"text": "roof"}, {"text": "gutter"}]}}assert images == {}assert documents == {}- def test_a_dotted_input_reaching_a_file_goes_to_the_file_channel(self) -> None:- invoice = _Invoice(total=1.0, scan=ImageContent(url="pipelex-storage://s/scan.png", mime_type="image/png"))+ def test_a_dotted_name_is_never_walked_as_a_path(self) -> None:+ """The dotted branch is gone, so a dotted name is looked up as a name, finds no stuff, and adds nothing."""+ memory = _memory({"invoice": _Invoice(total=1.0, scan=ImageContent(url="pipelex-storage://s/scan.png", mime_type="image/png"))})- state, images, _ = build_judgment_material(memory=_memory({"invoice": invoice}), input_names=["invoice.scan"])+ state, images, documents = build_judgment_material(memory=memory, input_names=["invoice.total", "invoice.scan"])assert state == {}- assert images == {"invoice.scan": [PromptImageUri(uri="pipelex-storage://s/scan.png", mime_type="image/png")]}-- def test_a_dotted_input_whose_field_or_root_holds_nothing_is_left_out(self) -> None:- memory = _memory({"message": TextContent(text="help"), "invoice": _Invoice(total=1.0)})-- state, _, _ = build_judgment_material(memory=memory, input_names=["message", "invoice.note", "estimate.total"])-- assert state == {"message": "help"}+ assert images == {}+ assert documents == {}diff --git a/tests/unit/pipelex/language/test_mthds_schema.py b/tests/unit/pipelex/language/test_mthds_schema.pyindex 1989b3154..bd591251d 100644--- a/tests/unit/pipelex/language/test_mthds_schema.py+++ b/tests/unit/pipelex/language/test_mthds_schema.py@@ -318,6 +318,48 @@ class TestMthdsSchemaGeneration:table = {**_minimal_pipe_table("PipeImgGen"), "size": size_value}assert validator.is_valid(table) is should_validate, f"size={size_value!r} should {'' if should_validate else 'not '}validate"+ @pytest.mark.parametrize("pipe_type", [*sorted(_PIPE_KIND_EXTRA_FIELDS), None])+ @pytest.mark.parametrize(+ ("input_name", "should_validate"),+ [+ pytest.param("invoice", True, id="plain"),+ pytest.param("invoice_total_2", True, id="plain-with-digits"),+ pytest.param("invoice.total", False, id="dotted"),+ pytest.param("InvoiceTotal", False, id="pascal-case"),+ pytest.param("2nd_total", False, id="leading-digit"),+ pytest.param("_total", False, id="leading-underscore"),+ ],+ )+ def test_input_names_follow_the_plain_name_grammar(+ self, schema: dict[str, Any], pipe_type: str | None, input_name: str, should_validate: bool+ ) -> None:+ """Every pipe kind's `inputs` keys, the typeless signature's included, are refused by the schema unless plain.++ This is what makes `invalid_input_name` a schema fault: a structural check refuses a dotted or+ malformed input name before the runtime is asked, on every pipe, with no per-kind exception.+ """+ validator = _pipe_union_oneof_validator(schema)+ if pipe_type is None:+ table: dict[str, Any] = {"description": "A signature", "output": "Text"}+ else:+ table = _minimal_pipe_table(pipe_type)+ table["inputs"] = {input_name: "Text"}+ assert validator.is_valid(table) is should_validate, f"{pipe_type or 'signature'} inputs key {input_name!r}"++ @pytest.mark.parametrize(+ ("input_list_name", "should_validate"),+ [+ pytest.param("pages", True, id="plain"),+ pytest.param("catalog.pages", False, id="dotted"),+ pytest.param("Pages", False, id="pascal-case"),+ ],+ )+ def test_batch_input_list_name_follows_the_plain_name_grammar(self, schema: dict[str, Any], input_list_name: str, should_validate: bool) -> None:+ """A PipeBatch's `input_list_name` is a plain input name, refused by the schema otherwise, as the runtime does."""+ validator = _pipe_union_oneof_validator(schema)+ table = {**_minimal_pipe_table("PipeBatch"), "input_list_name": input_list_name}+ assert validator.is_valid(table) is should_validate+def test_minimal_table_coverage_matches_schema_pipe_kinds(self, schema: dict[str, Any]) -> None:"""Guard: the test's per-kind table map covers exactly the *concrete* pipe kinds in the schema.diff --git a/tests/unit/pipelex/pipe_machinery/test_data.py b/tests/unit/pipelex/pipe_machinery/test_data.pynew file mode 100644index 000000000..b7db98d98--- /dev/null+++ b/tests/unit/pipelex/pipe_machinery/test_data.py@@ -0,0 +1,117 @@+from typing import ClassVar++from pipelex.pipe_machinery.pipe_blueprint import PipeType+++class InputNameRefusalTestData:+ """Pipe tables for the input-name refusal: one per pipe kind, valid on its own, each declaring `inputs` on one line."""++ PIPE_TABLES: ClassVar[dict[PipeType, str]] = {+ PipeType.PIPE_FUNC: """type = "PipeFunc"+description = "Totals an invoice"+inputs = { invoice = "Invoice" }+output = "Number"+function_name = "total_invoice"+""",+ PipeType.PIPE_IMG_GEN: """type = "PipeImgGen"+description = "Draws the letterhead of an invoice"+inputs = { invoice = "Invoice" }+output = "Image"+prompt = "A letterhead for $invoice"+""",+ PipeType.PIPE_COMPOSE: """type = "PipeCompose"+description = "Writes the reference line of an invoice"+inputs = { invoice = "Invoice" }+output = "Text"+template = "Invoice: $invoice"+""",+ PipeType.PIPE_LLM: """type = "PipeLLM"+description = "Summarizes an invoice"+inputs = { invoice = "Invoice" }+output = "Text"+prompt = "Summarize $invoice"+""",+ PipeType.PIPE_EXTRACT: """type = "PipeExtract"+description = "Reads the pages of an invoice scan"+inputs = { invoice = "Document" }+output = "Page[]"+""",+ PipeType.PIPE_SEARCH: """type = "PipeSearch"+description = "Looks up the supplier of an invoice"+inputs = { invoice = "Invoice" }+output = "SearchResult"+prompt = "Who issued $invoice?"+""",+ PipeType.PIPE_STRUCTURE: """type = "PipeStructure"+description = "Fills in an invoice from its text"+inputs = { invoice = "Text" }+output = "Invoice"+""",+ PipeType.PIPE_DOC_GEN: """type = "PipeDocGen"+description = "Prints an invoice"+inputs = { invoice = "Invoice" }+output = "Document"+format = "pdf"+filename = "invoice-{{ invoice.number }}"+""",+ PipeType.PIPE_JUDGE: """type = "PipeJudge"+description = "Judges whether an invoice is overdue"+inputs = { invoice = "Invoice" }+output = "YesNo"+question = "Is this invoice overdue?"+""",+ PipeType.PIPE_BATCH: """type = "PipeBatch"+description = "Totals each invoice"+inputs = { invoices = "Invoice[]" }+output = "Number[]"+branch_pipe_code = "total_invoice"+input_list_name = "invoices"+input_item_name = "invoice"+""",+ PipeType.PIPE_CONDITION: """type = "PipeCondition"+description = "Routes an invoice by its status"+inputs = { invoice = "Invoice" }+output = "Text"+expression = "invoice.status"+default_outcome = "fail"+outcomes = { paid = "summarize_invoice" }+""",+ PipeType.PIPE_PARALLEL: """type = "PipeParallel"+description = "Reads an invoice two ways at once"+inputs = { invoice = "Invoice" }+output = "InvoiceReading"+branches = [{ pipe = "summarize_invoice", result = "summary" }]+""",+ PipeType.PIPE_SEQUENCE: """type = "PipeSequence"+description = "Summarizes an invoice"+inputs = { invoice = "Invoice" }+output = "Text"+steps = [{ pipe = "summarize_invoice", result = "summary" }]+""",+ }++ # A pipe with no `type` and only the contract fields is a signature: the check covers it too.+ SIGNATURE_TABLE: ClassVar[str] = """description = "Summarizes an invoice"+inputs = { invoice = "Invoice" }+output = "Text"+"""++ BUNDLE_HEADER: ClassVar[str] = """domain = "invoicing"+description = "Invoices received from suppliers"++[concept]+Invoice = "An invoice received from a supplier"+InvoiceReading = "What was read off an invoice"+Catalog = "A supplier catalog"++[pipe.the_pipe]+"""++ BATCH_OVER_A_FIELD_TABLE: ClassVar[str] = """type = "PipeBatch"+description = "Totals each page of a catalog"+inputs = { catalog = "Catalog" }+output = "Number[]"+branch_pipe_code = "total_page"+input_list_name = "catalog.pages"+input_item_name = "page"+"""diff --git a/tests/unit/pipelex/pipe_machinery/test_input_name_refusal.py b/tests/unit/pipelex/pipe_machinery/test_input_name_refusal.pynew file mode 100644index 000000000..448704c24--- /dev/null+++ b/tests/unit/pipelex/pipe_machinery/test_input_name_refusal.py@@ -0,0 +1,130 @@+# An input name is a plain name, on every pipe: anything else is refused as ``invalid_input_name``.+#+# These cases are pinned through the parser, the entry point a ``.mthds`` file goes through: a dotted input key+# on every operator, controller and signature is refused by the one shared check, a dotted key beside its+# declared root carries the enrichment the fix planner deletes it with, other malformed names are refused the+# same way, and so is a dotted PipeBatch ``input_list_name``. Each refused bundle is paired with the same bundle+# without the fault, which parses, so the refusal is shown to come from the name and nothing else.++import pytest++from pipelex.core.exceptions import PipelexBundleBlueprintValidationErrorData+from pipelex.mthds_parsing.exceptions import MthdsParserError+from pipelex.mthds_parsing.parser import MthdsParser+from pipelex.pipe_machinery.pipe_blueprint import PipeType+from pipelex.validation_error_types import PipeValidationErrorType+from tests.unit.pipelex.pipe_machinery.test_data import InputNameRefusalTestData++_PIPE_TABLES = InputNameRefusalTestData.PIPE_TABLES+_SIGNATURE_ID = "PipeSignature"+++def _bundle(*, pipe_table: str, added_input: str | None = None) -> str:+ """A bundle holding one pipe, `the_pipe`, with an input entry written first in its `inputs` when given."""+ if added_input is not None:+ pipe_table = pipe_table.replace("inputs = { ", f"inputs = {{ {added_input}, ", 1)+ return InputNameRefusalTestData.BUNDLE_HEADER + pipe_table+++def _parse_errors(mthds_content: str) -> list[PipelexBundleBlueprintValidationErrorData]:+ with pytest.raises(MthdsParserError) as exc_info:+ MthdsParser.make_pipelex_bundle_blueprint(mthds_content=mthds_content, mthds_source="invoicing.mthds")+ return exc_info.value.validation_errors+++def _the_one_error(mthds_content: str) -> PipelexBundleBlueprintValidationErrorData:+ errors = _parse_errors(mthds_content)+ assert len(errors) == 1, f"Expected exactly one error, got {[(error.error_type, error.message) for error in errors]}"+ return errors[0]+++def _pipe_table(table_id: str) -> str:+ if table_id == _SIGNATURE_ID:+ return InputNameRefusalTestData.SIGNATURE_TABLE+ return _PIPE_TABLES[PipeType(table_id)]+++_ALL_TABLE_IDS = [*(pipe_type.value for pipe_type in _PIPE_TABLES), _SIGNATURE_ID]+++class TestInputNameRefusal:+ def test_every_pipe_kind_has_a_table(self) -> None:+ """Guard: the parametrized refusal below covers every executable pipe kind, so a new kind fails here until it is added."""+ assert set(_PIPE_TABLES) == set(PipeType)++ @pytest.mark.parametrize("table_id", _ALL_TABLE_IDS)+ def test_the_table_parses_without_the_dotted_key(self, table_id: str) -> None:+ """The control: each table is valid as written, so a refusal below comes from the added key alone."""+ blueprint = MthdsParser.make_pipelex_bundle_blueprint(mthds_content=_bundle(pipe_table=_pipe_table(table_id)), mthds_source="invoicing.mthds")+ assert blueprint.pipe is not None+ assert "the_pipe" in blueprint.pipe++ @pytest.mark.parametrize("table_id", _ALL_TABLE_IDS)+ def test_a_dotted_input_key_is_refused_on_every_pipe_kind(self, table_id: str) -> None:+ """A dotted key is refused by the one shared check, whichever operator, controller or signature declares it."""+ error = _the_one_error(_bundle(pipe_table=_pipe_table(table_id), added_input='"invoice.total" = "Number"'))++ assert error.error_type == PipeValidationErrorType.INVALID_INPUT_NAME+ assert error.pipe_code == "the_pipe"+ assert error.variable_names == ["invoice.total"]++ def test_a_lone_dotted_input_names_both_remedies_and_carries_no_fix_enrichment(self) -> None:+ """A lone dotted key, through the parser: the root is not declared, so nothing says its concept and the key is the author's to repair."""+ lone_table = _PIPE_TABLES[PipeType.PIPE_LLM].replace('inputs = { invoice = "Invoice" }', 'inputs = { "invoice.total" = "Number" }')+ lone_table = lone_table.replace("Summarize $invoice", "Summarize $invoice.total")++ error = _the_one_error(_bundle(pipe_table=lone_table))++ assert error.error_type == PipeValidationErrorType.INVALID_INPUT_NAME+ assert error.variable_names == ["invoice.total"]+ assert error.redundant_input_name is None+ assert "declare 'invoice' with its whole concept" in error.message+ assert '{ from = "invoice.total", result = "total" }' in error.message++ def test_a_dotted_input_beside_its_root_carries_the_fix_enrichment(self) -> None:+ """The root is declared in the same table, so the key is redundant and the error says which key to delete."""+ error = _the_one_error(_bundle(pipe_table=_PIPE_TABLES[PipeType.PIPE_LLM], added_input='"invoice.total" = "Number"'))++ assert error.error_type == PipeValidationErrorType.INVALID_INPUT_NAME+ assert error.redundant_input_name == "invoice.total"+ assert "'invoice' is already declared, so delete this key" in error.message+ assert '{ from = "invoice.total", result = "total" }' in error.message++ def test_a_redundant_dotted_input_is_reported_before_a_lone_one(self) -> None:+ """The fixable name is reported first, so the fix loop deletes it and the lone one is left to the author."""+ error = _the_one_error(+ _bundle(pipe_table=_PIPE_TABLES[PipeType.PIPE_LLM], added_input='"supplier.name" = "Text", "invoice.total" = "Number"')+ )++ assert error.redundant_input_name == "invoice.total"+ assert error.variable_names == ["invoice.total"]++ @pytest.mark.parametrize("malformed_name", ["InvoiceTotal", "2nd_total", "invoice-total", "_total", "invoice..total", "Invoice.total"])+ def test_a_malformed_input_name_is_refused(self, malformed_name: str) -> None:+ """Any name that is not a plain snake_case identifier is refused the same way, and is never deletable."""+ error = _the_one_error(_bundle(pipe_table=_PIPE_TABLES[PipeType.PIPE_LLM], added_input=f'"{malformed_name}" = "Number"'))++ assert error.error_type == PipeValidationErrorType.INVALID_INPUT_NAME+ assert error.variable_names == [malformed_name]+ assert error.redundant_input_name is None+ assert "[a-z][a-z0-9_]*" in error.message++ def test_a_dotted_batch_list_name_is_refused(self) -> None:+ """`input_list_name` is a plain input name, so a path into a field of a declared input is refused."""+ batch_table = InputNameRefusalTestData.BATCH_OVER_A_FIELD_TABLE+ error = _the_one_error(_bundle(pipe_table=batch_table))++ assert error.error_type == PipeValidationErrorType.INVALID_INPUT_NAME+ assert error.variable_names == ["catalog.pages"]+ assert error.redundant_input_name is None+ assert '{ from = "catalog.pages", result = "pages" }' in error.message++ def test_a_dotted_batch_list_declared_as_an_input_is_refused(self) -> None:+ """The other spelling of a dotted batch list: the list declared under its dotted name is refused by the shared input-name check."""+ batch_table = _PIPE_TABLES[PipeType.PIPE_BATCH].replace('inputs = { invoices = "Invoice[]" }', 'inputs = { "ledger.invoices" = "Invoice[]" }')+ batch_table = batch_table.replace('input_list_name = "invoices"', 'input_list_name = "ledger.invoices"')++ error = _the_one_error(_bundle(pipe_table=batch_table))++ assert error.error_type == PipeValidationErrorType.INVALID_INPUT_NAME+ assert error.variable_names == ["ledger.invoices"]diff --git a/tests/unit/pipelex/pipe_machinery/test_validation.py b/tests/unit/pipelex/pipe_machinery/test_validation.pyindex adefe66ea..e045499e2 100644--- a/tests/unit/pipelex/pipe_machinery/test_validation.py+++ b/tests/unit/pipelex/pipe_machinery/test_validation.py@@ -1,104 +1,241 @@import pytest-from pipelex.pipe_machinery.validation import is_valid_input_name, validate_input_name+from pipelex.core.pipes.exceptions import PipeValidationError+from pipelex.pipe_machinery.validation import check_input_list_name, is_valid_input_name, validate_input_names+from pipelex.validation_error_types import PipeValidationErrorTypeclass TestInputNameValidation:- """Test input name validation functions."""-@pytest.mark.parametrize(("input_name", "expected_result"),[- # Valid cases+ # A plain snake_case identifier("my_input", True),("input_123", True),("my_input_field", True),- ("my_input.field_name", True),- ("my_input.field_name.nested_field", True),- ("input_1.field_2.nested_3", True),("a", True),("a_b", True),- ("a.b", True),- ("a.b.c", True),- # Invalid cases - not snake_case+ ("trailing_", True),+ # Dotted: an input names one whole value, never a field of one+ ("my_input.field_name", False),+ ("my_input.field_name.nested_field", False),+ ("a.b", False),+ # Not snake_case("myInput", False),("MyInput", False),("my-input", False),("my input", False),- ("123_input", False), # Cannot start with number- # Invalid cases - dot issues+ ("123_input", False),+ ("2nd_total", False),+ ("_private", False),("", False),(".", False),(".my_input", False),("my_input.", False),("my_input..field", False),- ("my_input...field", False),- ("..", False),- ("...", False),- # Invalid cases - mixed with valid dots- ("my_input.fieldName", False), # Second part not snake_case- ("myInput.field_name", False), # First part not snake_case- ("my_input.Field_name", False), # Second part starts with uppercase- ("my_input..field_name", False), # Consecutive dots- ("my_input.field_name.", False), # Trailing dot- (".my_input.field_name", False), # Leading dot+ ("my_input\n", False),],)def test_is_valid_input_name(self, input_name: str, expected_result: bool):- """Test is_valid_input_name with various input names."""assert is_valid_input_name(input_name) == expected_result+ def test_plain_names_pass(self):+ validate_input_names(input_specs={"invoice": "Invoice", "supplier_name": "Text", "line_2": "Text?"})+ validate_input_names(input_specs={})++ def test_a_lone_dotted_name_names_both_remedies(self):+ """The root is not declared, so the message offers declaring it or binding the field, and no key is deletable."""+ with pytest.raises(PipeValidationError) as exc_info:+ validate_input_names(input_specs={"invoice.total": "Number"})++ error = exc_info.value+ assert error.error_type == PipeValidationErrorType.INVALID_INPUT_NAME+ assert error.variable_names == ["invoice.total"]+ assert error.redundant_input_name is None+ message = str(error)+ assert "Input 'invoice.total' is not a plain input name" in message+ assert "declare 'invoice' with its whole concept and read the field through it in the template (`$invoice.total`)" in message+ assert 'binding step (`{ from = "invoice.total", result = "total" }`)' in message++ def test_a_dotted_name_beside_its_root_is_redundant(self):+ """The root is declared in the same table, so the key is named as deletable, and the message still names the binding step."""+ with pytest.raises(PipeValidationError) as exc_info:+ validate_input_names(input_specs={"page": "Page", "page.page_view": "Image"})++ error = exc_info.value+ assert error.error_type == PipeValidationErrorType.INVALID_INPUT_NAME+ assert error.variable_names == ["page.page_view"]+ assert error.redundant_input_name == "page.page_view"+ assert error.dropped_input_marker is None+ assert error.root_input_marker is None+ message = str(error)+ assert "'page' is already declared, so delete this key" in message+ assert "Deleting 'page.page_view' drops" not in message+ assert 'binding step (`{ from = "page.page_view", result = "page_view" }`)' in message++ def test_the_redundant_name_is_reported_first(self):+ """The fixable name wins over an earlier lone one, so the fix loop can delete it before the author repairs the rest."""+ with pytest.raises(PipeValidationError) as exc_info:+ validate_input_names(input_specs={"supplier.name": "Text", "invoice": "Invoice", "invoice.total": "Number"})++ assert exc_info.value.redundant_input_name == "invoice.total"+@pytest.mark.parametrize(- "valid_input_name",+ ("input_specs", "reported_name", "dropped_input_marker", "root_input_marker"),[- "my_input",- "input_123",- "my_input_field",- "my_input.field_name",- "my_input.field_name.nested_field",- "input_1.field_2.nested_3",- "a",- "a_b",- "a.b",- "a.b.c",+ pytest.param({"data": "Text?", "data.text": "Text!"}, "data.text", "!", "?", id="forced-key-after-an-optional-root"),+ pytest.param({"data.text": "Text!", "data": "Text?"}, "data.text", None, None, id="forced-key-before-an-optional-root"),+ pytest.param({"data": "Text!", "data.text": "Text!"}, "data.text", None, None, id="equal-markers"),+ pytest.param({"items": "Item", "items.x": "Text[]"}, "items.x", "[]", "", id="list-key-after-a-single-root"),+ pytest.param({"items.x": "Text[]", "items": "Item"}, "items.x", None, None, id="list-key-before-a-single-root"),+ pytest.param({"items": "Item[]", "items.x": "Text"}, "items.x", "", "[]", id="single-key-after-a-list-root"),+ pytest.param({"data": "Text?", "data.text": "Text"}, "data.text", "", "?", id="plain-key-after-an-optional-root"),+ pytest.param({"items": "Item[]?", "items.x": "Item[]"}, "items.x", "[]", "[]?", id="presence-only-under-a-list-root"),+ pytest.param({"data": "Text", "data.text": "Text[]"}, "data.text", "[]", "", id="multiplicity-only"),+ pytest.param({"data": "Text?", "data.text": "Text[]!"}, "data.text", "[]!", "?", id="multiplicity-and-presence"),+ pytest.param({"page": "Page", "page.page_view": "Image"}, "page.page_view", None, None, id="differing-concept-only"),+ pytest.param({"data": "Text", "data.text": "Text[1]"}, "data.text", None, None, id="count-of-one-is-the-single-form"),+ pytest.param({"data": "Text?", "data.text": "Text!", "data.page": "Text?"}, "data.text", None, None, id="key-followed-under-its-root"),+ pytest.param(+ {"data": "Text?", "data.text": "Text!", "page": "Page", "page.page_view": "Image"},+ "page.page_view",+ None,+ None,+ id="safe-deletion-before-an-unsafe-one",+ ),],)- def test_validate_input_name_valid(self, valid_input_name: str):- """Test validate_input_name does not raise for valid input names."""- validate_input_name(valid_input_name) # Should not raise+ def test_a_redundant_name_carries_the_marker_its_deletion_would_drop(+ self,+ input_specs: dict[str, str],+ reported_name: str,+ dropped_input_marker: str | None,+ root_input_marker: str | None,+ ):+ """The last declaration under a root set its presence and multiplicity, so deleting a key that set them differently is flagged.++ The error carries the key's marker and its root's, so the warning can name only the part that differs.+ """+ with pytest.raises(PipeValidationError) as exc_info:+ validate_input_names(input_specs=input_specs)++ error = exc_info.value+ assert error.redundant_input_name == reported_name+ assert error.variable_names == [reported_name]+ assert error.dropped_input_marker == dropped_input_marker+ assert error.root_input_marker == root_input_marker@pytest.mark.parametrize(- "invalid_input_name",+ ("input_specs", "expected_warning"),[- "myInput",- "MyInput",- "my-input",- "my input",- "123_input",- "",- ".",- ".my_input",- "my_input.",- "my_input..field",- "my_input...field",- "..",- "...",- "my_input.fieldName",- "myInput.field_name",- "my_input.Field_name",+ pytest.param(+ {"items": "Item[]?", "items.x": "Item[]"},+ "Deleting 'items.x' drops its plain presence, where 'items' is optional (`?`): "+ "remove `?` from 'items' if the root must not be optional",+ id="presence-only-plain-key-under-an-optional-list-root",+ ),+ pytest.param(+ {"data": "Text?", "data.text": "Text"},+ "Deleting 'data.text' drops its plain presence, where 'data' is optional (`?`): "+ "remove `?` from 'data' if the root must not be optional",+ id="presence-only-plain-key-under-an-optional-root",+ ),+ pytest.param(+ {"data": "Text!", "data.text": "Text"},+ "Deleting 'data.text' drops its plain presence, where 'data' is forced (`!`): remove `!` from 'data' if the root must not be forced",+ id="presence-only-plain-key-under-a-forced-root",+ ),+ pytest.param(+ {"data": "Text", "data.text": "Text?"},+ "Deleting 'data.text' drops its optional presence (`?`), where 'data' is plain: add `?` to 'data' if the root must be optional",+ id="presence-only-optional-key-under-a-plain-root",+ ),+ pytest.param(+ {"data": "Text?", "data.text": "Text!"},+ "Deleting 'data.text' drops its forced presence (`!`), where 'data' is optional (`?`): "+ "replace `?` with `!` on 'data' if the root must be forced",+ id="presence-only-forced-key-under-an-optional-root",+ ),+ pytest.param(+ {"data": "Text", "data.text": "Text[]"},+ "Deleting 'data.text' drops its list form (`[]`), where 'data' is a single value: add `[]` to 'data' if the root must be a list",+ id="multiplicity-only-list-key-under-a-single-root",+ ),+ pytest.param(+ {"items": "Item[]", "items.x": "Text"},+ "Deleting 'items.x' drops its single-value form, where 'items' is a list (`[]`): "+ "remove `[]` from 'items' if the root must be a single value",+ id="multiplicity-only-single-key-under-a-list-root",+ ),+ pytest.param(+ {"items": "Item[]", "items.x": "Item[3]"},+ "Deleting 'items.x' drops its fixed-count form (`[3]`), where 'items' is a list (`[]`): "+ "replace `[]` with `[3]` on 'items' if the root must be a list of 3",+ id="multiplicity-only-fixed-count-key-under-a-list-root",+ ),+ pytest.param(+ {"data": "Text?", "data.text": "Text[]!"},+ "Deleting 'data.text' drops its list form (`[]`) and its forced presence (`!`), where 'data' is a single value and optional (`?`): "+ "replace `?` with `[]!` on 'data' if the root must be a list and must be forced",+ id="both-forced-list-key-under-an-optional-root",+ ),+ pytest.param(+ {"data": "Text?", "data.text": "Text[]"},+ "Deleting 'data.text' drops its list form (`[]`) and its plain presence, where 'data' is a single value and optional (`?`): "+ "replace `?` with `[]` on 'data' if the root must be a list and must not be optional",+ id="both-list-key-under-an-optional-root",+ ),],)- def test_validate_input_name_invalid(self, invalid_input_name: str):- """Test validate_input_name raises ValueError for invalid input names."""- with pytest.raises(ValueError, match="Invalid input name syntax"):- validate_input_name(invalid_input_name)-- def test_validate_input_name_error_message(self):- """Test that the error message is helpful and descriptive."""- with pytest.raises(ValueError, match="Invalid input name syntax") as exc_info:- validate_input_name("myInput.fieldName")-- error_message = str(exc_info.value)- assert "Invalid input name syntax 'myInput.fieldName'" in error_message- assert "snake_case" in error_message- assert "dots" in error_message or "nested field" in error_message.lower()+ def test_the_refusal_warns_only_of_the_part_its_deletion_would_drop(self, input_specs: dict[str, str], expected_warning: str):+ """The warning compares multiplicity and presence apart, and names and settles only the part, or the two parts, that differ."""+ with pytest.raises(PipeValidationError) as exc_info:+ validate_input_names(input_specs=input_specs)++ message = str(exc_info.value)+ assert "is already declared, so delete this key" in message+ assert f" {expected_warning}. To hand the field to this pipe under a name of its own instead" in message++ def test_the_presence_only_warning_does_not_ask_to_move_a_multiplicity_the_root_carries(self):+ """A list key under an optional list root differs only in presence, so the warning never asks to add the `[]` the root already has."""+ with pytest.raises(PipeValidationError) as exc_info:+ validate_input_names(input_specs={"items": "Item[]?", "items.x": "Item[]"})++ message = str(exc_info.value)+ assert "`[]`" not in message.split("To hand the field", maxsplit=1)[0]++ @pytest.mark.parametrize("malformed_name", ["InvoiceTotal", "2nd_total", "invoice-total", "Invoice.total", "invoice..total"])+ def test_a_malformed_name_is_refused_with_the_grammar(self, malformed_name: str):+ """A name that is not snake_case is refused with the grammar it breaks, even beside a declared root."""+ with pytest.raises(PipeValidationError) as exc_info:+ validate_input_names(input_specs={"invoice": "Invoice", malformed_name: "Number"})++ error = exc_info.value+ assert error.error_type == PipeValidationErrorType.INVALID_INPUT_NAME+ assert error.variable_names == [malformed_name]+ assert error.redundant_input_name is None+ assert f"Input '{malformed_name}' is not a valid input name" in str(error)+ assert "`[a-z][a-z0-9_]*`" in str(error)++ def test_a_plain_list_name_passes(self):+ check_input_list_name(input_list_name="pages")++ def test_a_dotted_list_name_is_refused(self):+ """A PipeBatch's list is one of its own inputs, so a dotted list name is refused, naming the binding step."""+ with pytest.raises(PipeValidationError) as exc_info:+ check_input_list_name(input_list_name="catalog.pages")++ error = exc_info.value+ assert error.error_type == PipeValidationErrorType.INVALID_INPUT_NAME+ assert error.variable_names == ["catalog.pages"]+ message = str(error)+ assert "`input_list_name` 'catalog.pages' is not a plain input name" in message+ assert '`input_list_name = "pages"`' in message+ assert '{ from = "catalog.pages", result = "pages" }' in message++ def test_a_malformed_list_name_is_refused(self):+ with pytest.raises(PipeValidationError) as exc_info:+ check_input_list_name(input_list_name="CatalogPages")++ assert exc_info.value.error_type == PipeValidationErrorType.INVALID_INPUT_NAME+ assert "is not a valid input name" in str(exc_info.value)diff --git a/tests/unit/pipelex/pipe_operators/pipe_compose/data.py b/tests/unit/pipelex/pipe_operators/pipe_compose/data.pyindex 65475898f..3d5080e5c 100644--- a/tests/unit/pipelex/pipe_operators/pipe_compose/data.py+++ b/tests/unit/pipelex/pipe_operators/pipe_compose/data.py@@ -185,19 +185,31 @@ class PipeComposeInputCheckTestCases:["place"],)- # A dotted input name alone does not supply the stuff its path is read from: the root must be declared+ # An input name is a plain name: a dotted one is refused by the shared input-name check, before the template is readREFUSED_TEMPLATE_LONE_DOTTED_INPUT: ClassVar[tuple[str, dict[str, Any], PipeValidationErrorType, list[str]]] = ("template_lone_dotted_input",{"description": "d", "inputs": {"deal.amount": "Number"}, "output": "Text", "template": "Worth $deal.amount"},- PipeValidationErrorType.MISSING_INPUT_VARIABLE,- ["deal"],+ PipeValidationErrorType.INVALID_INPUT_NAME,+ ["deal.amount"],)REFUSED_CONSTRUCT_LONE_DOTTED_INPUT: ClassVar[tuple[str, dict[str, Any], PipeValidationErrorType, list[str]]] = ("construct_lone_dotted_input",{"description": "d", "inputs": {"page.page_view": "Image"}, "output": "Summary", "construct": {"view": {"from": "page.page_view"}}},- PipeValidationErrorType.MISSING_INPUT_VARIABLE,- ["page"],+ PipeValidationErrorType.INVALID_INPUT_NAME,+ ["page.page_view"],+ )++ REFUSED_CONSTRUCT_DOTTED_INPUT_BESIDE_ITS_ROOT: ClassVar[tuple[str, dict[str, Any], PipeValidationErrorType, list[str]]] = (+ "construct_dotted_input_beside_its_root",+ {+ "description": "d",+ "inputs": {"page": "Page", "page.page_view": "Image"},+ "output": "Summary",+ "construct": {"view": {"from": "page.page_view"}, "text": {"from": "page.text_and_images"}},+ },+ PipeValidationErrorType.INVALID_INPUT_NAME,+ ["page.page_view"],)REFUSED_CASES: ClassVar[list[tuple[str, dict[str, Any], PipeValidationErrorType, list[str]]]] = [@@ -211,6 +223,7 @@ class PipeComposeInputCheckTestCases:REFUSED_CONSTRUCT_UNDECLARED_NESTED_TEMPLATE,REFUSED_TEMPLATE_LONE_DOTTED_INPUT,REFUSED_CONSTRUCT_LONE_DOTTED_INPUT,+ REFUSED_CONSTRUCT_DOTTED_INPUT_BESIDE_ITS_ROOT,]ACCEPTED_CASES: ClassVar[list[tuple[str, dict[str, Any]]]] = [@@ -241,10 +254,10 @@ class PipeComposeInputCheckTestCases:},),(- "construct_dotted_input_name",+ "construct_from_paths_through_the_root",{"description": "d",- "inputs": {"page": "Page", "page.page_view": "Image"},+ "inputs": {"page": "Page"},"output": "Summary","construct": {"view": {"from": "page.page_view"}, "text": {"from": "page.text_and_images"}},},diff --git a/tests/unit/pipelex/pipe_operators/pipe_img_gen/data.py b/tests/unit/pipelex/pipe_operators/pipe_img_gen/data.pyindex 724e5baa8..bd86bdc1c 100644--- a/tests/unit/pipelex/pipe_operators/pipe_img_gen/data.py+++ b/tests/unit/pipelex/pipe_operators/pipe_img_gen/data.py@@ -161,12 +161,12 @@ class PipeImgGenInputCheckTestCases:["avoid"],)- # A dotted input name alone does not supply the stuff its path is read from: the root must be declared+ # An input name is a plain name: a dotted one is refused by the shared input-name check, before the template is readREFUSED_LONE_DOTTED_INPUT: ClassVar[tuple[str, dict[str, Any], PipeValidationErrorType, list[str]]] = ("lone_dotted_input",{"description": "d", "inputs": {"scene.subject": "Text"}, "output": "Image", "prompt": "Sketch of $scene.subject"},- PipeValidationErrorType.MISSING_INPUT_VARIABLE,- ["scene"],+ PipeValidationErrorType.INVALID_INPUT_NAME,+ ["scene.subject"],)REFUSED_CASES: ClassVar[list[tuple[str, dict[str, Any], PipeValidationErrorType, list[str]]]] = [diff --git a/tests/unit/pipelex/pipe_operators/pipe_judge/data.py b/tests/unit/pipelex/pipe_operators/pipe_judge/data.pyindex 94e4993f0..9f4ec101d 100644--- a/tests/unit/pipelex/pipe_operators/pipe_judge/data.py+++ b/tests/unit/pipelex/pipe_operators/pipe_judge/data.py@@ -17,7 +17,7 @@ class PipeJudgeBlueprintTestCases:("both_spellings", _judge(prompt="Is it urgent?"), "sets `question`, or `prompt` as its synonym, but not both"),("empty_question", _judge(question=""), "`question` cannot be empty"),("blank_question", _judge(question=" \n "), "`question` cannot be empty"),- ("dotted_input", _judge(inputs={"invoice.total": "Number"}), "input 'invoice.total' cannot name a field"),+ ("dotted_input", _judge(inputs={"invoice.total": "Number"}), "Input 'invoice.total' is not a plain input name"),("options_and_levels", _judge(output="Choice", options={"a": "", "b": ""}, levels=["low", "high"]), "not both"),("criteria_beside_options",diff --git a/tests/unit/pipelex/pipe_operators/pipe_llm/test_pipe_llm_blueprint.py b/tests/unit/pipelex/pipe_operators/pipe_llm/test_pipe_llm_blueprint.pyindex f76aefb0e..d7243717a 100644--- a/tests/unit/pipelex/pipe_operators/pipe_llm/test_pipe_llm_blueprint.py+++ b/tests/unit/pipelex/pipe_operators/pipe_llm/test_pipe_llm_blueprint.py@@ -131,39 +131,45 @@ class TestPipeLLMBlueprint:assert error.variable_names == ["aaa", "bbb"]assert "Reference them in the prompt or system_prompt" in str(error)- def test_validate_inputs_correct_with_dotted_input_name(self):- """A dotted input name is read by the path it names, and its root input by another path."""+ def test_validate_inputs_correct_reading_fields_through_the_root(self):+ """Every template form reads a field through the root it names, with only the root declared."""blueprint = PipeLLMBlueprint(description="lorem ipsum",- inputs={"page": "Page", "page.page_view": "native.Image"},+ inputs={"page": "Page"},output="native.Text",- prompt="Describe:\[email protected]_view\n\nText: $page.text_and_images.text.text",+ prompt="Describe:\[email protected]_view\n\nText: $page.text_and_images.text.text\nStored at {{ page.page_view.url }}",)- assert set(blueprint.input_names) == {"page", "page.page_view"}+ assert blueprint.input_names == ["page"]- def test_validate_inputs_correct_with_lone_dotted_input_name(self):- """PipeLLM resolves a dotted input name as that attribute of the stuff, so it needs no root input beside it."""- blueprint = PipeLLMBlueprint(- description="lorem ipsum",- inputs={"page.page_view": "native.Image"},- output="native.Text",- prompt="Describe $page.page_view",+ def test_validate_inputs_refuses_a_lone_dotted_input_name(self):+ """An input name is a plain name, so a dotted one is refused before the prompt is read, naming both remedies."""+ error = refused_input_error(+ blueprint_class=PipeLLMBlueprint,+ blueprint_kwargs={+ "description": "lorem ipsum",+ "inputs": {"page.page_view": "native.Image"},+ "output": "native.Text",+ "prompt": "Describe:\[email protected]_view",+ },)- assert set(blueprint.input_names) == {"page.page_view"}+ assert error.error_type == PipeValidationErrorType.INVALID_INPUT_NAME+ assert error.variable_names == ["page.page_view"]+ assert error.redundant_input_name is None- def test_validate_inputs_incorrect_read_beside_lone_dotted_input_name(self):- """A dotted input name supplies its own path only, not the other attributes of its root."""+ def test_validate_inputs_refuses_a_dotted_input_name_beside_its_root(self):+ """The root declared beside the dotted key makes the key redundant, which the error names for the fix planner."""error = refused_input_error(blueprint_class=PipeLLMBlueprint,blueprint_kwargs={"description": "lorem ipsum",- "inputs": {"page.page_view": "native.Image"},+ "inputs": {"page.page_view": "native.Image", "page": "Page"},"output": "native.Text",- "prompt": "Describe $page.page_view in the light of $page.title",+ "prompt": "Describe:\[email protected]_view",},)- assert error.error_type == PipeValidationErrorType.MISSING_INPUT_VARIABLE- assert error.variable_names == ["page"]+ assert error.error_type == PipeValidationErrorType.INVALID_INPUT_NAME+ assert error.variable_names == ["page.page_view"]+ assert error.redundant_input_name == "page.page_view"def test_validate_inputs_correct_with_attribute_after_subscript(self):"""An input read only through a subscript followed by an attribute counts as read."""diff --git a/tests/unit/pipelex/pipe_operators/pipe_search/data.py b/tests/unit/pipelex/pipe_operators/pipe_search/data.pyindex dec8e5df1..f6a430ae6 100644--- a/tests/unit/pipelex/pipe_operators/pipe_search/data.py+++ b/tests/unit/pipelex/pipe_operators/pipe_search/data.py@@ -31,12 +31,12 @@ class PipeSearchInputCheckTestCases:["other"],)- # A dotted input name alone does not supply the stuff its path is read from: the root must be declared+ # An input name is a plain name: a dotted one is refused by the shared input-name check, before the template is readREFUSED_LONE_DOTTED_INPUT: ClassVar[tuple[str, dict[str, Any], PipeValidationErrorType, list[str]]] = ("lone_dotted_input",{"description": "d", "inputs": {"company.name": "Text"}, "output": "SearchResult", "prompt": "News on $company.name"},- PipeValidationErrorType.MISSING_INPUT_VARIABLE,- ["company"],+ PipeValidationErrorType.INVALID_INPUT_NAME,+ ["company.name"],)REFUSED_CASES: ClassVar[list[tuple[str, dict[str, Any], PipeValidationErrorType, list[str]]]] = [diff --git a/tests/unit/pipelex/pipeline/fixes/test_blueprint_fix_planner.py b/tests/unit/pipelex/pipeline/fixes/test_blueprint_fix_planner.pyindex b4d3a3ca3..46fc18ef2 100644--- a/tests/unit/pipelex/pipeline/fixes/test_blueprint_fix_planner.py+++ b/tests/unit/pipelex/pipeline/fixes/test_blueprint_fix_planner.py@@ -8,9 +8,13 @@ structurally. ``DELETE_KEY`` on ``["concept"]`` covers every authoring form (taball normalize to a ``concept.<Code>`` key)."""+import pytest+from pipelex.core.exceptions import PipelexBundleBlueprintValidationErrorData+from pipelex.mthds_parsing.exceptions import MthdsParserError+from pipelex.mthds_parsing.parser import MthdsParserfrom pipelex.pipeline.fixes.planner import plan_fix_for_blueprint_validation_error-from pipelex.suggested_fix import DeleteKeyOp, FixSafety, RenameTableKeyOp, SetKeyOp+from pipelex.suggested_fix import DeleteKeyOp, FixSafety, RenameTableKeyOp, SetKeyOp, SuggestedFixfrom pipelex.validation_error_types import PipeValidationErrorType@@ -45,6 +49,56 @@ def _strip_namespace_error_data()+def _invalid_input_name_error_data(+ *,+ variable_name: str,+ redundant_input_name: str | None,+ pipe_code: str | None = "describe_page",+ dropped_input_marker: str | None = None,+ root_input_marker: str | None = None,+) -> PipelexBundleBlueprintValidationErrorData:+ return PipelexBundleBlueprintValidationErrorData(+ error_type=PipeValidationErrorType.INVALID_INPUT_NAME,+ domain_code="catalog_review",+ source="main.mthds",+ pipe_code=pipe_code,+ variable_names=[variable_name],+ redundant_input_name=redundant_input_name,+ dropped_input_marker=dropped_input_marker,+ root_input_marker=root_input_marker,+ message=f"Input '{variable_name}' is not a plain input name.",+ )+++_REDUNDANT_INPUT_BUNDLE_HEADER = """domain = "dotted_safety"+description = "Inputs declared once by their root and again by a dotted path into it"++[concept]+Item = "An item of an order"++[pipe.read_input]+type = "PipeLLM"+description = "Reads a field of its input"+output = "Text"+"""+++def _fix_planned_from_inputs(input_specs: list[tuple[str, str]]) -> SuggestedFix:+ """The fix planned for a bundle whose one pipe declares these inputs, in this order, through the parser and its categorizer."""+ inputs_line = ", ".join(f'"{input_name}" = "{input_spec}"' for input_name, input_spec in input_specs)+ dotted_name = next(input_name for input_name, _ in input_specs if "." in input_name)+ mthds_content = f'{_REDUNDANT_INPUT_BUNDLE_HEADER}inputs = {{ {inputs_line} }}\nprompt = "Read ${dotted_name}"\n'+ with pytest.raises(MthdsParserError) as exc_info:+ MthdsParser.make_pipelex_bundle_blueprint(mthds_content=mthds_content, mthds_source="main.mthds")+ errors = exc_info.value.validation_errors+ assert len(errors) == 1, f"Expected exactly one error, got {[(error.error_type, error.message) for error in errors]}"+ assert errors[0].error_type == PipeValidationErrorType.INVALID_INPUT_NAME+ fix = plan_fix_for_blueprint_validation_error(errors[0])+ assert fix is not None+ assert fix.fix_code == "delete-redundant-dotted-input"+ return fix++class TestBlueprintFixPlanner:def test_native_redeclaration_yields_strip_fix(self) -> None:"""An enriched native-redeclaration error yields a SAFE delete_key of the concept."""@@ -117,3 +171,218 @@ class TestBlueprintFixPlanner:fix = plan_fix_for_blueprint_validation_error(error_data)assert fix is not Noneassert fix.source == "sibling.mthds"++ def test_redundant_dotted_input_yields_a_safe_delete_of_the_key(self) -> None:+ """A dotted input whose root the same table declares is deleted from that pipe's `inputs`, safely."""+ fix = plan_fix_for_blueprint_validation_error(+ _invalid_input_name_error_data(variable_name="page.page_view", redundant_input_name="page.page_view")+ )+ assert fix is not None+ assert fix.fix_code == "delete-redundant-dotted-input"+ assert fix.safety == FixSafety.SAFE+ assert fix.source == "main.mthds"+ assert fix.ops == [DeleteKeyOp(table_path=["pipe", "describe_page", "inputs"], key="page.page_view")]+ assert "page.page_view" in fix.description++ def test_lone_dotted_input_yields_none(self) -> None:+ """A lone dotted input carries no enrichment, since nothing says its root's concept: the author repairs it."""+ assert (+ plan_fix_for_blueprint_validation_error(_invalid_input_name_error_data(variable_name="page.page_view", redundant_input_name=None)) is None+ )++ def test_malformed_input_name_yields_none(self) -> None:+ """A malformed name is never deleted: its repair is a rename only the author can choose."""+ assert (+ plan_fix_for_blueprint_validation_error(_invalid_input_name_error_data(variable_name="InvoiceTotal", redundant_input_name=None)) is None+ )++ def test_redundant_dotted_input_without_its_pipe_yields_none(self) -> None:+ """Without the pipe the key lives in there is no table to delete it from."""+ error_data = _invalid_input_name_error_data(variable_name="page.page_view", redundant_input_name="page.page_view", pipe_code=None)+ assert plan_fix_for_blueprint_validation_error(error_data) is None++ @pytest.mark.parametrize(+ ("dropped_input_marker", "root_input_marker", "expected_warning"),+ [+ pytest.param(+ "[]",+ "[]?",+ "Deleting 'data.text' drops its plain presence, where 'data' is optional (`?`): "+ "remove `?` from 'data' if the root must not be optional",+ id="presence-only",+ ),+ pytest.param(+ "[]",+ "",+ "Deleting 'data.text' drops its list form (`[]`), where 'data' is a single value: add `[]` to 'data' if the root must be a list",+ id="multiplicity-only",+ ),+ pytest.param(+ "[]!",+ "?",+ "Deleting 'data.text' drops its list form (`[]`) and its forced presence (`!`), where 'data' is a single value and optional (`?`): "+ "replace `?` with `[]!` on 'data' if the root must be a list and must be forced",+ id="multiplicity-and-presence",+ ),+ pytest.param(+ "!",+ "?",+ "Deleting 'data.text' drops its forced presence (`!`), where 'data' is optional (`?`): "+ "replace `?` with `!` on 'data' if the root must be forced",+ id="forced-key-under-an-optional-root",+ ),+ pytest.param(+ "",+ "?",+ "Deleting 'data.text' drops its plain presence, where 'data' is optional (`?`): "+ "remove `?` from 'data' if the root must not be optional",+ id="plain-key-under-an-optional-root",+ ),+ ],+ )+ def test_redundant_dotted_input_dropping_a_marker_yields_an_unsafe_delete_naming_only_what_differs(+ self,+ dropped_input_marker: str,+ root_input_marker: str,+ expected_warning: str,+ ) -> None:+ """A deletion that would change the root's contract is offered as UNSAFE, naming only what differs and how to settle it on the root."""+ fix = plan_fix_for_blueprint_validation_error(+ _invalid_input_name_error_data(+ variable_name="data.text",+ redundant_input_name="data.text",+ dropped_input_marker=dropped_input_marker,+ root_input_marker=root_input_marker,+ )+ )+ assert fix is not None+ assert fix.fix_code == "delete-redundant-dotted-input"+ assert fix.safety == FixSafety.UNSAFE+ assert fix.ops == [DeleteKeyOp(table_path=["pipe", "describe_page", "inputs"], key="data.text")]+ assert fix.description == (+ "Delete the dotted input 'data.text' of pipe 'describe_page': its root is declared beside it, and a template reads the field "+ f"through the root. {expected_warning}"+ )++ def test_redundant_dotted_input_with_a_dropped_marker_but_no_root_marker_yields_none(self) -> None:+ """The two markers are set together; without the root's, the warning cannot say what differs, so no fix is offered rather than a SAFE one."""+ error_data = _invalid_input_name_error_data(variable_name="data.text", redundant_input_name="data.text", dropped_input_marker="!")+ assert plan_fix_for_blueprint_validation_error(error_data) is None++ @pytest.mark.parametrize(+ ("input_specs", "expected_safety", "deleted_key", "description_fragment"),+ [+ pytest.param(+ [("data", "Text?"), ("data.text", "Text!")],+ FixSafety.UNSAFE,+ "data.text",+ "drops its forced presence (`!`), where 'data' is optional (`?`): replace `?` with `!` on 'data' if the root must be forced",+ id="key-forcing-an-optional-root-declared-after-it",+ ),+ pytest.param(+ [("data.text", "Text!"), ("data", "Text?")],+ FixSafety.SAFE,+ "data.text",+ None,+ id="key-forcing-an-optional-root-declared-before-it",+ ),+ pytest.param(+ [("data", "Text!"), ("data.text", "Text!")],+ FixSafety.SAFE,+ "data.text",+ None,+ id="equal-markers",+ ),+ pytest.param(+ [("items", "Item"), ("items.x", "Text[]")],+ FixSafety.UNSAFE,+ "items.x",+ "drops its list form (`[]`), where 'items' is a single value: add `[]` to 'items' if the root must be a list",+ id="list-key-declared-after-its-single-root",+ ),+ pytest.param(+ [("items.x", "Text[]"), ("items", "Item")],+ FixSafety.SAFE,+ "items.x",+ None,+ id="list-key-declared-before-its-single-root",+ ),+ pytest.param(+ [("data", "Text?"), ("data.text", "Text")],+ FixSafety.UNSAFE,+ "data.text",+ "drops its plain presence, where 'data' is optional (`?`): remove `?` from 'data' if the root must not be optional",+ id="plain-key-declared-after-its-optional-root",+ ),+ pytest.param(+ [("data", "Text"), ("data.text", "Text[]")],+ FixSafety.UNSAFE,+ "data.text",+ "drops its list form (`[]`), where 'data' is a single value: add `[]` to 'data' if the root must be a list",+ id="multiplicity-only-list-key-declared-after-its-single-root",+ ),+ pytest.param(+ [("data", "Text?"), ("data.text", "Text[]")],+ FixSafety.UNSAFE,+ "data.text",+ "drops its list form (`[]`) and its plain presence, where 'data' is a single value and optional (`?`): "+ "replace `?` with `[]` on 'data' if the root must be a list and must not be optional",+ id="list-key-declared-after-its-optional-single-root",+ ),+ pytest.param(+ [("page", "Page"), ("page.page_view", "Image")],+ FixSafety.SAFE,+ "page.page_view",+ None,+ id="differing-concept-root-first",+ ),+ pytest.param(+ [("page.page_view", "Image"), ("page", "Page")],+ FixSafety.SAFE,+ "page.page_view",+ None,+ id="differing-concept-root-last",+ ),+ pytest.param(+ [("data", "Text"), ("data.text", "Text[1]")],+ FixSafety.SAFE,+ "data.text",+ None,+ id="count-of-one-is-the-single-form",+ ),+ pytest.param(+ [("data", "Text?"), ("data.text", "Text!"), ("data.page", "Text?")],+ FixSafety.SAFE,+ "data.text",+ None,+ id="key-followed-by-another-under-its-root",+ ),+ pytest.param(+ [("data", "Text?"), ("data.text", "Text!"), ("page", "Page"), ("page.page_view", "Image")],+ FixSafety.SAFE,+ "page.page_view",+ None,+ id="safe-deletion-reported-before-an-unsafe-one",+ ),+ ],+ )+ def test_redundant_dotted_input_is_safe_to_delete_only_when_the_roots_contract_holds(+ self,+ input_specs: list[tuple[str, str]],+ expected_safety: FixSafety,+ deleted_key: str,+ description_fragment: str | None,+ ) -> None:+ """Deleting a dotted key beside its root is SAFE only when the root keeps the presence marker and multiplicity it had.++ Before dotted names were refused, every declaration under a root was folded onto that root in declaration order, so+ the last one set the root's presence marker and multiplicity. The concepts never decide: a field's concept differs+ from its root's by nature. With several keys under one root the table is read in order, and a SAFE deletion is+ reported before an UNSAFE one so the fix loop makes progress first.+ """+ fix = _fix_planned_from_inputs(input_specs)++ assert fix.safety == expected_safety+ assert fix.ops == [DeleteKeyOp(table_path=["pipe", "read_input", "inputs"], key=deleted_key)]+ if description_fragment is not None:+ assert description_fragment in fix.description