reputation-ladder: dry-run scorer for the public edge (card #1984) #2949
No reviewers
Labels
No labels
backlog
bug
enhancement
in-progress
library
needs-rebase
review
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ymrtech/nix-config!2949
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "kb/reputation-ladder"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Card nix-config#1984 (child of #1977 part (c)).
Lands the scorer only, in dry-run. Nothing is enforced;
--enforceexits 2 and says why.What it does
ymrtech-access.log+ the two decoy logs on public, per-IP sliding-window state in SQLite/var/lib/reputation-ladder/proposals.jsonlreplaysubcommand scores an offline JSONL corpus (that is how the backtest ran)Thresholds are measured, not chosen (7 days of ymrtech.com, 2026-11-18..25)
11.0.0.0/24Replay of the real corpus:
{0: 2355, 2: 35, 4: 28, 5: 1}over 2,419 IPs. The single rung-5 IP is195.178.110.22(617 req / 617 404). The browser-shape test is the discriminator: real browsers fetch a subresource per ~2-5 documents (asset/browser-UA 0.20-0.80), UA-faking crawlers sit at 0.02 and below, so a UA string alone decides nothing.Scope: one vhost, deliberately
ymrtech-access.logon public only. A realgit cloneasks hundreds of distinct paths, so the many-distinct-URLs term is a false-positive generator on git/chat/vault/paste — each needs its own measurement before it is scored.Rungs
0 pass · 2 throttle signal · 4 proposes · 5/6 heavier · 7-9 (ban / graduated ban / permanent) unreachable here — top of this ladder is the challenge rung, and the ban rungs wait for an owner ruling.
Enforcement path, not in this PR
A ban must enter the LAPI as an alert so the profile chain and the per-host
simulatedstamp keep working;--enforcerefuses until that exists.Unit hygiene
ProtectSystem=strict+StateDirectory(only writable path),SupplementaryGroups=caddyto read 0640caddy:caddylogs rather than loosening the mode,PrivateNetwork,NoNewPrivileges.Verification done locally
nix buildof the package: ok; the built binary'sreplayon the 7-day corpus reproduces{0: 2355, 2: 35, 4: 28, 5: 1}nix eval .#nixosConfigurations.public.config.fleet.reputationLadder: renders as intended.forgejo/tests/test-reputation-ladder.py: 13 checks, all pass; wired intorepo-gatesAfter merge
Dry-run 7 days → confirm the proposals reproduce the same 17 IPs → then (and only then) discuss enabling rungs 4-6.
c18e312c5be2d6c64185foremerge intent coverage (advisory) — 3 of 6 changed path(s) in ymrtech/nix-config#2949 have no live foremerge intent:
.forgejo/tests/test-reputation-ladder.pypackages/reputation-ladder/default.nixpackages/reputation-ladder/reputation_ladder.pyCoverage was decided by reading the repo's foremerge ledger (16 in-flight intent(s) considered) against this PR's changed paths — no branch or session name is involved, so a force-push does not change the answer. Paths that legitimately need no claim (docs,
.md,flake.lock) are excluded.This is advisory and does not block the merge. To clear it, publish intent for the paths above (
foremerge intent publish --agent <your agent id> --task <task> --summary <what and why> --scope file:<path>=modify), or ignore it if the work genuinely collides with nobody.e2d6c6418531279491c9Repo gates went red on
e2d6c641, and it was right to. The step I added wasnix-shell -p python3 --run "python3 .forgejo/tests/test-reputation-ladder.py"— the[ci]runner unit has noNIX_PATH, so it died onfile 'nixpkgs' was not found in the Nix search path. That is the failure mode another workflow documents (it setsNIX_PATH: 'nixpkgs=flake:nixpkgs'at workflow level); repo-gates deliberately has no nix in it at all.Rather than add a network/channel dependency to an offline battery, the suite now runs in the derivation's
checkPhase. It is hermetic, stdlib-only, 0.6 s, and it travels with the package into every closure that imports it —nix-build-checkbuildspublic, so the gate fires there on every PR that touches the package. The repo-gates step is reverted; that file is unchanged in the diff.Confirmed in the sandbox, not the source tree:
While mutation-testing that move I found a real defect.
challenge_for()had no caller — the promise in its docstring ("a browser-shaped IP is never challenged, it only escalates to a ban") was not implemented anywhere, and droppingand not browser_shapedleft the whole suite green. Both are fixed: proposals now carrybrowser_shapedand an explicitchallengefield, and the pure function is pinned by four checks.Five mutations, each red now:
return rung < 4(drop the browser-shape guard)"challenge": Nonescore >= floor / 4)11.0.0.0/24--enforceHead is now
31279491(19 checks). Also folded in since the first push:proposals.jsonlrotates at 50 MB — nothing on the fleet grows without a bound.