Skip to content

Commit 389de4a

Browse files
refactor(ui)!: retire plugin-designer's dead collaboration code, VersionHistory and the useConfirmDialog entry export (#29529)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9Ubb4JjPNQfBQxo6jSSRhqXFe8)_ Part of #25921. This is the `@object-ui/plugin-designer` batch named in landing note 6579769954 ("New since this batch"), under claim 6583164004 and amendment 6583226546. The card stays open. Every other item it lists is untouched: `CommentSearchResult`, the providers/upload fold, `clearSharedDiscoveryCache` and the other packages' barrel batches. Clause-②: no (narrowing) Metadata-protocol: none ## 维护者速读 - 改了什么:删除 `@object-ui/plugin-designer` 中 #29388 之后已成死代码的协作实现:整个 `CollaborationProvider.tsx`,以及页面、数据模型、流程、报表四个设计器里永远为 null 的 `useCollaboration()` 分支和工具栏上的“N users / Connected”标记。删除无人渲染的 `VersionHistory` 组件及其测试。包入口不再导出 `VersionHistory` 和 `useConfirmDialog`。`useConfirmDialog` 模块保留,因为七个设计器内部都在用。 - 为什么改:普查(#28385 方法,`origin/main` `128681f4`,hotcrm `d4ffe99`)显示,这些名字在包外只有一个测试文件的历史注释提到,hotcrm 为零。`CollaborationProvider` 在全仓无人挂载,所以协作分支在运行时从不执行。 - 风险与回滚:Console 和其它 `@object-ui/*` 包都不导入这两个名字,不受影响。外部 npm 用户若导入会在升级时编译报错,changeset 写明了改法。设计器行为不变。回滚即 revert 本 PR。 - 先看:`ui/packages/plugin-designer/src/index.tsx`、`ui/packages/plugin-designer/src/ReportDesigner.tsx`(删得最多的设计器)、`.changeset/25921-plugin-designer-dead-collaboration-version-history.md`。 - 两分钟验证:`git grep -n -w -e CollaborationProvider -e useCollaboration -e VersionHistory -- ui/packages/plugin-designer ':!**/CHANGELOG.md'`,预期无输出(退出码 1)。 - 需要你做的:无,席位落地(入队前欠一次契约复审档复审,由席位转总监)。 ## What changes - **Dead collaboration code.** `src/CollaborationProvider.tsx` is deleted: the provider, `useCollaboration`, `ConnectionStatusIndicator` and their types. `CollaborationProvider` left the entry in #29388 and nothing mounts it anywhere, so `useCollaboration()` always returned `null`. In `PageDesigner` and `ReportDesigner`, the `broadcastOp` callback, its call sites and the `broadcastOp` entries in the hook dependency lists go. `DataModelDesigner` and `ProcessDesigner` lose their `collaboration?.sendOperation(...)` calls and the `collaboration` dependency entries. The always-hidden "N users" status chip (DataModel, Process) and the "Connected" chip (Report, with its local `LABELS.collaborationConnected`) go too, as does the now-unused `Users` icon import in `DataModelDesigner`. `AppCreationWizard` and `ObjectManager` had no collaboration branch. - **`VersionHistory`.** `src/components/VersionHistory.tsx` and its test `VersionHistory.displayLocale-9909.test.tsx` are deleted, along with its two `components/index.ts` lines and the entry line. Nothing in the package rendered it. The `VersionHistory` case leaves `ariaLabelNames.zh-12145.test.tsx`: the zh wait now anchors on the minimap image. The undo, redo and minimap names are still asserted against both packs. - **`useConfirmDialog`.** Only the entry line goes. `hooks/useConfirmDialog.ts` and its `hooks/index.ts` line stay, because `AppCreationWizard`, `DataModelDesigner`, `FieldDesigner`, `ObjectManager`, `PageDesigner`, `ProcessDesigner` and `ReportDesigner` import it. `hooks/index.ts` is a sub-barrel nothing imports, the same state #29388 left it in. - `README.md` stops teaching both names. `package.json`'s description drops "plus collaborative editing". One comment line in `useDesignerTranslation.ts` stops naming `VersionHistory`'s region. - One `!` changeset (`patch`, `**BREAKING**` banner, both declaration lines, the ADR-0087 `not-required (runtime-export-retired …)` marker naming both operands, and a FROM → TO "no replacement" line per name). ## Why The #28385 census was re-run before any edit at `origin/main` `128681f4` (hotcrm `d4ffe99`). For each name, `git grep -l -w -F` ran over the whole tree minus `ui/packages/plugin-designer/**`, `**/CHANGELOG.md`, the lockfiles, `.changeset/**` and `ui/.changeset/**` (A). The brief's cut (`ui packages apps examples content`, tests excluded) is B, test files only is T and hotcrm is H. IN counts the in-package non-test files. | name | on the entry before | A | B | T | H | IN | result | |:--|:--|--:|--:|--:|--:|--:|:--| | `ObjectGantt` (control) | gantt | 189 | 53 | 134 | 0 | 0 | control hits | | `SchemaRenderer` (control) | react | 1168 | 299 | 841 | 3 | 0 | control hits | | `CreateAppPage` (kept control) | yes | 49 | 4 | 45 | 0 | 3 | stays | | `useConfirmDialog` | yes | 1 | 0 | 1 | 0 | 11 | leaves the entry; module stays | | `VersionHistory` | yes | 1 | 0 | 1 | 0 | 5 | leaves the entry; module deleted | | `VersionHistoryProps` | no | 0 | 0 | 0 | 0 | 2 | deleted with the module | | `VersionHistoryEntry` | no | 1 | 0 | 1 | 0 | 2 | deleted with the module | | `DesignerConfirmDialogState` | no | 1 | 0 | 1 | 0 | 2 | stays (module stays) | | `CollaborationProvider` | no (left in #29388) | 0 | 0 | 0 | 0 | 5 | deleted | | `CollaborationProviderProps` | no | 0 | 0 | 0 | 0 | 1 | deleted | | `CollaborationContextValue` | no | 0 | 0 | 0 | 0 | 1 | deleted | | `useCollaboration` | no | 0 | 0 | 0 | 0 | 5 | deleted | | `ConnectionStatusIndicator` | no | 0 | 0 | 0 | 0 | 1 | deleted | The single A/T hit for `useConfirmDialog`, `VersionHistory`, `VersionHistoryEntry` and `DesignerConfirmDialogState` is one file, `ui/scripts/__tests__/one-authority-per-exported-name-6273.test.ts`. Its historical comments ("`ConfirmDialogState` sat here", "`VersionEntry` sat here") name the module paths. Under the claim, that comment does not keep a name. Keep rule 3: no kept entry export's declared signature names any retired type. Each appears only in its own module and its sub-barrel. After the change, at the merged head `d7514fc8`, the same `git grep` over the whole tree (CHANGELOGs and changesets excluded) finds zero files for `CollaborationProvider`, `CollaborationProviderProps`, `CollaborationContextValue`, `useCollaboration`, `ConnectionStatusIndicator` and `VersionHistoryProps`. `VersionHistory`, `VersionHistoryEntry` and `useConfirmDialog` outside the package appear only in that test comment. `useConfirmDialog` is absent from `src/index.tsx` and `README.md` (`git grep` exit 1). Control: `SchemaRenderer` 1207 files. ## Tests - Code head `fb1192c3`; `d7514fc8` merges 10 `origin/main` commits, none under `ui/packages/plugin-designer` (branch delta re-read: the same 14 files, +52 / -573). - `pnpm --filter @object-ui/plugin-designer run type-check` (`tsc --noEmit && tsc -p tsconfig.test.json`): `VERDICT command-exit 0` on `fb1192c3` and again on `d7514fc8`. - `pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-designer/`: Test Files 49 passed (49), Tests 456 passed (456), `VERDICT command-exit 0` on both heads. - `pnpm --dir ui exec vitest run --maxWorkers=2 scripts/` (includes `check-readme-exports`) on `fb1192c3`: Test Files 169 passed, 2 skipped (171); Tests 4921 passed, 2 skipped; `VERDICT command-exit 0`. - `eslint` on the eight changed source and test files: 0 errors, 18 warnings, all on lines this diff does not touch. - No ablation: this diff only deletes code, removes export lines and edits README text, so no tested behaviour changed. The zero-hit census above is the proof. ## Acceptance notes - `designer.versionHistory` is now unread. Its only reader was `VersionHistory`. Per the claim it stays in the ten locale packs and in `DESIGNER_DEFAULT_TRANSLATIONS`, the table the en-pack mirror gate compares. It is left for the dead-key item. - The historical comments in `ui/scripts/__tests__/one-authority-per-exported-name-6273.test.ts` still name `packages/plugin-designer/src/components/VersionHistory.tsx`, a path this PR deletes. They are a "sat here" record of an older rename, outside this claim's surface, and left as they are. - `@object-ui/types`' `CollaborationConfig`, `CollaborationPresence` and `CollaborationOperation` lose this package as a reader. `@object-ui/collaboration` still imports all three, so they stay. - The importers of this package (`@object-ui/app-shell`'s lazy designer pages, the Console) were not type-checked locally. The census shows neither imports either retired name (B = 0), and CI's `Type Check UI` compiles them. - A `CONTRACT_REVIEW_TIER` review is owed before the queue (an entry narrowing). The seat routes it to the director. ## Verification <details><summary>Derived gates: 46/46 run, 0 NOT-MEASURED</summary> `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` at `fb1192c3` gave 46 commands. `--ran` reports "46 derived famil(ies) accounted for — 46 run, 0 NOT-MEASURED". Every command exited 0. Among them: `check-adr-0087-registration --base origin/main` and `--self-test`, `check-changeset-no-major --base origin/main`, `check-empty-changeset`, `check-sdui-manifest` and its `--self-test`, `check:published-files`, `check:undeclared-dep-imports`, `check:nul-bytes`, `check:query-options-erasure` (293 s), `check-comment-mask-corpus` (20193 files, 0 disagree), `check:type-check-debt` (locked, 0 raw tsc errors) and `vitest run scripts/`. At `d7514fc8` the derived list is identical. `check-adr-0087-registration`, `check-changeset-no-major`, `check-empty-changeset`, `check-sdui-manifest`, `check:changeset-fixed`, `check:nul-bytes`, `check:cross-package-test-inputs`, `check:published-files`, `check:undeclared-dep-imports` and `check:test-source-alias` were re-run there, all exit 0. Outside the derived set: `check-platform-checklist --changed-from origin/main` exit 0 (0 anchored files). `dispatch-gates --tier`: no path-derived mandate, 625 changed lines (under the 3000 threshold), no governed path. </details> ## 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; `eslint` on the changed files exits 0 (warnings only, all pre-existing). The repo-wide `pnpm 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: its generated artifacts are regenerated and committed. (not touched) - [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. --- _Generated by [Claude Code](https://claude.ai/code/session_01QsR2jR9JS6qCZyzC5esvUr)_ <!-- signed: domain:ui#3 · zhuangjianguo · session_01QsR2jV4dWohojjbTJTQq5m --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 4b8cbe2 commit 389de4a

