Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/adopt-slim-facade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@platforma-open/milaboratories.samples-and-data": minor
---

Adopt the slim from-pack-v2 facade. The published package now carries only the
block's type surface plus a dependency-free `from-pack-v2` BlockPointer; the
model/ui/workflow packages are kept as private build-time siblings. Migrated onto
the published facade SDK toolchain.
9 changes: 5 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ jobs:
- init
uses: milaboratory/github-ci/.github/workflows/node-simple-pnpm.yaml@v4
with:
app-name: 'Block: Samples & Data'
app-name: 'Block: Samples And Data'
app-name-slug: 'block-samples-and-data'
node-version: '20.x'
build-script-name: 'build'
pnpm-recursive-build: false

test: true
test-script-name: 'test'
pnpm-recursive-tests: false
Expand Down Expand Up @@ -54,13 +55,13 @@ jobs:
"PL_CI_TEST_PASSWORD": ${{ toJSON(secrets.PL_CI_TEST_PASSWORD) }},

"AWS_CI_IAM_MONOREPO_SIMPLE_ROLE": ${{ toJSON(secrets.AWS_CI_IAM_MONOREPO_SIMPLE_ROLE) }},
"AWS_CI_TURBOREPO_S3_BUCKET": ${{ toJSON(secrets.AWS_CI_TURBOREPO_US_S3_BUCKET) }},
"PL_REGISTRY_PLATFORMA_OPEN_UPLOAD_URL": ${{ toJSON(secrets.PL_REGISTRY_PLOPEN_UPLOAD_URL) }},
"AWS_CI_TURBOREPO_S3_BUCKET": ${{ toJSON(secrets.AWS_CI_TURBOREPO_S3_BUCKET) }},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Secret name change may silently break Turborepo cache

The secret lookup was changed from AWS_CI_TURBOREPO_US_S3_BUCKET to AWS_CI_TURBOREPO_S3_BUCKET. If the GitHub org/repo only has the old secret (AWS_CI_TURBOREPO_US_S3_BUCKET), the new reference will resolve to an empty string — GitHub never errors on a missing secret — and Turborepo remote caching will silently be disabled. Could you confirm the org secret has already been renamed (or a new one added) before this is undrafted? Has the GitHub secret AWS_CI_TURBOREPO_S3_BUCKET been created/renamed at the org or repo level, or is this intentionally deferring to the finalization step?

Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/build.yaml
Line: 58

Comment:
**Secret name change may silently break Turborepo cache**

The secret lookup was changed from `AWS_CI_TURBOREPO_US_S3_BUCKET` to `AWS_CI_TURBOREPO_S3_BUCKET`. If the GitHub org/repo only has the old secret (`AWS_CI_TURBOREPO_US_S3_BUCKET`), the new reference will resolve to an empty string — GitHub never errors on a missing secret — and Turborepo remote caching will silently be disabled. Could you confirm the org secret has already been renamed (or a new one added) before this is undrafted? Has the GitHub secret `AWS_CI_TURBOREPO_S3_BUCKET` been created/renamed at the org or repo level, or is this intentionally deferring to the finalization step?

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code

"PL_REGISTRY_PLATFORMA_OPEN_UPLOAD_URL": ${{ toJSON(secrets.PL_REGISTRY_PLOPEN_UPLOAD_URL) }},
"QUAY_USERNAME": ${{ toJSON(secrets.QUAY_USERNAME) }},
"QUAY_ROBOT_TOKEN": ${{ toJSON(secrets.QUAY_ROBOT_TOKEN) }} }

SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_CHANNEL: ${{ secrets.SLACK_BLOCKS_CI_CHANNEL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

GH_ZEN_APP_ID: ${{ secrets.GH_ZEN_APP_ID }}
GH_ZEN_APP_PRIVATE_KEY: ${{ secrets.GH_ZEN_APP_PRIVATE_KEY }}
4 changes: 2 additions & 2 deletions .github/workflows/mark-stable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- init
uses: milaboratory/github-ci/.github/workflows/block-mark-stable.yaml@v4
with:
app-name: 'Block: Samples & Data - Mark Stable'
app-name: 'Block: Samples And Data - Mark Stable'
node-version: '20.x'
npmrc-config: |
{
Expand All @@ -30,5 +30,5 @@ jobs:
{ "NPMJS_TOKEN": ${{ toJSON(secrets.NPMJS_TOKEN) }},
"AWS_CI_IAM_MONOREPO_SIMPLE_ROLE": ${{ toJSON(secrets.AWS_CI_IAM_MONOREPO_SIMPLE_ROLE) }} }

SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_CHANNEL: ${{ secrets.SLACK_BLOCKS_CI_CHANNEL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
6 changes: 0 additions & 6 deletions block/index.d.ts

This file was deleted.

8 changes: 0 additions & 8 deletions block/index.js

This file was deleted.

35 changes: 24 additions & 11 deletions block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,38 @@
"name": "@platforma-open/milaboratories.samples-and-data",
"version": "1.17.5",
"files": [
"index.d.ts",
"index.js"
"dist",
"block-pack"
],
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"sources": "./src/index.ts",
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"scripts": {
"pretty": "prettier --write \"./**/*.{js,jsx,mjs,cjs,ts,tsx,json,vue}\"",
"build": "shx rm -rf ./block-pack && block-tools pack",
"mark-stable": "block-tools mark-stable -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'",
"prepublishOnly": "block-tools pack && block-tools publish -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'",
"do-pack": "shx rm -f *.tgz && block-tools pack && pnpm pack && shx mv *.tgz package.tgz"
"build": "ts-builder build --target block-facade && block-tools pack",
"prepublishOnly": "block-tools publish -r s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1 --registry-serve-url https://blocks.pl-open.science",
"do-pack": "pnpm pack && shx mv *.tgz package.tgz",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 do-pack no longer ensures a fresh block-pack before packaging

Previously do-pack ran shx rm -f *.tgz && block-tools pack && pnpm pack. The new script is just pnpm pack && shx mv *.tgz package.tgz. The block-tools pack step (which populates block-pack/) is now only called inside build. If someone runs do-pack in isolation — without a prior build — the published .tgz will contain a stale or missing block-pack directory. Also, omitting shx rm -f *.tgz before pnpm pack means a leftover .tgz from a previous run could cause shx mv *.tgz package.tgz to fail or move the wrong file if glob expansion yields multiple matches.

Prompt To Fix With AI
This is a comment left during a code review.
Path: block/package.json
Line: 23

Comment:
**`do-pack` no longer ensures a fresh `block-pack` before packaging**

Previously `do-pack` ran `shx rm -f *.tgz && block-tools pack && pnpm pack`. The new script is just `pnpm pack && shx mv *.tgz package.tgz`. The `block-tools pack` step (which populates `block-pack/`) is now only called inside `build`. If someone runs `do-pack` in isolation — without a prior `build` — the published `.tgz` will contain a stale or missing `block-pack` directory. Also, omitting `shx rm -f *.tgz` before `pnpm pack` means a leftover `.tgz` from a previous run could cause `shx mv *.tgz package.tgz` to fail or move the wrong file if glob expansion yields multiple matches.

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code

"check": "ts-builder type-check --target block-facade"
Comment on lines 19 to +24

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 mark-stable script removed — reusable CI workflow may break

The old block/package.json exposed a mark-stable script (block-tools mark-stable -r …). It has been removed here, but mark-stable.yaml still calls the reusable workflow block-mark-stable.yaml@v4. If that workflow invokes pnpm --filter ./block run mark-stable (a common pattern for this family of workflows), the mark-stable CI job will fail with "missing script". Please verify whether block-mark-stable.yaml@v4 calls the npm script directly or invokes block-tools mark-stable via its own mechanism. Does block-mark-stable.yaml@v4 call the mark-stable npm script, or does it invoke block-tools mark-stable independently? If the former, a script entry needs to be re-added.

Prompt To Fix With AI
This is a comment left during a code review.
Path: block/package.json
Line: 19-24

Comment:
**`mark-stable` script removed — reusable CI workflow may break**

The old `block/package.json` exposed a `mark-stable` script (`block-tools mark-stable -r …`). It has been removed here, but `mark-stable.yaml` still calls the reusable workflow `block-mark-stable.yaml@v4`. If that workflow invokes `pnpm --filter ./block run mark-stable` (a common pattern for this family of workflows), the mark-stable CI job will fail with "missing script". Please verify whether `block-mark-stable.yaml@v4` calls the npm script directly or invokes `block-tools mark-stable` via its own mechanism. Does `block-mark-stable.yaml@v4` call the `mark-stable` npm script, or does it invoke `block-tools mark-stable` independently? If the former, a script entry needs to be re-added.

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code

},
"dependencies": {
"dependencies": {},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since @platforma-sdk/model has been moved to devDependencies and dependencies is now empty, please ensure that @platforma-sdk/model is either bundled entirely into the published facade or declared as a peerDependency. If it is treated as an external dependency by ts-builder but not listed in dependencies or peerDependencies, consumers of this block package will encounter runtime and compilation errors due to the missing SDK package.

  "dependencies": {},
  "peerDependencies": {
    "@platforma-sdk/model": "catalog:"
  },

"devDependencies": {
"@milaboratories/ts-builder": "catalog:",
"@milaboratories/ts-configs": "catalog:",
"@platforma-open/milaboratories.samples-and-data.model": "workspace:*",
"@platforma-open/milaboratories.samples-and-data.ui": "workspace:*",
"@platforma-open/milaboratories.samples-and-data.workflow": "workspace:*",
"@platforma-sdk/model": "catalog:"
},
"devDependencies": {
"@platforma-sdk/block-tools": "catalog:",
"shx": "catalog:"
"@platforma-sdk/model": "catalog:",
"shx": "catalog:",
"typescript": "catalog:"
},
"packageManager": "pnpm@9.12.0",
"block": {
Expand Down
5 changes: 5 additions & 0 deletions block/src/AGENTS.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// This file is managed by `block-tools structure`. Do not edit by hand.
// Narrow MCP / AI surface.

export type { BlockContract, BlockOutputs, BlockData } from "./index";
export * from "./agents-extra";
8 changes: 8 additions & 0 deletions block/src/agents-extra.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Author-owned. `block-tools structure` does not modify this file.
// MCP / AI extension surface. Add types and functions the agent
// surface should expose.
//
// In the future this file will host JS functions the MCP runtime
// can execute. The `.d.ts` declarations stay visible to the agent;
// the JS bodies execute in the MCP code-execution context (the
// agent sees the types but not the implementation).
9 changes: 9 additions & 0 deletions block/src/block-extra.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Author-owned. `block-tools structure` does not modify this file.
// Add block-specific helper types or values the consumer surface
// should expose. Anything you `export` here flows out via the
// main entry (./index re-exports this file).
//
// Do NOT redefine: BlockContract, BlockOutputs, BlockData, BlockHref,
// BlockPointer, platforma, or the block-named <PascalName>Block*
// aliases — those names come from ./index and `export *` from this
// file would shadow them.
55 changes: 55 additions & 0 deletions block/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// This file is managed by `block-tools structure`. Do not edit by hand.
// Author content lives in ./block-extra.ts.

import { platforma } from "@platforma-open/milaboratories.samples-and-data.model";
import {
InferOutputsType,
InferDataType,
InferHrefType,
} from "@platforma-sdk/model";

export { platforma };

export type BlockContract = {
outputs: InferOutputsType<typeof platforma>;
data: InferDataType<typeof platforma>;
href: InferHrefType<typeof platforma>;
};

export type BlockOutputs = BlockContract["outputs"];
export type BlockData = BlockContract["data"];

// import.meta.url is a file: URL (always forward-slash, even on Windows:
// file:///C:/…). We expose URLs, NOT paths — the facade stays dependency-free
// and loadable in minimal engines (e.g. QuickJS), and each consumer converts
// at its own edge with the right tool (fileURLToPath in Node), where Windows
// drive letters / %-encoding / UNC are handled correctly. The bundled entry
// sits one dir under the package root (dist/index.js, or src/index.ts in dev),
// so the root is two URL segments up. The structurer owns this layout —
// consumers read these URLs, they never reconstruct <root>/block-pack.
//
// TypeScript ships `ImportMeta.url` only in the `dom`/`webworker` libs; the
// facade tsconfig is lib-minimal (no `dom`, no `@types/node`) by design. We
// type the one ESM-standard member we use with a local cast rather than a
// `declare global` — a global augmentation would leak into the published
// `dist/index.d.ts` and clash with `@types/node`'s `ImportMeta` in full-Node
// consumers (test packages, the Middle Layer).
const selfUrl = (import.meta as ImportMeta & { url: string }).url;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using a type assertion like (import.meta as ImportMeta & { url: string }).url can sometimes prevent older or simpler bundlers/transpilers (which rely on static AST or regex matching for import.meta.url) from correctly recognizing and rewriting the expression for CommonJS environments. Consider using a direct import.meta.url access with a // @ts-ignore comment to suppress the missing property error in minimal lib configurations, ensuring maximum compatibility with downstream bundlers.

Suggested change
const selfUrl = (import.meta as ImportMeta & { url: string }).url;
// @ts-ignore import.meta.url is not defined in minimal lib
const selfUrl = import.meta.url;

const dirUrl = selfUrl.slice(0, selfUrl.lastIndexOf("/"));
const rootUrl = dirUrl.slice(0, dirUrl.lastIndexOf("/"));

export const BlockPointer = {
type: "from-pack-v2" as const,
packUrl: rootUrl + "/block-pack",
rootUrl,
} as const;

// Block-named aliases for readable cross-block imports in tests and
// consumer code. Same types / same runtime value as the universal
// names above; the aliases avoid `as`-renames at the import site.
export type SamplesAndDataBlockContract = BlockContract;
export type SamplesAndDataBlockOutputs = BlockOutputs;
export type SamplesAndDataBlockData = BlockData;
export const SamplesAndDataBlockPointer = BlockPointer;

export * from "./block-extra";
4 changes: 4 additions & 0 deletions block/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "@milaboratories/ts-configs/block/facade",
"include": ["src/**/*"]
}
1 change: 1 addition & 0 deletions model/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@platforma-open/milaboratories.samples-and-data.model",
"version": "2.8.1",
"private": true,
"description": "Block model",
"type": "module",
"main": "dist/index.cjs",
Expand Down
Loading
Loading