Skip to content

Detect Compose Block Scalar Openers Through the YAML Lexer in the Prose Gate - #3721

Merged
ptr727 merged 4 commits into
developfrom
feature/burndown-compose-hash-key
Oct 31, 2026
Merged

ptr727 merged 4 commits into
developfrom
feature/burndown-compose-hash-key

Conversation

@ptr727

@ptr727 ptr727 commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Closes on promotion: #3717

Fixes a finding raised on promotion #3715.

The prose gate's Compose reader missed a block scalar opened by a valid mapping key containing # (for example x-a#b: |, or a quoted key such as "x #b": |), so mount-shaped text inside it was read as a volume entry and the home-path rule skipped it. container_paths now finds block scalar openers through the existing pygments YAML tokenization, reusing Starts, and the hand-written BLOCK_SCALAR regex is removed. Tests cover a key with #, a trailing comment after the indicator, and quoted keys.

🤖 Generated with Claude Code

ptr727 and others added 3 commits October 31, 2026 10:33
…calar in the Prose Gate

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…se Gate

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings October 31, 2026 17:47
@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@ptr727

ptr727 commented Oct 31, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 3cd90445188953aacd6f813e9f220435883f44d5, the content this pull request carries at that commit against develop, and it recorded 0 findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An active nit remains in prose_lint.py because the unexplained type-checker suppression violates the stated Python style contract.

1 open issue
What changed in this PR

This pull request fixes Compose block-scalar detection in the prose gate, including scalars opened by mapping keys containing #.

Changes:

  • Replaces the handwritten block-scalar regex with Pygments YAML tokenization.
  • Preserves correct Compose path scanning across scalar content.
  • Adds regression coverage for hash-containing keys, quoted keys, modifiers, and trailing comments.
  • Includes one minor style nit regarding an unexplained type-checker suppression.

This pull request is ready to be approved.

File Summary
.github/​actions/​prose-gate/​prose_lint.py Detects Compose block-scalar openers through YAML lexer tokens and uses them when scanning container paths.
tests/​test_prose_lint.py Adds regression coverage for hash-containing and quoted mapping keys, scalar modifiers, and trailing comments.

Review effort: Lite

@codecov

codecov Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.02%. Comparing base (27870ae) to head (f24fba5).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3721   +/-   ##
========================================
  Coverage    82.02%   82.02%           
========================================
  Files           27       27           
  Lines         9275     9275           
========================================
  Hits          7608     7608           
  Misses        1667     1667           
Flag Coverage Δ
python-3.13 82.02% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

… Gate

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@ptr727

ptr727 commented Oct 31, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head f24fba52b03bc362e83c7ae169906d31d7d4422e, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@ptr727
ptr727 merged commit 5f04434 into develop Oct 31, 2026
13 checks passed
@ptr727
ptr727 deleted the feature/burndown-compose-hash-key branch October 31, 2026 18:05
ptr727 added a commit that referenced this pull request Oct 31, 2026
…d Unread Moves Whole, and Name uv's No-Cache Setting (#3715)

Promotes the changes merged into `develop` since promotion #3703 to
`main`, the third round of a backlog burndown.

- [#3709](#3709) Reads a
push's remote, and the branch of a push with no refspec, in the
repository git actually uses in the write guard's owner check
(requirement 4). Before, `--git-dir` and a `GIT_DIR` on the push were
ignored, so a constructed `git --git-dir=<other>/.git push origin
develop` was checked against the working directory's repository rules
and allowed. A shape whose repository the guard cannot determine (an
earlier `GIT_DIR`, a `-c` or `--config-env` override of a `remote.` or
`url.` key, any `GIT_CONFIG*` variable, an unresolvable `--git-dir`) now
blocks `main`, `master` and `develop`. The self-test covers each shape
and `host-setup/agent-safety/README.md` states the requirement.
- [#3712](#3712) Reads a
file moved out of a source some rule never read in full for that rule in
the prose gate: a narrowed directory scope, a `home_path_exempt` file,
instruction text for `issue-ref`, and a move that changes the file's
lexer. Skips YAML block scalars when reading a Compose file's volume
entries.
- [#3707](#3707) Names
uv's no-cache setting, and its remedies, when the repo gate's resolved
PyYAML interpreter is gone at launch, rather than reporting a bare
missing-file error.
- [#3708](#3708) Moves the
section-name lookup key into one `section_key()` in
`spec/fidelity_text.py`, used by the carry, the audit, the skill build
and the review ledger, with no behavior change.

- [#3722](#3722) Applies
`env`'s directory and environment options to the command the write guard
judges, answering this promotion's first review round: `env
-C`/`--chdir` move the repository a relative `GIT_DIR` and the remote
resolve in, `env -i`/`-u` clear a `GIT_DIR` that no longer steers the
check, and `env -S` is read rather than skipped. A run-time directory
reads as undetermined, which blocks `main`, `master` and `develop`.
- [#3721](#3721) Finds a
Compose block-scalar opener through the YAML lexer the gate already uses
rather than a hand-written pattern, so a key holding `#`, quoted or not,
opens the opaque region. Also answers this promotion's first review
round.

- [#3727](#3727) Reads an
`env` option the write guard does not recognize, such as GNU `env`'s
`--ch` abbreviation of `--chdir`, as leaving the push's repository
undetermined, so `main`, `master` and `develop` fail closed, answering
this promotion's second review round. A feature-branch push is never
newly blocked.

- [#3731](#3731) Removes
the fallback #3727 kept for a push naming no refspec behind an
unrecognized `env` option, answering this promotion's third review
round. Such a push resolves its branch only through an absolute
`--git-dir`, git's own `-C`, or a `cd` in a wrapper body, and is
otherwise read as writing every protected default, so it fails closed
even from a feature branch.

Deferred review findings: #3705 (`scripts/README.md`'s uvx promise),
#3706 (`validate.py`'s exact section-name match), #3710 (whether
`section_key` should casefold), #3711 (Compose-name and directory moves
in the prose gate), #3713 (the review reader's `open review findings:`
spelling), #3714 (an edited shebang that changes a file's lexer), #3720
(the write guard's reading of `git push -o<value>`), #3723 (unused
`_bare_push_branch` parameters), #3729 (a bare push after a branch
switch earlier in the same command), #3732 (the review reader's `Review
findings remain:` spelling).

For the maintainer: #3730 asks whether every bare push whose repository
the guard cannot determine should fail closed, as #3731 now does behind
an unrecognized `env` option.

Fixes #3695
Fixes #3684
Fixes #3694
Fixes #2358
Fixes #3686
Fixes #3716
Fixes #3717
Fixes #3725
Fixes #3728

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

2 participants