ZDDC/zddc/internal/handler
ZDDC f196205622 refactor(audit): pre-release cleanup pass
Single audit pass that removes pre-release back-compat, consolidates the
admin-policy decider, and fixes the .zddc write path.

Field removal — acl.allow / acl.deny:
- Drop ACLRules.Allow / Deny struct fields and mergeLegacyACL().
- Remove walker / lookups / validate / decider branches that read them.
- Migrate every test fixture (YAML strings and ACLRules struct literals)
  to acl.permissions: { principal → verb-set }.
- Rewrite both bundled Rego policies (access.rego, access_federal.rego)
  to traverse level.acl.permissions; rewrite parity-test helpers.
- Update create-project form (profile page) to collect permissions
  instead of allow/deny lists.

Admin decider consolidation:
- Delete zddc.CanEditZddc — strict-ancestor rule retired. Subtree admins
  own their own .zddc; the policy decider's IsActiveAdmin short-circuit
  is the single bypass site.
- Migrate tablehandler.ServeTable to AllowActionFromChainP — closes the
  same Forbidden bug already fixed for /browse.html.
- Drop AccessView.EditableParentChoices and treeEntry.CanEdit (always
  true after the retirement). Profile page renders AdminSubtrees
  directly for both lists.
- Drop the excludeLeaf parameter from AdminLevelInChain /
  IsAdminForChain — no production caller passed true.

Dead code removed:
- policy.AllowWriteFromChain (zero production callers, zero tests).
- zddc.AllowedWithChain (zero production callers; tests deleted).

ModeStrict retirement — federal posture is OPA-only:
- Delete cascade_mode.go / cascade_mode_test.go and the ModeStrict
  branches in cascade.go and acl.go.
- Drop --cascade-mode flag, CascadeMode config field, and the
  InternalDecider.Mode field.
- Drop the mode parameter from every cascade helper:
  GrantedVerbsAtLevel, AllowedAction, EffectiveVerbs,
  EffectiveVerbsRange, RoleMembers, MatchesPrincipal,
  MatchingPrincipals, WormZoneGrant, PolicyChain.VisibleStart.
- Strip cascade_mode from /.profile/config and
  /.profile/effective-policy responses.
- Refresh README / ARCHITECTURE.md to describe federal posture as
  "deploy OPA with access_federal.rego" (NIST AC-6); the bundled Rego
  is the parent-deny-is-absolute variant. The in-process Go evaluator
  implements only the commercial cascade.

Legacy redirects + .admin.css fallback:
- Drop /<dir>/.zddc.html → ?file=.zddc redirect and its test.
- Drop ?zip=1 retired comment + legacy test (handled by the
  .zip virtual-URL path; covered by TestServeSubtreeZip).
- Drop .admin.css fallback in profile_assets.go — only .profile.css now.
- Refresh stale "retired" / "back-compat" / "legacy" comment markers.

.zddc write path fix:
- Dispatcher: route only GET/HEAD on .zddc URLs to ServeZddcFile; carve
  .zddc out of the dot-prefix guard so PUT/DELETE/POST reach
  ServeFileAPI. Before this, .zddc writes 405'd at ServeZddcFile and
  the YAML editor's save flow had no live path.
- ServeFileAPI.resolveTargetPath: same .zddc-leaf carve-out so the file
  API accepts the path; intermediate dot dirs (.zddc.d/) stay reserved.
