Repository navigation
feat(webui): zero-modal Configuration workbench with Global diff (PR 2/2) - #1119
Conversation
a123143 to
ba8d71c
Compare
There was a problem hiding this comment.
Important
The inspectors can misreport moderation and permission settings. The onboarding shortcut, keyboard selection, and log-stream focus also need fixes.
Approach The master-detail layout fits configuration inspection. The comparisons need to use the same settings and defaults the bot resolves.
Reviewed changes
- Automod Rules gained search and mode filters, an inspector with quick actions, a log preview, and a global comparison.
- Commands gained search and category filters plus a command configuration comparison.
- Log Channels gained stream navigation alongside the existing draft and receipt handling.
Six focused frontend tests passed. Seven additional JSDOM probes reproduced the review findings using simulated API responses.
Non-blocking
- A search with zero matches leaves an unrelated rule editable. The list shows an empty state while the inspector falls back to the first unfiltered rule and still offers mode changes and editing. Hide the inspector when no rule matches. Rules selection fallback
gpt-6.2-sol | 𝕏
…arding trap, keyboard selection, and log focus
ba8d71c to
efc3830
Compare
There was a problem hiding this comment.
Important
The command inspector can report a server override for a built-in command that uses its shipped settings.
Reviewed changes
I reviewed the changes since the prior Pullfrog review at a123143.
- Updated Automod inspection. Compared rule settings directly, gated onboarding resets by Manage Server access, and hid the inspector when no rule matches.
- Updated command inspection. Added a resolved default to the API and compared role restrictions and grants separately.
- Added keyboard selection. Made rule and command names focusable controls with a visible selected state.
- Preserved log-stream focus. Kept selection across remounts in the same guild and enrollment and cleared it on sign-out or authentication loss.
A Node probe using the checked-out inspector and simulated API rows reproduced the command finding. All 42 contrast and warmup tests passed. The focused workbench suite stopped at startup with ERR_MODULE_NOT_FOUND for react-dom/server.node.js.
gpt-6.2-sol | 𝕏
There was a problem hiding this comment.
ℹ️ No blocking issues. One non-blocking finding affects deployments running the new WebUI with an older API.
Reviewed changes
I reviewed commit 9c63ad8 since the previous Pullfrog review at efc3830.
- Corrected the command baseline. Preferred the API’s resolved default over stale global seeds, labeled unmodified built-ins as shipped defaults, and covered a stale disabled
banseed. - Moved command selection to the shared Inspect button. Kept an accessible command name and exposed selection with
aria-pressed.
A Node probe of the inspector confirmed the fix with current API responses and reproduced the older API case below. All 42 frontend contrast and warmup checks passed. The focused state suite could not start locally because react-dom/server.node.js was missing. Frontend CI
Non-blocking
- P2 · Older APIs can make the shipped-default badge contradict the diff. When an older API omits
default, a stale disabledbanseed still yieldsDisabled / Enabled / Overridefor a server with no override, even as the header says “shipped default.” Useeffectiveas the fallback for built-ins without a server override and show the baseline as unavailable for overridden built-ins until the API supplies it. Inspector fallback
gpt-6.2-sol | 𝕏
…arding trap, keyboard selection, and log focus
…nd use view IconButton for command inspection
9c63ad8 to
1cba469
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
I compared 1cba469 with the previously reviewed head, 9c63ad8.
- Rebased onto
main. PR #1118 is now in the base, and both heads have the same Git tree. The earlier non-blocking finding about the command inspector with older APIs still applies. Prior review
I did not rerun tests because the source tree is identical.
gpt-6.2-sol | 𝕏
There was a problem hiding this comment.
Hey - I've found 8 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="frontend/app.js" line_range="5466" />
<code_context>
+ className: mode === target ? `sf-tri-${target}` : "",
+ "aria-pressed": mode === target ? "true" : "false",
+ onClick: () => quickSetRuleMode(record, target),
+ },
+ label,
+ ),
</code_context>
<issue_to_address>
**Other server's rules get patched**
When a mode-change or server-rule reset is pending while the operator switches servers, the mode or reset response is applied to the currently selected server instead of the server that sent the request, so server A's result changes server B's in-memory rules and later edits can save that stale state to B.
Capture the request's guild and ignore its response unless that guild is still selected.
Also at `frontend/app.js:5504`.
</issue_to_address>
### Comment 2
<location path="frontend/app.js" line_range="5466" />
<code_context>
+ className: mode === target ? `sf-tri-${target}` : "",
+ "aria-pressed": mode === target ? "true" : "false",
+ onClick: () => quickSetRuleMode(record, target),
+ },
+ label,
+ ),
</code_context>
<issue_to_address>
**Rule mode changes overwrite each other**
When an operator changes a rule mode again before the previous PUT completes, or another editor saves that rule concurrently, `quickSetRuleMode` sends the entire rule copied from the rendered record, and overlapping PUT responses apply their patches without checking which request is newer. A later click can therefore be replaced in the UI by an earlier response, while either stale payload can overwrite intervening rule edits; the displayed mode or saved configuration no longer reflects the latest change.
Serialize mode changes per rule or use conditional/versioned updates and reconcile responses against the latest authoritative rule before applying them.
</issue_to_address>
### Comment 3
<location path="frontend/app.js" line_range="5466" />
<code_context>
+ className: mode === target ? `sf-tri-${target}` : "",
+ "aria-pressed": mode === target ? "true" : "false",
+ onClick: () => quickSetRuleMode(record, target),
+ },
+ label,
+ ),
</code_context>
<issue_to_address>
**Global rule toggles target guild scope**
When an operator changes a rule's mode from the global Rules workbench, `quickSetRuleMode` sends `scope: "guild"` for every rule and has no global-scope branch, so an operator using the global Rules workbench cannot apply the selected mode to the global rule; the toggle fails or writes to the wrong scope.
Choose the payload scope from the active workspace and send global rule changes with global scope.
</issue_to_address>
### Comment 4
<location path="frontend/app.js" line_range="5527" />
<code_context>
+ h(
+ "li",
+ { key: idx, className: "sf-wb-step" },
+ h("span", null, h("strong", null, `Strike ${step.at ?? idx + 1}`), ` — ${step.action}`, step.duration_minutes ? ` (${step.duration_minutes}m)` : "", step.action === "ban" && step.purge_last_hour ? " (purge 1h)" : "", step.reason ? `: ${step.reason}` : ""),
+ h(Badge, { component: "span", className: `badge ${step.action === "ban" ? "badge-error" : step.action === "timeout" || step.action === "warn" ? "badge-warning" : ""}` }, step.action),
+ ),
</code_context>
<issue_to_address>
**Ban deletion days are hidden**
When a ban step has `delete_days` set and `purge_last_hour` is false, the escalation preview shows the ban but omits `delete_days`, so operators cannot see how many days of messages the action deletes.
Render the ban step's `delete_days` in the escalation preview.
Also at `frontend/app.js:5528`.
</issue_to_address>
### Comment 5
<location path="frontend/app.js" line_range="5383" />
<code_context>
+ const shown = {};
+ for (const f of trigger.fields || []) shown[f.key] = String(rule.params?.[f.key] ?? f.fallback);
+ const outcome = ruleOutcomeFor(record.rule_id, rule, spamRuleBan(rule));
+ return ruleSummaryText(trigger.phrase(shown), outcome, rule.enabled, rule.dry_run);
+ }
+ return record.description || "Custom automod rule.";
</code_context>
<issue_to_address>
**Invite allowlist summary is inaccurate**
When an invite rule has a non-empty `params.allowlist_codes`, `formatRuleSummaryFor` passes `trigger.phrase` only values collected from `trigger.fields`, but the invite trigger has no fields and its phrase reads `allowlist_codes`; a configured allowlist is therefore shown as though all Discord invites are blocked, misleading operators about the rule.
Pass the invite allowlist value to the phrase formatter or define it as a trigger field.
</issue_to_address>
### Comment 6
<location path="frontend/app.js" line_range="7688-7694" />
<code_context>
+ ["State", baseline ? (baseline.enabled ? "Enabled" : "Disabled") : "—", eff.enabled ? "Enabled" : "Disabled", baseline != null && Boolean(baseline.enabled) !== Boolean(eff.enabled)],
</code_context>
<issue_to_address>
**Command diff hides behavior changes**
When a custom command’s server override changes its behavior while its displayed fields remain equal to the global command, `diffRows` never compares `behavior`, so when a server override changes a custom command’s steps or behavior parameters while the displayed fields match, every displayed row says “Matches global” and the inspector hides the change from the operator.
Include a normalized behavior comparison and display its global and server values in the diff.
</issue_to_address>
### Comment 7
<location path="frontend/app.js" line_range="9032-9035" />
<code_context>
+ const channels = state.config.log_channels.filter((lc) => lc.event !== "system");
+ const [selectedEvent, setSelectedEventState] = useState(() => {
+ if (
+ focusedLogStream.guildId === guildId
+ && focusedLogStream.enrollmentId === enrollmentId
+ && (focusedLogStream.event === "all" || channels.some((lc) => lc.event === focusedLogStream.event))
+ ) {
+ return focusedLogStream.event;
+ }
</code_context>
<issue_to_address>
**Previous server's filters remain active**
When the operator switches servers while Rules, Commands, or Log Channels remains mounted, the workbench keeps its previous query, filter, or focused stream instead of selecting valid state for the new server. A stale category or search can hide rules or commands, and a stale log stream can leave the log cards empty.
Reset or validate the workbench's local filters and focused stream when the guild or enrollment changes.
Also at `frontend/app.js:5576-5578`, `frontend/app.js:7762-7764`, `frontend/app.js:9030`.
</issue_to_address>
### Comment 8
<location path="frontend/app.js" line_range="5576-5578" />
<code_context>
function tabRules() {
const rules = state.config.rules.filter((r) => r.rule_id !== "known_spam" &&
(state.guildId !== "0" || r.rule_id !== ONBOARDING_TRAP_RULE));
+ const [query, setQuery] = useState("");
+ const [modeFilter, setModeFilter] = useState("all");
+ const [selectedId, setSelectedId] = useState(() => rules[0]?.rule_id ?? null);
+ const needle = query.trim().toLowerCase();
+ const filtered = rules.filter((r) => {
</code_context>
<issue_to_address>
**Workbench filters reset after updates**
When a rule or command workbench update or refresh calls `renderTab()`, `renderTab()` increments `contentRevision`, and `Workspace` keys `Content` by that value, so React remounts these components and discards their local query, filter, and selection state. After a rule toggle or configuration refresh, users lose their workbench context and return to the default list and selection.
Preserve the workbench query, filter, and selection across `Content` remounts, or avoid forcing that remount for ordinary updates.
Also at `frontend/app.js:7762-7764`.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 8 findings to address first, and the new inspector controls can change a server rule’s enforcement mode or remove its override, causing the global rule to take effect. If that enables automated bans or message deletion, reverting the UI change will not undo those actions.
Blocking findings: frontend/app.js:5466, frontend/app.js:5466, frontend/app.js:5466, frontend/app.js:5527, frontend/app.js:5383, and 3 more
…al toggles, show delete_days/allowlist/behavior diff, and scope workbench view state
There was a problem hiding this comment.
Important
The new command behavior diff hides changes to plan step parameters.
Reviewed changes
I reviewed 29a3821 against the prior Pullfrog review at 1cba469.
- Scoped quick rule mutations. Guarded toggle and reset responses by guild and enrollment and enabled global mode changes.
- Expanded inspector details. Added invite allowlist context, whole-day ban deletion windows, and a command behavior comparison.
- Preserved workbench state. Kept filters, selection, and log-stream focus across same-workspace refreshes and reset them when a workbench opens under a different guild or enrollment.
The WebUI build, five focused workbench state tests, and 42 contrast and warmup tests passed. Additional JSDOM checks with simulated API responses reproduced the three findings.
Non-blocking
- P2 · A server round trip can restore an old Rules filter. Set a filter on server A, return to Command Center, switch to B and back to A, then reopen Rules. A's old filter still applies because the stored view only checks for scope changes when a workbench renders. Clear the saved view when the server selection changes. Workbench state
- P2 · The ban preview can show two deletion windows. A ban with both
purge_last_hourand a legacydelete_daysvalue displays both windows. The bot gives the hour flag precedence, as the full editor does. Use the same precedence in the preview. Preview · Bot semantics
gpt-6.2-sol | 𝕏
There was a problem hiding this comment.
ℹ️ No blocking issues. The original reply-template case is fixed, with one remaining display ambiguity.
Reviewed changes
I reviewed dfc28c4 against the previously reviewed head, 29a3821.
- Displayed command plan parameters. The Behavior row now shows the parameters for each step and includes a regression test for a reply template edit with the same step count and type.
The WebUI build and both focused state tests passed. A Chromium probe using the inspector, built stylesheet, and simulated command records confirmed the fix and reproduced the remaining issue.
Non-blocking
- P2 · Different reply templates can still look identical. Replacing a space with a line break or adding a second space leaves both Behavior cells looking the same beside
Override. A reply containing); reply(template=can also look like an extra step. Quote string values and preserve their whitespace so readers can see the edit and tell where each step ends. Plan step formatter
gpt-6.2-sol | 𝕏

Summary
PR 2 of 2 (stacked on #1118) completing the Sentinel Fleet Workbench by upgrading Automod Rules, Commands, and Log Channels into zero-modal master-detail workbenches with live Global vs. Server Override Diff inspection.
What changed
tabRules,RuleWorkbenchInspectorinfrontend/app.js,frontend/style.css):All,Live,Dry,Off) usingnoAutofill/data-no-draftcontrols so filtering never dirties form drafts.Off / Dry / Livetoggle, 1-click Full editor and Reset to global actions, and a 2-tab switcher:automodlog channel.Enabled,Mode,Parameters,Actions,Exemptions) withOverride/Inheritedbadges.tabCommands,CommandWorkbenchInspector):State,Permission,Cooldown,Aliases, andAllowed roles.tabLogChannels):All streams+ per-event routing status / queued indicator) so operators can focus a single log stream or inspect all streams while preserving existing multi-card draft and receipt reconciliation behavior.eventLabel(event)helper reused byeventHeadingandtabLogChannels.scripts/frontend-state-test.mjs):Validation
npm run build --prefix tools/webui— PASSbash tools/eslint-web-selftest.sh— PASSnode --test scripts/frontend-contrast-test.mjs scripts/frontend-sr-only-test.mjs scripts/frontend-warmup-test.mjs scripts/package-webui-test.mjs scripts/administration-state-test.mjs— 88/88 PASSnode --test scripts/frontend-state-test.mjs— 620/620 PASS (includes real headless Firefox BiDi suite; simulated API stub server)git diff --check— cleanStack
feat/webui-sentinel-shell-command-center)feat/webui-sentinel-config-workbench(retarget tomainonce feat(webui): Sentinel Fleet Workbench shell and Bento Command Center (PR 1/2) #1118 merges)Summary by Sourcery
Introduce zero-modal configuration workbenches for automod rules, commands, and log-channel routing.
New Features:
Bug Fixes:
Enhancements:
Tests: