fix(workflows): escape the literal bracket in workflow resolve layer output - #3882
Open
jawwad-ali wants to merge 1 commit into
Open
fix(workflows): escape the literal bracket in workflow resolve layer output#3882jawwad-ali wants to merge 1 commit into
workflow resolve layer output#3882jawwad-ali wants to merge 1 commit into
Conversation
`workflow_resolve` printed each layer as
f" • [{layer.tier}] {layer.source} (priority={priority})"
Rich parses `[base]` and `[project-overlay]` as style tags, so the tier
column was silently swallowed on every run:
BEFORE: '* .specify/workflows/wf/workflow.yml (priority=n/a)'
AFTER : '* [base] .specify/workflows/wf/workflow.yml (priority=n/a)'
The tier is one of the two things the command exists to report, and the
JSON payload still carried it correctly — only the human-readable output
lost it.
The existing test asserts `"base" in result.output`, which passes anyway
because the step-attribution section prints the same word as a source, so
the missing column was masked.
Escape the literal bracket with `\[`, matching presets/_commands.py:378,
and escape the user-controlled layer sources and step ids while there.
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.
Problem
workflow_resolveinsrc/specify_cli/workflows/overlays/_commands.pyprints each layer like this:f" • [{layer.tier}] {layer.source} (priority={priority})"Rich parses
[base]and[project-overlay]as style tags, so the tier column is silently swallowed — on every single run, not just for odd input.Reproduction on current
main(81bf741)Note the double space in the BEFORE lines — that is where the tier used to be. The layer's tier is one of the two things
workflow resolveexists to tell you (which layer, at what precedence), so the human-readable output is missing half its answer. The--jsonpayload carriestiercorrectly; only the printed form loses it.Why the existing test didn't catch it
test_workflow_resolveasserts:That passes with the bug, because the step-attribution section prints the same word as a step source. The tier has to be asserted in bracket form, on the layers line itself — which is what the new test does.
Fix
Escape the literal bracket with
\[, exactly aspresets/_commands.py:378already does:I also escaped the interpolated values in the same output block —
layer.sourceis a filesystem path andcomposed.step_id/composed.sourceare user-authored ids, all of which can contain brackets and would break the same lines. That keeps the whole of this one command's output correct rather than fixing half of it.No breaking change.
rich.markup.escapeis a no-op on bracket-free values, and the--jsonpayload is untouched. The only difference is that output which previously lost characters now shows them.Verification
srcand passes with the fix. File: 1 failed → 21 passed.tests/workflows: failure set identical to the clean-mainbaseline captured on81bf741(10 pre-existing in scope, all Windows symlink-privilege).uvx ruff@0.15.0 check src tests→ cleanWritten with assistance from Claude Code. Bug found, reproduced, and verified by me on current
main.