Skip to content

[pr-schema-gate fixes](1) A quoted argument spanning lines is one word - #396

Merged
mergify[bot] merged 1 commit into
mainfrom
fix/pr-schema-gate-multiline-quotes
Sep 11, 2026
Merged

[pr-schema-gate fixes](1) A quoted argument spanning lines is one word#396
mergify[bot] merged 1 commit into
mainfrom
fix/pr-schema-gate-multiline-quotes

Conversation

@EdbertChan

@EdbertChan EdbertChan commented Sep 11, 2026

Copy link
Copy Markdown
Owner

Summary

pr-schema-gate no longer says "could not parse" on an ordinary multi-line commit message.

The parser read each line on its own, so a quoted argument spanning lines, like a git commit -m with a body and trailers, looked like an unclosed quote. Now a line that leaves a quote open joins the next lines until the quote closes.

Before and After

The real command that drew the false warning (a heredoc, then git commit -q -am "<subject>\n\n<trailer>", then git log), run through the hook from an Invoker checkout, on main and on this branch:

Before: exit=0 pr-schema-gate: could not parse this shell command, so any PR text it writes was not checked against the repo's PR style
After:  exit=0 (no output)

Review Claim

A quoted argument that spans lines is parsed as one word; only a quote that never closes is reported as unparseable.

Review Lane

behavior

Review Unit

engine-runtime

Safety Invariant

Only quoted text spanning lines changes, from "could not parse" to parsed. A quote that never closes is still reported, and the hook never blocks.

Slice Rationale

One parser change plus its test file. The separate gh api repo-scope fix is the next PR.

Non-goals

  • No change to which commands count as PR text writes.
  • No change to the validator call or the stack reminder.

Test Plan

Test Plan
  • python3 -m unittest discover -s engine/hooks/pr-schema-gate/tests -p 'test_multiline_quotes.py' before the fix: FAILED (failures=2, errors=1); after: all pr-schema-gate tests OK
  • Real payload through the hook on main and on this branch (Before and After above)
  • python3 engine/skills/make-pr/scripts/preflight.py --base origin/mainok preflight passed
  • Every .github/workflows/ci.yml step at the stack tip: all 14 exit 0 (run_all_tests.shOK)

Revert Plan

Revert Plan
  • Safe to revert? Yes
  • Revert command: git revert <sha>, then ./install.sh
  • Post-revert steps: None
  • Data migration? No

🤖 Generated with Claude Code

https://claude.ai/code/session_01WSVNdBBo7dFqoR8Tx521EJ


Note

Low Risk
Parser-only change in a non-blocking hook; behavior tightens false unparseable warnings without altering validation or command blocking.

Overview
Fixes false “could not parse” advisories in pr-schema-gate when a shell command includes a quoted argument that spans multiple lines (e.g. git commit -am "subject\n\ntrailers").

shell_model.py no longer tokenizes each logical line in isolation. If shlex reports an incomplete quote, lines are accumulated until the quote closes, so the multiline string stays a single argv word. parse_commands still returns None when a quote never closes.

Docs in README.md describe the new rule. test_multiline_quotes.py covers the real heredoc + multiline commit payload, single-quoted multiline args, unclosed quotes, and hook silence in scope.

Reviewed by Cursor Bugbot for commit e06b578. Bugbot is set up for automated code reviews on this repo. Configure here.

The parser lexed each line alone, so a multi-line quoted argument (a
`git commit -m` with a body and trailers) looked like an unclosed quote and
the hook reported "could not parse" on an ordinary commit. A line that
leaves a quote open now joins the following lines until the quote closes;
only a quote that never closes stays unparseable. Only the lexer's own
incomplete-input errors mean "keep reading"; anything else propagates.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WSVNdBBo7dFqoR8Tx521EJ
@cursor

cursor Bot commented Sep 11, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_8a3b7127-6f6e-46f0-aa3b-5560f94f9ba0)

@mergify

mergify Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Queued — the merge queue status continues in this comment ↓.

@EdbertChan

Copy link
Copy Markdown
Owner Author

@Mergifyio queue

@mergify

mergify Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 5 minutes 8 seconds in the queue, including 3 minutes 36 seconds running CI.

Required conditions to merge
  • check-success = lint
  • check-success = test

@mergify mergify Bot added the queued label Sep 11, 2026
@mergify
mergify Bot merged commit 745c393 into main Sep 11, 2026
4 checks passed
@mergify mergify Bot removed the queued label Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants