Commit 95b2cf4
* fix(review): pin the verified git identity across the residue probe (#9557)
`worktreeResidue` verified a tree's identity once and then ran five commands
that each re-discovered the repository from `cwd`, through the same `.git`
file the check had read — a file writable by anything running as this user.
Two halves, and they close different windows:
- **The gate now requires the gitfile's admin entry to point BACK at this
tree.** A repository whose `core.worktree` names this path answers
`--show-toplevel` with this path, so the old gate saw itself while every
command after it measured the plant's index — which already holds the
contamination as committed content, so `status` comes back clean for a tree
with a mutant in it. A planted standalone repo has no admin entry to
round-trip; `scratch-tree` gates its own reset on exactly this.
- **The verified `--git-dir`/`--work-tree` are pinned onto every later spawn**,
so a swap that lands AFTER the gate cannot redirect them either.
The reason recorded against doing this — that an explicit pin changes what
`ls-files` resolves, so it needs its own round — was measured and is wrong.
Across a standalone checkout, a linked worktree, a superproject with an
initialised submodule, and a worktree reached through a symlinked ancestor, all
five commands return **byte-identical** output pinned and unpinned. What was
right about it is that it needed measuring, which is what this is.
The backpointer half is pinned by a test that goes red without it. The pin half
is not: it closes a check-then-use window the suite cannot open deterministically
(the swap has to land between two spawns). Its evidence is a shell repro — with
the identity captured, then the gitfile swapped, discovery reports a clean tree
while the pinned commands still report ` M a.ts` and the untracked probe file.
Saying that rather than implying a pin that is not there.
* fix(review): refuse symlink redirects and forged admin entries in the residue probe (#9742)
* fix(review): fail closed on unanchored clean verdicts and steered boundaries (#9742)
The residue probe's identity gate answered CLEAN for shapes it cannot
vouch for. Four closes, all fail-closed:
- A repository answering for a path it does not contain — the common
dir no literal ancestor of the tree path — is refused before the
symlink walk. That is the shape a forge uses to steer the walk's own
stop boundary so it fires before the planted link is lstat'd, and the
walk's bound escaping to the filesystem root misdiagnosed refusals
(and reddened the suite on hosts whose tmpdir resolves through a
symlink).
- A clean measurement no fetched-head record anchored is refused: a
forged pair answers clean too, so an unanchored empty status
certifies whichever index the gitfile names. Dirty reports still
name paths — a forge answers clean, never dirty.
- The agent-prompt wiring fails closed when the plan's fetchedSha is
absent or malformed instead of degrading to an unpinned probe: every
worktree-mode fetch writes the field.
- A dangling admin-entry backpointer is "does not point back", not the
outer catch's "not a git worktree".
Comments now say what the pin actually closes (post-gate identity
redirect, pre-planted shapes) and what it does not (in-window state
presentation by an active writer — cost-raising, not closure; the
structural close is the sandbox boundary, #9556).
Witnessed: every guard flips its focused tests when removed (mutation
probes), including new ones for the case-fold, the unreadable-HEAD arm,
the sha handover seam, and the sha-less production caller. Fixtures
realpath their roots so the suite holds under any tmpdir spelling.
* fix(review): anchor the scratch-tree residue check and name unmeasured reasons (#9742)
Three closes on the round-4 findings, all inside the residue probe's
own footprint:
- The sha-less production caller flattened the tampering signal the
probe exists to protect: the no-record refusal fired on 100% of
clean runs, so a note that fires always is a note nobody reads.
scratch-tree now takes --fetched-sha, agent-prompt welds the plan's
record into the verifier's command, and a healthy shared tree
measures clean again — a forged pair is refused at the pin with a
distinguishable reason instead.
- The unmeasured renderers blamed `git status` for refusals where it
never failed (the gates run before it; the no-record tail runs after
it answered CLEAN), sending triagers to debug a git environment
with nothing wrong. All three renderings now name a reason.
- The ancestor-symlink walk had no witness: both sibling shapes
refuse at earlier gates, and deleting the arm shipped green
(measured). A shape that passes the leaf, the self-equality and the
boundary gate leaves only the walk to refuse it.
* test(review): pin the fetched-sha CLI contract and the weld continuation (#9742)
* test(review): share the forge-territory fixture across the redirect residue tests (#9742)
* fix(review): admit healthy trees spelled through links above the root (#9742)
* fix(review): canonicalise both spellings the containment gate compares (#9742)
* fix(review): admit healthy layouts and refuse unpinned or drifting trees (#9742)
---------
Co-authored-by: qwen-code-ci-bot <qwen-code-ci-bot@users.noreply.github.com>
Co-authored-by: qwen-code-dev-bot <qwen-code-dev@service.alibaba.com>
1 parent 3a9d2d3 commit 95b2cf4
6 files changed
Lines changed: 1221 additions & 57 deletions
File tree
- packages/cli/src/commands/review
- lib
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
1479 | 1480 | | |
1480 | 1481 | | |
1481 | 1482 | | |
1482 | | - | |
| 1483 | + | |
1483 | 1484 | | |
1484 | 1485 | | |
1485 | 1486 | | |
| |||
1504 | 1505 | | |
1505 | 1506 | | |
1506 | 1507 | | |
1507 | | - | |
1508 | | - | |
1509 | | - | |
1510 | | - | |
1511 | | - | |
1512 | | - | |
1513 | | - | |
1514 | | - | |
1515 | | - | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
1516 | 1520 | | |
1517 | 1521 | | |
1518 | 1522 | | |
| |||
1533 | 1537 | | |
1534 | 1538 | | |
1535 | 1539 | | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
1536 | 1571 | | |
1537 | 1572 | | |
1538 | 1573 | | |
1539 | 1574 | | |
1540 | 1575 | | |
1541 | 1576 | | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
1542 | 1669 | | |
1543 | 1670 | | |
1544 | 1671 | | |
| |||
2839 | 2966 | | |
2840 | 2967 | | |
2841 | 2968 | | |
| 2969 | + | |
| 2970 | + | |
| 2971 | + | |
| 2972 | + | |
| 2973 | + | |
| 2974 | + | |
| 2975 | + | |
| 2976 | + | |
| 2977 | + | |
| 2978 | + | |
| 2979 | + | |
| 2980 | + | |
| 2981 | + | |
| 2982 | + | |
| 2983 | + | |
| 2984 | + | |
| 2985 | + | |
| 2986 | + | |
| 2987 | + | |
| 2988 | + | |
| 2989 | + | |
| 2990 | + | |
| 2991 | + | |
| 2992 | + | |
| 2993 | + | |
| 2994 | + | |
| 2995 | + | |
| 2996 | + | |
| 2997 | + | |
| 2998 | + | |
| 2999 | + | |
| 3000 | + | |
| 3001 | + | |
| 3002 | + | |
| 3003 | + | |
| 3004 | + | |
2842 | 3005 | | |
2843 | 3006 | | |
2844 | 3007 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
103 | 107 | | |
104 | 108 | | |
105 | 109 | | |
| |||
151 | 155 | | |
152 | 156 | | |
153 | 157 | | |
| 158 | + | |
| 159 | + | |
154 | 160 | | |
155 | 161 | | |
156 | 162 | | |
| |||
1316 | 1322 | | |
1317 | 1323 | | |
1318 | 1324 | | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
1319 | 1346 | | |
1320 | 1347 | | |
1321 | 1348 | | |
| |||
1325 | 1352 | | |
1326 | 1353 | | |
1327 | 1354 | | |
1328 | | - | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
1329 | 1377 | | |
1330 | 1378 | | |
1331 | 1379 | | |
| |||
1380 | 1428 | | |
1381 | 1429 | | |
1382 | 1430 | | |
1383 | | - | |
| 1431 | + | |
1384 | 1432 | | |
1385 | 1433 | | |
1386 | 1434 | | |
| |||
1649 | 1697 | | |
1650 | 1698 | | |
1651 | 1699 | | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
1652 | 1705 | | |
1653 | 1706 | | |
1654 | 1707 | | |
| |||
1667 | 1720 | | |
1668 | 1721 | | |
1669 | 1722 | | |
1670 | | - | |
| 1723 | + | |
| 1724 | + | |
1671 | 1725 | | |
1672 | 1726 | | |
1673 | 1727 | | |
| |||
3212 | 3266 | | |
3213 | 3267 | | |
3214 | 3268 | | |
3215 | | - | |
| 3269 | + | |
3216 | 3270 | | |
3217 | 3271 | | |
3218 | 3272 | | |
| |||
0 commit comments