Skip to content

chore(promote): develop → main — opt-in black format job - #116

Merged
LukasWodka merged 3 commits into
mainfrom
develop
Jul 31, 2026
Merged

chore(promote): develop → main — opt-in black format job#116
LukasWodka merged 3 commits into
mainfrom
develop

Conversation

@LukasWodka

@LukasWodkaLukasWodka commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Promotes the code-quality format job (#115) to main, which is the ref every caller pins (code-quality.yml@main) — so the job only becomes available to repos after this hop.

Contains the Bugbot/@aptracebloc fix: the format verdict is derived from black's output rather than its exit code, because GNU xargs remaps black's exit 1 to 123 in diff mode (verified: BSD/macOS propagates 1, which is why it passed local validation and would have failed CI).

No caller enables format: true yet, so nothing changes for any repo on merge. Merge-commit, not squash, per the promotion-hop rule.

Part of tracebloc/backend#1303

🤖 Generated with Claude Code


Note

Low Risk
Changes are confined to an opt-in CI job defaulting off; no runtime or auth paths are touched, though adopters must pin black version correctly to avoid noisy failures.

Overview
Promotes an opt-in format job on the reusable code-quality.yml workflow so repos that pin @main can enable black --check without a separate workflow.

New caller inputs include format (default off), format-soft-fail for advisory-only adoption, and black-version (default 23.1.0 to match the fleet). The job mirrors ruff’s PR-diff file resolution with fail-open to all files, runs black with the repo’s [tool.black] config, and writes results to the job summary.

Pass/fail is driven by black’s output, not its exit code: in diff mode GNU xargs maps black’s exit 1 to 123, which would have hard-failed CI while macOS looked fine. Parse errors are treated separately from “would reformat” so advisory runs don’t report a false clean bill of health.

No caller sets format: true yet, so merge behavior for existing repos is unchanged until they opt in.

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

LukasWodkaand others added 3 commits July 31, 2026 09:45
Closes the last Layer-0/1 gap on backend#1303: black is CI-enforced only in
backend (its own lint.yml). This adds a shared, opt-in 'format' job so any
repo can enforce formatting without standing up its own workflow.
Diff-scoped like ruff: only the .py files a PR changes must be black-clean
(all files in all-files mode). That matters because every Python repo except
backend has a real formatting backlog (measured 2026-07-31 with black 26.3.1:
engine 157, py-package 168, data-ingestors 78, averaging 71, client-runtime
15; backend 0). Diff scoping means a repo can adopt the gate with zero churn
instead of a repo-wide reformat that would collide with in-flight work.
'format-soft-fail' lets a repo adopt advisory-first while its lint and
credential gates stay blocking. 'black-version' is pinned per caller because
black's stable style changes between releases; no repo enables this job by
default, so nothing changes until a caller opts in.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Bugbot + @aptracebloc: in diff mode black runs under xargs, and GNU xargs
remaps any child status in 1-125 to its own 123. So black's ordinary 'would
reformat' (exit 1) arrived as 123, hit the fail-closed branch, and hard-failed
before soft-fail could apply -- advisory adoption was impossible on the job's
primary path, and a real internal error looked identical to a formatting nit.
Now the verdict comes from black's OUTPUT: reformat-count vs error-count,
checked errors-first so a genuine internal error is never masked by a
reformat finding in the same run (the residual hole in the suggested
RC=1 rewrite). Exit codes are only a tiebreaker for 'nonzero with no
findings', which still fails closed.
Why local validation missed it: BSD/macOS xargs propagates 1, GNU xargs
remaps to 123 -- verified both. Simulated all 8 outcome combinations
(dirty/unparsable/clean x advisory/blocking x diff/all-files).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
feat(code-quality): opt-in black --check format job (diff-scoped)
@LukasWodka
LukasWodka merged commit 5be0707 into mainJul 31, 2026
6 checks passed

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 772cea8. Configure here.

echo "### format (black ${{ inputs.black-version }})"
echo ""
if [ "${ERRS:-0}" -gt 0 ]; then
echo "black could not process ${ERRS} file(s) -- this is an error, not a formatting verdict."

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Error count double-counts summary

Low Severity

ERRS is derived with grep -cE '^error:|would fail to reformat', but black emits both a per-file error: cannot format … line and a check-mode summary containing would fail to reformat. That summary line is counted as an extra file, so messages that treat ERRS as a file count are inflated by one per black invocation (more when xargs splits batches).

Additional Locations (1)
Fix in CursorFix in Web

Reviewed by Cursor Bugbot for commit 772cea8. Configure here.

Sign up for freeto 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.

1 participant

@LukasWodka