Repository navigation
fix(devtools): refuse an oversized closure graph instead of truncating - #4398
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4d60ae2b1b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
#4401) ## Summary Make the definition-closure evaluator refuse input it cannot represent, and surface explicit exceptions on the rendered graph. ## Problem `evaluate` silently dropped data at three bounds: it `break`-ed out of the row loop at `MAX_GRAPH_ROWS`, and truncated evidence with `tuple(refs)[:MAX_EDGES_PER_DEFINITION]`. A graph built past either bound still reported its status counts as if complete, so the closure gate could read "satisfied" over a partial graph — the failure mode the gate exists to prevent. Explicit intentional absences were also only reachable by correlating policy and row payloads, so an exception could not be audited from the rendered graph alone. ## Solution - Exceeding `MAX_GRAPH_ROWS` or `MAX_EDGES_PER_DEFINITION` raises `ValueError` naming the bound, instead of truncating. - `ClosurePolicy` validation rejects a duplicate required edge kind. - `DefinitionClosureGraph.exceptions` renders every explicit exception, including ones with no row, and `to_dict` carries it. ## Verification `devtools test tests/unit/devtools/test_definition_closure.py` → 11 passed. New tests assert the two bounded-limit refusals via `pytest.raises(..., match="bounded definition limit")` and `match="bounded edge limit"`; reverting either raise to the prior slice or `break` turns them red. Quick gate green apart from `browser-extension/tests/background.test.js`, which fails only under concurrent host load and is green on master — filed as polylogue-xe4hx. ## Residual risk `policy.definitions[:MAX_DEFINITIONS]` still truncates silently per policy. A single policy exceeding that bound while the total stays under `MAX_GRAPH_ROWS` reaches none of the new refusals. Filed separately; this change does not close it. ## Note An earlier PR (#4398) for this change merged as an empty commit: its branch head was based on a stale master, so the squash produced no file changes while landing a commit message describing the fix. Master was not damaged — `git diff-tree d0094af` lists zero files — but the fix did not land. This PR carries the actual change, rebased onto current master.
#4398) ## Summary Make the definition-closure evaluator refuse input it cannot represent, and surface explicit exceptions on the rendered graph. ## Problem `evaluate` silently dropped data at three bounds: it `break`-ed out of the row loop at `MAX_GRAPH_ROWS`, and truncated evidence with `tuple(refs)[:MAX_EDGES_PER_DEFINITION]`. A graph built past either bound still reported its status counts as if complete, so the closure gate could read "satisfied" over a partial graph — the failure mode the gate exists to prevent. Explicit intentional absences were also only reachable by correlating policy and row payloads, so an exception could not be audited from the rendered graph alone. ## Solution - Exceeding `MAX_GRAPH_ROWS` or `MAX_EDGES_PER_DEFINITION` raises `ValueError` naming the bound, instead of truncating. - `ClosurePolicy` validation rejects a duplicate required edge kind. - `DefinitionClosureGraph.exceptions` renders every explicit exception, including ones with no row, and `to_dict` carries it. ## Verification `devtools test tests/unit/devtools/test_definition_closure.py` → 11 passed. New tests assert the two bounded-limit refusals via `pytest.raises(..., match="bounded definition limit")` and `match="bounded edge limit"`; reverting either raise to the prior slice or `break` turns them red. Quick gate green apart from `browser-extension/tests/background.test.js`, which fails only under concurrent host load and is green on master — filed as polylogue-xe4hx. ## Residual risk `policy.definitions[:MAX_DEFINITIONS]` still truncates silently per policy. A single policy exceeding that bound while the total stays under `MAX_GRAPH_ROWS` reaches none of the new refusals. Filed separately; this change does not close it.
#4398) ## Summary Make the definition-closure evaluator refuse input it cannot represent, and surface explicit exceptions on the rendered graph. ## Problem `evaluate` silently dropped data at three bounds: it `break`-ed out of the row loop at `MAX_GRAPH_ROWS`, and truncated evidence with `tuple(refs)[:MAX_EDGES_PER_DEFINITION]`. A graph built past either bound still reported its status counts as if complete, so the closure gate could read "satisfied" over a partial graph — the failure mode the gate exists to prevent. Explicit intentional absences were also only reachable by correlating policy and row payloads, so an exception could not be audited from the rendered graph alone. ## Solution - Exceeding `MAX_GRAPH_ROWS` or `MAX_EDGES_PER_DEFINITION` raises `ValueError` naming the bound, instead of truncating. - `ClosurePolicy` validation rejects a duplicate required edge kind. - `DefinitionClosureGraph.exceptions` renders every explicit exception, including ones with no row, and `to_dict` carries it. ## Verification `devtools test tests/unit/devtools/test_definition_closure.py` → 11 passed. New tests assert the two bounded-limit refusals via `pytest.raises(..., match="bounded definition limit")` and `match="bounded edge limit"`; reverting either raise to the prior slice or `break` turns them red. Quick gate green apart from `browser-extension/tests/background.test.js`, which fails only under concurrent host load and is green on master — filed as polylogue-xe4hx. ## Residual risk `policy.definitions[:MAX_DEFINITIONS]` still truncates silently per policy. A single policy exceeding that bound while the total stays under `MAX_GRAPH_ROWS` reaches none of the new refusals. Filed separately; this change does not close it.
#4401) ## Summary Make the definition-closure evaluator refuse input it cannot represent, and surface explicit exceptions on the rendered graph. ## Problem `evaluate` silently dropped data at three bounds: it `break`-ed out of the row loop at `MAX_GRAPH_ROWS`, and truncated evidence with `tuple(refs)[:MAX_EDGES_PER_DEFINITION]`. A graph built past either bound still reported its status counts as if complete, so the closure gate could read "satisfied" over a partial graph — the failure mode the gate exists to prevent. Explicit intentional absences were also only reachable by correlating policy and row payloads, so an exception could not be audited from the rendered graph alone. ## Solution - Exceeding `MAX_GRAPH_ROWS` or `MAX_EDGES_PER_DEFINITION` raises `ValueError` naming the bound, instead of truncating. - `ClosurePolicy` validation rejects a duplicate required edge kind. - `DefinitionClosureGraph.exceptions` renders every explicit exception, including ones with no row, and `to_dict` carries it. ## Verification `devtools test tests/unit/devtools/test_definition_closure.py` → 11 passed. New tests assert the two bounded-limit refusals via `pytest.raises(..., match="bounded definition limit")` and `match="bounded edge limit"`; reverting either raise to the prior slice or `break` turns them red. Quick gate green apart from `browser-extension/tests/background.test.js`, which fails only under concurrent host load and is green on master — filed as polylogue-xe4hx. ## Residual risk `policy.definitions[:MAX_DEFINITIONS]` still truncates silently per policy. A single policy exceeding that bound while the total stays under `MAX_GRAPH_ROWS` reaches none of the new refusals. Filed separately; this change does not close it. ## Note An earlier PR (#4398) for this change merged as an empty commit: its branch head was based on a stale master, so the squash produced no file changes while landing a commit message describing the fix. Master was not damaged — `git diff-tree d0094af` lists zero files — but the fix did not land. This PR carries the actual change, rebased onto current master.
#4398) ## Summary Make the definition-closure evaluator refuse input it cannot represent, and surface explicit exceptions on the rendered graph. ## Problem `evaluate` silently dropped data at three bounds: it `break`-ed out of the row loop at `MAX_GRAPH_ROWS`, and truncated evidence with `tuple(refs)[:MAX_EDGES_PER_DEFINITION]`. A graph built past either bound still reported its status counts as if complete, so the closure gate could read "satisfied" over a partial graph — the failure mode the gate exists to prevent. Explicit intentional absences were also only reachable by correlating policy and row payloads, so an exception could not be audited from the rendered graph alone. ## Solution - Exceeding `MAX_GRAPH_ROWS` or `MAX_EDGES_PER_DEFINITION` raises `ValueError` naming the bound, instead of truncating. - `ClosurePolicy` validation rejects a duplicate required edge kind. - `DefinitionClosureGraph.exceptions` renders every explicit exception, including ones with no row, and `to_dict` carries it. ## Verification `devtools test tests/unit/devtools/test_definition_closure.py` → 11 passed. New tests assert the two bounded-limit refusals via `pytest.raises(..., match="bounded definition limit")` and `match="bounded edge limit"`; reverting either raise to the prior slice or `break` turns them red. Quick gate green apart from `browser-extension/tests/background.test.js`, which fails only under concurrent host load and is green on master — filed as polylogue-xe4hx. ## Residual risk `policy.definitions[:MAX_DEFINITIONS]` still truncates silently per policy. A single policy exceeding that bound while the total stays under `MAX_GRAPH_ROWS` reaches none of the new refusals. Filed separately; this change does not close it.
|
Closing out open Codex review threads on this PR (evidence checked against master at 64a9bd0):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
|
Closing out open Codex review threads on this PR (evidence checked against master at bf68918):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
Summary
Make the definition-closure evaluator refuse input it cannot represent, and surface explicit exceptions on the rendered graph.
Problem
evaluatesilently dropped data at three bounds: itbreak-ed out of the row loop atMAX_GRAPH_ROWS, and truncated evidence withtuple(refs)[:MAX_EDGES_PER_DEFINITION]. A graph built past either bound still reported its status counts as if complete, so the closure gate could read "satisfied" over a partial graph — the failure mode the gate exists to prevent.Explicit intentional absences were also only reachable by correlating policy and row payloads, so an exception could not be audited from the rendered graph alone.
Solution
MAX_GRAPH_ROWSorMAX_EDGES_PER_DEFINITIONraisesValueErrornaming the bound, instead of truncating.ClosurePolicyvalidation rejects a duplicate required edge kind.DefinitionClosureGraph.exceptionsrenders every explicit exception, including ones with no row, andto_dictcarries it.Verification
devtools test tests/unit/devtools/test_definition_closure.py→ 11 passed. New tests assert the two bounded-limit refusals viapytest.raises(..., match="bounded definition limit")andmatch="bounded edge limit"; reverting either raise to the prior slice orbreakturns them red.Quick gate green apart from
browser-extension/tests/background.test.js, which fails only under concurrent host load and is green on master — filed as polylogue-xe4hx.Residual risk
policy.definitions[:MAX_DEFINITIONS]still truncates silently per policy. A single policy exceeding that bound while the total stays underMAX_GRAPH_ROWSreaches none of the new refusals. Filed separately; this change does not close it.