diff --git a/zddc/internal/handler/auth_invariants_test.go b/zddc/internal/handler/auth_invariants_test.go
index 869c694..13488c9 100644
--- a/zddc/internal/handler/auth_invariants_test.go
+++ b/zddc/internal/handler/auth_invariants_test.go
@@ -157,26 +157,34 @@ func TestInvariant_ElevatedSubtreeAdminBlockedOutsideScope(t *testing.T) {
// ── Invariant 4 — .zddc strict-ancestor self-elevation prevention ─────────
-func TestInvariant_SubtreeAdminCannotEditOwnSubtreeZddc(t *testing.T) {
- // alice's authority comes from /Project-1/working/.zddc. She must
- // NOT be able to edit that file — strict-ancestor rule prevents
- // her from adding peers, removing the delegator, or otherwise
- // self-elevating.
+// Strict-ancestor was retired — a subtree admin owns their .zddc.
+// These tests pin the post-change contract: an elevated admin
+// granted in /
/.zddc CAN edit that file (add collaborators,
+// adjust ACLs, even — accidentally — remove themselves). Footgun
+// is recoverable via super-admin restore.
+
+func TestInvariant_SubtreeAdminCanEditOwnSubtreeZddc(t *testing.T) {
cfg, _ := invariantsFixture(t)
p := zddc.Principal{Email: "alice@example.com", Elevated: true}
dir := filepath.Join(cfg.Root, "Project-1/working")
- if zddc.CanEditZddc(cfg.Root, dir, p) {
- t.Fatalf("subtree admin can edit own .zddc — strict-ancestor rule bypassed")
+ chain, err := zddc.EffectivePolicy(cfg.Root, dir)
+ if err != nil {
+ t.Fatalf("EffectivePolicy: %v", err)
+ }
+ if !zddc.IsAdminForChain(chain, p.Email, false) {
+ t.Fatalf("subtree admin lost authority to edit own .zddc — strict-ancestor wasn't supposed to apply")
}
}
func TestInvariant_SubtreeAdminCanEditDeeperZddc(t *testing.T) {
- // alice's authority over Project-1/working/ should let her create
- // or edit .zddc files in deeper subtrees (e.g., per-user homes).
cfg, _ := invariantsFixture(t)
p := zddc.Principal{Email: "alice@example.com", Elevated: true}
dir := filepath.Join(cfg.Root, "Project-1/working/eve@example.com")
- if !zddc.CanEditZddc(cfg.Root, dir, p) {
+ chain, err := zddc.EffectivePolicy(cfg.Root, dir)
+ if err != nil {
+ t.Fatalf("EffectivePolicy: %v", err)
+ }
+ if !zddc.IsAdminForChain(chain, p.Email, false) {
t.Fatalf("subtree admin blocked from editing deeper .zddc")
}
}
diff --git a/zddc/internal/handler/tables.html b/zddc/internal/handler/tables.html
index 10d94f2..2dad3ad 100644
--- a/zddc/internal/handler/tables.html
+++ b/zddc/internal/handler/tables.html
@@ -1559,7 +1559,7 @@ body.is-elevated {