Skip to content

Commit 8a12a17

Browse files
refactor(ui)!: retire test-only barrel helpers, CommentSearchResult and four dead publicForm keys (#28544)
<!-- claude-projects-attribution: {"github_login":"os-tesla"} --> _Requested by **Tesla** · [project thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoSoxEEBsgSbf7fv9MkDm77d)_ Part of #25921 (items B1, B3, B4, B6 and B10 of the card thread's ledger, claim 6553495326; the card's other open items stay on it) Clause-②: no (narrowing) Metadata-protocol: none ## 维护者速读 - 改了什么:从五个 ui 包的公共入口拿掉无人使用的面:core 的 `resetActionKeyWarnings`、react 的 `__resetVisibilityPredicateWarnings`、plugin-detail 的 `resetUnknownActivityTypeWarnings`(三个都是只给测试用的「清掉只警告一次的记忆」助手),types 的 `CommentSearchResult` 接口(唯一生产者早已退役),以及十个语言包里四个没有任何界面读取的 `publicForm.*` 文案。 - 为什么改:#25921 清理零消费者公开面;这几项在仓内、`examples/**` 与 hotcrm 中都没有非测试读者,留在入口上只会被当成公开 API 承诺。 - 风险与回滚:只删导出与文案,不改任何运行行为;跨包测试改为从声明模块直接引入助手。对外部 npm 使用者是破坏性变更,五个包各带一个 `!` changeset 写明替代写法。回滚即 revert 本 PR。 - 先看:`ui/packages/core/src/actions/index.ts`(`export *` 改为具名列表,少了 reset);`ui/packages/types/src/__tests__/record-id-string-survivors-10078.test.ts`(钉子去掉一行);`.changeset/25921-*.md` 五个文件。 - 两分钟验证:`git grep -n -w -e resetActionKeyWarnings -e __resetVisibilityPredicateWarnings -e resetUnknownActivityTypeWarnings -- 'ui/packages/*/src/index.ts*'` 只剩三行「test-only and stays off the barrel」注释;`git grep -w CommentSearchResult -- ui/packages` 无结果。 - 需要你做的:无,席位落地(收窄公开入口,席位先做一次契约档复核)。 ## What changes - **B1 `@object-ui/core`:** `actions/index.ts` re-exported `./actionKeys.js` with `export *`, which put the test seam `resetActionKeyWarnings` on the package entry. It now re-exports the module's other ten names by name. Core's own tests already import the helper from `../actionKeys`. - **B3 `@object-ui/react`:** `__resetVisibilityPredicateWarnings` leaves the entry. Nine cross-package tests imported it from `@object-ui/react` (the ledger said five; the import scan on the branch found nine) and now import it from `react/src/utils/visibilityDiagnostic`, the same module the vitest alias resolves the entry to, so the reset still clears the instance the code under test reads. Four app-shell tests already used that path. - **B4 `@object-ui/plugin-detail`:** `resetUnknownActivityTypeWarnings` leaves the entry; its one cross-package test (`RecordDetailView.activityUnmappedType-5896`) imports `plugin-detail/src/renderers/recordActivityFeed`. The entry's docblock sentence that justified exporting it goes with it. - **B6 `@object-ui/types`:** `CommentSearchResult` is deleted from `views.ts` and the entry. Its only producer, `useCommentSearch` in collaboration, retired in #28385. The record-id pin `record-id-string-survivors-10078` keeps its two other shapes (`RecordSubscription.recordId`, `DataSourceMutationEvent.id`) with their type rows, value controls and census rows. - **B10 `@object-ui/i18n`:** `publicForm.consentRequired`, `rateLimited`, `redirectBlocked` and `requiredHint` leave all ten packs (40 lines). `ui/scripts/check-i18n-dead-keys.mjs` lists all four CONFIRMED; the form page reads the nine sibling `publicForm` keys, none of these. - Five changesets, one per package, each `patch` with a **BREAKING** banner, both declaration lines and an ADR-0087 disposition (`runtime-export-retired` for the four exports, `no-migration-prescription` for the keys). Zero-consumer readings (ledger `/mnt/project-files/ui-seat-1/r2026-10-31b/out/25921-ledger.md`, objectstack `efb1620c`, hotcrm `a598256`, positive controls `SchemaRenderer` 1,198 files and `useRecordPresence` 113): each name has no non-test reader outside its package; every import of the four names on this branch was re-read from the import statements themselves. ## Verification Head `fef5795d` (branch point `eeec88d1`). <details><summary>Tests</summary> - `pnpm --dir ui exec vitest run packages/core/src/actions/ packages/react/ packages/plugin-detail/ packages/types/ packages/i18n/` plus the ten edited cross-package test files: Test Files 1022 passed, 7 failed, 1 skipped (1030). All seven reds read `no module symbol for packages/spec/dist/...d.mts` or the spec export probe: the closure had been built with `OS_SKIP_DTS=1`. After `pnpm --filter @objectstack/spec build` with declarations, the seven files rerun: 7 passed, 184 tests passed. - `pnpm turbo run type-check` for types, core, react, plugin-detail, i18n, components, app-shell and console (each package's own `tsc --noEmit` plus its `tsconfig.test.json`, so the pin's compile-time rows and every repointed test are compiled): 78/78 tasks successful, lock VERDICT command-exit 0. - `pnpm --dir ui exec vitest run scripts/`: 169 files passed, 2 skipped; 4901 tests passed. - No ablation: the diff removes exports and dead strings; no tested behaviour changes. </details> <details><summary>Gates</summary> - `dispatch-gates --commands`: 34 commands, all run with stdin closed, each exit recorded before any pipe; `--ran`: 34 derived, 34 run, 0 NOT-MEASURED. All exit 0. `check:type-check-debt` first exited 3 (prerequisite: run during the build) and exits 0 on rerun (0 entries above their recorded number). - `check-adr-0087-registration --base origin/main`: 5 declared-breaking changesets, each with a verified disposition. - Outside the derived set: `check-sdui-manifest` exit 0; `check-platform-checklist --changed-from origin/main` exit 0 (0 anchored files); `ui` `check:new-line-citations` exit 0 (0 new). - `dispatch-gates --tier`: no path-derived mandate; 194 changed lines (+104 / -90), under the 3,000 threshold. No governed path. </details> ## Acceptance notes - The ledger counted five cross-package importers of `__resetVisibilityPredicateWarnings`; it is nine (multi-line imports the first scan missed). All nine are repointed here, same item, same file class. - Left on #25921 by the seat's pick: B2 (`clearSharedDiscoveryCache`), B5 (`resetRetiredDashboardNodeTypeReports`, declared published on purpose), B7 (S3/Azure upload adapters), B8 and B11 (governed), B9, B12, B13. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (not touched) - [x] 2. Every name I added uses the casing for its kind. (no names added) - [x] 3. No formatter ran; `pnpm lint` passes. (lint is CI's run) - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: n/a. - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English (the 维护者速读 block is the maintainer's channel). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L9qibzKqWksC1TiqsHCrrU --- _Generated by [Claude Code](https://claude.ai/code/session_01L9qibzKqWksC1TiqsHCrrU)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent c658320 commit 8a12a17

32 files changed

Lines changed: 107 additions & 93 deletions

‎.changeset/25921-collaboration-zero-consumer-exports.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ What leaves, and what to write instead:
1515

1616
- FROM `useCommentSearch` TO a `useMemo` over your own comment list that keeps the entries whose `text` or `author` contains the trimmed, lower-cased query.
1717
- FROM `CommentSearchConfig` TO `{ comments: CommentEntry[] }`, with `CommentEntry` from `@object-ui/types`.
18-
- FROM `CommentSearchReturn` TO the shape your own search state returns; the result rows can keep using `CommentSearchResult` from `@object-ui/types`.
18+
- FROM `CommentSearchReturn` TO the shape your own search state returns; type the result rows with a local interface, `{ comment: CommentEntry; objectName: string; recordId: string; highlight?: string }` (`CommentSearchResult` leaves `@object-ui/types` in the same release).
1919
- FROM `createPresenceUpdater` TO a `Map<string, PresenceUser>` keyed by `userId` that you update from your realtime channel, or `PresenceProvider` with `useTenantPresence` / `useRecordPresence`, which the package keeps exporting.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@object-ui/core': patch
3+
---
4+
5+
refactor(core)!: take the test-only `resetActionKeyWarnings` off the package entry
6+
7+
Clause-②: no (narrowing)
8+
Metadata-protocol: none
9+
10+
<!-- adr-0087: not-required (runtime-export-retired @object-ui/core#resetActionKeyWarnings) the retired operand is a test seam that clears a warn-once memo; nothing in the workspace or in hotcrm imported it from the package entry, and no packages/spec schema, registered node type, conversion surface or stored shape names it, so there is nothing for `objectstack migrate meta` to rewrite -->
11+
12+
**BREAKING** for a host that imports `resetActionKeyWarnings` from `@object-ui/core`. It cleared the once-per-key memo behind the unknown-action-key warning and existed for tests; core's own tests reach it through the module that declares it. The other ten names of that module (`ACTION_DEF_KEYS`, `SPEC_ACTION_KEYS`, `NAVIGATION_ALIAS_KEYS`, `HOST_DISPATCH_ACTION_KEYS`, `RETIRED_ACTION_KEYS`, `KNOWN_ACTION_KEYS`, `classifyActionKeys`, `warnOnUnknownActionKeys`, `hasDeprecatedObjectParams`, `warnOnDeprecatedObjectParams`) stay exported unchanged, and the warning itself still fires once per key.
13+
14+
- FROM `resetActionKeyWarnings()` in a test TO a fresh module instance per test (`vi.resetModules()` before importing `@object-ui/core`), or no reset at all when the test asserts the first warning only.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@object-ui/i18n': patch
3+
---
4+
5+
refactor(i18n)!: delete four `publicForm` keys that no screen reads
6+
7+
Clause-②: no (narrowing)
8+
Metadata-protocol: none
9+
10+
<!-- adr-0087: not-required (no-migration-prescription) the four deleted keys are message strings in the built-in locale packs that no t() call site in the workspace or in hotcrm reads (the embeddable form draws its own English literals instead); they are not metadata, no packages/spec schema or stored shape names them, and a host that kept its own text under these keys keeps it in its own resources -->
11+
12+
**BREAKING** only for TypeScript code that names one of the deleted keys through the pack-derived key type (`TranslationKeys`): `publicForm.consentRequired`, `publicForm.rateLimited`, `publicForm.redirectBlocked` and `publicForm.requiredHint` leave all ten packs (ar, de, en, es, fr, ja, ko, pt, ru, zh). No translation call read them. `EmbeddableForm` in `@object-ui/plugin-form` draws the same wording as hard-coded English defaults for `consentRequired`, `rateLimited` and `requiredHint`, and shows `redirectBlocked` only when the form author supplies `texts.redirectBlocked`; those defaults were never localised through these keys and stay un-localised English after this change. An author localises them per form through `config.texts`. The form page's other `publicForm` keys (`submit`, `submitting`, `poweredBy`, `thankYouTitle`, `thankYouMessage`, `redirecting`, `redirectPending`, `loading`, `requiredFields`) are unchanged.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@object-ui/plugin-detail': patch
3+
---
4+
5+
refactor(plugin-detail)!: take the test-only `resetUnknownActivityTypeWarnings` off the package entry
6+
7+
Clause-②: no (narrowing)
8+
Metadata-protocol: none
9+
10+
<!-- adr-0087: not-required (runtime-export-retired @object-ui/plugin-detail#resetUnknownActivityTypeWarnings) the retired operand is a test seam that clears the warn-once bucket of the unmapped activity-type diagnostic; no shipped code in the workspace or in hotcrm called it, and no packages/spec schema, registered node type, conversion surface or stored shape names it, so there is nothing for `objectstack migrate meta` to rewrite -->
11+
12+
**BREAKING** for a host that imports `resetUnknownActivityTypeWarnings` from `@object-ui/plugin-detail`. It existed for tests; the one workspace test outside the package now imports it from the module that declares it. `ACTIVITY_TYPE_TO_FEED_TYPE`, `UNMAPPED_ACTIVITY_FEED_TYPE`, `activityRowToFeedItem` and `isRefusedFeedRead` stay exported unchanged, and the diagnostic still warns once per unmapped type.
13+
14+
- FROM `resetUnknownActivityTypeWarnings()` in a test TO a fresh module instance per test (`vi.resetModules()` before importing `@object-ui/plugin-detail`), or an activity type unique to that test.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@object-ui/react': patch
3+
---
4+
5+
refactor(react)!: take the test-only `__resetVisibilityPredicateWarnings` off the package entry
6+
7+
Clause-②: no (narrowing)
8+
Metadata-protocol: none
9+
10+
<!-- adr-0087: not-required (runtime-export-retired @object-ui/react#__resetVisibilityPredicateWarnings) the retired operand is a test seam that clears the once-per-predicate dedupe of the unresolvable-visibility report; no shipped code in the workspace or in hotcrm called it, and no packages/spec schema, registered node type, conversion surface or stored shape names it, so there is nothing for `objectstack migrate meta` to rewrite -->
11+
12+
**BREAKING** for a host that imports `__resetVisibilityPredicateWarnings` from `@object-ui/react`. The double-underscore name already marked it as a test seam; the workspace tests that used it now import it from the module that declares it. `reportUnresolvableVisibilityPredicate`, `formatUnresolvableVisibilityMessage`, `UNRESOLVABLE_VISIBILITY_PREFIX`, `UNRESOLVABLE_ENABLEMENT_PREFIX` and the `PredicateScopeTier` type stay exported unchanged, and the report still dedupes per predicate.
13+
14+
- FROM `__resetVisibilityPredicateWarnings()` in a test TO a fresh module instance per test (`vi.resetModules()` before importing `@object-ui/react`), or a predicate source string unique to that test so the dedupe cannot hide its line.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@object-ui/types': patch
3+
---
4+
5+
refactor(types)!: retire the zero-consumer `CommentSearchResult` interface
6+
7+
Clause-②: no (narrowing)
8+
Metadata-protocol: none
9+
10+
<!-- adr-0087: not-required (runtime-export-retired @object-ui/types#CommentSearchResult) the retired operand is a TypeScript interface for a cross-record comment search result; its only producer, the `useCommentSearch` hook of `@object-ui/collaboration`, already retired, and nothing in the workspace or in hotcrm reads the type; no packages/spec schema, registered node type, conversion surface or stored shape names it, so there is nothing for `objectstack migrate meta` to rewrite -->
11+
12+
**BREAKING** for a host that imports the type `CommentSearchResult` from `@object-ui/types`. It described the hits of a comment search the packages no longer ship. `CommentEntry`, `MentionNotification` and `ActivityEntry` stay exported unchanged.
13+
14+
- FROM `CommentSearchResult` TO a local interface in your own code: `{ comment: CommentEntry; objectName: string; recordId: string; highlight?: string }`.

‎ui/apps/console/src/__tests__/App.homePermissions-12700.test.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ import { describe, it, expect, vi, beforeEach, afterEach, type MockInstance } fr
3434
import { render, screen, cleanup, waitFor, act } from '@testing-library/react';
3535
import { useContext, type ReactNode } from 'react';
3636
import { useNavigate } from 'react-router-dom';
37-
import { MetadataCtx, type MetadataContextValue, __resetVisibilityPredicateWarnings } from '@object-ui/react';
37+
import { MetadataCtx, type MetadataContextValue } from '@object-ui/react';
38+
import { __resetVisibilityPredicateWarnings } from '../../../../packages/react/src/utils/visibilityDiagnostic';
3839
import { usePermissions, type MePermissionsResponse } from '@object-ui/permissions';
3940
// Not on the package's entry: the context object itself, read by its module id
4041
// (`@object-ui/permissions` resolves to `packages/permissions/src`, so this is

‎ui/packages/app-shell/src/layout/__tests__/UnifiedSidebar.navCanPermissions-12700.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { render, screen, waitFor, act } from '@testing-library/react';
2626
import { MemoryRouter } from 'react-router-dom';
2727
import type { NavigationItem } from '@object-ui/types';
2828
import { MePermissionsProvider, type MePermissionsResponse } from '@object-ui/permissions';
29-
import { __resetVisibilityPredicateWarnings } from '@object-ui/react';
29+
import { __resetVisibilityPredicateWarnings } from '../../../../react/src/utils/visibilityDiagnostic';
3030

3131
vi.mock('@object-ui/i18n', async (importOriginal) => ({
3232
...(await importOriginal<Record<string, unknown>>()),

‎ui/packages/app-shell/src/providers/ExpressionProvider.visibleFaultDiagnostic.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
6969
import { ExpressionEvaluator } from '@object-ui/core';
7070
import {
7171
UNRESOLVABLE_VISIBILITY_PREFIX,
72-
__resetVisibilityPredicateWarnings,
7372
} from '@object-ui/react';
73+
import { __resetVisibilityPredicateWarnings } from '../../../react/src/utils/visibilityDiagnostic';
7474
import { hasVisibleNavigationItems } from '@object-ui/layout';
7575
import { buildExpressionScope, evaluateVisibility } from './ExpressionProvider';
7676

‎ui/packages/app-shell/src/providers/__tests__/navigationVisibility-12700.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import { describe, it, expect, vi, beforeEach, afterEach, type MockInstance } from 'vitest';
1919
import { toEvalPermissions } from '@objectstack/formula';
20-
import { __resetVisibilityPredicateWarnings } from '@object-ui/react';
20+
import { __resetVisibilityPredicateWarnings } from '../../../../react/src/utils/visibilityDiagnostic';
2121
import {
2222
createExpressionEvaluator,
2323
evaluateNavigationVisibility,

0 commit comments

Comments
 (0)