Repository navigation
feat(github): pushes a ruleset refused in the audit log, from rule insights - #3027
Confidence 6/10 · 2 issues to address
🟡 Confidence 6/10 · needs attention. Held at 6 because a performance warning is open.
2 warnings −2 · tests covered · risk medium · 4/4 new units observable
Reads GitHub rule insights every 15 minutes into rule_suite.failed audit events, with a per-repository cursor, a new audit category and a detection template. Two warnings before merge: the scans ride the webhook queue, and a failed audit write records no reason. The four open VCS errors are untouched.
*/15cron addsrunRuleSuiteScan, onerule-suite-scanjob per installationGithubProvider.fetchRefusedPushespages failed rule suites and reads which rules failedscanRefusedPusheswritesrule_suite.failedaudit events and advances the cursor- New
refusedPushesaudit category and "Push refused by a ruleset" template
Before merge
- Migration · Check it is safe on production data and with the code still deployed ·
packages/db/drizzle/20261124152731_vcs_rule_suites_read_until/migration.sql - Manual · The GitHub App manifest now needs Administration: read; existing orgs must accept it or every scan is skipped
- Manual ·
rule_suites_read_untillands through the prd alchemy deploy;db:migrateis local only
Findings
🟠 Warning · F2 · rule-suite-scan jobs land on the two-slot webhook queue
performance · packages/backend/src/services/integrations/vcs/VcsScheduledSyncService.ts:102
vcsQueueFor (VcsSyncQueue.ts:26) routes only sync-branches, sync-commits, dependency-scan and scheduled installation-sync to vcs-backfill; the new kind falls through to vcs-sync, whose consumer runs maxConcurrency: 2 (consumers.ts:28). A scan reads up to 50 repositories at a time plus immediate continuation jobs, so a push waits behind it for its PR sync.
Add `"rule-suite-scan"` to `BACKFILL_KINDS` in `VcsSyncQueue.ts`; the rate-limited retry in `handleRuleSuiteScan` reuses `vcsQueueFor`, so it follows.
🟠 Warning · F3 · Failed audit-log write drops the error and logs only the repository
observability · STAT-01 · packages/backend/src/services/integrations/vcs/VcsSyncService.ts:1302-1319
catchTag turns the AuditTrailPersistenceError into true and discards it; the logError at line 1317 names only vcs.repository.id, and the enclosing span stays Unset because the failure was caught. A refusal that never reached the audit log leaves no reason�������������������������������������������������������������������������������������������������������������������������������姫كي
Production impact
2 open error groups in the changed files, 39 occurrences. Details are in Maple.
Production traffic of the changed files (last 7 days)
| File | Calls/day |
|---|---|
packages/backend/src/services/integrations/vcs/VcsSyncService.ts |
94k |
packages/backend/src/services/integrations/vcs/VcsRepository.ts |
22k |
Telemetry this change adds and removes (20)
- ➕ attribute
vcs.rule_suites.enqueued·apps/api/src/vcs-sync-runtime.ts:128 - ➕ span name
VcsRuleSuiteScan.tick·apps/api/src/vcs-sync-runtime.ts:135 - ➕ span name
VcsRepository.restartRuleSuiteCursors·packages/backend/src/services/integrations/vcs/VcsRepository.ts:585 - ➕ span name
VcsRepository.listRuleSuiteScanTargets·packages/backend/src/services/integrations/vcs/VcsRepository.ts:677 - ➕ span name
VcsRepository.advanceRuleSuitesReadUntil·packages/backend/src/services/integrations/vcs/VcsRepository.ts:705 - ➕ attribute
vcs.rule_suites.installations_total·packages/backend/src/services/integrations/vcs/VcsScheduledSyncService.ts:104 - ➕ span name
VcsScheduledSyncService.runRuleSuiteScan·packages/backend/src/services/integrations/vcs/VcsScheduledSyncService.ts:108 - ➕ span name
VcsSyncService.scanRefusedPushes·packages/backend/src/services/integrations/vcs/VcsSyncService.ts:1225 - ➕ span name
VcsSyncService.handleRuleSuiteScan·packages/backend/src/services/integrations/vcs/VcsSyncService.ts:1329 - ➕ attribute
vcs.rule_suites.collected·packages/backend/src/services/integrations/vcs/VcsSyncService.ts:1339 - ➕ attribute
vcs.rule_suites.permitted·packages/backend/src/services/integrations/vcs/VcsSyncService.ts:1347 - ➕ attribute
vcs.rule_suites.repositories·packages/backend/src/services/integrations/vcs/VcsSyncService.ts:1369 - ➕ attribute
vcs.rule_suites.unavailable·packages/backend/src/services/integrations/vcs/VcsSyncService.ts:1370 - ➕ attribute
vcs.rule_suites.failed·packages/backend/src/services/integrations/vcs/VcsSyncService.ts:1371 - ➕ attribute
vcs.rule_suites.rate_limited·packages/backend/src/services/integrations/vcs/VcsSyncService.ts:1372 - ➕ span name
GithubAppClient.listFailedRuleSuites·packages/backend/src/services/integrations/vcs/vendor/github/GithubAppClient.ts:1418 - ➕ span name
GithubAppClient.getRuleSuite·packages/backend/src/services/integrations/vcs/vendor/github/GithubAppClient.ts:1447 - ➕ attribute
vcs.rule_suites.time_period·packages/backend/src/services/integrations/vcs/vendor/github/GithubProvider.ts:1444 - ➕ attribute
vcs.rule_suites.read·packages/backend/src/services/integrations/vcs/vendor/github/GithubProvider.ts:1445 - ➕ attribute
vcs.rule_suites.refused·packages/backend/src/services/integrations/vcs/vendor/github/GithubProvider.ts:1446
Ingest cost of new log lines
packages/backend/src/services/integrations/vcs/VcsSyncService.ts:1260: If this logs once per call, about 780 MB/month: the file's operations run 94k times a day.packages/backend/src/services/integrations/vcs/VcsSyncService.ts:1280: If this logs once per call, about 780 MB/month: the file's operations run 94k times a day.packages/backend/src/services/integrations/vcs/VcsSyncService.ts:1317: If this logs once per call, about 780 MB/month: the file's operations run 94k times a day.
What was checked
- Cursor stops 1 ms before the first unwritten refusal, so same-second refusals are re-read (
VcsSyncService.ts:1309) - Detail cap takes the newest 20 suites and drops evaluate-only rules (
GithubProvider.ts:1395) auditCategoriesis string-keyed overrides, so stored rows decode with the new category (github-audit.ts:148)
Observability coverage: 4 of 4 changes observable
| Change | Kind | Observable | Evidence |
|---|---|---|---|
api Worker cron */15 * * * * |
cron | yes | VcsRuleSuiteScan.tick span in apps/api/src/vcs-sync-runtime.ts:135, enqueued count on it |
rule-suite-scan queue consumer |
consumer | yes | shared VcsSyncQueue.processMessage consumer span (vcs-sync-runtime.ts:196) carrying messaging attributes |
| GitHub rule-insight requests | client | yes | one Effect.fn span per call in GithubAppClient; Internal kind, no peer.service, like every sibling GitHub call |
rule-suite cursor queries in VcsRepository |
db | yes | named Effect.fn plus dbRead("vcs_repositories")/dbExecute as the neighbouring queries do |
6ae5eb6 · Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one. Check ids refer to Maple's instrumentation audit.
Annotations
maple-review-bot / Maple / review
performance: `rule-suite-scan` jobs land on the two-slot webhook queue
`vcsQueueFor` (`VcsSyncQueue.ts:26`) routes only `sync-branches`, `sync-commits`, `dependency-scan` and scheduled `installation-sync` to `vcs-backfill`; the new kind falls through to `vcs-sync`, whose consumer runs `maxConcurrency: 2` (`consumers.ts:28`). A scan reads up to 50 repositories at a time plus immediate continuation jobs, so a push waits behind it for its PR sync.
Check warning on line 1319 in packages/backend/src/services/integrations/vcs/VcsSyncService.ts
maple-review-bot / Maple / review
observability · STAT-01: Failed audit-log write drops the error and logs only the repository
`catchTag` turns the `AuditTrailPersistenceError` into `true` and discards it; the `logError` at line 1317 names only `vcs.repository.id`, and the enclosing span stays Unset because the failure was caught. A refusal that never reached the audit log leaves no reason�������������������������������������������������������������������������������������������������������������������������������姫كي