fix(projects): name the corrected spec.workflow.file in both missing-workflow errors - #51
Merged
Merged
Conversation
…workflow errors bd 6ns.6, a follow-up from 6ns.2 part 2b. Two call sites report a spec.workflow.file that names no file, and they disagreed. load_project said where the declaration is and the expected form, but never named the corrected declaration. `gridalyn project validate` said only "workflow file does not exist: <path>": no project.yaml, no key, no remedy, against the repo's located-and-remediating error convention. - loader.build_missing_workflow_message builds one message for both call sites: the project.yaml, the key, the path tried and the expected form. When the declaration repeats the project directory -- the repository-relative form a pathBase: repo study wrote before 6ns.2 -- and the corrected file exists, it also says "declare 'workflow.yaml'". It lives in the loader because it uses the loader's field hints; path_contract cannot import the loader without a cycle. - The correction comes from the path gate's own derivation, now public as path_contract.build_corrected_declaration (formerly the private _suggest), rather than a second copy. build_* is the documented verb for a deterministic in-memory construction. - validation._read_workflow_data takes the project.yaml path and checks is_file(), matching the loader. - docs/reference/workflow-yaml.md's 2026-09-11 note says what the error names and that validate reports the same message; one ledger line re-derived. Tests: a stale repo-relative declaration names the correction; validate's error is identical to load_project's; no correction is named when none can be derived or the corrected file is absent. Against unchanged main, the first two fail and the guards pass. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
build_corrected_declaration had been appended at the end; it belongs between PathContractViolation and find_path_contract_violations. Review feedback. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bd 6ns.6, a follow-up from 6ns.2 part 2b. A
spec.workflow.filethat names no file is reported in two places. They now report the same located, remediating message, and it names the corrected declaration when one can be derived.Before
load_projectgave the project file, the key, the path it tried and the expected form, but never the fix.gridalyn project validategave onlyworkflow file does not exist: <path>.After (both)
<project.yaml>: spec.workflow.file names 'projects/my_case/workflow.yaml', which does not exist at <path> -- expected a path to the Workflow YAML, relative to the project directory whatever spec.pathBase says, e.g. file: workflow.yaml; declare 'workflow.yaml'Changes
loader.build_missing_workflow_messageis shared by both call sites. The correction is appended only when the declaration repeatsprojects/<study>/, the pre-6ns.2 form of apathBase: repostudy, and the corrected file exists. The builder lives in the loader because it uses the loader's field hints;path_contractcannot import the loader without a cycle.path_contract.build_corrected_declarationwas the private_suggest, now public so the loader reuses the path gate's derivation instead of copying it.build_*is the documented verb for a deterministic in-memory construction, agreed with the module's author.validation._read_workflow_datatakes theproject.yamlpath and checksis_file(), as the loader does.docs/reference/workflow-yaml.md: the 2026-09-11 note now says the error names the corrected declaration and thatvalidatereports the same message. One ledgerlinewas re-derived through the tool.Verification
tests/test_project_error_messages.py. Against unchanged main, the two new behaviours fail as they should: the named correction, and validate's message equalling the loader's. The two guards against over-suggesting pass.🤖 Generated with Claude Code