Skip to content

policy: accept oversize: deny so a pack can get the deny back - #736

Merged
LoopGlitch26 merged 2 commits into
Cygnux-Labs:mainfrom
Shivansh22Saroha:oversize-deny-setting
Nov 12, 2026
Merged

LoopGlitch26 merged 2 commits into
Cygnux-Labs:mainfrom
Shivansh22Saroha:oversize-deny-setting

Conversation

@Shivansh22Saroha

Copy link
Copy Markdown
Contributor

Closes #733

oversize accepted only ask, so a pack built on dev.yaml could not get
the deny back (extends: dev.yaml plus oversize: deny was a lint error).

  • compile.py: oversize now accepts ask or deny; anything else is still
    a lint error ("oversize must be ask or deny"). The engine needed no change:
    it only acts on oversize == "ask", so deny behaves as the key left out.
  • A child pack's oversize overrides its parent's through extends.
  • docs/policy-v2.md: documents both values (TK-OVERSIZE row, file-format
    example, and a short paragraph).
  • Tests (tests/test_policy2.py): oversize: deny is accepted; oversize: maybe
    is a lint error; a child's deny overrides the parent's ask; extends: dev.yaml
    plus oversize: deny denies a 108 KB Write, while dev.yaml alone still holds it.

Checked: tests/test_policy2.py and tests/test_eval_docs.py pass, tracekit policy lint is clean on every shipped pack, and make eval shows no verdict
changes (only the regex version string differs in two result files, from my
environment, so I did not commit them).

AI assistance: I used Claude to help plan and write this change. I ran the
tests and reviewed every line myself.

Signed-off-by: Shivansh Saroha <4shivanshsaroha@gmail.com>

@LoopGlitch26 LoopGlitch26 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, this is what #733 asked for, and it reads right. _lint now takes ask or deny; compile.build already lets a child's top-level keys win over its parent's (L365-366), so extends: dev.yaml plus oversize: deny gets deny; and the engine acts only on oversize == "ask" (engine.py L435), so deny behaves as the key left out. The new test checks the 108 KB Write both ways, which is the case that matters. The packs don't change, so no eval results move.

The CI runs for this branch still need an approval on our side. Once they're green and the final head has its last check, it goes to the owner to merge.

Signed-off-by: Shivansh Saroha <4shivanshsaroha@gmail.com>
@Shivansh22Saroha

Copy link
Copy Markdown
Contributor Author

Pushed a fix for the Windows/macOS failures, which were in my new test, not the change:
os.path.relpath between the temp dir and the repo fails across drives on Windows and
likely misresolves through the /var symlink on macOS. The test now copies the packs into
the temp dir and extends packs/dev.yaml, and it asserts the build has no errors.

@LoopGlitch26 LoopGlitch26 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Re-checked at 630f309.

The new test now copies the packs into the temp dir and extends packs/dev.yaml, as Compile already does at tests/test_policy2.py L302, and asserts the child builds with no errors. That covers both failures at 7085600: on Windows os.path.relpath crossed drives, and on macOS the child decided allow, as one whose extends didn't resolve would; with the errors asserted, that can't pass silently again. Without the compile.py change the child's build returns "oversize must be ask", so the test still fails without the fix.

One small cleanup: import shutil and from tracekit.policy2.engine import Engine inside test_oversize_deny_on_a_pack_extending_dev_denies_a_large_write repeat imports already at the top of the file (L11 and L30), so they can go.

Ready to merge once CI on 630f309 is green; its CI and DCO runs still need an approval on our side.

@LoopGlitch26
LoopGlitch26 merged commit dd04d5d into Cygnux-Labs:main Nov 12, 2026
59 of 60 checks passed
@LoopGlitch26

Copy link
Copy Markdown
Member

Merged, thanks. A pack can now set oversize: deny and get the deny back, and the lint accepts it. It ships in the next release.

If you'd like another one close to this: #769 measures the dev signer's cold start since the bigger dev pack, which is mostly policy-loading time, and #770 makes the MCP gateway name the real cause when an upstream can't be opened.

A request: if you use a coding agent (Claude Code, Codex, Cursor, Gemini CLI or OpenCode), would you run Tracekit on it for a week, on your own projects?

pip install -U tracekit-ai
tracekit audit --since 7d   # read-only: what it would have held last week
tracekit init --dev --v2    # then record and guard from now on

After a week, tracekit report --share prints counts only (no commands, paths or content). Post it in #385; that's all we need.

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.

Policy: let a pack set oversize: deny, so a deployment built on dev.yaml can get the deny back

2 participants