Skip to content

feat(3C): editing UI + Publish page - #2

Merged
iboughtamouse merged 7 commits into
stagingfrom
feat/3c-editing
Jul 7, 2026
Merged

iboughtamouse merged 7 commits into
stagingfrom
feat/3c-editing

Conversation

@iboughtamouse

Copy link
Copy Markdown
Owner

Phase 3 stage 3C — the editing UI + Publish page

The dashboard half of 3C (design §5), against the API client committed earlier on this branch. Everything edits the draft config; nothing observers see changes until Publish.

What's here

  • Aviary page becomes the per-aviary editor:
    • Subjects: add (name/species/type/arrival; the P2-D8 reserved-name and Excel sheet-name rules are enforced server-side, errors surface inline), record a departure, change type (one close+reopen action), remove — removing a published episode shows the API's friendly refusal.
    • Perches: add / edit label+group / retire / unretire / remove, same refusal handling.
    • Enabled vocabulary: the full catalog as checkbox grids (behaviors by group, then the four option kinds), seeded from the aviary's enabled sets; Save submits the complete replace-set the PUT expects and stays disabled until something changed.
  • Vocabulary page becomes the catalog editor: add behavior captures everything the schema and Excel derivation need (group picker, the six requires-flags as plain-language checkboxes, Excel row label, insert-after placement), add group (next sort order prefilled), inline edit, retire/unretire, draft removal. The enablement matrix stays read-only here — each aviary's page owns its set.
  • Publish page (P3-D3 review step): the change list since the latest version from GET /config/diff, a blocking violations panel with the server's fix-it messages, the two confirmation checkboxes the publish endpoint requires when behaviors changed requires-flags or Excel rows, optional notes, and a success panel with the published version. Nav gains Publish; the Overview drift badge links here.
  • Shared useAction hook (busy + friendly error per mutation), constants.js for wire-value labels.

Pre-merge review (standing multi-angle find→verify pass)

Same authorized find→verify pass as the API branch. Admin-side dispositions:

# Finding (defect → impact) Disposition
1 Every mutation's reload flipped the page to the Loading… screen, unmounting ALL sections — an open editor row or half-built enablement draft in a sibling section was silently discarded Fixed — pages only blank on first load; stale data renders through reloads
2 EnablementSection resynced its draft on prop identity, so any sibling mutation's refetch clobbered a dirty draft even with the page kept mounted Fixed — resync keys on enablement content; test pins draft survival and real-change resync
3 After a failed publish the diff was never refreshed: if the draft moved under the page (server now requires a confirmation the mount-time diff didn't show), the needed checkbox never rendered — dead end Fixed — the diff reloads after failure too; test drives the stale-confirmation path
4 Test gap: the default "at the end" add-behavior path was untested, so a regression sending insertAfter: '' (which the server rejects) would pass the suite Fixed — test pins that the key is omitted
5 With zero behavior groups, AddBehaviorForm would submit group: '' and show a server 400 Refuted by the verifier — unreachable: the seed always ships groups, groups can't be deleted, and the server message is intelligible

Verification

  • 61 tests (was 31 at branch start), lint, build, prettier all green.
  • The client layer was exercised end-to-end against a locally booted API (edit → guardrail refusals → diff → publish → public config serves the new version).

Merges with ethogram-api PR (3C backend). Note for the owner's future bulk push: the admin app still has no Vercel project — the staging test path remains local dev app ↔ staging api, per HANDOFF.

Client wrappers for every 3C write endpoint (aviary/perch/subject/
behavior/group/option CRUD, enablement replace-set, config diff +
publish) and a reload() on useFetch so pages can refetch after a
mutation. Additive and green (31 tests, lint, build); the editing pages
that consume these are the next step.
SubjectsSection: add a subject (P2-D8 reserved names and the Excel
sheet-name rule are enforced server-side; errors surface inline),
record a departure, change type (one close+reopen action), and remove
— removal of a published episode shows the API's friendly refusal.
PerchesSection: add / edit label+group / retire / unretire / remove,
same refusal handling. Shared useAction hook wraps every mutation
(busy + friendly error), constants.js centralizes wire-value labels.
41 tests.
EnablementSection replaces the read-only counts block on the aviary
page: the full catalog renders as checkbox grids (behaviors by group,
then the four option kinds), seeded from the aviary's enabled sets, and
Save submits the complete replace-set the PUT endpoint expects. Save
stays disabled until something actually changed. Draft-config hint
added at the top of the page.
VocabularyPage splits into BehaviorCatalog and OptionsCatalog. Add a
behavior captures everything the schema and Excel derivation need
(design §5): group picker, the six requires-flags as plain-language
checkboxes, Excel row label, and row placement via insert-after. Add a
group prefills the next sort order. Both catalogs get inline editing,
one-click retire/unretire, and draft removal with the API's refusal
surfaced for published entries. The enablement matrix stays read-only
here — each aviary's page owns its enabled set.
GET /config/diff drives the review step: the change list since the
latest version, a blocking violations panel when a draft change would
break published values (with the server's fix-it messages), and the
two explicit confirmation checkboxes the publish endpoint requires
when behaviors changed requires-flags or Excel rows. Optional notes
ride into the version history. Success shows the published version and
its changes; the diff reloads to the clean state. Nav gains Publish;
the Overview drift badge now links here.
…fresh

Review findings fixed (same find→verify pass as the api branch):

- AviaryPage/VocabularyPage/PublishPage only blank to 'Loading…' on
  first load. During post-mutation reloads the stale data keeps
  rendering, so sibling sections (an open editor row, a half-built
  form) are no longer unmounted and silently discarded.
- EnablementSection resyncs its draft on enablement CONTENT, not prop
  identity — a perch rename two sections up no longer clobbers a dirty
  enabled-vocabulary draft. Real content changes still resync.
- PublishPage refreshes the diff after a FAILED publish too: the
  server may require a confirmation the mount-time diff didn't show
  (draft moved under the page); without the refresh the needed
  checkbox never rendered and the page dead-ended.
- Test gap closed: the default at-the-end add-behavior path is pinned
  to OMIT insertAfter (the server rejects an empty string).

61 tests (was 58).
@iboughtamouse
iboughtamouse merged commit 9969862 into staging Jul 7, 2026
1 check passed
@iboughtamouse
iboughtamouse deleted the feat/3c-editing branch July 7, 2026 19:07
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