Skip to content

fix(projects): name the corrected spec.workflow.file in both missing-workflow errors - #51

Merged
nilsonfh merged 2 commits into
mainfrom
fix/name-the-corrected-workflow-file
Sep 16, 2026
Merged

nilsonfh merged 2 commits into
mainfrom
fix/name-the-corrected-workflow-file

Conversation

@nilsonfh

Copy link
Copy Markdown
Contributor

Summary

bd 6ns.6, a follow-up from 6ns.2 part 2b. A spec.workflow.file that 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_project gave the project file, the key, the path it tried and the expected form, but never the fix.
  • gridalyn project validate gave only workflow 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_message is shared by both call sites. The correction is appended only when the declaration repeats projects/<study>/, the pre-6ns.2 form of a pathBase: repo study, and the corrected file exists. The builder lives in the loader because it uses the loader's field hints; path_contract cannot import the loader without a cycle.
  • path_contract.build_corrected_declaration was 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_data takes the project.yaml path and checks is_file(), as the loader does.
  • docs/reference/workflow-yaml.md: the 2026-09-11 note now says the error names the corrected declaration and that validate reports the same message. One ledger line was re-derived through the tool.

Verification

  • Tests: four tests in 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.
  • Targeted tests: 98 passed across 8 files: error messages, path contract, workflow, sense checks, import hygiene, layer direction, doc instructions, verb-prefix conventions.
  • mypy: the three ratchets, run as the pre-push hook runs them, stay at 116/116, 846/846, 12/12.
  • Lint and ledger: pinned black/isort/flake8 clean; doc instruction ledger OK.
  • Full suite: runs in this PR's CI. It is not run locally while a long flagship run occupies this machine.
  • Review: requested from the path-contract module's author, who agreed the public name.

🤖 Generated with Claude Code

nilsonfh and others added 2 commits September 15, 2026 20:49
…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>
@nilsonfh
nilsonfh merged commit 3c80b88 into main Sep 16, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant