Skip to content

Commit 9b85162

Browse files
docs(skills): the objectui data-integration guide stops teaching the MSW plugin removed in 12.0 (#27764)
<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} --> _Requested by **Elon** · [project thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DEgy1aicRXWh4AbhmimiUdx)_ Fixes #27678 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:已发布的 `objectui` 技能不再教 12.0 已删除的 MSW 插件;数据集成指南的「前端先行开发」一节改教树上真有的两条路(无后端用静态 scope,或本地 `os dev` 起真服务 + Vite 代理 `/api`),对应 eval 改判这个答案;顺手删掉 console 里没人读的 `VITE_USE_MOCK_SERVER` 等 MSW 残留。 - 为什么改:客户 agent 加载技能后照抄会去装 11.0.0 的旧插件(npm 上未弃用、能装上),装进 18.x 栈;eval 还给这个错答案打满分。 - 风险与回滚:纯文档、eval 与 console 构建配置,无运行时行为变化;回滚即 revert 本 PR。技能净减 35 行、约 171 token。 - 先看:`skills/objectui/guides/data-integration.md`(新「Frontend-first development」一节的每条事实)、`skills/objectui/evals/data-integration.json`(eval 2)、`ui/apps/console/vercel.json`(rewrite 正则少了 `mockServiceWorker.js` 排除项)。 - 两分钟验证:`git grep -n 'plugin-msw\|MSWPlugin' -- skills; git grep -n 'VITE_USE_MOCK_SERVER\|vendor-msw' -- ui/apps` 两条都无输出;`node ui/scripts/check-skill-eval-tokens.mjs` 退出 0。 - 需要你做的:受管面(`skills/**`),席位契约复核通过后请批准;npm 上是否弃用 `@objectstack/plugin-msw` 是发版动作,另由你定。 ## What changes - `skills/objectui/guides/data-integration.md`: the section "MSW mock setup (frontend-first development)" (a browser kernel built on the MSW plugin package, removed in 12.0 by `7087cfe6e3`) becomes "Frontend-first development". It names the two paths the tree supports today: - no backend: the existing "Static data (no backend)" scope; - a real API locally: `os dev` from the ObjectStack app, with the Vite dev server proxying `/api` to `http://localhost:3000` so page and API share one origin (the same shape `ui/apps/console/vite.config.ts` uses). It also states what `os dev` does with data: it persists to a SQLite file, `--fresh` gives a throwaway database, a dev admin is seeded on an empty database, the retired in-memory driver is refused, and `--database :memory:` is SQLite's in-memory database. The two MSW pitfall bullets are removed. - `skills/objectui/evals/data-integration.json`, eval 2: the prompt asks for a working local API before the backend is deployed. `must_contain` is `os dev`, `proxy`, `objectstack.config`; `must_not_contain` is `enableBrowser` and `setupWorker` (the MSW plugin option and the MSW worker API). - Console remnants (cross-domain exception granted by triage 6504442774): - `VITE_USE_MOCK_SERVER=false` leaves `ui/apps/console/.env.development`, `.env.production` and the Vercel `buildCommand`. No source reads the key: `git grep VITE_USE_MOCK_SERVER -- ui` outside these files, the test below and the CHANGELOG finds one comment in `ui/playwright.import-console.config.ts`. - The Vercel rewrite stops excluding `mockServiceWorker.js`; `ui/apps/console/public` holds no such file. - The `vendor-msw` row leaves the chunk table in `ui/apps/console/docs/deployment.md`; `vite.config.ts` declares no such chunk. - `ui/packages/app-shell/src/observability/committed-telemetry-endpoint.test.ts`, measured first as the card asked: - `:118` is a vacuum guard that the parser reads real assignments out of `.env.production`. It used `VITE_USE_MOCK_SERVER` only as a known line, not as live behaviour. It now asserts `VITE_SERVER_URL` parses to the empty string. - `:136` is a synthetic negative probe that reads no file; its second line becomes `VITE_BASE_PATH=/`. - Changeset `27678-objectui-skill-msw-removed.md`: `@objectstack/skills` and `@object-ui/console` patch. ### Published-skills readings | reading | before | after | |---|---|---| | `skills/objectui/guides/data-integration.md` lines / ratchet tokens | 514 / 4451 | 479 / 4280 (ceiling 4451, headroom 171) | | `skills/objectui/evals/data-integration.json` lines / ratchet tokens | 54 / 471 | 54 / 466 (ceiling 471, headroom 5) | | `skills/objectui/**` lines | 5446 | 5411 | | all `skills/**/SKILL.md` lines | 4610 | 4610 | Ceilings are left where they are; the shrink shows as headroom. ## Tests - `pnpm exec vitest run packages/app-shell/src/observability/committed-telemetry-endpoint.test.ts` (from `ui/`): Test Files 1 passed, Tests 5 passed. - `node ui/scripts/check-skill-eval-tokens.mjs`: exit 0, "Every must_contain token is taught by its own skill bundle." - `node ui/scripts/check-skills-paths.mjs`: exit 0 (85/86 stated paths resolve, 1 baselined, unchanged). ## Acceptance notes - `git grep -n 'plugin-msw\|MSWPlugin' -- skills`: 0 hits. - `git grep -n 'VITE_USE_MOCK_SERVER\|vendor-msw' -- ui/apps`: 0 hits. - Survivors outside `ui/apps`, out of scope: `ui/CHANGELOG.md:392` (history, not edited) and a comment in `ui/playwright.import-console.config.ts:24` that sets the variable in a recipe. - The dispatch's mechanism assumption ("`objectstack dev` with an in-memory driver") did not hold on `origin/main`: the in-memory engine is no longer a boot store (`packages/cli/src/commands/dev.ts` header; `dev-default-db.test.ts` pins the refusal). The guide teaches what the tree does instead. - `npm view @objectstack/plugin-msw version deprecated` on 2026-10-29: `11.0.0`, not deprecated. Deprecating it is the maintainer's release action and is not part of this PR. ## Verification <details><summary>dispatch-gates: 57 derived families, all exit 0, at a5cbb8f</summary> `node scripts/pm/dispatch-gates.mjs --ran`: "57 derived famil(ies) accounted for — 57 run, 0 NOT-MEASURED". The first pass recorded exit 1 on `pnpm --dir ui exec vitest run scripts/` (unbuilt `@objectstack/spec` dist) and on two gates that read the generated `packages/spec/src/migrations/registry.ts` before it existed, plus exit 3 on six build-prerequisite gates. After `turbo run build --filter='@objectstack/client-react...' --filter=@objectstack/lint...`, every one of them re-ran at exit 0. The pre-push checks `check-regen-pending` and `check-commit-card-trailers --range origin/main..HEAD` both exit 0. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_016WV4cymVzRLDH1j6gwgGAk --- _Generated by [Claude Code](https://claude.ai/code/session_016WV4cymVzRLDH1j6gwgGAk)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 3865159 commit 9b85162

