Repository navigation
Commit a98de8b
authored
feat(coderabbit-config): validate .coderabbit.yaml so a broken config fails its own PR (BE-7757) (#179)
* feat(coderabbit-config): validate .coderabbit.yaml so a broken config fails its own PR (BE-7757)
CodeRabbit rejects an invalid .coderabbit.yaml WHOLE — it discards the file and
reviews with org-wide UI defaults, so every reviewer instruction, path filter,
path instruction and WIP-skip rule in it goes silently inert. And it validates
the BASE branch, not the PR head, so the PR that breaks the file goes green and
the breakage first surfaces on the NEXT PR, blamed on a change that did not
cause it. Nothing in CI caught this; the same field on the same repo was fixed
twice in six days by two independent tickets.
Adds coderabbit-config-validate.yml (reusable, workflows_ref REQUIRED, checker
loaded from this repo at the pinned ref), its checker + VENDORED schema under
.github/coderabbit-config/, the test workflow, the bump fleet entrypoint, and a
weekly refresh job that opens a PR when the vendored schema drifts upstream.
Severity mirrors CodeRabbit's own behaviour rather than a schema library's:
parse / maxLength / type / enum errors FAIL; an unknown key WARNS (CodeRabbit
strips those, so the config loads while everything under the key does nothing)
unless strict_unknown_keys: true. A repo with no config passes, and says so.
The schema is vendored, never fetched on the validation path: a live fetch makes
every consumer's CI depend on a third party, and an upstream tightening would
redden the fleet with no change here.
* fix(coderabbit-config): close the review panel's findings on the validator (BE-7757)
Ten findings from the cursor-review panel, addressed in place.
Checker:
- Containment now resolves symlinks on BOTH sides (`realpath`, not `abspath`).
A config committed as a symlink out of the tree cleared the old textual guard
and was read anyway, and a YAML error quotes the target into a public log.
- A path that exists but is not a regular file (directory, dangling symlink) is
exit 2, not a silent pass.
- `.coderabbit.yml` under the default name is validated with a warning instead
of reported "absent — pass". CodeRabbit honours both spellings, so that was a
permanently green check over a config nobody looked at.
- `config_file` and `--root` are escaped in the banner and result lines like
every other print; a newline in that workflow input could emit
`::stop-commands::` and suppress the annotations of a failing check.
- Bound the PR-controlled input (512 KiB) and the reported findings (100).
Schema drift:
- Diff the UNION of old and new caps. The old walk skipped a cap upstream ADDS
to a previously uncapped property — the single most config-invalidating drift
there is — and never looked at one it removes; both then printed "No property
or `maxLength` changes", which is false.
- Walk `anyOf`/`oneOf`/`allOf`, `patternProperties`, schema-valued
`additionalProperties`, list-form `items` and `$defs`. The vendored schema
already uses two of those shapes, so drift inside them was invisible.
- An unexpected exception exits 2, not Python's default 1 — 1 means DRIFTED to
the caller, which force-resets a shared branch on it.
Workflows:
- `python3 -P -m pip`: that step's working directory is the untrusted caller
checkout, and `-m` puts it first on `sys.path`, so a PR adding `pip/__main__.py`
ran its own code before the pinned checker and could rewrite it.
- The refresh's invariant suite no longer aborts the run before the PR exists.
It asserts exact facts (the 14-cap set, tone_instructions == 250), so any real
upstream cap change failed it — and the later steps' implicit `success()` then
opened no PR at all, silently dropping the drift class this prioritizes. The
verdict now rides in the PR body and reddens the run at the end.
- Verify drift.md before the force-push, so the shared branch never moves with
nothing to explain it.
Docs scoped to reality: unknown-key detection only fires where the schema CLOSES
an object, so a typo inside `reviews` is not caught. Widening it is follow-up work.1 parent 6446399 commit a98de8b
17 files changed
Lines changed: 4966 additions & 4 deletions
File tree
- .github
- bump-callers
- coderabbit-config
- tests
- workflows
- docs/callers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
0 commit comments