ZDDC/zddc/internal/handler
ZDDC 3b2280de7f test(handler): coverage for record audit + history flows
Adds history_test.go with eight cases exercising the record-write
orchestration path:
- CreateStampsAuditFields: PUT to a fresh mdl path → audit fields
  injected; response echoes the stamped YAML; no history dir yet.
- UpdateIncrementsRevisionAndArchivesPrior: second PUT archives
  the prior bytes under .history/<base>/<ts>-<sha8>.yaml, bumps
  revision, preserves created_*, chains previous_sha.
- ConflictPreservesHistory: 412 from stale If-Match leaves the live
  file untouched and writes NO history entry (the failed write must
  be a true no-op).
- ClientAuditFieldsStripped: client-supplied created_by / revision
  are silently overwritten by server values — anti-forgery test.
- FilenameMismatch: URL says ...-0002 but body composes to ...-0001
  → 422.
- LockedFieldRejected: posting type=SPC to an rsk row → 422 with
  /type error (rsk/ locks type=RSK via cascade).
- SSRHistoryAtPartyLevel: writes to archive/<party>/ssr.yaml put
  history at archive/<party>/.history/ssr/, NOT at
  archive/.history/<party>/.
- RollupCreate_AssignsRowAndComposesFilename: three POSTs to
  /project/rsk/form.html in two table-scope groups demonstrate the
  server picks up filename_format + row_field+row_scope_fields from
  the cascade, auto-assigns sequence row numbers per group, and
  composes the canonical filename.

Bug fix surfaced by the first test: composeFilename was eliding TWO
separators around an optional placeholder when one was correct.
"ACM-{phase?}-PRJ" with phase="" was producing "ACMPRJ" instead of
"ACM-PRJ". Now drops only the trailing separator from output and
lets the next iteration emit the connector.

Default-project-{mdl,rsk}.form.yaml updated: project-rollup MDL +
RSK schemas gained the six readOnly audit fields and the project-
rsk schema picked up the full table-tracking component shape (+
row) plus an enum-locked type=RSK. The required: list no longer
includes type for rsk schemas — the cascade's field_defaults
injects it after schema validation, and requiring it would 422
well-behaved clients.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 10:08:52 -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 test: lock down elevation gate, .zddc write matrix, audit-log attribution 2026-05-18 16:29:43 -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(convert): wrapper-in-image owns the sandbox; Go just exec's binaries 2026-05-19 07:47:58 -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(forms): cascade-driven filename composition + audit on row create 2026-05-19 09:55:07 -05:00
default-mdl.table.yaml feat(mdl): default columns mirror tracking-number components + customizable 2026-05-09 11:09:31 -05:00
default-project-mdl.form.yaml test(handler): coverage for record audit + history flows 2026-05-19 10:08:52 -05:00
default-project-mdl.table.yaml feat(tables): rollup Add Row routes via the party column 2026-05-19 08:14:37 -05:00
default-project-rsk.form.yaml test(handler): coverage for record audit + history flows 2026-05-19 10:08:52 -05:00
default-project-rsk.table.yaml feat(tables): rollup Add Row routes via the party column 2026-05-19 08:14:37 -05:00
default-rsk.form.yaml test(handler): coverage for record audit + history flows 2026-05-19 10:08:52 -05:00
default-rsk.table.yaml feat: per-party RSK + project-level SSR/MDL/RSK rollup tables 2026-05-18 21:47:56 -05:00
default-ssr.form.yaml feat(forms): cascade-driven filename composition + audit on row create 2026-05-19 09:55:07 -05:00
default-ssr.table.yaml feat: per-party RSK + project-level SSR/MDL/RSK rollup tables 2026-05-18 21:47:56 -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 feat(zddc-server): server-stamped audit + history for record YAMLs 2026-05-19 09:48:58 -05:00
fileapi_test.go refactor(audit): pre-release cleanup pass 2026-05-18 16:28:07 -05:00
formhandler.go feat(forms): augment served schema with cascade field_codes + locks 2026-05-19 09:58:21 -05:00
formhandler_test.go refactor(audit): pre-release cleanup pass 2026-05-18 16:28:07 -05:00
history.go test(handler): coverage for record audit + history flows 2026-05-19 10:08:52 -05:00
history_test.go test(handler): coverage for record audit + history flows 2026-05-19 10:08:52 -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 test: lock down elevation gate, .zddc write matrix, audit-log attribution 2026-05-18 16:29:43 -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
ssrhandler.go feat(forms): cascade-driven filename composition + audit on row create 2026-05-19 09:55:07 -05:00
ssrhandler_test.go feat: per-party RSK + project-level SSR/MDL/RSK rollup tables 2026-05-18 21:47: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 feat(tables): rollup Add Row routes via the party column 2026-05-19 08:14:37 -05:00
tablehandler_test.go feat: per-party RSK + project-level SSR/MDL/RSK rollup tables 2026-05-18 21:47:56 -05:00
tables.html feat(tables): row context-menu opens the form, not raw YAML 2026-05-19 08:43:45 -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
virtualviewhandler.go feat: per-party RSK + project-level SSR/MDL/RSK rollup tables 2026-05-18 21:47:56 -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