Repository navigation
Commit 31b2666
fix(fleet-write): advisory_list follows the next link that names the collection by this repository's own id (#36172)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1X1qGnTYLQs3EtmtCmjrcfCe)_
Fixes #36146
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户无感:这是车队内部的写中继工具,两位安全席位的「列出全部安全通告」探针在某一状态超过一百条后恢复可用。
- 安全席位的收件探针自今天下午起一直失败,两条安全线看不到自己的待办,本修复替他们解决。
- 出错时只会影响安全席位的列表读取,单条通告的读写不受影响,改动可直接撤回。
- 无。
## What changes
`advisory_list` refused the whole stroke as soon as one state held a
second page. The refusal came from `advisoryListNextCursor`, which
accepted a next link only on the path
`/repos/{owner}/{name}/security-advisories`.
**What is measured, and what is inferred** (no advisory data was read
for any of this):
- GitHub's REST pagination guide (the `github/docs` source,
`content/rest/using-the-rest-api/using-pagination-in-the-rest-api.md`)
shows a request to `/repos/octocat/Spoon-Knife/issues?per_page=2`
answered by next links on
`/repositories/1300192/issues?per_page=2&page=2`. The link names the
collection by the repository's **numeric id**, not the path the request
used.
- This repository already holds one Link header measured in a
GitHub-hosted context, the fixture in
`scripts/pm/check-governed-merges.mjs` ("Real headers, measured on" a
260-file pull). It is on `/repositories/1136691870/pulls/.../files`, and
`1136691870` is this repository's own id (`GET
/repos/objectstack-ai/objectstack` returns `.id`, read for this PR).
`scripts/qa/retest-owed.mjs` also records, as measured, that GitHub
returns the `/repositories/ID/...` form on cursor-paged issue listings.
- Through this session's API proxy, cursor-paged endpoints of this
repository returned these next links. `/issues`: path
`/repos/OWNER/NAME/issues`, parameter names `per_page,state,after,page`,
cursor percent-encoded, alphanumerics and `=` only. `/activity`:
parameter names `per_page,after`. That proxy refuses `/repositories/ID`
paths, and the `/repos/` spelling it returned differs from the
documented one, so it most likely rewrites Link headers. **The proxy's
path spelling is not evidence of what a runner sees.** What it does tell
us: the parameter names, a `page` sitting beside `after` on a cursor
link, and that the cursor stays inside the base64 alphabet.
- **Not measured:** the `security-advisories` endpoint's own Link
header. This account cannot read advisories, and doing so is out of
bounds. The inference is that it follows the platform-wide
`/repositories/{id}/` form. The `page`-without-`after` and
off-alphabet-cursor candidates on the card remain refused; the new
diagnostic will name them if one of them turns out to be the cause.
**The fix** (`scripts/pm/fleet-write/ops.mjs`, `execute.mjs`):
- `advisoryListNextCursor` also accepts
`/repositories/{id}/security-advisories`
(`ADVISORY_LIST_NUMERIC_COLLECTION_SHAPE`: digits, no leading zero). It
does so **only when `{id}` equals the repository's own id**. The rule
judges origin, state and cursor first. If those hold and no id has been
read yet, it answers `needsRepoId`.
- The walk then reads the id **once per listing** with one `GET
/repos/{repo}` (`advisoryListRepoIdOf`: 200, its own `full_name`, a
positive safe integer) and asks again. It never takes the id from the
link. If the read fails, the action FAILS and names the status alone
(`advisoryListRepoIdUnreadText`). If the call throws, the action FAILS
with `ADVISORY_LIST_UNREACHED`. The read uses the stroke's literal
`metadata: read` and is not in any refused path family. A listing whose
links use the `/repos/` spelling never makes the read.
- The next request is still the relay's own
`/repos/{repo}/...?state=S&per_page=100&after=C` spelling. The link
itself is never followed.
- **Diagnostic:** a refused link now prints `advisoryListLinkShape`
after the unchanged fixed sentence, in the row and the job log. It gives
the next-link count, whether the origin is the relay's API, and the path
with `OWNER`/`NAME`/`ID`/`SEG`/`N` placeholders, noting whether the
owner and name or the id are this repository's. It also lists the query
parameter **names** and whether `state` and `after` stand as the walk
needs: absent, several, the walk's or not, and for the cursor in shape,
over its cap or off-alphabet. It never prints a host, owner, name, id,
state, cursor or other value.
- Every refusal on the card still holds: a link off the collection
(another host, plain http, another repository, another collection, a
trailing slash, another id, a leading-zero id), a link off the state, a
cursor that is absent, doubled, over-long or outside its shape, and more
than one next link.
- `.github/workflows/fleet-write.yml` is untouched.
## Tests
- `node scripts/pm/fleet-write/validate.mjs --self-test`: 436 cases pass
across 22 batteries (431 before). The advisory_list battery pin goes
from 21 to 28, its registered count. New cases cover the real-shape
fixture (numeric id, `per_page,state,after,page`, an encoded cursor),
the id-less `needsRepoId` answer, another id, and state/cursor checks
that run before any id read. They also cover the repo-id reader on 12
answers, a no-value sweep of the diagnostic over 26 links (every refused
link, a link in another letter case, and a cursor and a parameter name
that carry the marker), and the diagnostic text pinned on 6 shapes.
- `node scripts/pm/fleet-write/execute.mjs --self-test`: 433 cases pass
across 30 batteries (429 before). The advisory_list battery pin goes
from 22 to 27. New cases: the real numeric link walks a second page in
two states with **one** repository read and lands sealed as ten parts
(212 listed). Another id is refused with its shape. A repository read
that answers 403, another `full_name` or a string id is FAILED naming
its status, and a read that throws is unreached. A `/repos/` link makes
no repository read. The off-link runs now assert that the shape appears
in the row and the log. The marker sweep covers 46 runs (40 before) and
the repository answer carries the marker too: no marker, id or cursor
reaches any channel.
- `node scripts/pm/fleet-write/ops.mjs --self-test` and `dispatch.mjs
--self-test`: exit 0, unchanged.
<details><summary>Ablations (each mutated through
scripts/ablation-replace.mjs, restored to the HEAD blob with git diff
HEAD empty)</summary>
1. Numeric acceptance removed (the own-id return becomes a refusal):
validate goes red on the REAL-shape case, and execute goes red on the
real-shape walk.
2. Id comparison removed (any id accepted): validate goes red on the
refused-links case and the REAL-shape case; execute goes red on the
off-link case and the another-id case.
3. Cursor redaction removed from the diagnostic (it prints the raw
value): validate goes red on the no-value sweep and the pinned shapes;
execute goes red on the another-id case and THE MARKER TEST.
</details>
## Acceptance notes
- This fix is verified for real only **after merge**, when a security
seat re-runs the card's re-check line (`advisory_list` through
`dispatch.mjs ... --reveal`) and it exits 0 with the listing opened. No
advisory was read for this PR. If the platform's real link breaks a
different condition, that run fails with the new `link shape:` text
naming which one, and the follow-up starts from that log line.
- Open question, not decided here: a `/repos/` link whose owner or name
differs from the request only in letter case stays refused. Nothing
measured shows the platform doing that. The diagnostic reports it as
"this repository in another letter case".
## Verification
Read first (risk order): `advisoryListNextCursor` and
`advisoryListLinkShape` in `scripts/pm/fleet-write/ops.mjs`, then the
`needsRepoId` branch in `advisoryListAction`
(`scripts/pm/fleet-write/execute.mjs`).
Two-minute check: `node scripts/pm/fleet-write/execute.mjs --self-test`
prints `433 cases pass across 30 batteries`, and the case starting "the
REAL next-link shape" is among them.
Seat: repo:objectstack#4 · os-project-manager ·
session_01FEkQ5kt9AD1TPLy7Y9oa9D
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 6aacad9 commit 31b2666
3 files changed
Lines changed: 212 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
368 | | - | |
369 | | - | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
370 | 373 | | |
371 | 374 | | |
372 | 375 | | |
| |||
675 | 678 | | |
676 | 679 | | |
677 | 680 | | |
| 681 | + | |
678 | 682 | | |
679 | 683 | | |
680 | 684 | | |
681 | 685 | | |
682 | 686 | | |
683 | 687 | | |
| 688 | + | |
| 689 | + | |
684 | 690 | | |
685 | 691 | | |
686 | 692 | | |
| |||
1844 | 1850 | | |
1845 | 1851 | | |
1846 | 1852 | | |
| 1853 | + | |
| 1854 | + | |
1847 | 1855 | | |
1848 | 1856 | | |
1849 | 1857 | | |
| |||
1863 | 1871 | | |
1864 | 1872 | | |
1865 | 1873 | | |
1866 | | - | |
1867 | | - | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
1868 | 1885 | | |
1869 | 1886 | | |
1870 | 1887 | | |
| |||
2633 | 2650 | | |
2634 | 2651 | | |
2635 | 2652 | | |
2636 | | - | |
| 2653 | + | |
2637 | 2654 | | |
2638 | 2655 | | |
2639 | 2656 | | |
| |||
4449 | 4466 | | |
4450 | 4467 | | |
4451 | 4468 | | |
| 4469 | + | |
| 4470 | + | |
| 4471 | + | |
| 4472 | + | |
| 4473 | + | |
4452 | 4474 | | |
4453 | 4475 | | |
4454 | 4476 | | |
| |||
4552 | 4574 | | |
4553 | 4575 | | |
4554 | 4576 | | |
4555 | | - | |
4556 | | - | |
| 4577 | + | |
| 4578 | + | |
| 4579 | + | |
| 4580 | + | |
| 4581 | + | |
| 4582 | + | |
| 4583 | + | |
| 4584 | + | |
| 4585 | + | |
| 4586 | + | |
| 4587 | + | |
| 4588 | + | |
| 4589 | + | |
| 4590 | + | |
| 4591 | + | |
| 4592 | + | |
| 4593 | + | |
| 4594 | + | |
| 4595 | + | |
| 4596 | + | |
4557 | 4597 | | |
4558 | | - | |
| 4598 | + | |
| 4599 | + | |
| 4600 | + | |
4559 | 4601 | | |
4560 | 4602 | | |
4561 | 4603 | | |
| |||
4596 | 4638 | | |
4597 | 4639 | | |
4598 | 4640 | | |
4599 | | - | |
| 4641 | + | |
4600 | 4642 | | |
4601 | 4643 | | |
4602 | 4644 | | |
| |||
0 commit comments