Skip to content

Tell Apart the Causes a Labels Payload Is Refused For - #2230

Merged
ptr727 merged 3 commits into
developfrom
feature/auto-1372
Oct 1, 2026
Merged

ptr727 merged 3 commits into
developfrom
feature/auto-1372

Conversation

@ptr727

@ptr727 ptr727 commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Closes on promotion: #1372

labels_payload_ok now refuses a repeated label name (ignoring ASCII case) and an uppercase hex color, since GitHub stores colors lowercased (confirmed read-only against this repository's labels). It checks the payload in separate steps and reports each cause as itself: did not parse, not exactly one JSON document, not an array, empty, outside the field contract, repeated name, and a failing jq. cmd_apply and check_labels print that reason.

Tests in LabelsPayloadCase use constructed payloads and fail on the old code. The comment change needs the comments label.

Remaining gaps the local review found are filed as #2229.

🤖 Generated with Claude Code

ptr727 and others added 3 commits October 1, 2026 01:16
Refuse a repeated label name and an uppercase hex color, which GitHub stores lowercased, and report an unparseable payload, a non-array, an empty array, an out-of-contract label, a repeated name, and a failing jq each as what it is instead of one message.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Read a payload as exactly one JSON document, tell a jq failure from a parse error at the first step, treat null as not an array, and compare names ignoring case, since GitHub does.

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 October 1, 2026 08:23
@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Oct 1, 2026
@coderabbitai

coderabbitai Bot commented Oct 1, 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: f57289b2-d8e8-4fd3-bb14-be7e47005bfb

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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 Oct 1, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #2230   +/-   ##
==========================================
  Coverage           ?   56.61%           
==========================================
  Files              ?       16           
  Lines              ?     7482           
  Branches           ?        0           
==========================================
  Hits               ?     4236           
  Misses             ?     3246           
  Partials           ?        0           
Flag Coverage Δ
python-3.13 56.61% <ø> (?)

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

🔵 Needs a closer look

It changes shared fleet tooling that gates configuration writes and relies on subtle, jq-version-dependent exit-code and error-message behavior, so a maintainer should confirm it before merge.

Review effort: Balanced
Findings: None

What changed in this PR

This PR hardens labels_payload_ok, the shared pre-flight validator for repo-config/labels.json in the fleet configuration script. Previously the predicate folded every failure cause into a single boolean with suppressed jq stderr, admitted duplicate label names and uppercase hex colors (both of which later read as permanent drift against GitHub's lowercased, name-unique storage), and could blame a valid payload when jq itself failed (for example a build lacking test/1). The function now runs each check as its own step, reports the specific cause, rejects case-insensitive duplicate names and uppercase hex, and distinguishes a jq failure from a bad payload. This addresses the three defects tracked in the linked issue; remaining tightening is deferred to a follow-up issue.

Changes:

  • Rewrote labels_payload_ok into an ordered sequence of jq steps (parse, exactly-one-document, array, non-empty, field contract with lowercase-only hex, unique-name-ignoring-case), each emitting its own reason and separating a jq execution failure from a payload defect.
  • Wired the returned reason into cmd_apply and check_labels via if ! why="$(labels_payload_ok)", so the abort/drift message names the specific cause.
  • Added LabelsPayloadCase tests exercising the lifted function against constructed payloads (duplicate names, case-folded duplicates, uppercase color, each parse/structure cause, and a stubbed failing jq), plus a test that the committed labels.json still passes.
File Description
repo-config/​configure.sh Splits labels_payload_ok into per-cause steps with lowercase-hex and unique-name checks; callers surface the specific reason.
tests/​test_configure_project.py New LabelsPayloadCase lifting the function to assert each refusal cause and that the committed payload is admitted.

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

@ptr727 ptr727 closed this Oct 1, 2026
@ptr727 ptr727 reopened this Oct 1, 2026
@ptr727
ptr727 merged commit 0b89558 into develop Oct 1, 2026
20 of 26 checks passed
ptr727 added a commit that referenced this pull request Oct 1, 2026
## Summary

Promotes develop to main, carrying the pull requests below, each already
reviewed and merged into develop.

- [#2203](#2203): Strip
every heredoc body a line opens in the wait-loop rule.
- [#2216](#2216): Point
the charset-unknown message at where a tier is classified.
- [#2218](#2218): Name the
leftover old tree when the Bash loader cannot remove it.
- [#2227](#2227): End the
guard's stdin redirect scan at a trailing comment.
- [#2230](#2230): Tell
apart the causes a labels payload is refused for.
- [#2232](#2232): Correct
the task names and pointers in the Python tasks snippet header.
- [#2234](#2234): Drop the
stale private-repository note from PhotoCleaner's registry entry.
- [#2237](#2237): State
the bootstrap's archive live channel in two skills.
- [#2239](#2239): Stop the
promotion count on a failed fetch in backlog-burndown.
- [#2241](#2241): Render
the include walk once per `build_dist.py --check` run.
- [#2243](#2243): Have the
tree check call `escapes_repo_root` and refuse a symlinked component.
- [#2247](#2247): Refuse a
Windows drive component anywhere in a tree path.
- [#2222](#2222): Tick the
adopted repos in the merge-bot and gate rollout stages.
- [#2121](#2121): Refuse a
dangling remote-tracking target in `local_review`.
- [#2249](#2249): Ignore a
quoted separator when the guard finds a loop's `done`.

Closes #2112
Closes #2171
Closes #1790
Closes #2152
Closes #1372
Closes #2149
Closes #1082
Closes #1772
Closes #1310
Closes #1379
Closes #1452
Closes #2244
Closes #2168
Closes #2106
Closes #2207

🤖 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

comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants