Uh oh!
There was an error while loading. Please reload this page.
chore(promote): develop → main — opt-in black format job - #116
Conversation
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)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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." |
There was a problem hiding this comment.
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)
Reviewed by Cursor Bugbot for commit 772cea8. Configure here.


Promotes the code-quality
formatjob (#115) tomain, 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: trueyet, 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
formatjob on the reusablecode-quality.ymlworkflow so repos that pin@maincan enableblack --checkwithout a separate workflow.New caller inputs include
format(default off),format-soft-failfor advisory-only adoption, andblack-version(default23.1.0to 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
xargsmaps black’s exit1to123, 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: trueyet, 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.