Skip to content

feat(web): let admins allow rule rows on profiles from Home rows - #1898

Merged
Quick104 merged 5 commits into
feat/collections-revampfrom
feat/home-rows-profile-rule-switch
Oct 4, 2026
Merged

Quick104 merged 5 commits into
feat/collections-revampfrom
feat/home-rows-profile-rule-switch

Conversation

@Quick104

@Quick104 Quick104 commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #1137, #989, #1118
Validation tasks: none (no case covers whether profiles can add rule rows)

Stacked on #1897 (library copies), so this targets feat/home-rows-library-copies. #1897 sits on #1895, #1893, #1891, #1889, #1885, #1884, #1883 and #1882. It retargets to feat/collections-revamp once those merge.

The server setting sections.allow_profile_custom_sections decides whether non-admin profiles can add their own rule rows ("Titles matching rules") in Settings > Home Screen. The web has no control for it, so an admin who wants to turn it on has to call PUT /api/v2/admin/settings/sections by hand. This PR adds the switch the approved Home rows design draws: "Let profiles add rule rows" under More on admin Home rows.

Approach

  • The switch: More gets a "Let profiles add rule rows" item in its own group, with the help line "Profiles can build their own “Titles matching rules” and “Editor's picks” rows." It is a menuitemcheckbox with aria-checked, drawn with a switch in place of the check mark. The setting is server-wide, so the switch shows the same value on every page.
  • Reads and writes: the setting is read each time More opens. A change sends PUT /api/v2/admin/settings/sections with If-Match set to the ETag that was read, never *. While the change saves, the switch shows the new value and is disabled. Any read still in flight is cancelled first, so an older answer can't replace the saved value. On success a toast confirms the change, and the page invalidates the ["profile-section-flags"] query that Settings > Home Screen reads.
  • 412: if another admin changed the setting since it was read, the page reads it again, shows the current value with the toast "Changed elsewhere; it's now On/Off." and doesn't write again.
  • 403 (demo mode): the switch stays disabled and its help line shows the server's reason.
  • Turning off asks first: "Turn off rule rows for profiles? Profiles that already have rule rows or Editor's picks rows keep them, but can't change that page until they delete them." Turning on saves straight away.
  • Note in Add row: when an admin builds a rule row, the form ends with "Only admins can add rule rows unless Let profiles add rule rows is on in More." The wording keeps the fix(web): hide admin-only section types from profiles that cannot save them #1118 rule that admin accounts can always add rule rows on their own profiles. Components read a new profileRuleRowsSwitch capability, which only the admin adapter sets; no component checks the account role.

Differences from the plan and the approved design, for sign-off:

  • Turning off closes the menu before the confirm opens, and focus goes back to More when the confirm closes. Turning on keeps the menu open, as designed. A dialog opened over an open menu leaves two focus traps fighting over focus.
  • The confirm's buttons read Cancel, then Turn off, like the other Home rows dialogs. The plan lists them the other way round.
  • The item uses the Radix CheckboxItem primitive, not the DropdownMenuCheckboxItem wrapper, because the wrapper always draws a check mark next to the switch. The role and aria-checked are the same.
  • The server setting admits every admin-only row kind, so it also lets profiles add Editor's picks rows in Settings > Home Screen. The help line and the turn-off confirm name Editor's picks as well as rule rows; the design names only rule rows.
  • Text the design doesn't give: the success toasts "Profiles can now add rule rows." and "Profiles can no longer add rule rows.", and the help line "Couldn't read this setting. Open More again to retry." when the read fails.

Validation

  • Web: make test-web (786 files, 7227 tests passed), pnpm run lint (0 errors; nothing reported in changed files), format:check, build, tsc -b and budget:check pass.
  • Tests run the full admin page against a mocked v2 that issues value-based ETags like the server's. They cover the If-Match header, a read on each open, the keyboard path (open More, reach the switch, toggle it, Escape, focus back on More), the switch disabled while saving, the confirm and its Cancel, the 412 and demo-mode 403 paths, an older read landing after a save, the profile flags query being invalidated, and the note appearing only with the capability and at the end of the form. The new tests fail against the base branch's code.
  • Hygiene: make verify-local-paths passes.
  • Not run: the Go gate and the contract verify targets, because this diff changes no Go, contract or generated input. No browser check was run against a build; the menu item and the note were compared with the approved mockups in code only.

Risks

Turning the setting off is now one click. The server then refuses every save on a non-admin profile's page that still holds one of its own rule rows or Editor's picks rows, until the profile deletes those rows. That was already true when the setting changed through the API. The confirm says so, and a later PR in this series adds a note and a "Delete rule rows…" action on the profile side. Until then, such a save fails with "Failed to save section changes" and the server's reason.

Other browsers that already read the profile flags keep them for up to five minutes, so Settings > Home Screen there can briefly offer or hide rule rows on the old value. The server checks every save either way.

No API, section_type, recipe ID, preset key, layout export/import or hero change. The setting and its API already existed, so silo-apple, silo-android and jellycompat need no change.

The user manual doesn't describe this setting. A siloserver.org issue covering it, along with the rest of the Home rows changes, is drafted and not filed yet.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.

