Repository navigation
Store command menu item rules as trees - #32398
FelixMalfait wants to merge 14 commits into
Conversation
Command menu items get conditionalAvailability and conditionalPinned jsonb columns, mirroring page layout widgets and tabs. Every producer (standard app, app manifests, the create API, navigation side effects) writes the tree next to the legacy expression, and the validator checks trees against a new commandMenuItem evaluation configuration. A 2-68 workspace command copies stored expressions into trees and turns on IS_COMMAND_MENU_ITEM_CONDITIONAL_AVAILABILITY_ENABLED only when every rule could be read. With the flag on, the front evaluates availability and pinning from the trees. The legacy expression columns stay until a later release.
|
Each change only adds Generated by Claude Code |
Confidence Score: 5/5
[Medium impact] The PR appears safe to merge. SummaryStores command menu availability and pinning rules as trees while keeping the text form for rollback.
No actionable issues were found. Review was based on source inspection; tests were not run. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[New or synced rule text] --> B[Parse and check]
B --> C[Store text and tree]
D[Existing rule text] --> E[Workspace copy command]
E --> F{Every rule readable?}
F -->|Yes| G[Enable tree reads]
F -->|No| H[Keep text reads]
C --> I{Workspace flag enabled?}
G --> I
H --> I
I -->|Yes| J[Evaluate tree]
I -->|No| K[Evaluate text]
J --> L[Availability and pinning]
K --> L
Reviews (1) · Last reviewed commit: "Store command menu item rules as trees" · Reviewed by Greptile |
🤖 PR Review
🛡️ Security Review✅ No high-severity vulnerabilities detected. 🚦 Auto-approve🙋 Manual review recommended for the following reason(s):
Automated pre-review — human approval still required. |
🟡 Quality review · 6 findings
High-level — Follows the widget rule-tree pattern: nullable tree columns are added beside the deprecated expressions, every write path parses leniently, a re-runnable 2-68 copy command turns the flag on per workspace (it stays off if any rule can't be read), and the front keeps reading the legacy expressions while the flag is off, so there is no product, architecture, build or deploy concern. 💬 6 inline comments on the diff. Reviewed against the |
|
Thanks for the review. Going through the findings: Strict parse on write paths (high-level). Confirmed. App manifest sync and Carried into the next push:
Not changing:
Generated by Claude Code |
Object creation parsed the generated navigation expression, so an invalid nameSingular threw before the object validator could report METADATA_VALIDATION_FAILED. The navigation rule is now built as a tree next to its expression. Also updates the flat entity properties snapshot for the two new columns, drops a cast in the 2-68 copy util and types the validator's rules as trees.
🔍 Visual Regression Review —
|
| Story | Verdict | Confidence | Explained by | |
|---|---|---|---|---|
| 🟡 | ui-surfaces-dialog--non-modal-page-interaction |
uncertain | 60% | none |
Changed stories
| Story | Diff % |
|---|---|
| ui-surfaces-dialog--non-modal-page-interaction | 1% |
| ui-components-codeeditor--display | 0% |
| ui-icon-icon--constrained-rows | 0% |
View run details · advisory mode
🔍 Visual Regression Review —
|
| Story | Verdict | Confidence | Explained by | |
|---|---|---|---|---|
| 🟡 | modules-ai-aichataddmenu--ignore-enter-on-outdated-records |
uncertain | 60% | none (likely hover/active-row flakiness) |
| 🟡 | modules-recordexport-connection--page-hide |
uncertain | 65% | none (focus ring flakiness) |
| 🟡 | modules-settings-applications-settingsapplicationiframemediapermissionssection--… |
uncertain | 65% | none (focus ring flakiness) |
| 🟡 | modules-pagelayout-widgets-recordpagenotewidget--dashboard-selection |
uncertain | 60% | none (editor selection state) |
| 🟡 | modules-pagelayout-widgets-recordpagenotewidget--align-text |
uncertain | 60% | none (editor selection state) |
| 🟡 | modules-sidepanel-recordcreationflow--submit-with-button |
uncertain | 75% | none (random UUID in story output) |
| 🟡 | modules-sidepanel-recordcreationflow--submit-with-command-enter |
uncertain | 75% | none (random UUID in story output) |
| 🟡 | modules-sidepanel-recordcreationflow--submit-with-control-enter |
uncertain | 75% | none (random UUID in story output) |
| 🟡 | modules-sidepanel-recordcreationflow--retry-after-failed-creation |
uncertain | 75% | none (random UUID in story output) |
| 🟡 | modules-ai-aichattab--new-chat-suggested-prompt |
uncertain | 55% | none (likely randomized suggested prompt text) |
| 🟡 | modules-settings-applications-settingsapplicationiframemediapermissionssection--… |
uncertain | 65% | none (sub-pixel text antialiasing noise) |
Changed stories
| Story | Diff % |
|---|---|
| modules-ai-aichataddmenu--ignore-enter-on-outdated-records | 4% |
| modules-recordexport-connection--page-hide | 2% |
| modules-settings-applications-settingsapplicationiframemediapermissionssection--does-not-apply-rejected-approval | 2% |
| modules-pagelayout-widgets-recordpagenotewidget--dashboard-selection | 1% |
| modules-pagelayout-widgets-recordpagenotewidget--align-text | 1% |
| modules-sidepanel-recordcreationflow--submit-with-button | 0% |
| modules-sidepanel-recordcreationflow--submit-with-command-enter | 0% |
| modules-sidepanel-recordcreationflow--submit-with-control-enter | 0% |
| modules-sidepanel-recordcreationflow--retry-after-failed-creation | 0% |
| modules-ai-aichattab--new-chat-suggested-prompt | 0% |
| modules-settings-applications-settingsapplicationiframemediapermissionssection--reports-failed-refresh | 0% |
| modules-activities-files-videopreview--player | 0% |
| pages-settings-mcpservers-settingsaimcpserverdetail--sync-keeps-unsaved-edits | 0% |
| modules-ai-aichattab--open-original-from-reply | 0% |
View run details · advisory mode
The merge from main shifted the JSON and UUID type indexes; this also corrects MinimalView.universalIdentifier, which main's generated client still pointed at the previous UUID index. The navigation rule tree now takes its path from buildNavigationConditionalAvailabilityExpression.
|
One of the regenerated lines isn't from this PR: Generated by Claude Code |
|
Follow-up: the author approved the tolerant approach, and it's in f3c24c5. Like widgets, an expression that can't be parsed now keeps its text and gets a null tree instead of failing the write, so re-syncing an app with an old rule no longer breaks. Covered by a unit spec and an integration case on create. Generated by Claude Code |
|
On the 10 quality nits:
Generated by Claude Code |
|
Generated by Claude Code |
|
Generated by Claude Code |
|
Generated by Claude Code |
…le-tree # Conflicts: # packages/twenty-server/src/database/commands/upgrade-version-command/2-68/2-68-upgrade-version-command.module.ts
|
Let's address comments |
|
🚀 Preview Environment Ready! Your preview environment is available at: https://legs-tan-whilst-charges.trycloudflare.com This environment will automatically shut down after 5 hours. |
|
Follow-up on
This PR doesn't touch workflow execution. One plausible reason it hits this PR every time: the PR adds integration specs, which changes how specs are split across shards, so this spec now runs alongside different neighbours. I haven't verified that. I'm leaving the test alone; a re-run of the shard should tell us more. Generated by Claude Code |
|
Address relevant comments that are still open/resolve all |
… so the copy can be re-run after the rollout
|
Update on Generated by Claude Code |
…le-tree # Conflicts: # packages/twenty-client-sdk/src/metadata/generated/schema.ts
|
This isn't from this PR: it doesn't touch rate limiting, REST or usage limits. The suite uses a 1-second bucket ( Generated by Claude Code |
|
Update on the two red integration shards on 8622937, after one re-run each:
It looks like a flaky lock timeout in that suite. I've used this PR's one re-run, so I'm leaving the check red rather than re-running it again. Generated by Claude Code |
…command-menu-rule-tree # Conflicts: # packages/twenty-client-sdk/src/metadata/generated/schema.ts
What
Phase 4 of the rule-tree migration: command menu items store their availability and pinning rules as trees, the same way page layout widgets (2-63) and tabs (2-67) already do.
Schema: new nullable jsonb columns
conditionalAvailabilityandconditionalPinnedoncore.commandMenuItem(2-68 fast instance command). Both are exposed on the GraphQL type, and the two text fields are marked deprecated.Writes: every producer now writes the tree next to the expression:
createCommandMenuItemAs with widgets, an expression that can't be parsed keeps its text and gets a null tree, so installing or re-syncing an app never fails on an old rule.
Validation: the flat command menu item validator checks both trees against a new
commandMenuItementry inCONDITIONAL_EVALUATION_CONFIGURATION_BY_METADATA_NAME. Its variables are exactly the keys ofCommandMenuContextApi, enforced withsatisfies.Upgrade: the
upgrade:2-68:copy-command-menu-item-rules-to-treesworkspace command:IS_COMMAND_MENU_ITEM_CONDITIONAL_AVAILABILITY_ENABLEDonly if every rule was readable;New workspaces get the flag by default. Re-run the command once the 2.67 pods are gone: they keep serving during the upgrade and can write expressions without trees, and the re-run repairs those.
Front:
evaluateCommandMenuItemRulereads the tree when the flag is on and the expression otherwise. Both places that work out availability use it (CommandMenuContextProviderContent,StandalonePageCommandMenu), and so does pinning (resolveCommandMenuItemPinning).Removing the legacy expression columns and the front fallback is a later PR. It is gated on:
Pinning
conditionalPinnedExpressiongets the same treatment as availability: its own tree column, copied by the upgrade command, and read from the tree when the flag is on. Pinning tests cover both branches.Not in this PR
parseConditionalEvaluationExpressioncalls here needfields: [].Note for reviewers
The new required flat fields had to be added as
nullto a few older upgrade commands and their specs:build-legacy-navigation-flat-command-menu-item.util.ts.This is the same pattern used when
availabilityCoreObjectNamewas added. Because it touches previous version folders, theci:allow-previous-version-upgrade-mutationlabel is applied so the guard passes.Testing
command-menu-itemmetadata suites;tsgopasses on server, front and shared. GraphQL and SDK clients were regenerated against a running server.Generated by Claude Code