Skip to content

refactor(webui): use existing frameworks across both pages - #175

Merged
jatmn merged 14 commits into
mainfrom
fix/158-local-webui-TBCTwdSV
Oct 10, 2026
Merged

jatmn merged 14 commits into
mainfrom
fix/158-local-webui-TBCTwdSV

Conversation

@jatmn

@jatmn jatmn commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

The existing frameworks supplied styles while both pages still constructed and reconciled most of the interface manually. Move the moderation dashboard and owner Administration onto React/ReactDOM, with Headless UI handling editor focus/dismissal and form associations. Preserve the switches, pale-blue/navy themes, statistics layout and centered editors while reducing unused browser dependencies.

  • Remove manual element construction/reconciliation, the select-mounting bridge and bespoke focus trap. Use Headless native Select with daisyUI styling; inline text filtering is removed.
  • Exclude Combobox, TanStack Virtual and Floating UI from browser JavaScript. Their installation lock entries remain required by upstream Headless UI; no dependency is patched or replaced with a stub.
  • Mount each React root once and subscribe to UI status snapshots with useSyncExternalStore. Existing API controllers retain immediate busy/auth guards. Controlled inputs use record/field draft keys and React context for save groups, replacing DOM scans, positional IDs, value restoration and synthetic event replay.
  • Preserve partial-save sibling drafts through repeated failed refreshes and Retry, fenced to their original guild/tab/membership. Copy source and section survive unrelated saves with the originally captured source token; restoration never silently refreshes that token. Retain command-plan validation, read deadlines and queued receipt handling.
  • Share appearance state/effects between both pages, including system preference and blocked-storage behavior. Remove theme-select and other ineffective classes; behavior tests use accessible selectors.
  • Use the 16 needed daisyUI component families, soft badges, semantic alerts, toast/fieldset styling, and button/card foundations including escalation panels. Omit unused broad utility sheets. Preserve the five-file deployment output and locked runtime dependencies; jsdom is test-only. Obsolete startup DOM test stubs, CSS cascade simulation, unused draft-test bindings and the retired image-test helper/lint exception are removed; current behavior coverage remains. No generated assets are committed.
  • After rebasing onto current main: role, voice, nickname, username and thread log events added on main render from the config payload, and the template reference names those variables (covered by a new dashboard state test). Administration Updates, refresh status and Database Usage screens from main work under the React version.
  • After rebasing onto main with feat(bot): keep database writes on the bot process #185 (single writer): the recovery page still shows the paired-upgrade refusal (409, pointing to Sign release images and verify signatures in the updater; ship schema migrations only in new images #188), Check still goes through the bot, and a missing control link shows control link unavailable on both the Updates and recovery pages. The only conflict was docs/UPGRADE.md; it keeps feat(bot): keep database writes on the bot process #185's one-app upgrade note and this PR's built dist/frontend/ upload.

Generated asset sizes including license text (measured before the rebase onto current main): dashboard JavaScript 403,635 bytes (121,801 gzip), Administration JavaScript 250,351 bytes (77,106 gzip), shared CSS 339,935 bytes (27,332 gzip). This is a local asset measurement, not a deployment timing benchmark. The redundancy pass reuses the existing Headless-backed field helper, daisyUI table scaffold and stat renderer, removes redundant control cloning, and reduces production source by 83 lines (4,232 bytes) and built dashboard JavaScript by 2,382 bytes (241 gzip), with no dependency or test-file changes.

Validation: full required bash scripts/ci-preflight.sh (frontend lint, WebUI build and frontend tests included); 127 dashboard and 37 Administration state tests using real React/Headless/DOM; packaged dependency/import/CSS checks. Chromium checks at 420/1280px in light/dark cover native selections, partial saves, failed-refresh recovery, retained copy scope, field labels, reachable centered editors, focus/Escape, exact role IDs, consolidated table content/classes/scroll focus, status contrast and no horizontal overflow. Focused independent review of draft/membership races found two task regressions, both corrected and verified. API responses are mocked; no live Discord, remote database, provider or deployment checks were performed. Cargo advisories follow the repository's existing PR policy.

Closes #158.

Validated commit: 445d93ae1acb8dea00795e1b85a9f44e7c8ffa2c (rebased onto main 7a2d748; Buildkite build 647 passed).

@socket-security

socket-security Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​esbuild@​0.28.2921007386100
Addednpm/​daisyui@​5.7.431001008396100
Addednpm/​@​headlessui/​react@​2.2.101001008387100
Addednpm/​react@​19.3.01001008497100
Addednpm/​react-dom@​19.3.01001009298100
Addednpm/​es-module-lexer@​3.0.310010010092100
Addednpm/​jsdom@​27.4.09510010097100

View full report

@jatmn jatmn changed the title fix(webui): bundle frontend dependencies at build time fix(webui): trim unused dependency code and styles Oct 6, 2026
@jatmn jatmn changed the title fix(webui): trim unused dependency code and styles refactor(webui): use existing frameworks across both pages Oct 6, 2026
@jatmn jatmn self-assigned this Oct 7, 2026
@jatmn
jatmn force-pushed the fix/158-local-webui-TBCTwdSV branch from 5404194 to 420bca3 Compare October 9, 2026 16:40

jatmn commented Oct 9, 2026

Copy link
Copy Markdown
Owner Author

@pullfrog review

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes across the full PR, including the dashboard and test files omitted from the rendered diff, against issue #158 and the current repository invariants.

  • React rendering and controls: Both pages now use mounted React roots, external-store subscriptions, shared appearance handling, native selects, and Headless editor/form components.
  • Configuration and recovery: Reviewed partial-save draft retention, guild/tab/membership fencing, captured copy-source scope, command-plan validation, queued log-channel reconciliation, and authentication-loss handling.
  • Administration: Reviewed release-policy and install controls, status polling, paired-upgrade links, and aggregate/detail Database Usage refresh behavior.
  • Build and deployment: Reviewed pinned dependency bundling, component/CSS exclusions, license inclusion, five-file packaging, API embedding, Buildkite selection/publication changes, and installation documentation.
  • Verification: The WebUI build, all 195 frontend Node tests, browser ESLint self-test, check-selection contracts, and image-publication contracts passed. Both npm audits reported zero vulnerabilities. React/Headless tests use jsdom and mocked API responses; publication tests use local fixtures. I did not rerun the full Rust preflight, browser automation, or live provider/deployment checks. GitHub CI-status lookup was denied: GraphQL: Resource not accessible by integration (repository.pullRequest.statusCheckRollup.nodes.0.commit.statusCheckRollup).

Pullfrog  | View workflow run | Using gpt-6.1-sol | 𝕏

@jatmn jatmn left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

— jatmn's PR Review agent

🟢 LGTM. I don't see any actionable issues on 420bca3449041586b044b26037b0ecb72af158ac.

Merge readiness

  • Head 420bca3 confirmed on GitHub; merge-base 41cbe776 on main. No conflicts, not behind main. Still a draft.
  • Buildkite buildkite/jmodguard (build 639) passed on this head.
  • The UI style changes are intentional per the owner and were not reviewed as regressions.

Other reviews checked against this head

  • Pullfrog (review on 420bca3, 2026-10-09): no new issues found. Clean.
  • Socket Security dependency report: the new direct npm dependencies (react, react-dom, @headlessui/react, daisyui, esbuild) are real and expected for this refactor. Socket shows no alerts, and npm audit --audit-level=high in ci-preflight passes, so this is not a blocker.

Withdrawn on re-check

A possible P2 about Settings and Cases keeping stale membership-scoped data after an enrollment change was checked and withdrawn as drift. Tabs remount through h(Content, { key: display.contentRevision }) (frontend/app.js:281), and renderTab() follows every loadConfig() success path that can detect a membership change. A save carrying an old revision under a new enrollment is rejected by set_case_delete_roles revision fencing (src/db/guild_data/tenant_settings.rs:76), not applied.

Validation: bash scripts/ci-preflight.sh --only frontend passed on the pinned head; review gates passed.

@jatmn
jatmn force-pushed the fix/158-local-webui-TBCTwdSV branch from 420bca3 to 445d93a Compare October 10, 2026 00:57

jatmn commented Oct 10, 2026

Copy link
Copy Markdown
Owner Author

@pullfrog review

@jatmn jatmn left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

— jatmn's PR Review agent