15 files changed

Lines changed: 54 additions & 575 deletions
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
'@object-ui/plugin-designer': patch
3+
---
4+
5+
refactor(plugin-designer)!: retire `useConfirmDialog` and `VersionHistory` from the entry, and delete the designers' dead collaboration code
6+
7+
Clause-②: no (narrowing)
8+
Metadata-protocol: none
9+
10+
<!-- adr-0087: not-required (runtime-export-retired @object-ui/plugin-designer#useConfirmDialog, @object-ui/plugin-designer#VersionHistory) the retired operands are a React hook and a React component in a published ui package's entry that nothing in the workspace or in hotcrm imported; no packages/spec schema, registered node type, ADR-0087 conversion surface or stored shape names them, so there is nothing for `objectstack migrate meta` to rewrite -->
11+
12+
**BREAKING** for a host that imports `useConfirmDialog` or `VersionHistory` from `@object-ui/plugin-designer`. Neither had an importer anywhere in the workspace or in hotcrm, so the Console and every `@object-ui/*` package are unaffected.
13+
14+
- The `VersionHistory` timeline module is deleted: nothing in the package rendered it. The `designer.versionHistory` translation key stays in the locale packs for now, with no reader.
15+
- `useConfirmDialog` stays inside the package, because the designers use it for their delete prompts. Only the entry stops publishing it.
16+
- The collaboration code that became unreachable once the previous release stopped exporting `CollaborationProvider` is deleted. That covers the provider module, the always-null `useCollaboration()` branches in the page, data model, process and report designers, and their "N users" / "Connected" toolbar chips. Nothing outside the package could mount the provider, so no designer behaves differently.
17+
18+
What leaves, and what to write instead (neither has a replacement export):
19+
20+
- FROM `useConfirmDialog` TO no replacement: render your own confirm prompt with `ConfirmDialog` (still exported) and local `useState`.
21+
- FROM `VersionHistory` TO no replacement: render the version list in your own component. The designers never showed one.

‎ui/packages/i18n/src/__tests__/ariaLabelLiteralCensus-12145.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ const BACKLOG: Declared[] = (
252252
'packages/plugin-designer/src/DataModelDesigner.tsx',
253253
[
254254
'Designer toolbar', 'Undo', 'Redo', 'Zoom Out', 'Zoom In', 'Reset Zoom', 'Copy', 'Paste', 'Auto Layout',
255-
'Collaboration active', 'Add Entity', 'Add Relationship', 'Canvas',
255+
'Add Entity', 'Add Relationship', 'Canvas',
256256
],
257257
],
258258
['packages/plugin-designer/src/EditorModeToggle.tsx', ['Editor mode']],
@@ -267,7 +267,7 @@ const BACKLOG: Declared[] = (
267267
[
268268
'packages/plugin-designer/src/ProcessDesigner.tsx',
269269
[
270-
'Process toolbar', 'Process name', 'Process version', 'Collaboration active', 'Undo', 'Redo', 'Copy',
270+
'Process toolbar', 'Process name', 'Process version', 'Undo', 'Redo', 'Copy',
271271
'Paste', 'Connect nodes', 'Auto layout', 'Zoom in', 'Zoom level', 'Zoom out', 'Reset zoom',
272272
'Add Start Event', 'Add User Task', 'Add Gateway', 'Add End Event', 'Process canvas', 'Delete node',
273273
'Property panel',

‎ui/packages/plugin-designer/README.md‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,18 +125,17 @@ declare const sections: ReportDesignerSection[];
125125
### Shared Hooks
126126

127127
```tsx
128-
import { useUndoRedo, useConfirmDialog } from '@object-ui/plugin-designer';
128+
import { useUndoRedo } from '@object-ui/plugin-designer';
129129

130130
import type { DesignerComponent } from '@object-ui/types';
131131

132132
const { undo, redo, canUndo, canRedo } = useUndoRedo<DesignerComponent[]>([]);
133-
const { confirm, isOpen } = useConfirmDialog();
134133
```
135134

136135
### Shared Components
137136

138137
```tsx
139-
import { ConfirmDialog, Minimap, VersionHistory } from '@object-ui/plugin-designer';
138+
import { ConfirmDialog, Minimap } from '@object-ui/plugin-designer';
140139
```
141140

142141
## Links

‎ui/packages/plugin-designer/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "18.2.0",
44
"type": "module",
55
"license": "MIT",
6-
"description": "Visual designer plugin for ObjectUI with page, data model, process, and report designers plus collaborative editing.",
6+
"description": "Visual designer plugin for ObjectUI with page, data model, process, and report designers.",
77
"main": "dist/index.umd.cjs",
88
"module": "dist/index.js",
99
"types": "dist/index.d.ts",

‎ui/packages/plugin-designer/src/CollaborationProvider.tsx‎

Lines changed: 0 additions & 252 deletions
This file was deleted.

‎ui/packages/plugin-designer/src/DataModelDesigner.tsx‎

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import React, { useState, useCallback, useEffect, useRef } from 'react';
1010
import type { DataModelEntity, DataModelField, DataModelRelationship, DesignerCanvasConfig } from '@object-ui/types';
11-
import { Database, Plus, Trash2, Link2, Undo2, Redo2, Grid3X3, ZoomIn, ZoomOut, RotateCcw, ChevronDown, ChevronRight, Copy, Clipboard, Users } from 'lucide-react';
11+
import { Database, Plus, Trash2, Link2, Undo2, Redo2, Grid3X3, ZoomIn, ZoomOut, RotateCcw, ChevronDown, ChevronRight, Copy, Clipboard } from 'lucide-react';
1212
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@object-ui/components';
1313
import { clsx } from 'clsx';
1414
import { twMerge } from 'tailwind-merge';
@@ -20,7 +20,6 @@ import { useCanvasPanZoom } from './hooks/useCanvasPanZoom';
2020
import { ConfirmDialog } from './components/ConfirmDialog';
2121
import { PropertyEditor, type PropertyField } from './components/PropertyEditor';
2222
import { Minimap } from './components/Minimap';
23-
import { useCollaboration } from './CollaborationProvider';
2423
import { CANVAS_BACKGROUND_CLASS, canvasBackgroundStyle } from './canvasBackground';
2524

2625
function cn(...inputs: (string | undefined | false)[]) {
@@ -253,7 +252,7 @@ export interface DataModelDesignerProps {
253252
* rows of its `sourceField` and `targetField`, with its `deleteBehavior` beside
254253
* the label (objectui#11434).
255254
* Supports undo/redo, multi-select, copy/paste, pan/zoom, drag-to-reposition,
256-
* inline field editing, property editor, minimap, auto-layout, and collaboration.
255+
* inline field editing, property editor, minimap and auto-layout.
257256
*/
258257
export function DataModelDesigner({
259258
entities: initialEntities = [],
@@ -300,9 +299,6 @@ export function DataModelDesigner({
300299
// --- Pan/Zoom ---
301300
const panZoom = useCanvasPanZoom({ minZoom: 0.25, maxZoom: 3, zoomStep: 0.1 });
302301

303-
// --- Collaboration ---
304-
const collaboration = useCollaboration();
305-
306302
// --- Collapsible panels ---
307303
const [showProperties, setShowProperties] = useState(true);
308304
const [showMinimap, setShowMinimap] = useState(true);
@@ -343,8 +339,7 @@ export function DataModelDesigner({
343339
};
344340
pushState(next);
345341
multiSelect.selectOne(newEntity.id);
346-
collaboration?.sendOperation({ type: 'insert', userId: collaboration?.currentUserId ?? '', elementId: newEntity.id, data: { name: newEntity.name, label: newEntity.label } });
347-
}, [readOnly, undoRedo, pushState, multiSelect, collaboration]);
342+
}, [readOnly, undoRedo, pushState, multiSelect]);
348343

349344
const handleDeleteEntity = useCallback(
350345
async (id: string) => {
@@ -367,9 +362,8 @@ export function DataModelDesigner({
367362
if (multiSelect.isSelected(id)) {
368363
multiSelect.clearSelection();
369364
}
370-
collaboration?.sendOperation({ type: 'delete', userId: collaboration?.currentUserId ?? '', elementId: id, data: {} });
371365
},
372-
[readOnly, entities, confirmDialog, undoRedo, pushState, multiSelect, collaboration],
366+
[readOnly, entities, confirmDialog, undoRedo, pushState, multiSelect],
373367
);
374368

375369
const handleDeleteSelected = useCallback(async () => {
@@ -788,14 +782,6 @@ export function DataModelDesigner({
788782

789783
<div className="flex-1" />
790784

791-
{/* Collaboration status */}
792-
{collaboration?.isConnected && (
793-
<div className="flex items-center gap-1 text-xs text-muted-foreground" role="status" aria-label="Collaboration active">
794-
<Users className="h-3 w-3" />
795-
<span>{collaboration.users.length} user{collaboration.users.length !== 1 ? 's' : ''}</span>
796-
</div>
797-
)}
798-
799785
{/* Multi-select count */}
800786
{multiSelect.count > 1 && (
801787
<span className="text-xs text-muted-foreground">{multiSelect.count} selected</span>

0 commit comments

Comments
 (0)