Fail plan/model/parse on parse errors and surface their diagnostics - #81
Merged
Conversation
plan/model/parse shared run_single_file, which serialised a view of the parsed module and hard-coded exit 0, discarding parse diagnostics. As the parser is error-tolerant, a spec that does not parse yielded a partial module and, for plan, an empty obligation set indistinguishable from a valid spec with none. Route every single-file command through single_file_exit: exit non-zero on an error-severity diagnostic and merge a `diagnostics` array (mirroring check) into the JSON output. Warnings and info do not fail the run, so a valid spec still exits 0. Add cli_smoke regression tests across the family and a behaviour spec for the shared contract. Fixes #80
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.
Fixes #80.
Problem
allium planreturned{"obligations": [], "version": 3}and exit 0 for a spec that does not parse. A consumer could not tell "valid spec with no obligations" from "unparseable garbage".Root cause:
plan,modelandparsesharerun_single_file, which serialised a view of the parsed module and hard-codedExitCode::SUCCESS, never touchingresult.diagnostics. Because the parser is error-tolerant (a failed parse still yields a partial module plus diagnostics rather than failing outright), a broken spec produced a well-formed-but-empty result that read as success. The information existed; the single-file path just never wired it to the output or the exit code.Fix
Every single-file command now routes through a shared
single_file_exit:diagnosticsarray into the JSON output, mirroringcheck(issue resolution 2).checkfails on warnings,planshould not.Help text for all three commands documents the behaviour (issue resolution 3).
Verification (issue matrix)
[]Prevention
cli_smokeregression tests iterate overplan/model/parse, covering the whole family rather than the single reported command.docs/project/specs/allium-single-file-tool-behaviour.alliumstates the contract in Allium, alongside the existingcheck/analysespecs.Version bump follows separately on
mainafter merge.