Skip to content

Custody's second rung was macOS-only too, and the ratchet is empty - #10

Merged
opencdlee-dotcom merged 1 commit into
feat/custody-gradingfrom
agent/claude/feat-custody-grading
Aug 25, 2026
Merged

Custody's second rung was macOS-only too, and the ratchet is empty#10
opencdlee-dotcom merged 1 commit into
feat/custody-gradingfrom
agent/claude/feat-custody-grading

Conversation

@opencdlee-dotcom

Copy link
Copy Markdown
Owner

Closes the two review findings deferred from #9, and empties the ratchet #9 introduced.

The other half of the macOS-only custody asymmetry

_grade_binary offers a sensor exactly two demotions: operator-vouched and
package-managed. #9 fixed publisher-stable; this fixes the second. The receipt probes were
Homebrew, VS Code, pipx and uv — so an apt/rpm/winget-installed binary, the ordinary shape of a
developer's toolchain, was scored at full severity with custody=None on Linux and Windows
while its Homebrew equivalent on macOS was demoted a step.

The Linux half needed no new machinery. _classify_linux had shelled out to dpkg/rpm/pacman
since forever to decide os-managed; custody simply never asked. That query is now
_linux_pkg_owner — one spelling, two callers, with a test asserting they agree.

Measured on real files:

input before after
…/Microsoft/WinGet/Packages/Foo.Bar_1.2.3/tool.exe None winget:Foo.Bar
…/Microsoft/WinGet/Links/tool.exe None winget:link
…/chocolatey/lib/ripgrep/tools/rg.exe None choco:ripgrep
/usr/bin/curl (Linux, dpkg) None dpkg:curl
…/Local/Temp/payload/tool.exe None None ← still earns nothing

_os_package_receipt sits last in _PACKAGE_RECEIPTS (three subprocesses vs pure path
arithmetic above it) and memoizes per resolved path, both tested.

The ratchet is empty

Emptied by shrinking, with the stale-entry check still guarding it, so it cannot quietly
become an exemption list. Its last three entries were settled by mutation rather than by
reading: swapping all four "developer-id" sites to PUBLISHER_TRUST broke exactly one test —
TestHotDirAppBundle's, whose subject is an unnotarized Developer-ID .app, a Gatekeeper
concept with no analog on any other body, in a class conftest already gates to macOS. That
literal stays with the reason recorded above the class. The other three were inert:
target_trust is written at aegis.py:11172 and read by no gate at all.

Verification

Targets feat/custody-grading rather than pushing to it, because another agent holds an
uncommitted ci.yml edit in that checkout.

🤖 Generated with Claude Code

Two deferred review findings, plus the debt the last commit left behind.

`_grade_binary` offers a sensor exactly two demotions: operator-vouched and
package-managed. The second consulted Homebrew, VS Code, pipx and uv — so an
apt/rpm/winget-installed binary, the ordinary shape of a developer's toolchain,
was scored at full severity with custody=None on Linux and Windows while its
Homebrew equivalent on macOS was demoted a step. Both rungs available off-mac
were narrower than on mac; the previous commit fixed one of them and this
fixes the other.

The Linux half needed no new machinery. `_classify_linux` had shelled out to
dpkg/rpm/pacman since forever to decide `os-managed`; custody simply never
asked. That query is now `_linux_pkg_owner` — one spelling, two callers, with a
test asserting they agree. It sits LAST in _PACKAGE_RECEIPTS because it can
cost three subprocesses while every probe above it is pure path arithmetic, and
it memoizes per resolved path because the custody layer asks about the same
handful of programs repeatedly within one scan (also tested: one query per
path, not four).

Windows gets `_winget_receipt` and `_choco_receipt`, path-shaped like the
portable probes beside them but normalizing separators instead of using os.sep,
so they are exercisable from any body — the same reason test_cross_platform
parses captured Windows output on a Mac. Measured on real files:

    before  [None, None, None]
    after   ['winget:Foo.Bar', 'winget:link', 'choco:ripgrep']

and on Linux, None -> 'dpkg:curl'. A path under Local/Temp still earns nothing;
a probe that demoted anything under a user-writable root would be a blind spot,
not a rung.

And the ratchet from the previous commit is EMPTY — by shrinking, not by
deletion, with the stale-entry check still guarding it. Its last three entries
were settled by mutation rather than by reading: swapping all four
"developer-id" sites to PUBLISHER_TRUST broke exactly one test,
TestHotDirAppBundle's, whose subject is an unnotarized Developer-ID .app — a
Gatekeeper concept with no analog on any other body, in a class conftest
already gates to macOS. That literal stays, with the reason recorded above the
class. The other three were inert: `target_trust` is written at aegis.py:11172
and read by no gate at all.

Verified: 1045 passed / 4 skipped on macOS, and the whole suite under simulated
linux and win diffed against 7279c68 — no new failures on either.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@opencdlee-dotcom
opencdlee-dotcom merged commit 9d8cdbf into feat/custody-grading Aug 25, 2026
7 checks passed
@opencdlee-dotcom
opencdlee-dotcom deleted the agent/claude/feat-custody-grading branch August 25, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant