Repository navigation
fix(dashboards): leave the List Price by Category tile out when revenue is disabled (#2383) - #2390
Merged
Merged
Conversation
…ue is disabled The tile binds revenue's product_metrics. With the revenue module disabled, the platform stops serving its objects and datasets and the tile drew a 'dataset not defined' error. requiresObject: 'crm_product' makes the dashboard omit it instead; with revenue on it draws as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAnoe7eWhDPCCPzDBh5
#2383) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAnoe7eWhDPCCPzDBh5
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Author
席位核对Verdict: ACCEPT ·
Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Irene · project thread
Part of #2383. This PR fixes the dashboard tile. The other surfaces measured either already tolerate a disabled module, or need a platform change before HotCRM can hide them. The report on #2383 lists each one, and the seat decides what happens to the card.
Clause-②: no
Metadata-protocol: none
维护者速读
requiresObject: 'crm_product'。停用 revenue 模块时,这块磁贴不再显示,以前它会显示红色的「数据集未定义」错误。crm.dashboard.ts里的这一行。src/sales/dashboards/crm.dashboard.ts(top_products磁贴)、test/package-ownership.test.ts(新用例)。npx vitest run test/package-ownership.test.ts,预期 30 个用例全绿。What changes
src/sales/dashboards/crm.dashboard.ts: thetop_productswidget (List Price by Category) now carriesrequiresObject: 'crm_product'. Its datasetproduct_metricsships in the revenue module and readscrm_product.Measured on 18.2.0: when a package is disabled, its objects drop out of
GET /api/v1/meta/object(the served listrequiresObjectis checked against). So with revenue off, the console leaves the tile out. Without this change it drewDataset "product_metrics" is not defined in this environmentin red. With revenue on, the object is served and the tile draws as before.test/package-ownership.test.tsadds one case. Every app-package dashboard widget bound to a dataset that ships in a module asks, throughrequiresObject, for that dataset's own object, and that object belongs to the same module. Today the only such widget iscrm_overview_dashboard.top_products.No in-app docs change. The reasons are under Acceptance notes.
Tests
pnpm verifyonc520cfb: validate, typecheck, lint, hygiene, hygiene:tokens and build all exit 0, andvitest rungives Test Files 253 passed (253) · Tests 4881 passed, 1 skipped.VERIFY_EXIT=0.22d288eonly adds the claim's two lines to the changeset. On that head, the six suites that read.changesetor this test file give 6 files and 143 tests passed.pnpm hygieneandpnpm hygiene:tokensexit 0.requiresObjectline (one hit before, zero after) turns the new case red withcrm_overview_dashboard.top_products: expected undefined to be 'crm_product'. Restored withgit checkout HEAD --, andgit diff HEADis empty afterwards.Acceptance notes
How a module was disabled.
PATCH /api/v1/packages/app.objectstack.hotcrm.{marketing,revenue,service}/disableanswers 422WRITABLE_PACKAGE_REQUIREDon 18.2.0 for all three modules, because objectstack#28117 is still open. Instead I used the platform's own persisted-state path. I wroteOS_HOME/package-state/env_local.jsonas{"disabled":["app.objectstack.hotcrm.MODULE"]}and bootedobjectstack dev, whereAppPlugin.seedPersistedDisabledPackagesreads it.GET /api/v1/packagesthen reports the moduleenabled: false, and its objects answer 404OBJECT_PACKAGE_DISABLEDon the data plane and on the by-name reads. That matches the order's mechanism assumption 1. Each module was off on its own, all on one database, browsed as the dev admin and, for the actions, as amarketing_userholder.Each surface:
crm_opportunity.crm_campaignlookupSelect…and the picker says "No options found". A save sends only the dirty fields, so the value is kept. No error.crm_task.related_to_case,crm_event.related_to_caseSelect…. A save PATCHes{"description":…}only, sorelated_to_casekeeps its value (measured). No error.0 · No related records found, or fold into "+N empty". No error.create_campaign) and contact (add_contact_to_campaign)Flow 'campaign_lead_member_enroll' not found.generate_quote)Flow 'quote_generation' not found.Why the actions are platform-only. Their
visiblepredicates readcurrent_user.can(...). With marketing off,GET /api/v1/auth/me/permissions, as the admin and as amarketing_userholder, still listscrm_campaign_memberwithallowCreate: truewhile the data plane answers 404. Socan()answers true and the button draws. The console's predicate context offersrecord,current_userandfeatures, which holds server feature flags, not package state. 18.2.0 therefore has no metadata way to hide an action from a disabled module. Per AGENTS.md rules 1 and 2, this goes upstream rather than being worked around here, and the report hands it to the seat.generate_quotehas nocan()gate today. Adding one would not hide it on 18.2.0 either, so it is not added (no half landing).Lookups are not hidden, only read-empty. A form field's
visibleWhensees the same context, so nothing in it can tell that a module is off. The card accepts "read-only-empty, not an error", and that is what 18.2.0 already does.No in-app docs change. On 18.2.0 an administrator has no door to disable a module: Setup's Disable is refused with 422, so the only switch is an operator's state file. And two of the screens a doc would describe, the actions, still behave in a way the platform is meant to change. A page written now would describe a switch admins cannot use, plus behaviour that is waiting on a fix. The doc fits better once objectstack#28117 and its console card land.
Also seen, not app-package items: the module sidebar entries (Campaigns, Quotes, Products, Price Books) stay with their module off. That is objectstack#28117 item 2, and those entries are module navigation contributions anyway. The Help count drops by the disabled module's manual, as expected.
Verification
The tile, revenue off, before and after; all modules on, after
/_console/apps/app.objectstack.hotcrm/dashboard/crm_overview_dashboarddrew "List Price by Category", andPOST /api/v1/analytics/dataset/queryanswered 404Dataset "product_metrics" not found./api/request fails./api/request fails.The disable door and the permission payload
Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01J8VVAnoe7eWhDPCCPzDBh5