Follow-up after the rebase onto main 7a2d748 (#185). My prior comment-only LGTM was on 420bca3 (base 41cbe77). Head reviewed: 445d93ae1acb8dea00795e1b85a9f44e7c8ffa2c.

🟢 LGTM on 445d93a. The rebase onto #185 keeps the WebUI behavior I already reviewed on 420bca3; the only replay difference is the documentation conflict resolution.

Merge readiness

  • Range: live-base-three-dot, 7a2d748..445d93a (14 commits). No conflicts, not behind main.
  • CI: Buildkite buildkite/jmodguard build #647 passed on this head. Socket checks success.
  • Still a draft. Closes #158 (in PR body).

Rebase replay (git range-diff 41cbe77..420bca3 7a2d748..445d93a)

# Old New Patch
1 f07a41e 024f97c Changed, docs only: DEPLOY-BUNNY.md carries #185's one-app / control-link / read-only API text; UPGRADE.md Bunny section merges #185's one-app coordinated upgrade wording with #175's built dist/frontend/ upload (the one conflict).
2–13 same subjects same subjects Unchanged
14 420bca3 445d93a Same patch (activity-log template variables + state test).

UPGRADE.md / operator docs

docs/UPGRADE.md §5 and the Bunny section match merged main: Administration coordinated flow, paired-upgrade refusal until #188, manual rollout for baseline/OS changes, and the dist/frontend/ upload when the page needs new API. Cross-checked against DEPLOY-BUNNY.md (one pod, launcher revision 3 only through new images, control link, read-only API token). No lost or contradictory instructions.

#185 integration (Updates and recovery pages)

  • Snapshot shape still matches crates/api/src/web/updates.rs status_response (components, compatibility, launchers, coordinated_upgrade_path, service_upgrade, apply_enabled, webui_storage_configured).
  • Paired-upgrade refusal: PAIRED_UPGRADES_DISABLED (409, #188 message) surfaces through the JSON error field; Administration disables install while a pair is active (state test covers it).
  • Check through the bot: RecordUpdateCheck / installs go via_bot; failures land in check_error and the request error text, which Check now still shows.
  • Control link unavailable: CONTROL_LINK_UNAVAILABLE from the API commit path; Administration request() throws value.error, and the recovery page shows data.error.

No field or status-code mismatches between the PR's frontend and the merged API.

Tests

  • Baseline: Buildkite 647 on 445d93a.
  • Local on the pinned checkout: scripts/administration-state-test.mjs 37/37 and scripts/frontend-state-test.mjs 127/127.
  • older_guild_store_stays_live_then_becomes_ready_after_bot_migration is a #185 test this PR doesn't touch; one failure under full-workspace load then a pass on rerun points to a possible flake on main, not a #175 finding.

Other reviews

  • Pullfrog: @pullfrog review was requested on 445d93a; its review on this head has not posted yet. The last Pullfrog review (no new issues) is on 420bca3. The WebUI code is patch-identical to 420bca3, but the docs commit differs, so Pullfrog's pass on 445d93a is still needed before merge.
  • Sourcery / humans: nothing new since 420bca3.

Findings

None.

@pullfrog

pullfrog Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Pullfrog couldn't start this run — your .github/workflows/pullfrog.yml is missing the required workflow_dispatch: trigger. Add it back on your default branch and try again.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes across the full PR against issue #158, including the dashboard implementation and test file omitted from the rendered diff.

  • Rendering and forms: Both pages move to React roots and external-store subscriptions, with shared appearance handling, native selections, Headless UI dialogs and associated field labels.
  • Configuration safety: Reviewed partial-save draft retention, failed-refresh recovery, guild/tab/membership fencing, captured copy-source scope, rule/command validation, authentication loss and queued log-channel receipts.
  • Administration: Reviewed release-policy and update controls, polling, paired-upgrade recovery links and aggregate/detail Database Usage reconciliation.
  • Build and deployment: Reviewed locked dependency bundling, unused component/CSS exclusions, license inclusion, five-file packaging, API embedding, Buildkite selection/publication and installation documentation.
  • Verification: The production WebUI build, all 195 frontend Node tests, browser ESLint self-test, publication contracts and public-install acceptance passed; both npm audits reported zero vulnerabilities. Check-selection contracts passed on retry after the first invocation reported select-checks-test: root frontend plan omitted api (embed-ui include_str). Chromium smoke checks exercised desktop/mobile dashboard loading, visible centered rule editors, Escape/focus restoration and shared dark-theme persistence, with no runtime errors or horizontal overflow on the exercised screens. API responses were mocked and publication checks used local fixtures; the full Rust preflight and live Discord/database/Bunny/deployment checks were not rerun.

Pullfrog  | View workflow run | Using gpt-6.1-sol | 𝕏

@jatmn
jatmn marked this pull request as ready for review October 10, 2026 01:26
@sourcery-ai

sourcery-ai Bot commented Oct 10, 2026

Copy link
Copy Markdown

Sorry @jatmn, your pull request is larger than the review limit of 300,000 diff characters

@jatmn
jatmn merged commit 6016be8 into main Oct 10, 2026
7 checks passed
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.

WebUI: audit frontend dependencies, drop unused ones, and speed up loading

1 participant