8 files changed

Lines changed: 42 additions & 66 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@objectstack/skills': patch
3+
'@object-ui/console': patch
4+
---
5+
6+
docs(skills): the objectui data-integration guide stops teaching the MSW plugin removed in 12.0
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
- **Before.** `skills/objectui/guides/data-integration.md` taught a frontend-first setup built on the MSW plugin package, removed in 12.0 (its last npm release is 11.0.0, so the install still succeeds and pulls an 11.x plugin into the current stack), and eval 2 of `evals/data-integration.json` rewarded that answer.
12+
- **Now.** The section "Frontend-first development" names the two supported paths: a static scope with no backend, or the real server run locally with `os dev` behind a Vite `/api` proxy. It states that `os dev` persists to SQLite, that `--fresh` gives a throwaway database, and that the retired in-memory driver is refused. Eval 2 grades `os dev`, `proxy` and `objectstack.config`, and refuses the MSW setup. Net -35 lines in the guide.
13+
- **Console.** `VITE_USE_MOCK_SERVER`, which no source reads, leaves `.env.development`, `.env.production` and the Vercel build command. The `mockServiceWorker.js` rewrite exclusion and the `vendor-msw` chunk row in `docs/deployment.md` go too. No runtime behaviour changes.

‎skills/objectui/evals/data-integration.json‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@
2121
},
2222
{
2323
"id": 2,
24-
"prompt": "Set up MSW mock data for my ObjectUI app so I can develop the frontend without a running backend. I have a Todo object with title, completed, and dueDate fields.",
25-
"expected_output": "Provides MSW browser setup using ObjectKernel + InMemoryDriver + MSWPlugin, objectstack.config with the Todo schema, and main.tsx bootstrap pattern.",
24+
"prompt": "I want to build my ObjectUI frontend before the backend is deployed. I have a Todo object with title, completed, and dueDate fields. How do I get a working API locally?",
25+
"expected_output": "Runs the real server locally with os dev (the Todo object in objectstack.config) and proxies /api to it from the Vite dev server; no MSW plugin.",
2626
"files": [],
2727
"assertions": {
2828
"must_contain": [
29-
"ObjectKernel",
30-
"InMemoryDriver",
31-
"MSWPlugin",
29+
"os dev",
30+
"proxy",
3231
"objectstack.config"
3332
],
3433
"must_not_contain": [
35-
"msw rest.get('/api/todos'"
34+
"enableBrowser",
35+
"setupWorker"
3636
]
3737
}
3838
},

