Skip to content

fix(rules): skip deletes by default and protect system roles/policies - #106

Merged
matt-rolley merged 3 commits into
v7from
fix/rules-delete-guards
Oct 6, 2026
Merged

matt-rolley merged 3 commits into
v7from
fix/rules-delete-guards

Conversation

@matt-rolley

Copy link
Copy Markdown
Contributor

Problem

pushRules deleted remote-only roles/policies when they were absent from a hand-authored partial ruleset. With an admin token that can drop Administrator, Public, and admin_access policies — a production footgun.

skipDeletes also defaulted to false, so opt-out was the only safe mode.

Fix

  • skipDeletes defaults to true (additive push by default).
  • CLI: pass --delete to allow remote-only removals; --skip-deletes remains a no-op alias of the new default.
  • Hard-protect system entities regardless of flags:
    • Roles: Administrator, Public, $t:public_label
    • Policies: admin_access: true, plus known system names (Administrator, Public, $t:admin_policy, …)

Protected removals are recorded as skipped rather than attempted deletes.

Tests

Unit coverage for isProtectedRole / isProtectedPolicy.

Breaking change

Callers that relied on destructive sync without opting in must now pass skipDeletes: false (or CLI --delete).

Partial hand-authored rulesets used to mark Administrator/Public as
removed and delete them when push ran with an admin token. skipDeletes
now defaults to true; pass --delete (or skipDeletes: false) to allow
remote-only removals. Administrator, Public, admin_access policies, and
known system names are never deleted regardless of the flag.
@vercel

vercel Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
nuxt-directus-sdk Ready Ready Preview Oct 5, 2026 4:58pm UTC
nuxt-directus-sdk-playground Ready Ready Preview Oct 5, 2026 4:58pm UTC

Request Review

@pkg-pr-new

pkg-pr-new Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/nuxt-directus-sdk@106

commit: 67bfc3b

- rules:push errors when --skip-deletes and --delete are both passed
  instead of silently letting --delete win
- protected role/policy skips now use a dedicated reason field so they
  are not conflated with error skips, and formatPushResult lists them
  under a Skipped section so --delete users can see why nothing was
  removed
@matt-rolley
matt-rolley changed the base branch from main to v7 October 6, 2026 08:55
@matt-rolley
matt-rolley merged commit 8c3483c into v7 Oct 6, 2026
5 checks passed

This branch was successfully deployed

2 active deployments
Preview – nuxt-directus-sdk-playground — 67bfc3b6 Deployed Oct 5, 2026 by vercel[bot]
Preview – nuxt-directus-sdk — 67bfc3b6 Deployed Oct 5, 2026 by vercel[bot]
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