Workflow actions state-aware UI/UX, backend validation fixes, and documentation overhaul#2
Merged
Merged
Conversation
- Create web/src/pages/document-detail/workflow-actions.ts with action availability matrix - Add isTerminalStatus(), canAnalyze(), canApproveRouting(), canReroute(), canRequestConsultation(), canResolveConsultation(), canEscalate(), canMarkOutOfScope(), canClose() predicate helpers - Add getWorkflowActionStates() returning available/disabled/hidden actions - Refactor DocumentDetailPage to use model-driven action rendering - Terminal-state documents now show 'no further actions' message - Actions grouped by category (Analysis, Review, Consultation, Closeout) - Disabled actions show explicit reason text
- Add getWorkflowStatusMessage() for contextual status-aware helper text - Add TerminalStateCard component with status-appropriate icons - Update button variants: blue (primary), amber (caution), red (destructive) - Disabled actions render at 40% opacity with reason text - Action group headers adapt styling based on availability - Empty state message when no actions available for user role - Consultation form colors updated to amber variant
…ion endpoints - reroute_document now validates transition before setting status to routed - resolve_consultation now validates transition before setting status to under_review - Both return 400 INVALID_TRANSITION for illegal state changes - Prevents rerouting from terminal states (closed, out_of_scope) - Prevents resolving consultation on documents not in in_consultation - All other endpoints confirmed to already have proper validation
…ests Frontend tests (39 tests via vitest): - isTerminalStatus, canAnalyze, canApproveRouting, canRequestConsultation - canResolveConsultation, canEscalate, canMarkOutOfScope, canClose - getWorkflowActionStates integration tests for key statuses - getWorkflowStatusMessage tests Backend tests (11 tests): - reroute endpoint: validates transition from under_review succeeds, from terminal states (closed, out_of_scope) returns 400 - resolve-consultation endpoint: validates transition from in_consultation succeeds, from terminal states returns 400 Added vitest config and test scripts to web/package.json
… routed is invalid) - canReroute now only returns true for under_review status - Removed in_consultation from allowed reroute states - Updated disabled reason text - Added canReroute unit tests and integration tests - Frontend now matches backend VALID_TRANSITIONS exactly
- Add reroute inline form with department select and rationale input - Fetch departments from API and display actual department names - Add 'success' button variant (emerald) for approve, resolve, close actions - Add frontend tests to make test target in Makefile - Add integration tests for reroute and resolve-consultation transition validation
- Rewrite README.md with professional structure: badges, features, architecture, workflow diagram, quick start, tech stack, role-based access, testing overview - Create CONTRIBUTING.md with dev setup, code style, testing, and PR guidelines - Create CHANGELOG.md using Keep a Changelog format (v0.1.0) - Create GitHub issue templates (bug_report.md, feature_request.md) - Update metadata.json with major capabilities and version
…ulation - Remove standalone API Documentation section (Swagger/ReDoc not accessible through main UI) - Add API health endpoint reference to Development commands table - Rename 'Role-Based Access' to 'Simulated Multi-Role Workflow' and 'Demo Roles' - Add note clarifying role switching is a demo simulation, not production auth
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
This PR delivers the complete Workflow Actions State-Aware Fix as specified in the handoff document, plus a professional documentation overhaul for open-source readiness.
Changes
🔧 Workflow Actions — State-Aware UI/UX (Passes 1–6)
Centralized action model (
web/src/pages/document-detail/workflow-actions.ts)canAnalyze,canApproveRouting,canReroute,canRequestConsultation,canResolveConsultation,canEscalate,canMarkOutOfScope,canClose)getWorkflowActionStates(doc, role)returning available/disabled/hidden action arraysgetWorkflowStatusMessage()for contextual status-aware helper textRefactored DocumentDetailPage to use model-driven action rendering
Backend transition validation fixes (
api/app/api/v1/endpoints/review.py)validate_transition()toreroute_document(was missing — allowed rerouting from terminal states)validate_transition()toresolve_consultation(was missing — allowed resolving on non-consultation documents)INVALID_TRANSITIONerror responses across all endpoints🧪 Tests
📚 Documentation Overhaul
Test Results
make ci: ✅ All checks pass (lint, build, test)Files Changed
New files (6):
web/src/pages/document-detail/workflow-actions.tsweb/src/pages/document-detail/workflow-actions.test.tsapi/tests/unit/test_review_endpoints.pyapi/tests/integration/test_review_endpoint_transitions.pyCONTRIBUTING.mdCHANGELOG.md.github/ISSUE_TEMPLATE/bug_report.md.github/ISSUE_TEMPLATE/feature_request.mdModified files (5):
web/src/pages/DocumentDetailPage.tsxapi/app/api/v1/endpoints/review.pyREADME.mdmetadata.jsonMakefile