- Listing: compute Writable per-file with ActionAdmin for .zddc
  (matches the file API's gate) instead of ActionWrite for everything.
- Virtual .zddc placeholder: compute Writable via the same
  parentActiveAdmin || ActionAdmin path. Was always false before.
- browse YAML editor canSave: exempt virtual .zddc — the synthetic
  body is designed to materialize on PUT.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 16:28:07 -05:00
..
accepthandler.go refactor(audit): pre-release cleanup pass 2026-05-18 16:28:07 -05:00
accepthandler_test.go feat: reviewing/ lifecycle — Plan Review endpoint, virtual received window, browse context-menu workflows 2026-05-15 16:08:04 -05:00
admin_helpers.go chore: elevation slot in every tool + docs + helper file splits + smell cleanup 2026-05-14 12:15:41 -05:00
archivehandler.go fix(policy): read-path ACL honors admin bypass via AllowFromChainP 2026-05-18 09:54:46 -05:00
archivehandler_test.go refactor(audit): pre-release cleanup pass 2026-05-18 16:28:07 -05:00
auth_invariants_test.go refactor(audit): pre-release cleanup pass 2026-05-18 16:28:07 -05:00
authcheck.go refactor(audit): pre-release cleanup pass 2026-05-18 16:28:07 -05:00
authcheck_test.go refactor: unified listing protocol + form-editor retirement + admin elevation 2026-05-14 12:15:07 -05:00
converthandler.go refactor(audit): pre-release cleanup pass 2026-05-18 16:28:07 -05:00
cors.go feat(server): authenticated CRUD + verb-based RBAC with WORM archive folders 2026-05-05 15:58:04 -05:00
cors_test.go feat(zddc-server): admin debug page + X-Auth-Request-Email default + hidden-segment guard 2026-04-28 14:02:06 -05:00
default-mdl.form.yaml feat(mdl): default columns mirror tracking-number components + customizable 2026-05-09 11:09:31 -05:00
default-mdl.table.yaml feat(mdl): default columns mirror tracking-number components + customizable 2026-05-09 11:09:31 -05:00
directory.go fix(policy): read-path ACL honors admin bypass via AllowFromChainP 2026-05-18 09:54:46 -05:00
directory_test.go refactor(audit): pre-release cleanup pass 2026-05-18 16:28:07 -05:00
fileapi.go refactor(audit): pre-release cleanup pass 2026-05-18 16:28:07 -05:00
fileapi_test.go refactor(audit): pre-release cleanup pass 2026-05-18 16:28:07 -05:00
formhandler.go fix(policy): read-path ACL honors admin bypass via AllowFromChainP 2026-05-18 09:54:46 -05:00
formhandler_test.go refactor(audit): pre-release cleanup pass 2026-05-18 16:28:07 -05:00
logring.go feat(zddc-server): user profile page replaces /.admin/ 2026-04-29 16:32:02 -05:00
logring_test.go feat(zddc-server): admin debug page + X-Auth-Request-Email default + hidden-segment guard 2026-04-28 14:02:06 -05:00
middleware.go refactor(audit): pre-release cleanup pass 2026-05-18 16:28:07 -05:00
middleware_test.go feat(handler): audit log records active_admin alongside elevated 2026-05-18 09:26:13 -05:00
paths.go chore: elevation slot in every tool + docs + helper file splits + smell cleanup 2026-05-14 12:15:41 -05:00
planreview.go refactor(audit): pre-release cleanup pass 2026-05-18 16:28:07 -05:00
planreview_test.go feat: reviewing/ lifecycle — Plan Review endpoint, virtual received window, browse context-menu workflows 2026-05-15 16:08:04 -05:00
profile_assets.go refactor(audit): pre-release cleanup pass 2026-05-18 16:28:07 -05:00
profilehandler.go refactor(audit): pre-release cleanup pass 2026-05-18 16:28:07 -05:00
profilehandler_test.go refactor(audit): pre-release cleanup pass 2026-05-18 16:28:07 -05:00
profilepage.go refactor(audit): pre-release cleanup pass 2026-05-18 16:28:07 -05:00
profileprojects.go refactor(audit): pre-release cleanup pass 2026-05-18 16:28:07 -05:00
profileprojects_test.go feat: project creation gated by cascade ActionCreate, not hardcoded admin 2026-05-18 10:25:19 -05:00
projecthandler.go refactor(zddc-server): demote routing-shape redirects from 301 to 302 2026-05-10 14:37:02 -05:00
projecthandler_test.go refactor(landing): project landing is now a single-file SPA, not server-rendered 2026-05-10 07:57:30 -05:00
projectshandler.go fix(policy): read-path ACL honors admin bypass via AllowFromChainP 2026-05-18 09:54:46 -05:00
singleflight.go feat(zddc): MD→{docx,html,pdf} server-side conversion via stock pandoc + chromium containers 2026-05-13 10:33:56 -05:00
static.go Initial commit 2026-04-27 11:05:47 -05:00
subtreezip.go refactor(audit): pre-release cleanup pass 2026-05-18 16:28:07 -05:00
subtreezip_test.go refactor: virtual file extensions for subtree zip + MD conversion 2026-05-14 12:23:37 -05:00
tablehandler.go refactor(audit): pre-release cleanup pass 2026-05-18 16:28:07 -05:00
tablehandler_test.go refactor: unified listing protocol + form-editor retirement + admin elevation 2026-05-14 12:15:07 -05:00
tables.html feat(audit): chain_admin_level field in access log 2026-05-18 10:55:53 -05:00
tokenhandler.go feat(server): self-issued bearer tokens + --no-auth flag 2026-05-08 07:40:28 -05:00
tokenhandler_test.go feat(server): self-issued bearer tokens + --no-auth flag 2026-05-08 07:40:28 -05:00
wormbypass_test.go test(handler): lock-in invariants for admin/elevation/WORM behavior 2026-05-18 09:12:37 -05:00
zddcfile.go refactor(audit): pre-release cleanup pass 2026-05-18 16:28:07 -05:00
zddcfile_test.go refactor(audit): pre-release cleanup pass 2026-05-18 16:28:07 -05:00
ziphandler.go feat(zddc): serve a .zip as a virtual directory (zipfs + dispatch intercept) 2026-05-12 12:17:47 -05:00
ziphandler_test.go feat(zddc): serve a .zip as a virtual directory (zipfs + dispatch intercept) 2026-05-12 12:17:47 -05:00