Skip to content

refactor(data-objectstack)!: retire the test-only clearSharedDiscoveryCache from the entry - #33666

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-69v17q
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-69v17q

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

Part of #25921

Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none (the name appears under neither skills/** nor content/docs/**)

维护者速读

  • 改了什么:@object-ui/data-objectstack 的根入口不再导出只给测试用的 clearSharedDiscoveryCache(清空适配器按来源缓存的 discovery 文档)。缓存这一小段代码原样搬进包内新模块 sharedDiscovery.ts,getSharedDiscovery 照旧从入口导出;38 个测试改为从该模块直接引入。这是 retire the zero-consumer surface: nine dead modules (2,211 LOC), plugin-ai, runner's publish flag, test-only reset helpers on public barrels, the providers trio, 122 dead i18n keys, root orphans #25921 第 18 批,补完卡上「reset* 测试助手移出公共入口」那一条的最后一项(前 8 个早已移出)。
  • 为什么改:两个仓库里除测试外没有任何代码、文档或技能调用它;留在入口上会被当成公开 API 承诺。做法与之前移出 resetRuntimeConfigForTesting、__clearRecordEditableCache 等助手一致。
  • 风险与回滚:运行时行为零变化(搬移是逐字的,适配器仍走同一份缓存);测试断言一行未改。外部 npm 宿主若从入口 import 这个助手会编译失败(未实测,changeset 写了 BREAKING 与替代写法)。! patch,回滚即 revert 本 PR。
  • 先看:ui/packages/data-objectstack/src/sharedDiscovery.ts、ui/packages/data-objectstack/src/index.ts(缓存段与新增 import)、.changeset/25921-data-objectstack-shared-discovery-cache-helper.md。
  • 两分钟验证:node scripts/check-adr-0087-registration.mjs --base origin/main,预期该名字 verified、退出 0。
  • 需要你做的:无,席位落地。

What changes

Batch 18 as named in the seat's amendment 6888438983 on claim 6888311800 (census /mnt/project-files/pm-orders/ui/25921-b18-census.md, objectstack origin/main 6e287974, hotcrm 2492ac6).

  • New ui/packages/data-objectstack/src/sharedDiscovery.ts: the per-origin discovery cache block (the discoveryCache Map, getSharedDiscovery, clearSharedDiscoveryCache), moved verbatim from index.ts under a short module header.
  • ui/packages/data-objectstack/src/index.ts: imports getSharedDiscovery from the module for ObjectStackAdapter.connect() and re-exports it unchanged. clearSharedDiscoveryCache leaves the entry; in its place sits the "test-only and stays off the barrel" comment its siblings carry in app-shell, types and plugin-detail. serverOriginOf, which sat between the moved lines, stays in index.ts.
  • 38 test files, import lines only: 28 in data-objectstack/src now import the helper from ./sharedDiscovery; 10 in console (4), app-shell (4) and react (2) import it by relative source path, the spelling those packages already use for resetRuntimeConfigForTesting, resetInflightGetsForTesting and __clearRecordEditableCache. ui vitest aliases @object-ui/data-objectstack to the package src, so the adapter and the helper resolve to one module instance. No assertion changes.
  • ui/packages/app-shell/src/views/metadata-admin/previews/canvasDataSource-27585.test.tsx, beyond its import line: two module-top side-effect imports, @objectstack/lint and @objectstack/formula, that check:test-source-alias asks of an edited test reaching those lazy loads (see Verification, round 1). The amendment named import-line edits only; this is the gate's prescribed fix for a file the batch had to touch.
  • Changeset .changeset/25921-data-objectstack-shared-discovery-cache-helper.md: ! patch, BREAKING, FROM/TO, one runtime-export-retired marker (FROM spans 1:1), both declaration lines.

Why

The card's recommendation "Move the nine reset* helpers into @object-ui/test-support or tag them @internal" was done for eight helpers (objectui#13453 and #28544); clearSharedDiscoveryCache was left as item B2 and carried as open in the landing notes through #31056. The census found zero non-test callers in either repo, and no README, docs page, skill, changeset or CHANGELOG naming it.

Tests

  • Census (one rg -w -F pass per repo): the helper's only hits outside the package are the 10 test files above; hotcrm 0. Positive control in the same block: getSharedDiscovery has non-test readers outside the package (ui/apps/console/src/languageSeed.ts, ui/packages/app-shell/src/chrome/ConditionalAuthWrapper.tsx) and stays exported.
  • Reverse probe: the TypeScript checker's export list of src/index.ts goes 127 → 126, exactly clearSharedDiscoveryCache gone, nothing added. The built dist/index.js, imported at runtime, has no clearSharedDiscoveryCache key and still has getSharedDiscovery and ObjectStackAdapter. A probe compiled against the built dist/index.d.ts answers TS2305 for the helper and nothing on the control line (getSharedDiscovery, ObjectStackAdapter).
  • Under the lock: pnpm --workspace-concurrency=2 --filter '@object-ui/data-objectstack...' build then its type-check (its tsconfig includes the in-package tests): VERDICT command-exit 0. --filter '@object-ui/console...' build then type-check of @object-ui/react, @object-ui/app-shell and @object-ui/console (each runs its tsconfig.test.json or equivalent): VERDICT command-exit 0.
  • pnpm --dir ui exec vitest run --maxWorkers=2 packages/data-objectstack/ plus the 10 cross-package test files, under the lock: VERDICT command-exit 0, Test Files 131 passed (131), Tests 1475 passed (1475).
  • No test added or removed, and no ablation: the diff moves code verbatim and unexports one test-only helper; no tested behaviour changes.

Acceptance notes

  • The moved helper keeps its original one-line JSDoc ("Test/dev helper to drop the cache (e.g. on logout or origin change)"), verbatim per the amendment; nothing outside tests calls it.
  • Follow-ups noted on the claim amendment, not in this batch: the runner move under apps/ or examples/, and 57 newly CONFIRMED i18n keys that are not the card's 122.

Verification

Derived gates on HEAD 85ef16b (38/38, all exit 0, --ran reconciled)

node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ran ran.list (each line CMD :: exit N) → "38 derived famil(ies) accounted for — 38 run, 0 NOT-MEASURED (a DERIVED zero — all 38 recorded an exit code and none of them is 3)". Each command ran with stdin closed and its exit code captured before any pipe.

  • node scripts/check-adr-0087-registration.mjs --base origin/main exit 0: not-required (runtime-export-retired) -- verified: @object-ui/data-objectstack#clearSharedDiscoveryCache; --self-test exit 0
  • node scripts/check-changeset-no-major.mjs --base origin/main, check-empty-changeset.mjs --base origin/main (+ --self-test), check-closing-keyword-parity.mjs (+ --self-test), check-comment-mask-corpus.mjs, check-sdui-manifest.mjs (+ --self-test), ci/snapshot-next.mjs --self-test, pm/release-rehearsal-clone.mjs --self-test, release-pending-publish.mjs --self-test: exit 0
  • pnpm --dir ui exec vitest run scripts/ under the lock → Test Files 171 passed | 2 skipped (173), Tests 5062 passed | 2 skipped (5064)
  • pnpm check:type-check-debt under the lock → exit 0 ("0 raw tsc error(s) total, none above its recorded number")
  • pnpm check:cross-package-test-inputs exit 0 ("32 package(s) read outside themselves, all declared")
  • pnpm check:test-source-alias exit 0 (see round 1 below)
  • pnpm --filter @objectstack/spec run check:duration-unit-keys, check:error-code-provenance; pnpm check:changeset-gate-self-tests, check:closed-ceremony-text, check:dispatcher-error-vocabulary, check:driver-memory-census, check:engine-double-contract, check:error-status-conformance, check:gitlink-declared, check:nul-bytes, check:published-files, check:query-options-erasure, check:refd-timer-probe, check:registry-log-declared, check:rest-log-spy-declared, check:skill-identifier-liveness, check:tier-file-adoption, check:type-check-coverage, check:undeclared-dep-imports, check:watch-hint-literal, check:where-matcher: exit 0

Round 1 on 20126db (same 38): 37 exit 0, pnpm check:test-source-alias exit 1. It judges a test file a change edits, and the edited canvasDataSource-27585.test.tsx reaches import('@objectstack/lint') and import('@objectstack/formula') inside function bodies (the object picker under the dataset form). Commit 85ef16b adds the two module-top side-effect imports the gate prescribes, the spelling three AppContent.* tests in app-shell already use; that file then passes 5/5 under the lock, and the whole list was rerun on 85ef16b above.

Outside the derivation: node scripts/check-platform-checklist.mjs --changed-from origin/main exit 0 (0 anchored files); pnpm --dir ui run check:new-line-citations exit 0 (0 new citations).

Full dogfood battery on HEAD 85ef16b

bash scripts/pm/os-verify-lock.sh -c "pnpm --workspace-concurrency=2 --filter '@objectstack/dogfood^...' build && pnpm --filter @objectstack/dogfood test" → os-verify-lock: VERDICT command-exit 0 (held 41m18s) · Test Files 467 passed | 3 skipped (470) · Tests 3953 passed | 42 skipped (3995) · no failure.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (not touched)
  • 2. Every name I added uses the casing for its kind. (one module file, sharedDiscovery.ts, camelCase like its siblings)
  • 3. No formatter ran; pnpm lint passes. (lint is CI's run)
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: n/a.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English. (the 维护者速读 block is the fleet's required Chinese summary)

Generated by Claude Code

🤖 Generated with Claude Code

https://claude.ai/code/session_01FEkQ5oqJ6hpya34gYbwBaJ

…yCache from the entry

The per-origin discovery cache (the Map, getSharedDiscovery and the reset
helper) moves verbatim from index.ts to the in-package module
sharedDiscovery.ts. The entry keeps re-exporting getSharedDiscovery and
reads it for ObjectStackAdapter.connect(); the test-only reset helper leaves
the entry, like the other reset helpers already kept off the package barrels.
The 28 in-package and 10 cross-package tests that call it import it from the
module; no assertion changes.

Co-Authored-By: Claude <noreply@anthropic.com>
…ads at collection

check:test-source-alias judges a test file a change edits: the object picker
under the dataset form loads both packages lazily, so the edited test imports
them at module top instead of paying the first load inside a case's timeout.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 15, 2026
@objectstack-fleet objectstack-fleet Bot added the needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides label Nov 15, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 85ef16b866860b12de8afe3ed21a5de5979fb6f7
Local-runs: none
Scope: every path of the diff outside the changeset (40 paths: ui/packages/data-objectstack/src/index.ts, ui/packages/data-objectstack/src/sharedDiscovery.ts, the 28 in-package test files, the 4 console, 4 app-shell and 2 react test files) + read to judge it: .changeset/25921-data-objectstack-shared-discovery-cache-helper.md, ui/packages/data-objectstack/package.json, ui/packages/data-objectstack/tsup.config.ts, ui/packages/data-objectstack/tsconfig.json, ui/packages/data-objectstack/README.md, ui/vitest.config.mts, ui/apps/console/vitest.config.ts, ui/apps/console/vite.config.ts, ui/apps/console/src/languageSeed.ts, ui/packages/app-shell/src/chrome/ConditionalAuthWrapper.tsx, ui/packages/app-shell/package.json, ui/packages/react/tsconfig.test.json, scripts/check-cross-package-test-inputs.mjs, AGENTS.md (changeset rule), main at e9884e19, and the org-wide code search for the retired name

① Derived judgments

Read on the net diff against the merge base 6e287974 (41 files, +124 / -65); main at e9884e19 has not touched ui/packages/data-objectstack/src/index.ts since.

  • Public surface of @object-ui/data-objectstack: exactly one name leaves, none enters. Right. package.json publishes one entry (exports holds . only, files is dist), and tsup.config.ts bundles from src/index.ts alone, so the new module is not a reachable subpath and its unexported helper is not in the built entry. index.ts now re-exports getSharedDiscovery by name from ./sharedDiscovery and nothing else from it.
  • getSharedDiscovery keeps its name, signature and behaviour. Right. The removed block and the new module are the same text (the Map, the function, the helper); discoveryCache has no reader left in index.ts; connect() at index.ts:3831 and the two outside readers (languageSeed.ts:109, ConditionalAuthWrapper.tsx:55) call it as before. serverOriginOf stays where it was.
  • Accept-set: unchanged. Right. No schema, wire shape, request or stored value moves; Metadata-protocol: none is correct (no path under packages/spec).
  • The 38 test files: import lines only. Right. The diff over those files, sorted and counted, is import statements and nothing else, apart from the two side-effect imports in canvasDataSource-27585.test.tsx. All ten relative paths resolve to ui/packages/data-objectstack/src/sharedDiscovery (depths checked one by one).
  • One module instance in the cross-package tests. Right. ui/vitest.config.mts:538 and ui/apps/console/vite.config.ts:640 alias @object-ui/data-objectstack to the package src, whose index.ts imports ./sharedDiscovery; the relative import names the same file, so the adapter and the helper share one cache. None of the ten files calls vi.resetModules() or mocks the package, so the reset still reaches the cache the adapter reads.
  • No reader left behind. Right. At the head the name appears only in the module, the comment in index.ts, the changeset and the 38 tests, each importing from sharedDiscovery. On main at e9884e19 the reader set is the same 38 tests plus index.ts (no test added since the base), so no merge skew. Org code search: 38 hits, all in this repo; hotcrm 0.
  • canvasDataSource-27585.test.tsx side-effect imports. Right. @objectstack/lint and @objectstack/formula are declared dependencies of @object-ui/app-shell (package.json:95-96), and the same module-top @objectstack/lint spelling is already in 87 app-shell test files. No assertion changes.
  • Gate verdicts. Check-runs on this head, read at 2026-11-15T05:33Z: 63 runs, 46 success, 17 skipped, 0 failed, none pending. Among the successes: Type Check UI, Lint UI, Build & E2E UI, Live E2E UI, Test UI 16/16 shards, Check Changeset, the PR-body guards, Governed Surface Queue Guard, and every Lint · and Type Check · family. The skipped runs are the path-filtered core jobs, the opt-in harnesses, the queue-verdict jobs and UI Published Artifacts.

② Semver level

Clause-②: no (narrowing)

The changeset bumps @object-ui/data-objectstack at patch with a ! title. That is the level AGENTS.md gives a breaking change outside the metadata protocol ("a non-protocol change, widening or breaking, ships patch and keeps its BREAKING banner and ADR-0087 disposition"). The body carries both declaration lines, identical to the PR body's, a BREAKING paragraph, one FROM → TO line for the one name, and exactly one ADR-0087 marker (runtime-export-retired @object-ui/data-objectstack#clearSharedDiscoveryCache). Only one package's entry changes, and only that package is bumped. The level and the declaration match what the diff publishes.

③ Boundary flags

  • open_questions in os-dev-report 6889629117 is empty. Nothing to answer.
  • Deviation "two side-effect imports beyond the import line": answered in ①; the gate that asked for them is green on this head.
  • Deviation "branch not merged with main": answered in ①; main has no new reader of the name and no change to index.ts.
  • Deviations on assignees, labels and the detached checkout are process, with no contract effect.
  • Earlier notes on this card (6594905321, 6660207006, 6677640939) said the helper "needs a test-support home first". That was a scoping note, not a ruling, and amendment 6888438983 names the direct module import instead. The tree supports the amendment: the cache is module state inside data-objectstack, so @object-ui/test-support could only re-export it, and the sibling helpers already cross packages by relative source path on main (resetRuntimeConfigForTesting and resetInflightGetsForTesting from console tests, __clearRecordEditableCache from app-shell tests). Answered, not escalated.
  • Out-of-scope findings (the runner move, 57 newly confirmed i18n keys) are follow-ups on the card and are not in this diff.

④ Design judgment

The narrowing takes away no declared capability. clearSharedDiscoveryCache is named in no README, docs page, skill or spec; its only readers in either repo are tests; and the card's own bullet, approved by the maintainer at filing, lists it among the nine test-only helpers to move off the public barrels. The package keeps every documented cache control (invalidateCache, clearCache, getCacheStats) and the documented getSharedDiscovery. This is the same shape as the eight siblings already landed.

Attempts to break it, and what they found:

  • A second copy of the cache in tests (helper clears one Map, adapter reads another): not reachable, see the module-instance judgment in ①.
  • The helper leaking back out through a subpath or the built entry: not reachable, one exports entry and one bundle entry.
  • A production path that needed the reset (logout, origin change): none. The cache is keyed by baseUrl, so an origin change is a new key; a failed read deletes its own entry and is retried; no logout path in the tree called the helper before this diff. A host cannot now force a re-read of a successful discovery at the same baseUrl within one page load, but that was never offered as an API and nothing in the Console does it. If a host ever needs it, that is a new, named capability on the entry, not this helper.
  • A source-text scanner or export ratchet pinned to the old block: the scripts suite, the type-check families and all UI test shards are green on this head.

Findings:

  • nit — ui/packages/data-objectstack/src/sharedDiscovery.ts:33: the moved JSDoc still reads "Test/dev helper to drop the cache (e.g. on logout or origin change)", while the module header four lines up and the changeset call it test-only, and no logout or origin-change path uses it. Moved verbatim as the amendment asked; a later edit can shorten it to "Test-only". No effect on behaviour.
  • nit — the changeset's FROM → TO line offers "or stubs the fetch its adapter makes" as a way to get a fresh discovery read. getSharedDiscovery returns the cached promise before it calls the fetcher, so a stub alone does not re-read a baseUrl already answered in the same module instance. The first alternative (a baseUrl per case) is correct; vi.resetModules() would be the accurate second one. The affected reader is a host test with zero known instances.
  • nit — the new module carries the Apache-2.0 one-line header, while the code came from the MIT-headed index.ts and the package's LICENSE and package.json say MIT. 24 files in the package's src already carry the same header, so this follows an existing drift rather than starting one.

No must-fix and no should-fix. The three nits are left as accepted deviations or a follow-up; none needs this head to move.

Implemented-by: claude/project-thread-69v17q
Reviewed-by: contract-review subagent of domain:ui#1 (session_01FEkQ5nWoa1Ze1QzjRTSYXD)

VERDICT: PASS

@os-zhuang

Copy link
Copy Markdown
Contributor

你有fable为什么不自己复审?

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD

席位核对

Verdict: ACCEPT · head 85ef16b8 · 2026-11-15T05:36Z

  1. Shape. Draft → main, Part of #25921 (batch 18, no closing keyword). 41 files, +124/−65:

    • clearSharedDiscoveryCache leaves the @object-ui/data-objectstack entry. The cache block (discoveryCache, getSharedDiscovery, the helper) moves verbatim to the new in-package src/sharedDiscovery.ts, and getSharedDiscovery is still re-exported.
    • 38 test files: import line only (28 in-package, 10 in console / app-shell / react).
    • one root ! patch changeset, 25921-data-objectstack-shared-discovery-cache-helper.md, with one runtime-export-retired marker.

    All of it is on the amended surface (6888438983).

  2. Premise. The census (/mnt/project-files/pm-orders/ui/25921-b18-census.md) shows the helper is the last open item of the card's reset* bullet, with 0 non-test consumers in objectstack and hotcrm and no README teaching it. Reverse probe: the entry goes from 127 to 126 names, and the built d.ts answers TS2305 for the name.

  3. Contract record. PASS 6889824738 at CONTRACT_REVIEW_TIER (narrowing face) on this head, with 0 must-fix, 0 should-fix and 3 nits. The nits are left as accepted deviations: the moved JSDoc still says "Test/dev helper", the changeset's TO line could name vi.resetModules(), and the new file carries the Apache header its 24 siblings carry.

  4. Gates on head 85ef16b8.

    • 63 check runs: 46 success, 17 skipped, 0 failed.
    • The dev's local --ran is 38/38, and the full dogfood battery passed on this head (VERDICT 0, 3953 tests).
  5. Accepted deviation. canvasDataSource-27585.test.tsx gains the two module-top side-effect imports that check:test-source-alias prescribes once a test file is edited, in the same spelling the AppContent.* tests use.

  6. K. 68 first-parent commits since base 6e287974 ≥ 15, so I synced the base (merge of main at 8f915f2a, new head 8d0cafa5). The sync is merge-only: patch-id c4c8b4e539be on both heads. The landing waits for the rerun to go green.

  7. Out of scope (follow-ups, not filed now since P3 claiming is closed): the runner move, and the 57 newly confirmed dead i18n keys.

  8. Authority. Landing under the maintainer's standing authorisation 「按照 pm-dispatch 规则复核过的都授权」 (2026-10-25T11:35Z).

@objectstack-fleet objectstack-fleet Bot removed the needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides label Nov 15, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD

Landing · head 8d0cafa5 (base sync of the ACCEPTed 85ef16b8, merge of main at 8f915f2a; patch-id c4c8b4e539be on both heads) · 2026-11-15T05:59Z

reading value
check runs on 8d0cafa5 61, all success or skipped
contract record PASS 6889824738 at CONTRACT_REVIEW_TIER (on 85ef16b8; the sync is merge-only)
seat ACCEPT 6889840161

State: ready + auto-merge.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 05:59
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit 854d383 Nov 15, 2026
62 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-69v17q branch November 15, 2026 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants