Skip to content

Editor optimization: IA/efficiency rework, collab WS authz fix, structural editing + /inspections consolidation - #203

Merged
important-new merged 19 commits into
InspectorHub:mainfrom
important-new:feat/editor-optimization
Jun 25, 2026
Merged

Editor optimization: IA/efficiency rework, collab WS authz fix, structural editing + /inspections consolidation#203
important-new merged 19 commits into
InspectorHub:mainfrom
important-new:feat/editor-optimization

Conversation

@important-new

Copy link
Copy Markdown
Contributor

Reworks the inspection editor for information architecture, tool efficiency, and parity with the pre-flatten feature set, fixes a latent collab-WS authorization gap, and consolidates the two inspection-list pages into one.

Editor optimization (decisions D1–D10)

  • D1 — Collab WS authorization. Shared canAccessInspectionCollab predicate; both WS auth sites (collab + presence) now allow tenant admin/manager, not only the assigned inspector (the latent 403 → stuck "Connecting…"). Quicker first-connect retry to mask DO cold start.
  • D7 — Auto-advance. "Satisfactory" now advances on click (not only keyboard); defects still pause.
  • D2/D10 — Toolbar. Zoned into Left/Center/Right; Auto-sign moved out of the toolbar into the Publish modal (it's a setting, not an action). Per-section icons restored in the rail.
  • D3 — Inspection Details. The per-section "Property" tab is replaced by a report-scoped Inspection Details overview entry.
  • D4 — Item Fullscreen. The no-op Split/Focus toggle is replaced by a real Item Fullscreen + collapsible photo rail.
  • D5 — Batch editing. Controls consolidated into a bottom action bar next to the items, with shift-click range-select and undo of a batch rating apply.
  • D8 — Structural editing (× collab). Restored add/duplicate/delete/move for sections and items, a 9-type "Add item" picker, impact-aware delete confirmation, and save structure → source template / as a new template. All structural edits route through the Durable Object (restructure() seeds adds + removes deleted keys, then broadcasts MSG_RESTORE to converge live clients) — the DO remains the sole writer of inspection_results.data.

Final whole-branch review fixes

A senior-reviewer pass (no Critical) surfaced and we fixed: an optimistic-snapshot lost-edit race on rapid structural ops; silent swallowing of a non-501 collab-restructure failure (now surfaced rather than reporting clean convergence over a drifted doc); a dead toggleBatchSelect(shiftKey) range path; plus Escape-to-cancel on the destructive structural-delete modal and a guarded fullscreen-exit.

/dashboard → /inspections consolidation

The sidebar "Inspections" link pointed at a thin, feature-poor list while the full workspace (stats, New Inspection, filters, tabs, search, batch) lived at /dashboard — two pages, same backend endpoint. This moves the rich page to /inspections, retires the thin list, drops /dashboard, and repoints every page link (post-login/SSO/OAuth redirects, root, command palette, PWA manifest, editor exit, etc.). The /api/inspections/dashboard data endpoint and the separate /agent-dashboard route are untouched.

Tests

type-check 0/0 · test:unit 2162 passed (8 pre-existing skips) · test:web 590 passed · test:workers 66 passed · DS-token / migration-ref / file-size / bundle gates green.

🤖 Generated with Claude Code

important-new and others added 19 commits June 24, 2026 15:18
…via snapshot PATCH + DO restructure (D8)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AG7v84fofi49dqZS7he9f2
…t hook + AddSectionPromptModal (D8)

Behavior-preserving: moves the section structural-edit wiring (snapshot ref,
applyStructure fetcher, add/duplicate/delete/move handlers, delete-impact +
add-section-prompt modal state) out of inspection-edit.tsx (2053->1937 lines)
into a reusable hook + component. Addresses the Important review finding on
task 10.3 and gives item-level (10.4) a hook to extend instead of inlining more.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AG7v84fofi49dqZS7he9f2
…ve + type picker (D8)

Extends useStructureEdit with item handlers (over the addItem/duplicateItem/
deleteItem/moveItem ops) and a generalized delete-impact modal (section OR item).
ItemList gains a per-item ⋯ menu (duplicate/delete/move) + "+ Add item"; new
AddItemTypeModal offers the 9 item types. StructureDeleteModal is now noun-aware.
Routes through the same restructure action + DO convergence as section edits.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AG7v84fofi49dqZS7he9f2
Adds a save-structure-template action intent (PUT source template / POST new,
reusing the existing template service), useStructureEdit save-template state,
a SaveTemplateModal (back = overwrite-source warning; new = name input), and
two SectionRail footer actions ("Save structure → template" gated on a source
template, "Save as new template…"). Completes P10 structural editing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AG7v84fofi49dqZS7he9f2
Addresses the whole-branch review of feat/editor-optimization (no Critical):

- useStructureEdit: advance snapshotRef optimistically in applyStructure so
  two rapid structural ops compose instead of the second recomputing from the
  pre-first snapshot and silently dropping the first (wholesale PATCH is LWW).
- restructure action: stop reporting clean convergence over a drifted doc.
  When collab is on, a non-501 failure from the collab/restructure ping (e.g.
  403) now surfaces an error instead of being swallowed; documents the
  PATCH(tenant-role) vs ping(assignment-scoped) authorization surfaces.
- save-structure-template 'back': fail the save if the source template name
  can't be resolved, rather than PUTting a "Template" placeholder that would
  silently rename the source.
- Delete the dead toggleBatchSelect(shiftKey) range branch + now-unused
  lastBatchClickedRef (canonical range path is batchSelectRange/batch-range).
- StructureDeleteModal: Escape cancels the destructive action.
- onExitFullscreen: guard the state write so a bare Escape is a true no-op.

type-check 0/0, test:web 590/590, eslint clean, lint:ds/migrefs OK,
file-size ratchet tightened (useInspectionBatch shrank).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AG7v84fofi49dqZS7he9f2
…l list)

The sidebar "Inspections" link pointed at a thin, feature-poor status-grouped
list (routes/inspections.tsx) while the full workspace — stats, + New
Inspection, filters, tabs, search, batch — lived at /dashboard. Two pages,
same backend endpoint (api.inspections.dashboard), confusing IA.

- Move the rich routes/dashboard.tsx → routes/inspections.tsx; serve it at
  /inspections. Delete the thin list. Drop the /dashboard route entirely
  (pre-launch: no back-compat redirect).
- Repoint every /dashboard page link: post-login/setup/join redirects,
  home "/" index + server root redirect, SSO/TOTP/identity-switch redirects,
  Google-calendar OAuth callback, concierge review email, editor exit,
  inspection-hub / form-renderer / feature-disabled back-links, calendar
  new-inspection link, reports-redirect (→ /inspections?workflow=published),
  CommandPalette, BackButton, NewInspectionWizard action, PWA manifest.
- Left untouched: the /api/inspections/dashboard data endpoint, the separate
  /agent-dashboard route, /dashboard-columns, dashboard-* libs/components,
  and the Cloudflare-dashboard doc mention.
- Updated unit tests (route-metadata, identity-service, concierge-emails,
  dashboard-tabs/-workflow imports) + e2e specs + docs.

type-check 0/0, test:web 590/590, test:unit 2162 passed, DS/migrefs OK.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AG7v84fofi49dqZS7he9f2
@important-new
important-new merged commit a128bb4 into InspectorHub:main Jun 25, 2026
4 checks passed
@important-new
important-new deleted the feat/editor-optimization branch June 25, 2026 14:50
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