Repository navigation
policy: accept oversize: deny so a pack can get the deny back - #736
Conversation
Signed-off-by: Shivansh Saroha <4shivanshsaroha@gmail.com>
LoopGlitch26
left a comment
There was a problem hiding this comment.
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>
|
Pushed a fix for the Windows/macOS failures, which were in my new test, not the change: |
LoopGlitch26
left a comment
There was a problem hiding this comment.
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.
|
Merged, thanks. A pack can now set 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? After a week, |
Closes #733
oversizeaccepted onlyask, so a pack built ondev.yamlcould not getthe deny back (
extends: dev.yamlplusoversize: denywas a lint error).compile.py:oversizenow acceptsaskordeny; anything else is stilla lint error ("oversize must be ask or deny"). The engine needed no change:
it only acts on
oversize == "ask", sodenybehaves as the key left out.oversizeoverrides its parent's throughextends.docs/policy-v2.md: documents both values (TK-OVERSIZE row, file-formatexample, and a short paragraph).
tests/test_policy2.py):oversize: denyis accepted;oversize: maybeis a lint error; a child's
denyoverrides the parent'sask;extends: dev.yamlplus
oversize: denydenies a 108 KBWrite, while dev.yaml alone still holds it.Checked:
tests/test_policy2.pyandtests/test_eval_docs.pypass,tracekit policy lintis clean on every shipped pack, andmake evalshows no verdictchanges (only the
regexversion string differs in two result files, from myenvironment, 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.