AI Disclosure

  • Harness: Claude Code (in T3 Code)
  • Tool(s): Claude Code subagents (implementer, independent reviewer)
  • Model(s): claude-opus-5-5[1m]
  • Involvement: Fully AI-generated, human review pending
  • Adversarial review: An independent reviewer subagent checked the diff against the approved design and the planned scope, compared the 412 handling with the server's value-based ETag, re-ran the related tests, and ran the new tests against the base branch's code to confirm they catch the change. It found no blockers, two minor problems and one nit, all fixed. The switch's icon wasn't muted like the other More icons. The note in Add row sat under the rule builder as plain text, where the mockup ends the form with a filled panel. Two behaviors had no test: cancelling an older read before a write, and reading the setting again on a later open after another admin changed it. Both now have tests, and each test fails when its code is removed.

🤖 Generated with Claude Code

Note

Add admin More-menu switch on Admin Home to allow profile rule rows

  • Adds a "Users" switch to the Admin Home More menu that reads and toggles whether profiles may add rule rows, backed by a new ETag-versioned settings reader and writer in adminSectionSettings.ts
  • Extends PageMoreMenu.tsx to support switch entries with checked state; direct changes keep the menu open, and entries that request confirmation close before invoking the change
  • Turning the switch off opens a new confirmation dialog (RuleRowsOffDialog.tsx); confirming preserves existing profile rows and returns focus to the More trigger
  • The new hook useProfileRuleRowsSetting.ts handles optimistic checked-state display, 412 stale-version rereads without retry, forbidden-write refusal, and profile-flag invalidation after writes
  • Row forms show an informational note about profile rule rows when the new capability flag in types.ts is set
  • Behavioral Change: PageMoreMenuEntry types are reworked — actions and switches are now discriminated shapes, and deferred-action bookkeeping replaces selected-item tracking in PageMoreMenu.tsx; existing menu consumers using action entries keep prior behavior

Macroscope summarized 53b6033.

Quick104 and others added 3 commits October 4, 2026 05:43
The server setting that lets profiles build their own rule rows had no
control in the web app. More on admin Home rows now has a "Let profiles
add rule rows" switch. It reads the setting each time More opens and
writes with If-Match. A change made elsewhere in the meantime shows the
current value instead of overwriting it. Turning the setting off asks
first, because profiles that already have rule rows can't change that
page until they delete them. The rule builder on the admin page now
says where this switch is.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The switch item skipped the menu item's muted icon color, so its icon
stood out from the other menu items. The rule-row note sat under the rule
builder as plain text; the mockup puts it last in the form as a filled
note.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ing late

Neither the read on a later open nor the cancel that keeps an older read
from overwriting a just-saved value had a test that failed without it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3ad98382-dc3a-4256-990b-b1937ccff865

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-04T12:59:14.106675Z 53b6033 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 102aeb57ab

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

let next = null as string | null;
const body = await v2("PUT /api/v2/admin/settings/sections", {
headers: { "If-Match": ifMatch },
body: { allow_profile_custom_sections: allowProfileRuleRows },

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid granting every admin-only recipe from a rule-row switch

Enabling this switch writes the broad allow_profile_custom_sections flag, not a rule-row-specific permission. HomeScreenSettings passes that flag to filterRecipeCatalog, which admits every recipe where admin_only is true, and internal/sections/recipes/admin_curated_list.go also marks admin_curated_list as admin-only. An admin using a control described solely as “Let profiles add rule rows” therefore also lets non-admin profiles create Editor's Picks rows, while disabling it can lock pages containing those rows. Either introduce a recipe-specific permission or make the control and confirmation describe the full scope of this flag.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Confirmed: the server flag admits every admin-only recipe, so it also covers admin_curated_list (Editor's picks) in Settings > Home Screen and in the save gate. A recipe-specific permission would be a server and contract change outside this web PR, so 53b6033 makes the control describe the full scope instead: the help line now reads "Profiles can build their own “Titles matching rules” and “Editor's picks” rows." and the turn-off confirm says profiles with rule rows or Editor's picks rows keep them but can't change that page until they delete them. The switch tests assert both strings.

Quick104 and others added 2 commits October 4, 2026 08:54
…nto feat/home-rows-profile-rule-switch

# Conflicts:
#	web/src/pages/AdminHomeRows.tsx
The server setting behind "Let profiles add rule rows" admits every
admin-only row kind, so turning it on also lets profiles add Editor's
picks rows in Settings > Home Screen, and turning it off locks pages
holding them. The switch's help line and the turn-off confirm now name
both kinds.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@macroscopeapp

macroscopeapp Bot commented Oct 4, 2026

Copy link
Copy Markdown

The validation-task line should include #1141 C1. The More menu gains the profile-rule switch, and rule-row Add row forms gain a note, so Web admin C1's build/reorder screen now has changed UI. The row creation and reorder behavior is unchanged; C1 is currently Not run, so there is no prior result to invalidate.

Suggested line:
Validation tasks: changes #1141 C1 (More adds the profile-rule switch and rule-row form note; row build/reorder behavior is unchanged)

Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.

Posted via Macroscope — v1 validation impact

Base automatically changed from feat/home-rows-library-copies to feat/collections-revamp October 4, 2026 14:47
@Quick104
Quick104 merged commit 4df5286 into feat/collections-revamp Oct 4, 2026
34 of 38 checks passed
@Quick104
Quick104 deleted the feat/home-rows-profile-rule-switch branch October 4, 2026 15:02
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