‎skills/objectui/guides/data-integration.md‎

Lines changed: 19 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -351,65 +351,33 @@ function MyPlugin() {
351351
}
352352
```
353353

354-
## MSW mock setup (frontend-first development)
354+
## Frontend-first development
355355

356-
For developing the UI without a running backend, use Mock Service Worker with ObjectStack's in-browser kernel.
356+
There is no mock-server plugin: the MSW plugin was removed in 12.0, and npm
357+
still serves its stale 11.x build — ⛔ do not install it. Two supported paths:
357358

358-
### Browser mock server
359+
- **No backend:** publish static values as a scope ("Static data (no backend)" above).
360+
- **Real API, locally:** run `os dev` in the ObjectStack app whose
361+
`objectstack.config.ts` declares your objects. In a project that runs Vite
362+
itself (not `objectui dev`), proxy `/api` to it so page and API share one origin:
359363

360-
```typescript
361-
// src/mocks/browser.ts
362-
import { ObjectKernel, DriverPlugin, AppPlugin } from '@objectstack/runtime';
363-
import { ObjectQLPlugin } from '@objectstack/objectql';
364-
import { InMemoryDriver } from '@objectstack/driver-memory';
365-
import { MSWPlugin } from '@objectstack/plugin-msw';
366-
367-
export async function startMockServer(appConfig: any) {
368-
const kernel = new ObjectKernel({ skipSystemValidation: true });
369-
370-
await kernel.use(new ObjectQLPlugin());
371-
372-
const driver = new InMemoryDriver();
373-
await kernel.use(new DriverPlugin(driver, 'memory'));
374-
await kernel.use(new AppPlugin(appConfig));
375-
await kernel.use(new MSWPlugin({
376-
enableBrowser: true,
377-
baseUrl: '/api/v1',
378-
logRequests: true,
379-
}));
380-
381-
await kernel.bootstrap();
382-
383-
// Seed initial data
384-
if (appConfig.manifest?.data) {
385-
for (const dataset of appConfig.manifest.data) {
386-
for (const record of dataset.records) {
387-
await driver.create(dataset.object, record);
388-
}
389-
}
390-
}
391-
}
364+
```bash
365+
os dev # http://localhost:3000; if busy, the banner names the port taken
366+
os dev --fresh # throwaway database, deleted on exit
392367
```
393368

394-
### App entry with MSW
395-
396369
```typescript
397-
// src/main.tsx
398-
import { startMockServer } from './mocks/browser';
399-
import appConfig from '../objectstack.config';
400-
401-
async function bootstrap() {
402-
if (import.meta.env.DEV) {
403-
await startMockServer(appConfig);
404-
}
405-
406-
const root = ReactDOM.createRoot(document.getElementById('root')!);
407-
root.render(<App />);
408-
}
409-
410-
bootstrap();
370+
// vite.config.ts
371+
export default defineConfig({
372+
server: { proxy: { '/api': { target: 'http://localhost:3000', changeOrigin: true } } },
373+
});
411374
```
412375

376+
By default `os dev` persists to a SQLite file and seeds a dev admin
377+
(`admin@objectos.ai` / `admin123`) on an empty database. It has no in-memory
378+
driver (`--database-driver memory` is refused); `--database :memory:` is
379+
SQLite's in-memory database. Commands and flags: the `objectstack-platform` skill.
380+
413381
### Test DataSource helper
414382

415383
<!-- os:check -->
@@ -507,8 +475,6 @@ unsubscribe?.();
507475

