feat(publish): guided publish flow in the case editor (ADR 0003) - #887
Merged
Merged
Conversation
… 0003) Builds the complete publish/republish/unpublish flow on top of the previously orphaned publish-service backend: - Publish: validates case-information completeness (currently just a required description) before a single-confirm publish via the existing publishAssuranceCase/POST /api/cases/[id]/publish. Incomplete cases get the exact missing fields surfaced in place, with a shortcut into the existing case-information pane focused on the gap. - Republish/unpublish: reuses the existing PATCH /api/cases/[id]/status transitions; unpublish now has a plain-consequences confirm step. - Fixes the case editor's status button to open the dialog immediately from already-known state, instead of awaiting the synchronous export+change-detection GET /api/cases/[id]/status before opening. - Adds a case-information completeness gate (lib/schemas/case-information, case-information-service, the publish route) as defence in depth behind the client-side check. - Deletes the dead publish-modal.tsx/use-publish-modal.ts pair this replaces and the placeholder Draft status-modal content. Unit and integration tests cover the completeness gate, the publish/ unpublish confirm flows, and the header's no-longer-synchronous open.
…republish (ADR 0003) Chris's ruling: the publish-readiness gate now requires description, authors AND sector (previously description-only), widening REQUIRED_CASE_INFORMATION_FIELDS and the associated labels/UI copy. Lead adjudication: republish (PATCH /api/cases/[id]/status PUBLISHED -> PUBLISHED, the "Update Published" action) now re-runs the same completeness gate as first publish, so a published record can't regress to incomplete via an edit that clears a required field followed by a republish. The status modal's Published view surfaces the same missing-fields gate as the Draft flow rather than a raw error.
Post-review fixes (QA + code review, 2026-08-11): - PATCH /api/cases/[id]/status now runs the case-information completeness gate for first publish (DRAFT -> PUBLISHED), not just republish — a direct PATCH used to bypass it entirely, since the check only ran `if (isRepublish)`. - Extract the duplicated completeness-check/fieldErrors/validation-error block from publish/route.ts and status/route.ts into a shared `requireCaseInformationComplete` helper in case-information-service.ts. - Extract the duplicated missing-fields gate JSX (PublishContent / PublishedContent) into a shared `<MissingFieldsGate>` component. - Add a direct assertion for the "changes since last published" divergence Alert (previously only the button was asserted).
Fallow combined reportGitHub PR summary, scope: project Important Quality gates need attention. Found 44 findings. Checks
Top fixes
Generated by fallow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wires the complete publish flow into the case editor (ADR 0003 items 2–3):
publishAssuranceCase.PATCH /statusfirst-publish path).publish-modal.tsx/use-publish-modal.tsand the READY_TO_PUBLISH placeholder content.Review chain
publishing-schema-migrationafterAll-timeout flake passes in isolation).requireCaseInformationComplete,MissingFieldsGate). Fallow audit clean against baselines.