Remove empty deny block after notify cleanup#3794
Conversation
louis030195
left a comment
There was a problem hiding this comment.
@isanchez404 lgtm, great catch and elegant fix!
generated by the screenpipe pr-review pipe (https://screenpi.pe), not written by a human — reply and tag @louis030195 if it got something wrong.
|
Nice catch. The old Verified it end to end (reproduced on deny-only, multi-rule deny, other-fields, allow-before-deny, and deny-before-allow all pass. One small edge case, not a blocker: for compact YAML where list items sit at the same indent as their key, the new check is slightly worse than the old one. permissions:
deny:
- Api(POST /search)
- Api(POST /notify)Removing the notify rule now also drops If you want to cover both, keep the list-item clause but make it indent-aware (verified against both cases): const childIndent = lines[nextIdx].match(/^\s*/)?.[0].length ?? 0;
const isListItem = lines[nextIdx].trim().startsWith("-");
const hasChildren = childIndent > blockIndent || (isListItem && childIndent >= blockIndent);Either way this is a clean improvement. |
| const hasChildren = | ||
| nextIdx < lines.length && | ||
| (lines[nextIdx].startsWith(" ") || lines[nextIdx].trim().startsWith("-")); | ||
| (lines[nextIdx].match(/^\s*/)?.[0].length ?? 0) > blockIndent; |
There was a problem hiding this comment.
Optional, if you want to also handle compact same-indent block sequences (keeps the list-item case the old code covered, but indent-aware so the deny-before-allow fix still holds). Verified against both scenarios.
| const hasChildren = | |
| nextIdx < lines.length && | |
| (lines[nextIdx].startsWith(" ") || lines[nextIdx].trim().startsWith("-")); | |
| (lines[nextIdx].match(/^\s*/)?.[0].length ?? 0) > blockIndent; | |
| const childIndent = | |
| nextIdx < lines.length ? lines[nextIdx].match(/^\s*/)?.[0].length ?? 0 : -1; | |
| const isListItem = | |
| nextIdx < lines.length && lines[nextIdx].trim().startsWith("-"); | |
| const hasChildren = | |
| childIndent > blockIndent || (isListItem && childIndent >= blockIndent); |
e215e30 to
dc3a615
Compare
louis030195
left a comment
There was a problem hiding this comment.
@isanchez404 nice yaml parsing fix and solid test coverage. looks good to merge.
generated by the screenpipe pr-review pipe (https://screenpi.pe), not written by a human — reply and tag @louis030195 if it got something wrong.
Strengthens the unit suites for the three Tier-1 fixes just merged: - media-file-path (#3845): malformed percent-escapes, no-extension / empty / backtick inputs, case-insensitive ext, Windows forward-slash path in text, Unix audio-chunk path with spaces+parens; audio/media classifier casing; already-wrapped markdown link, > escaping, Windows path in a markdown link. - context-pruning (#3854): malformed <conversation_history> blocks (unterminated, close-before-open) fall back to generic head+tail; multiple oversized text blocks clamped while non-text blocks untouched; non-string/non-array message content ignored; zero window from getContextUsage falls back to default. - notification-toggle (#3794): notify rule detected across a blank line in the deny block; enable keeps permissions+allow children when only the notify deny rule existed; deny block retained when a non-notify rule remains. Test-only. Full vitest suite green (486 tests). These functions are pure modules; the wdio e2e suite mocks pi and drives whole-app UI, so the deterministic edge-case layer for them is vitest (the context-pruning suite is already documented as the extension's real e2e coverage). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Summary
permissions.denyblock after removingApi(POST /notify)allowrules whendenyappears beforeallowin frontmatterValidation
vet "Fix empty deny-block cleanup when allow follows it in notification toggle frontmatter" --agentic --agent-harness claude --history-loader "python3 ~/.codex/skills/vet/scripts/export_codex_session.py --session-file /Users/isaac.sanchez/.codex/sessions/2026/06/03/rollout-2026-06-03T09-01-53-019e8d93-7a00-7162-9086-ccd5b79846a4.jsonl"node --experimental-strip-types - <<'NODE' ... NODE(asserted deny-before-allow cleanup preservesallowand removesdeny:)git diff --checkRisk Notes
notification-toggle.tsChanged Area
apps/screenpipe-app-tauri/lib/utils/notification-toggle.tsapps/screenpipe-app-tauri/lib/utils/notification-toggle.test.tsSkipped Test Rationale
bun run typecheckfailed in this sandbox witherror: bun is unable to write files to tempdir: PermissionDeniedbunx vitest run lib/utils/notification-toggle.test.tsfailed in this sandbox with the same Bun tempdir permission error