508476
- Spelling `QueryParams` options without the `$` prefix (`limit`, `filter`, `sort`): the index signature accepts them, nothing reads them, and a dropped `$top` fetches the whole table.
509477
- Importing `fetch` directly in components instead of using DataSource from context.
510-
- Forgetting to await `startMockServer()` before rendering — MSW intercepts aren't ready.
511-
- Mismatched `baseUrl` between MSW plugin and ObjectStackAdapter — requests bypass mocks.
512478
- Not providing `getObjectSchema()` — plugins that need field metadata will fail.
513479
- Passing a DataSource adapter instance where a static object is expected (or vice versa).
514480
- Not handling loading/error states in components that fetch data.

‎ui/apps/console/.env.development‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@
1717
# Setting VITE_SERVER_URL to an absolute origin still works, but it opts this
1818
# app back out of same-origin and into CORS + the 401 above.
1919
VITE_SERVER_URL=
20-
VITE_USE_MOCK_SERVER=false

‎ui/apps/console/.env.production‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# (e.g. demo.objectstack.ai on Vercel) inject VITE_SERVER_URL at
66
# build time via their deploy environment.
77
VITE_SERVER_URL=
8-
VITE_USE_MOCK_SERVER=false
98

109
# ── Sentry error tracking: CONFIGURED ON THE SERVER, never here ─────────────
1110
#

‎ui/apps/console/docs/deployment.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ The console build produces 17+ named chunks via `manualChunks`:
125125
| `vendor-ui-utils` | cva, clsx, tailwind-merge | Rare |
126126
| `vendor-objectstack` | @objectstack/spec, client | Moderate |
127127
| `vendor-zod` | Zod validation | Rare |
128-
| `vendor-msw` | MSW (demo mode only) | Rare |
129128
| `vendor-charts` | Recharts, D3 | Rare |
130129
| `vendor-dndkit` | @dnd-kit | Rare |
131130
| `vendor-i18n` | i18next | Rare |

‎ui/apps/console/vercel.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"$schema": "https://openapi.vercel.sh/vercel.json",
33
"installCommand": "cd ../.. && pnpm install --frozen-lockfile",
4-
"buildCommand": "cd ../.. && pnpm --filter @object-ui/app-shell... build && cd apps/console && NODE_OPTIONS=--max-old-space-size=4096 VITE_USE_MOCK_SERVER=false VITE_BASE_PATH=/ vite build",
4+
"buildCommand": "cd ../.. && pnpm --filter @object-ui/app-shell... build && cd apps/console && NODE_OPTIONS=--max-old-space-size=4096 VITE_BASE_PATH=/ vite build",
55
"outputDirectory": "dist",
66
"framework": "vite",
77
"rewrites": [
8-
{ "source": "/((?!assets|mockServiceWorker\\.js).*)", "destination": "/index.html" }
8+
{ "source": "/((?!assets).*)", "destination": "/index.html" }
99
]
1010
}

‎ui/packages/app-shell/src/observability/committed-telemetry-endpoint.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ describe('committed .env files carry no third-party telemetry endpoint', () => {
115115
it('parses real assignments out of the console production env', () => {
116116
const parsed = parseEnv(readFileSync(path.join(repoRoot, 'apps/console/.env.production'), 'utf8'));
117117
expect(parsed.map((entry) => entry.key)).toContain('VITE_SERVER_URL');
118-
expect(parsed.find((entry) => entry.key === 'VITE_USE_MOCK_SERVER')?.value).toBe('false');
118+
expect(parsed.find((entry) => entry.key === 'VITE_SERVER_URL')?.value).toBe('');
119119
});
120120

121121
it('flags an offending file — proving the rules can actually fire', () => {
@@ -133,7 +133,7 @@ describe('committed .env files carry no third-party telemetry endpoint', () => {
133133
expect(violationsIn('OS_TELEMETRY_CLIENT_ERROR_REPORTING_SEND_DEFAULT_PII=true')).not.toEqual([]);
134134
// …and does not fire on the commentary that documents the recipe.
135135
expect(violationsIn('# VITE_SENTRY_DSN=https://<key>@<org>.ingest.sentry.io/<p>')).toEqual([]);
136-
expect(violationsIn('VITE_SERVER_URL=\nVITE_USE_MOCK_SERVER=false')).toEqual([]);
136+
expect(violationsIn('VITE_SERVER_URL=\nVITE_BASE_PATH=/')).toEqual([]);
137137
});
138138

139139
it.each(envFiles)('%s', (file) => {

0 commit comments

Comments
 (0)