Skip to content

fix(devtools): refuse an oversized closure graph instead of truncating - #4398

Merged
Sinity merged 1 commit into
masterfrom
feature/packet/polylogue-9e5.31
Aug 28, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/packet/polylogue-9e5.31

Conversation

@Sinity

@Sinity Sinity commented Aug 28, 2026

Copy link
Copy Markdown
Owner

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-08-28T23:27:10.803294Z 4d60ae2 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e978fb96-c79d-4d91-bb78-ccb891210005


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread devtools/definition_closure.py Resolved
Comment thread devtools/definition_closure.py Resolved
Comment thread devtools/definition_closure.py Resolved
@Sinity
Sinity merged commit d0094af into master Aug 28, 2026
3 checks passed
@Sinity
Sinity deleted the feature/packet/polylogue-9e5.31 branch August 28, 2026 23:53
Sinity added a commit that referenced this pull request Aug 29, 2026
#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.
Sinity added a commit that referenced this pull request Aug 29, 2026
#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.
Sinity added a commit that referenced this pull request Sep 1, 2026
#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.
Sinity added a commit that referenced this pull request Sep 1, 2026
#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.
Sinity added a commit that referenced this pull request Sep 3, 2026
#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.
@Sinity

Sinity commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

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.

@Sinity

Sinity commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

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.

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