Skip to content

Guard check_settings' Live Read of the Repository Response - #2088

Merged
ptr727 merged 3 commits into
developfrom
feature/auto-1260
Sep 29, 2026
Merged

ptr727 merged 3 commits into
developfrom
feature/auto-1260

Conversation

@ptr727

@ptr727 ptr727 commented Sep 29, 2026

Copy link
Copy Markdown
Owner

check_settings() read $live with bare assignments, so a 2xx body that is not one JSON object aborted the whole check run under set -e with an unattributed jq error. It now validates the response once, reports one named FAIL, and returns. A test lifts the function from configure.sh and fails when the guard is reverted.

Closes on promotion: #1260

🤖 Generated with Claude Code

ptr727 and others added 3 commits September 29, 2026 10:07
A 2xx response that is not a JSON object aborted the whole check under set -e with an unattributed jq error. It now reports one named FAIL and returns.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings September 29, 2026 17:11
@coderabbitai

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

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

⚙️ Run configuration

Configuration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 6afec9fd-13b3-4b2e-bf93-d85133d71879


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

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@b56efb2). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #2088   +/-   ##
==========================================
  Coverage           ?   55.91%           
==========================================
  Files              ?       16           
  Lines              ?     7359           
  Branches           ?        0           
==========================================
  Hits               ?     4115           
  Misses             ?     3244           
  Partials           ?        0           
Flag Coverage Δ
python-3.13 55.91% <ø> (?)

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.

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.

Copilot review overview

🟢 Approval recommended

The small, defensive read-only guard matches the existing guard pattern, is verified correct against every test input, and is covered by a new offline test with no defects found.

Review effort: Balanced
Findings: None

What changed in this PR

This PR hardens repo-config/configure.sh's read-only check mode against a malformed-but-successful (2xx) repository-settings response. Previously, check_settings() read $live with bare command substitutions, so a body that is not exactly one JSON object (a truncated response or a proxy-injected non-JSON 200) would trip set -e inside a $(...) read and abort the entire check run with an unattributed jq error instead of the clean, attributed FAIL the rest of the function guarantees. The change adds a single validation of the live body up front, mirroring the guard already present for the analogous payload-file and check_ruleset() $live reads, and closes the remaining gap tracked by the linked issue.

Changes:

  • Add a guard in check_settings() that validates the live response is exactly one JSON object before any read, emitting a named FAIL and returning cleanly otherwise.
  • Add tests/test_configure_settings_live.py, which lifts the real check_settings() (and its helpers) from configure.sh and stubs only gh, so removing the guard fails the tests rather than a reimplementation agreeing with itself.
File Description
repo-config/​configure.sh Adds a slurp-based jq_has guard so a non-object live settings body yields one named FAIL and returns instead of aborting the run under set -e.
tests/​test_configure_settings_live.py New offline test covering non-JSON, non-object, multi-document-stream, and single-object bodies, asserting the guard fires once and the run continues.

I verified the guard's behavior directly (jq -e -s 'length == 1 and (.[0] | type == "object")' returns FAIL for <html>proxy</html>, [], and [] {}, and PASS for a single object), confirmed each lift() regex resolves to exactly one region in configure.sh, and confirmed the check_ruleset() $live read is already guarded (its first read is wrapped in if ! got_types=...), so scoping this PR to check_settings() is correct. The new test follows the same lift-and-stub convention as tests/test_configure_ruleset_id.py.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

