spike: slim facade — bundler comparison (sum/enter-numbers-v3)#1644
spike: slim facade — bundler comparison (sum/enter-numbers-v3)#1644dbolotin wants to merge 2 commits into
Conversation
Branch-only scratch driver building each block's facade with both `dts-bundle-generator` and `rolldown-plugin-dts`. Outputs land in `dist-dbg/` and `dist-rdp/` (gitignored) for side-by-side inspection. Per-block changes: - `block/src/index.ts` — new facade source. Re-exports `BlockSpec` (block-named twin + universal alias), `OutputsOf` / `DataOf` / `HrefOf` type generators, `BlockData`, model helpers (`SumNumbersRef` / `EnterNumbersRef`, `SumOutcome` / `SortedNumbers`), and a placeholder `blockSpec` value. - `block/tsconfig.json` — facade tsconfig extending `@milaboratories/ts-configs/node`, declaration emit only. - `block/build-facade.mjs` — scratch dual-bundler driver invoked by `pnpm build:facade`. - `block/package.json` — local devDeps for the two bundlers and TS. - `model/src/index.ts` — Zod removed (operator: not in use). `BlockData` hand-authored with per-field JSDoc. One named output return type (`SumOutcome` / `SortedNumbers`) added as a JSDoc-propagation probe. Findings summary lives in `docs/mitxt/work/2026-05-13-test-framework/spike-slim-facade-plan.md` (Phase B Results) and the productionization plan in `facade-build-plan.md` in the same folder. Decision: `rolldown-plugin-dts` wins.
|
There was a problem hiding this comment.
Code Review
This pull request implements a slim-facade spike for the enter-numbers-v3 and sum-numbers-v3 blocks, introducing build scripts that use rolldown and dts-bundle-generator to produce self-contained bundled facades. It replaces zod-based data models with native TypeScript types and adds reference shapes for block identity. Review feedback focuses on improving cross-platform compatibility by using fileURLToPath from node:url for directory resolution and ensuring constants follow standard naming conventions.
| @@ -0,0 +1,59 @@ | |||
| import type { InferDataType, InferHrefType, InferOutputsType } from "@platforma-sdk/model"; | |||
There was a problem hiding this comment.
To ensure cross-platform compatibility, especially on Windows, it is recommended to use fileURLToPath from the node:url module when deriving file system paths from import.meta.url. This avoids issues with URI-encoded characters and the leading slash present in .pathname on Windows.
import { fileURLToPath } from "node:url";
import type { InferDataType, InferHrefType, InferOutputsType } from "@platforma-sdk/model";|
|
||
| export type { BlockData, EnterNumbersRef }; | ||
|
|
||
| const __facadeDir__ = new URL(".", import.meta.url).pathname; |
There was a problem hiding this comment.
Using .pathname on a URL object returns a URI-style path (e.g., /C:/path on Windows), which is not a valid native path for Node.js file system APIs. Use fileURLToPath to obtain a platform-native path. Additionally, rename the constant to FACADE_DIR to adhere to the repository's naming convention (SCREAM_CASE or UpperCamelCase).
| const __facadeDir__ = new URL(".", import.meta.url).pathname; | |
| const FACADE_DIR = fileURLToPath(new URL(".", import.meta.url)); |
References
- Use SCREAM_CASE or UpperCamelCase for constants.
| @@ -0,0 +1,60 @@ | |||
| import type { InferDataType, InferHrefType, InferOutputsType } from "@platforma-sdk/model"; | |||
There was a problem hiding this comment.
To ensure cross-platform compatibility, especially on Windows, it is recommended to use fileURLToPath from the node:url module when deriving file system paths from import.meta.url.
import { fileURLToPath } from "node:url";
import type { InferDataType, InferHrefType, InferOutputsType } from "@platforma-sdk/model";|
|
||
| export type { BlockData, SumNumbersRef, SumOutcome }; | ||
|
|
||
| const __facadeDir__ = new URL(".", import.meta.url).pathname; |
There was a problem hiding this comment.
Using .pathname on a URL object returns a URI-style path which can cause issues on Windows. Use fileURLToPath for a platform-native path. Additionally, rename the constant to FACADE_DIR to adhere to the repository's naming convention (SCREAM_CASE or UpperCamelCase).
| const __facadeDir__ = new URL(".", import.meta.url).pathname; | |
| const FACADE_DIR = fileURLToPath(new URL(".", import.meta.url)); |
References
- Use SCREAM_CASE or UpperCamelCase for constants.
❌ 3 Tests Failed:
View the full list of 3 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
Summary
Branch-only scratch from the slim-facade spike (Phases A+B). Bundles each test block's facade with both
dts-bundle-generatorandrolldown-plugin-dtsfor side-by-side inspection.Not for merge — productionization plan lives in
docs/mitxt/work/2026-05-13-test-framework/facade-build-plan.md(separate repo). This PR is the empirical artifact backing that plan.What's in
Per-block (
sum-numbers-v3,enter-numbers-v3):block/src/index.ts— facade source. ExportsBlockSpec(block-named twin + universal alias),OutputsOf/DataOf/HrefOfgenerators,BlockData, hand-written model helpers, placeholderblockSpecvalue.block/tsconfig.json— declaration-emit tsconfig extending@milaboratories/ts-configs/node.block/build-facade.mjs— scratch dual-bundler driver invoked bypnpm build:facade. Outputs land indist-dbg/(dts-bundle-generator) anddist-rdp/(rolldown-plugin-dts); both gitignored.block/package.json— local devDeps for the two bundlers and TS.model/src/index.ts— Zod removed (not in use).BlockDatahand-authored with per-field JSDoc.SumOutcome(sum-numbers-v3 only) added as a JSDoc-propagation probe throughInferRenderFunctionReturn.Findings (short)
rolldown-plugin-dts. More aggressive default inlining (external: () => false→ zero external imports). Same toolchain we already use in ts-builder.DataOf<BlockSpec>propagation works end-to-end —BlockDataalias survives throughPlatformaV3<BlockData, …>slot, JSDoc reaches consumer.OutputsOf<BlockSpec>[K]loses alias regardless of bundler — root cause is SDK-level expansion inInferRenderFunctionReturn<RF>during model.d.tsemit. SDK reshape needed; tracked separately.Full Phase B results table and findings in
spike-slim-facade-plan.md(docs/mitxt/).What's not in
block/index.jsuntouched.