Repository navigation
Commit b5ae0c1
feat: keep an opt-in problem history for the Briefing (#165)
* feat: keep an opt-in problem history on codeboarding/briefing
With `problem_history: 'true'`, each sync run collects the repository's
issues and merged pull requests since the last update, plus each merged
pull request's architecture findings from its review artifact, sends
them to POST /v1/briefing and commits the returned ledger as
problems.json on the orphan codeboarding/briefing branch. Every rule
lives in the service; the Action only gathers facts and writes the
answer. Off by default, and it never fails the run.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: bound the problem history step and follow briefing amendment 1
- Cut every issue body to 2000 UTF-16 code units, never splitting a
surrogate pair; the oversize-only trimming is gone.
- Stay under the service's caps by construction: 1000 open plus 1000
recently closed issues on a first run, 1000 plus 100 re-read later,
500 merged, 40 new plus 10 retried findings.
- Send openIssues: every open issue number, read first in creation
order, complete false past 5000, after a capped issue read, and on
the conflict retry.
- Ask again for findings of the 10 newest ledger merges whose findings
were never read; send skipped envelopes so they count as read.
- Re-read up to 100 stored open issues with an open linked pull request.
- First-run caps are per pass, and issuesThrough never claims an issue
a cap skipped.
- Skip review artifacts over 50 MB, scan at most 20 pages of merged
pull requests, give the service call 300 s, and stop the script after
10 minutes (a composite step cannot set timeout-minutes).
- A ruleset or branch-name 422 on the ref update is a clear notice, not
retried; a second lost race is a notice too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor: tighten problem_history without changing what it sends
- Page a pull request's changed files through the shared `_nodes` pager,
starting from the page MERGED_QUERY already returned, instead of a
second hand-written cursor loop; `islice` keeps the 300-path cap from
asking for a page past it.
- Build issue, linked pull request and merged pull request facts as one
literal each, with an `_author` spread for the optional login.
- Pick a timeline event's pull request through one side table.
- Read the ledger's ref and file under one 404 guard, and drop the
unreachable assertion after the retry loop.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test: share problem_history fakes and table-drive repeated cases
- FakeGitHub gains add_review() for a run plus its review artifact and
calls() for the GraphQL requests a test inspects; ledger(), numbers()
and closed_node() replace literals repeated across tests.
- Table-driven: the surrogate-safe cut, the 5000 open-issue boundary,
first-run caps, read_architecture, main's never-fail outcomes and the
three commit shapes (orphan, fast-forward, push-named).
- The changed-paths test now also asserts no page past the 300-path cap
is requested; the cap test asserts the uncapped run's issues.
The new file passes against the code before the refactor, and the old
file passes against the code after it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs: trim the problem history README section and step comment
Keep what a customer needs (opt-in, what is sent and its limits, what
is written, permissions, never failing the run, how to turn it off)
and drop the restatements: the Briefing's wording when it is off, and
where the problem rules live, which the module docstring already says.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor: share the GitHub call, error message and packing with closed_features
problem_history had its own copies of the GitHub request, the error-body
message and the gzip-and-check step. closed_features now takes a method,
payload, API base, token and timeout on _github, exposes _error_message
and _gzip, and names what _check_size measured; problem_history uses them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: keep reading issues after a bulk edit past the cap
A later run cut at 1000 issues recorded the last one read as issuesThrough.
When more than 1000 issues share one update time, the next run starts on
the same page and reads it again forever. A capped run now records at
least the previous issuesThrough plus the overlap and a second, so each
run moves on; ties left past the cap are lost.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: give every issue with an open linked pull request a turn to be read again
Re-reads picked the 100 issues whose stored pull request moved most
recently, so those were read every run and the rest never were. They now
take turns in number order, starting where the previous update stopped,
which the commit count of codeboarding/briefing tells. The ledger head is
read with that count in one GraphQL query instead of the REST ref.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: keep the merged cursor at the oldest merge a capped run did not read
Past 500 merged pull requests the scan stopped at the first 500 in update
order, newest first, and said nothing. The service records the newest
merge it is sent as where the next run starts, so the older ones were
never read. A capped run now sends the 500 oldest, notes the cut, and the
next run carries on from there. The README states the cap.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: read merged pull requests' findings only from this repository's own reviews, within bounds
Retrying unread findings could cost tens of requests a run for nothing:
every unread merge of 56 days was tried, any workflow's runs on its head
commit were listed, and each head commit took its own pulls call. Retries
now stop at the review artifact's 14-day retention, list only CodeBoarding
runs of pull_request events, and read the heads in one aliased query.
A fork's pull_request run executes the fork's workflow, so it could upload
a forged review artifact. Findings now come only from runs whose head
repository is this one, and only when metadata.json names the pull
request. metadata.json and closed/architecture.json are not read past
1 MB each, and an envelope that would take the request over the service's
limit is left out (largest first) instead of skipping the whole update.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: never send the run's GITHUB_TOKEN to the briefing service
Without id-token: write, _bearer falls back to the run's GITHUB_TOKEN,
which on the sync job holds contents: write. The problem history now
skips the update with a notice to add id-token: write, before it reads
anything. The input description, the README permissions and the failure
hint list all five permissions, and the hint also fires when GraphQL
refuses the repository or one of its lists (FORBIDDEN or
INSUFFICIENT_SCOPES), which used to surface as a bare error.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: list the open issue numbers once a day rather than on every sync
The full list costs a request per 100 open issues on every run, 20 for a
repository with 2000, and only lets the service drop an issue that was
deleted, transferred or made a discussion. It is now read by the first
update of each UTC day (the ledger's updatedAt says which that is), and
the other runs send it as incomplete, which drops nothing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor: count a failed head lookup once per merge it left unread
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent c546ce1 commit b5ae0c1
5 files changed
Lines changed: 1920 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
357 | 392 | | |
358 | 393 | | |
359 | 394 | | |
| |||
371 | 406 | | |
372 | 407 | | |
373 | 408 | | |
374 | | - | |
| 409 | + | |
375 | 410 | | |
| 411 | + | |
376 | 412 | | |
377 | 413 | | |
378 | 414 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| 151 | + | |
151 | 152 | | |
152 | 153 | | |
153 | 154 | | |
| |||
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
161 | 174 | | |
162 | 175 | | |
163 | 176 | | |
| |||
571 | 584 | | |
572 | 585 | | |
573 | 586 | | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
574 | 604 | | |
575 | 605 | | |
576 | 606 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
72 | 82 | | |
73 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
74 | 86 | | |
75 | | - | |
| 87 | + | |
76 | 88 | | |
77 | 89 | | |
78 | 90 | | |
79 | 91 | | |
80 | | - | |
| 92 | + | |
81 | 93 | | |
82 | 94 | | |
83 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
84 | 104 | | |
85 | 105 | | |
86 | 106 | | |
| |||
308 | 328 | | |
309 | 329 | | |
310 | 330 | | |
311 | | - | |
| 331 | + | |
312 | 332 | | |
313 | 333 | | |
314 | 334 | | |
315 | 335 | | |
316 | 336 | | |
317 | 337 | | |
318 | 338 | | |
319 | | - | |
| 339 | + | |
320 | 340 | | |
321 | 341 | | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
| 342 | + | |
327 | 343 | | |
328 | 344 | | |
329 | 345 | | |
330 | 346 | | |
331 | 347 | | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
332 | 352 | | |
333 | 353 | | |
334 | 354 | | |
335 | 355 | | |
336 | | - | |
| 356 | + | |
337 | 357 | | |
338 | 358 | | |
339 | | - | |
| 359 | + | |
340 | 360 | | |
341 | | - | |
| 361 | + | |
342 | 362 | | |
343 | 363 | | |
344 | 364 | | |
| |||
0 commit comments