ptr727 added a commit that referenced this pull request Sep 29, 2026
…d Effort (#2104)

## Summary

Copilot code review's default effort moved from Lite to Balanced on
2026-09-28. Balanced rounds write the `ccr-overview-v2` body with a
per-file table and almost never a coverage statement. So `pr_review.py`
read every such pull request as `COVERAGE_IS_UNSTATED` (exit 45) and
parked it on a maintainer decision (#2103, #2095, #2089, #2082, #2077).

Measured over the Copilot rounds on the 40 newest pull requests here, 25
of 29 Lite rounds carried the `fleet-review` marker, against 1 of 22
Balanced rounds. Stating the marker literally in the runbook did not
help. A Balanced round on this branch read that instruction, quoted it
in its own summary, and still left the marker out. So the tooling now
accepts a coverage reading that works at any effort level, instead of
depending on one setting.

### The rule

A head that no coverage statement reaches, meaning none is stated on it
and none is carried to it, now reads `coverage=table` and passes when
all of these hold:

- A round covering the head has its own file table naming exactly the
changed files.
- No Copilot round on the pull request, on any commit, states or appears
to state partial coverage. The scan reads each round body in 12 ways:
raw, entity-decoded, and compatibility-folded, each with tags kept and
stripped three ways. A partial found in any reading counts.
- The whole review history is in view.
- The changed-file list is present, well-formed, non-empty, and within
the 100-file window.

A statement that reaches the head always wins, so a stated partial still
blocks. A pull request that ever had a partial round goes to the
maintainer. When no table stands in, the digest prints the reason as `NO
FILE TABLE STANDS IN: <reason>`.

The rule is stated in `GOVERNANCE.md` "PR Review Etiquette", in the
`pr-review-conduct` Merge Gate (source and generated copies), in the
runbook, in `scripts/README.md`, and in the script's own docstring and
exit-45 message.

Measured live with this branch: #2102, #2094, #2088, #2081, #2076,
#2050, #2046, #2039 and #2033 read `coverage=table`. #2098, which
carries the marker, still reads `full`.

## Known limits, all failing closed unless noted

- **Glob rows.** Copilot sometimes collapses generated skill copies into
glob rows such as `.../skills/*/references/*.md`, so on those pull
requests the table does not match and they go to the maintainer. #2053
and #2021 are examples.
- **Marker quoted near digits.** A round that quotes the marker next to
digits reads as a partial. That includes this pull request's own first
round, so this PR goes to the maintainer.
- **Early-closed fences.** A fence that Markdown closes early, through a
list item or an HTML block, masks a real table after it.
- **Prose partials (fail-open).** A partial worded in prose that none of
the patterns anticipate can still pass. The scan narrows this gap but
cannot close it.
- **Malformed marker before a full one (pre-existing, not introduced
here).** On the head, a malformed marker followed by a well-formed full
marker is read as full by the existing coverage reader.
- **Unpinned readings.** Tests do not pin each of the 12 readings
individually, the echoed snippet can carry raw control characters into
the digest line, and two docstrings overstate slightly. None of these
affects a verdict.

## Verification

- `python3 -m unittest discover -s tests`: 1841 tests pass. The new
tests were mutation-checked, and each guard fails its test when removed.
- ruff, mypy, the prose gate, markdownlint, `build_dist.py --check`,
`spec/validate.py`, and the eol gate are clean.
- The local strict review ran across several rounds, and the last pass
found no fail-open. Its differential fuzz over 150k bodies found nothing
the previous commit flagged that this one misses. Its receipt is
recorded.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@ptr727
ptr727 merged commit 4aa54de into develop Sep 29, 2026
11 checks passed
@ptr727
ptr727 deleted the feature/auto-1260 branch September 29, 2026 21:30
ptr727 added a commit that referenced this pull request Sep 29, 2026
…pilot Coverage at Balanced Effort (#2105)

## Summary

Promotes develop to main, carrying 14 pull requests:

- [#2076](#2076) Read the
Guard's Token Fallback With a Bash-Aware Context Scan
- [#2081](#2081) Keep the
Guard's Quote Mask When an Escape Sits Outside the Loop Condition
- [#2094](#2094)
Reconfigure pr_review.py's Console Streams to UTF-8
- [#2088](#2088) Guard
check_settings' Live Read of the Repository Response
- [#2102](#2102) Skip a
Blockquoted List Marker in the Prose Gate's Dash Rule
- [#2104](#2104) Accept a
Head Round's Exact File Table as Copilot Coverage at Balanced Effort
- [#2098](#2098) Quote the
Review Engine's Remaining Bare Shell Placeholders
- [#2050](#2050) Hand
Unstated Coverage to the Maintainer Instead of Prescribing a Re-Request
- [#2046](#2046) Report a
Copilot Review Request That Records Nothing Instead of Waiting It Out
- [#2053](#2053) State the
Python Build Profile by Its Trait, Not One of Its Forms
- [#2068](#2068) Strip the
CR From configure.sh's Environment-Name Encoding
- [#2033](#2033) Bound the
Guard's Stdin Descriptor Before int()
- [#2036](#2036) Guard
ruleset_id() Against Malformed Array Elements
- [#2039](#2039) Strip the
CR From configure.sh's Workflow-Model Read

The lead change is #2104. Copilot code review's default effort moved
from Lite to Balanced on 2026-09-28, and Balanced rounds write a
per-file table but almost never a coverage statement. `pr_review.py` now
accepts a head round's file table as coverage when it names exactly the
changed files and no Copilot round on the pull request has ever stated
or appeared to state partial coverage. Before this, every pull request
reviewed at Balanced effort parked on a maintainer decision. The other
pull requests are guard, configure, prose-gate, and review-engine fixes
that were waiting on that decision or landed earlier.

#2076 leaves #1910, #1958, and #1959 open, per #1960.

Closes #1998
Closes #2091
Closes #1260
Closes #1190
Closes #1652
Closes #2047
Closes #1904
Closes #1947
Closes #1882
Closes #2028
Closes #1987
Closes #1881

🤖 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