Commit Graph

240 Commits

Author SHA1 Message Date
chihlasm
2d73bb861f chore: install @xyflow/react and @dagrejs/dagre
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 20:59:31 -05:00
chihlasm
6efbdda688 docs: add React Flow migration implementation plan
12 tasks across 8 phases covering dagre layout, custom nodes,
side panel editor, and full canvas integration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 20:50:00 -05:00
chihlasm
af9e44d633 docs: add React Flow migration design for flow editor canvas
Replaces hand-built CSS flexbox canvas with @xyflow/react for zoom/pan,
dagre auto-layout, collapsible minimap, and side-panel editing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 20:41:34 -05:00
chihlasm
da2807b14b feat: feedback form with DB persistence, email notifications, and keyboard-accessible dropdown (#81)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 19:04:16 -05:00
chihlasm
6ec00b6723 fix: Tab selects highlighted dropdown option before advancing focus
When the dropdown is open with a highlighted option, pressing Tab now
selects that option and then moves focus to the next field naturally.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 18:58:42 -05:00
chihlasm
d2b5a8017e fix: add keyboard navigation to feedback type dropdown
Arrow keys open/navigate options, Enter/Space selects, Escape closes.
Added ARIA attributes (combobox, listbox, option) and click-outside
dismiss. Mouse hover also updates the highlight.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 18:43:42 -05:00
chihlasm
cd19005831 feat: add feedback route, sidebar nav item, and account link card
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 17:59:33 -05:00
chihlasm
5672d9062d feat: add FeedbackPage with custom feedback type selector
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 17:58:42 -05:00
chihlasm
47c2ee42c6 feat: add feedback API client
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 17:58:05 -05:00
chihlasm
8b05afaf8f test: add feedback endpoint tests including DB persistence
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 17:56:29 -05:00
chihlasm
72e801eca6 feat: add POST /feedback endpoint with DB persistence and dual emails
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 17:43:21 -05:00
chihlasm
1e7eeb8daa feat: add feedback notification and confirmation emails to EmailService
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 17:41:30 -05:00
chihlasm
dc93e96a20 feat: add FEEDBACK_EMAIL config setting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 17:39:52 -05:00
chihlasm
38e9b7c4a8 feat: add feedback database model and migration
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 17:39:44 -05:00
chihlasm
ed5863768a feat: add feedback submission schema
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 17:35:20 -05:00
chihlasm
eeac98b17a docs: revise feedback design doc with enhancements
Adds DB persistence, feedback type helper text, confirmation
email, and future post-session prompt notes. Removes "No DB
persistence" from YAGNI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 17:31:25 -05:00
chihlasm
e995316d41 docs: revise feedback implementation plan with enhancements
Adds: DB persistence, feedback type helper text, confirmation
email to submitter, and TODO breadcrumbs for post-session prompt.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 17:27:14 -05:00
chihlasm
b0b77d6645 docs: add feedback form implementation plan
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 17:22:09 -05:00
chihlasm
346b99ff31 docs: add feedback form design document
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 17:19:24 -05:00
chihlasm
b127b28711 docs: add implementation plan for flow editor UX fixes
6-phase, 16-task plan covering: canvas card scroll + fullscreen modal,
InfoTip component + tooltip replacements in all 3 NodeForm components,
answer stub type system (types → AnswerStubCard → TreeCanvas wiring →
NodeList guard), backend draft/publish validation, markdown serializer
compatibility, and session navigation defensive guard.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-18 14:10:10 -05:00
chihlasm
94de29b5f2 feat: canvas UX fixes — scroll, fullscreen, InfoTip tooltips, answer stub system (#80)
* feat: Add TreeCanvasNode inline editor card component

Replaces modal-based node editing with inline expand/collapse cards.
Each card shows node type, title, and options in compact mode, then
renders the full edit form inline on expand — no modal required.

Local draft state with save/cancel prevents premature store writes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: Add TreeCanvas layout with visual branching and orchestration

Replaces NodeList + TreePreviewPanel with a single full-width canvas.
Decision nodes branch horizontally; action/solution nodes flow vertically.
Inline type picker adds nodes without modal interruption. Handles pending
link resolution, inbound reference cleanup on delete, and selection sync.

CSS dot-grid background + connector lines for structure clarity.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor: Update forms for inline safety, add MetadataSidePanel, update layout

- NodeFormDecision: option reorder via onUpdate (no premature store writes)
- NodePicker: add allowCreate prop (default true) to hide Create New options
  during inline canvas editing, preventing side-effect node creation
- MetadataSidePanel: 320px right slide-in overlay wrapping TreeMetadataForm,
  closes on backdrop click, close button, and Escape key
- TreeEditorLayout: Flow mode now renders full-width TreeCanvas + MetadataSidePanel
  overlay; Code mode unchanged (Monaco + preview split)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: Wire toolbar metadata toggle and integrate canvas layout

- Add isMetadataOpen state in TreeEditorPage
- Add Metadata toolbar button (visible in Flow mode only)
- Auto-close metadata panel when switching to Code mode
- Pass isMetadataOpen/onCloseMetadata props through TreeEditorLayout
- Update Flow mode toggle tooltip to reflect new canvas editing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: add canvas UX fixes design doc (scroll, tooltips, answer stubs)

Captures approved design for three post-implementation UX improvements
to the tree canvas editor: card scroll fix, info tooltip replacement for
hint text, and the new 'answer' node type for sketching decision branches
before assigning types.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: add implementation plan for canvas UX fixes

12-task plan covering scroll fix, info tooltips, and answer stub
node type. Each task has exact file paths, code, and build
verification steps.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: make canvas card expanded area scrollable with sticky header

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: add fullscreen toggle to Modal, enable in NodeEditorModal

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: add reusable InfoTip component for field-level help

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: replace hint paragraphs with InfoTip tooltips in NodeFormDecision

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: replace hint paragraphs with InfoTip tooltips in NodeFormAction

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: replace hint paragraphs with InfoTip tooltips in NodeFormResolution

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: add 'answer' to NodeType union for branch placeholder stubs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: add AnswerStubCard component for unresolved branch placeholders

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: guard NODE_TYPE_CONFIG lookup against 'answer' type

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: redesign NodeFormDecision to label-only options, remove NodePicker

Users now type answer labels only. Stub nodes are created automatically
by TreeCanvas when the decision node is saved.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: auto-create answer stubs on decision save, render AnswerStubCard

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: add answer type to all Record<NodeType> icon and color maps

Fixes NodeList, ContinuationModal, NodePicker, and TreePreviewNode.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: allow 'answer' type in tree drafts, block on publish

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: block publish if unresolved answer stub nodes exist

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: serialize 'answer' stub nodes in markdown output

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: add defensive guard for answer nodes in session navigation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: add delete button with confirmation to AnswerStubCard

Adds an inline delete flow to answer stub placeholder cards:
- Trash icon button (top-right, subtle) visible in idle state
- Click reveals "Delete this stub?" confirmation with Delete/Cancel
- Confirmed delete calls onDelete(nodeId) wired to handleDelete in TreeCanvas

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: prevent category Cancel overflow and add Tab/Enter to create options

- TreeMetadataForm: add min-w-0 + shrink-0 to keep Cancel button in-panel
- NodeFormDecision: Tab or Enter on the last non-empty option input adds a
  new option and auto-focuses it; empty last input lets Tab pass through normally

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: re-sync draft from store when canvas card is opened

When a decision node is saved with new options, stub next_node_id values
are written back to the store. But the local draft was initialized once at
mount and never refreshed, so reopening the card gave a stale draft with
empty next_node_ids — causing duplicate stubs on every subsequent save.

Fix: reset draft from the live node whenever isExpanded transitions to true.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix+feat: blank options, stub card dismiss, collapsible subtrees

- TreeCanvas: strip blank-label options on save so they don't generate
  stubs; also filter them from the unlinked-option add-button list
- AnswerStubCard: collapse type-picker when clicking outside the card
- TreeCanvasNode: add subtree collapse toggle button (ChevronsDownUp icon)
  visible in compact mode when the node has children
- TreeCanvas: track collapsedNodeIds; hide subtree behind a clickable
  "N nodes hidden" pill when collapsed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: stop connector fork line from overlapping child cards

Replace the two-element approach (separate fork line + child lanes div with
mismatched maxWidth values) with a single relative-positioned container.
The fork line is absolutely positioned and its left/right are calculated from
the number of children so it spans exactly from the center of the first lane
to the center of the last lane.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: replace Show Drafts checkbox with Drafts tab in Flow Library

- Remove the out-of-place checkbox; add 'Drafts' as a tab alongside
  All | Troubleshooting | Projects | Maintenance
- Drafts tab sets showDrafts=true + typeFilter='all' so the API filter
  still works correctly via include_drafts
- Move SortDropdown to the right side next to ViewToggle, so both
  secondary controls are grouped together

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-18 12:52:08 -05:00
chihlasm
fad9646ed3 fix: prevent sidebar wheel from blocking tree library scrolling 2026-02-17 21:06:56 -05:00
chihlasm
9f2e98376e fix: ensure procedural runtime panes are scrollable in app shell 2026-02-17 20:21:49 -05:00
chihlasm
db715929e7 fix: stabilize maintenance flow run/resume and procedural scrolling 2026-02-17 20:12:07 -05:00
chihlasm
058e2c5a23 fix: remove folder icons, add single run for maintenance, fix batch 400
- Remove AddToFolderMenu from grid/list/table library views (folders removed)
- Add single "Run" button to MaintenanceFlowDetailPage alongside Batch Launch
- Change seed script to publish maintenance flows (batch rejects drafts)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 19:35:52 -05:00
chihlasm
fbfca80313 chore: add maintenance flow seed script with 3 MSP templates
Adds SonicWall firmware update, Windows DC updates, and SSL cert
renewal maintenance flow templates for seeding demo/test data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 19:24:06 -05:00
chihlasm
c8c5fc84db fix: wire up maintenance flow creation, editing, and navigation in frontend
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 18:47:26 -05:00
chihlasm
dbe0e9e5b3 docs: update CLAUDE.md with maintenance flows learnings
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 18:36:22 -05:00
chihlasm
1b1ecf13ca Merge branch 'feat/maintenance-flows' 2026-02-17 16:40:43 -05:00
chihlasm
c89456b53c chore: add .worktrees/ to .gitignore
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 16:36:55 -05:00
chihlasm
d18ec88bc3 docs: add maintenance flows implementation plan
10-task plan across 4 phases: DB/API, frontend UI, APScheduler
integration, and target lists settings. TDD throughout.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 16:36:55 -05:00
chihlasm
3b506059f6 docs: add maintenance flows design document
Covers tree_type expansion, target_lists + maintenance_schedules data
model, APScheduler-based auto-session creation, batch launch modal,
and phased rollout plan.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 16:36:55 -05:00
chihlasm
6240d68d09 fix: apply code review security and robustness fixes
- Add require_engineer_or_admin to POST/PUT/DELETE in target_lists.py (blocks viewers from write ops)
- Add require_engineer_or_admin to POST/PATCH in maintenance_schedules.py (blocks viewers from write ops)
- Add team ownership guard in batch_launch_sessions after active/published checks (Fix 2)
- Wrap scheduler.remove_job in try/except for SchedulerNotRunningError and JobLookupError (Fix 3)
- Recompute next_run_at when is_active flips to True, capturing was_active before update (Fix 4)
- Add optional batch_id and target_label fields to Session type; remove unsafe cast in MaintenanceFlowDetailPage.tsx (Fix 5)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 16:15:19 -05:00
chihlasm
a4717e9dd7 feat: add Target Lists settings page under Team account
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 14:38:26 -05:00
chihlasm
5abff028bc feat: APScheduler integration for maintenance flow auto-session creation
- Add backend/app/core/scheduler.py with AsyncIOScheduler, CronTrigger-based
  job registration, and _fire_maintenance_schedule to create batch sessions
- Wire scheduler.start()/load_all_schedules()/shutdown() into main.py lifespan
- Call register_schedule() in create_schedule endpoint after commit
- Call register_schedule()/unregister_schedule() in update_schedule based on is_active
- Add TreeShare to models/__init__.py so all SQLAlchemy mapper relationships
  resolve before ORM queries in the scheduler context

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 14:21:29 -05:00
chihlasm
55cd481e48 feat: BatchLaunchModal and MaintenanceFlowDetailPage with schedule panel and run history
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 14:11:20 -05:00
chihlasm
8441a8dbaf feat: maintenance flows frontend foundation - types, API clients, sidebar, library filter
- Add maintenance.ts types: TargetEntry, TargetList, MaintenanceSchedule, BatchLaunch
- Add targetListsApi and maintenanceSchedulesApi/batchLaunchApi clients
- Extend TreeType union with 'maintenance' in tree.ts
- Update getTreeNavigatePath/getTreeEditorPath in routing.ts for maintenance
- Sidebar: track maintenance count and add Maintenance sub-nav item
- TreeLibraryPage: add maintenance to typeFilter state, URL sync, and tab buttons
- TreeGridView, TreeListView, TreeTableView: add amber Wrench maintenance badge

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 14:06:36 -05:00
chihlasm
829b7cf5a7 fix: add cross-team authorization to maintenance schedule endpoints
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 13:42:23 -05:00
chihlasm
25cc16da3a feat: add maintenance_schedules table, schema, and CRUD endpoints
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 13:20:55 -05:00
chihlasm
5a3af9c87e fix: add auth guards, optimize refresh loop, and improve batch session tests
- Move mid-file pydantic/uuid imports to top of sessions.py
- Add can_access_tree, is_active, and draft status guards to batch_launch_sessions
- Remove notes field from _BatchTarget to keep API clean
- Add max_length=100 cap to targets list in _BatchLaunchRequest
- Hoist tree_snapshot computation above the session creation loop
- Replace N db.refresh() calls with a single bulk select after flush
- Add test_batch_launch_requires_auth and test_batch_launch_rejects_draft_tree tests
- Fix trailing slash on /api/v1/trees/ URL in new test (caused 307 redirect)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 12:29:04 -05:00
chihlasm
b78a50c8c5 feat: add batch_id/target_label to sessions and batch launch endpoint
- Add batch_id (UUID, nullable, indexed) and target_label (String 255,
  nullable) columns to the Session model
- Manual Alembic migration 6e8128ef2aa8 applies both columns
- POST /sessions/batch creates one session per target for maintenance
  flows; rejects empty targets (422) and non-maintenance trees (400)
- SessionResponse schema exposes batch_id and target_label
- 3 new integration tests, all 540 tests pass

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 11:48:08 -05:00
chihlasm
adcdf39d35 fix: clean migration, cross-team isolation test, and PUT field-set fix for target_lists
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 11:29:25 -05:00
chihlasm
0c2d4ba685 feat: add target_lists table, schema, and CRUD endpoints
Introduces the TargetList model (team-scoped JSONB target arrays),
Pydantic schemas, and full CRUD REST API at /target-lists/.
Includes Alembic migration and 5 integration tests (TDD).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 11:16:40 -05:00
chihlasm
36e1335a00 refactor: extract PROCEDURAL_TREE_TYPES constant and add negative tree_type test
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 10:54:39 -05:00
chihlasm
d75e6f78e1 feat: add maintenance tree_type with db migration and tests
- Expand ck_trees_tree_type CHECK constraint to include 'maintenance'
- Add 'maintenance' to TreeType Literal in schemas
- Treat maintenance trees as procedural in can_publish_tree validation
- Alembic migration 0f1ca2af3647 drops and recreates the constraint
- Two integration tests: create and filter by tree_type=maintenance

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 10:35:31 -05:00
chihlasm
8baddd6597 chore: add .worktrees/ to .gitignore
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 10:03:03 -05:00
chihlasm
64a36c941a docs: add maintenance flows implementation plan
10-task plan across 4 phases: DB/API, frontend UI, APScheduler
integration, and target lists settings. TDD throughout.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 09:54:20 -05:00
chihlasm
f27d922f61 docs: add maintenance flows design document
Covers tree_type expansion, target_lists + maintenance_schedules data
model, APScheduler-based auto-session creation, batch launch modal,
and phased rollout plan.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 09:47:23 -05:00
chihlasm
3a112476dc Add Claude Code GitHub Workflow (#79)
* "Claude PR Assistant workflow"

* "Claude Code Review workflow"
2026-02-17 00:43:50 -05:00
chihlasm
01a062169e chore: add test user seed script and fix seed flow validation
Add seed_test_users.py for creating 4 dev accounts (super admin, pro
solo, team admin, team engineer) via direct SQL. Fix seed scripts to
create flows as drafts to bypass publish validation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 22:48:51 -05:00