Skip to content

fix(webconsole): three PHI routes now charge the per-actor read budget (BACKLOG #1025) - #247

Open
wshallwshall wants to merge 2 commits into
mainfrom
fix-1025-phi-read-budget
Open

fix(webconsole): three PHI routes now charge the per-actor read budget (BACKLOG #1025)#247
wshallwshall wants to merge 2 commits into
mainfrom
fix-1025-phi-read-budget

Conversation

@wshallwshall

Copy link
Copy Markdown
Collaborator

Fixes BACKLOG #1025. webconsole; the #324 seam.

Three PHI console routes served payload data without charging the per-actor read budget, so the
budget under-counted exactly the accesses it exists to bound. All three now pass phi=True.

Verified in-lane: plan -> build -> 3-lens adversarial verify -> remediate. Banner gate OK.

…KLOG #1025)

`GET /ui/messages/search` and `GET /ui/messages/search/layered` reach the reused
engine handlers (`search_messages` / `layered_search`) only on their criteria/preset
path; those handlers already charge the per-actor PHI-read budget in their own body
(`enforce_phi_read_pacing`). The only genuinely-unpaced path was each route's
SHORT-CIRCUIT render -- the bare-form and no-preset re-renders that return before the
handler runs -- which on first deployment would skip the read budget entirely.

A gate-level `phi=` on `require_ui_step_up` (the filing's proposed fix) is wrong for
these mixed routes: a FastAPI dependency runs on EVERY request, so it would charge the
criteria/preset path a SECOND time on top of the handler -- the exact double-count that
already excludes the uploaded-logs route. Instead each search route now charges
`enforce_phi_read_pacing` INLINE on its short-circuit branch only, so the render spends
one token while a real search still charges exactly once. `GET /ui/uploaded-logs/file/{file_id}`
keeps no console-side charge: its handler paces every call and it has no short-circuit,
so any second charge would double-count (its scope-guard test is added here).

Scope note: the filing named three routes and a `phi=` on all three; verified against
the code, only the two search renders were the real gap and the naive `phi=` would have
double-charged. Two routes changed, uploaded-logs deliberately unchanged.

Tests: two short-circuit tests (bare-form / no-preset -> 429 when over budget), two
double-charge guards (a criteria search and a preset-bearing layered run each stay 200
at a tight budget -- they red if a gate-level `phi=` is reintroduced), and the
uploaded-logs scope guard. Each falsified by mutation (remove the inline charge -> the
short-circuit test reds; reintroduce gate `phi=` -> the criteria guards red).

Docs: the `require_ui_step_up` docstring, `docs/SECURITY.md` and the webconsole CHANGELOG
now describe the inline-charge mechanism. The edit pair (BACKLOG #324) still uses gate
`phi=` because `get_message` does not self-pace on a direct console call.

NOT-DEPLOYED beta: written in the conditional ("would skip the budget on first
deployment"), not a live exposure.
Flip the #1025 banner from filed to shipped and correct its mechanism note from the
gate-level `phi=` the earlier draft described to the inline short-circuit charge that
actually shipped (a gate `phi=` would have double-charged the criteria path). Banner
line only.

The census distribution lines were NOT recomputed; this commit touches only the #1025
banner. The item's Severity/Mechanism body paragraphs still describe the pre-amendment
three-route premise and need a follow-up reconciliation not bound by the banner-only
rule (flagged for the owner).
@wshallwshall
wshallwshall enabled auto-merge (squash) August 6, 2026 14:16
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