Skip to content

MILAB-6497: enroll rarefaction on structurer software-build#33

Open
vadimpiven wants to merge 1 commit into
chore/rarefaction-structurerfrom
MILAB-6497_rarefaction-software-build
Open

MILAB-6497: enroll rarefaction on structurer software-build#33
vadimpiven wants to merge 1 commit into
chore/rarefaction-structurerfrom
MILAB-6497_rarefaction-software-build

Conversation

@vadimpiven

@vadimpiven vadimpiven commented Jul 6, 2026

Copy link
Copy Markdown

Enrolls rarefaction onto the structurer's software-build path (block-tools structure refresh --software-build), so its software builds via block-tools software build and the block gains the channel/location build:* script set.

What changed

  • .structuresoftwareBuild: true marker.
  • Root scripts → the scenario set: build:dev-local / build:dev-remote / build:dev-no-software / build:dev-binary-existing / build:release, and test on the dev-binary-local selector (legacy build:dev removed).
  • software/ leaf → build/prepublishOnly = block-tools software build; turbo build.env gains PL_BUILD_*.
  • Block block/ layout brought to current canonical (block/src/…, block/tsconfig.json, facade), which required SDK bumps: @milaboratories/ts-configs 1.2.3 → 1.3.0, @milaboratories/ts-builder 1.5.2 → 1.6.0 (both released).

Verified

build:dev-remote is green (10/10 tasks). Software built (polars+numpy), pushed to the dev ECR + midev, descriptor isDev / midev / content-addressed, and downloadable from bin-dev.pl-open.science (HTTP 200). Block-pack assembles.

Blocked before this can go green in CI / merge

  1. block-tools with the software build command must be published and the catalog entry bumped — this block now calls block-tools software build, which the current published @platforma-sdk/block-tools (catalog) does not have, so CI build will fail until then.
  2. Add a changeset if the block CI requires one for the touched packages.

Local pnpm.overrides (used to test against the unreleased block-tools / package-builder-lib) are intentionally not included.

Greptile Summary

This PR enrolls the rarefaction block onto the structurer's software-build path by adding softwareBuild: true to .structure and wiring up all the corresponding infrastructure. The block package is migrated from a flat CJS facade to a proper ESM TypeScript facade (block/src/) built by ts-builder --target block-facade, with workspace runtime deps correctly moved to devDependencies and the BlockPointer value computed via import.meta.url.

  • Build scripts — the single build:dev root script is replaced by the canonical 5-script scenario set (build:dev-local, build:dev-remote, build:dev-no-software, build:dev-binary-existing, build:release), and test/test:dry-run are updated to the new PL_BUILD_* env var convention. Turbo's build.env gains the new variables accordingly.
  • Dependency/tooling bumps@milaboratories/ts-builder 1.5.2 → 1.6.0 and @milaboratories/ts-configs 1.2.3 → 1.3.0 across all sub-packages; model gains private: true; CI workflow corrects the Turborepo S3 secret name and enables the test job.
  • Known pre-merge blockerblock-tools software build is not yet in the published @platforma-sdk/block-tools, so the CI build step will fail until that command ships and the catalog entry is bumped (documented in the PR description).

Touched terms:

  • softwareBuild (boolean in .structure) — new flag that tells block-tools structure refresh to include the block in the software-build pipeline, enabling build:* channel scripts and the software/ build path.
  • BlockContract (type in block/src/index.ts) — aggregate type capturing a block's outputs, data, and href shapes, inferred from the platforma model definition via InferOutputsType / InferDataType / InferHrefType.
  • BlockPointer (const in block/src/index.ts) — runtime value of type from-pack-v2 that exposes the package root URL and block-pack/ URL derived from import.meta.url, replacing the old __dirname-based CJS object.
  • PL_BUILD_CHANNEL / PL_BUILD_VARIANT / PL_BUILD_LOCATION (env vars in package.json and turbo.json) — new trio that replaces PL_PKG_DEV; controls which software artifact tier (dev/release), which variant (all/binary/none), and where to push (local/remote).
  • block-facade (ts-builder target in block/package.json) — build target that compiles block/src/index.ts into a minimal, dependency-free ESM facade with accompanying .d.ts declarations.
  • from-pack-v2 (type literal in BlockPointer) — block pointer protocol version used by the Platform runtime to locate and load a block-pack directory from a URL.

Confidence Score: 4/5

Safe to merge once block-tools software build is published and the catalog entry is bumped; the current state will produce a CI build failure on the software step.

The structural changes are mechanical and well-understood (structurer enrollment pattern). The block facade migration is clean — BlockPointer correctly uses import.meta.url, runtime deps are properly in devDependencies, and the 2-level directory assumption is documented and owned by the structurer. Two minor cleanup items exist in turbo.json (stale PL_PKG_DEV in build.env, unused build:dev task), but neither affects correctness. The known pre-merge blocker is explicitly called out in the PR description.

turbo.json has a stale PL_PKG_DEV env entry and a build:dev task no longer driven by any root script — worth cleaning up before or shortly after merge.

Important Files Changed

Filename Overview
.structure Adds softwareBuild: true to enroll the block in the structurer's software-build path; minimal one-field change.
block/package.json Refactored to a proper ESM TypeScript facade: files include dist/ and block-pack/, build now runs ts-builder + pack, workspace deps moved to devDependencies, new check script added. The prepublishOnly no longer calls block-tools pack explicitly, relying on build having been run first.
block/src/index.ts New block facade: infers BlockContract/BlockOutputs/BlockData from model types, computes BlockPointer via import.meta.url with a well-documented 2-level directory assumption, exports block-named aliases.
turbo.json build.env gains PL_BUILD_* variables to support new channel/variant/location build system; PL_PKG_DEV remains in the env list despite the root scripts no longer setting it; build:dev task remains defined but unused at root level.
package.json Replaces single build:dev script with the canonical 5-script scenario set (dev-local/dev-remote/dev-no-software/dev-binary-existing/release); test scripts updated to new PL_BUILD_* env var convention.
software/package.json Adds build and prepublishOnly scripts pointing to block-tools software build, and block-tools as devDependency, enabling the software-build pipeline.
.github/workflows/build.yaml Fixes app-name-slug, enables tests in CI, and corrects the AWS secret name (AWS_CI_TURBOREPO_US_S3_BUCKET → AWS_CI_TURBOREPO_S3_BUCKET).
.github/workflows/mark-stable.yaml Removes the now-redundant repository guard conditions, fixes app-name casing, reorders SLACK secrets.
model/package.json Adds private: true — consistent with the new architecture where only the block facade package is published.
pnpm-workspace.yaml Updates catalog to ts-builder 1.6.0 and ts-configs 1.3.0; all other versions unchanged.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["pnpm build:dev-remote / build:release"] --> B["turbo run build"]
    B --> C1["model: ts-builder build"]
    B --> C2["ui: ts-builder build"]
    B --> C3["workflow: tengo-builder build"]
    B --> C4["software: block-tools software build"]
    B --> C5["block: ts-builder --target block-facade + block-tools pack"]
    C1 --> C5
    C2 --> C5
    C3 --> C5
    C4 --> C5
    C5 --> D["block-pack/"]
    C5 --> E["dist/index.js (BlockPointer via import.meta.url)"]
    D --> F["block-tools publish"]
    E --> F
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A["pnpm build:dev-remote / build:release"] --> B["turbo run build"]
    B --> C1["model: ts-builder build"]
    B --> C2["ui: ts-builder build"]
    B --> C3["workflow: tengo-builder build"]
    B --> C4["software: block-tools software build"]
    B --> C5["block: ts-builder --target block-facade + block-tools pack"]
    C1 --> C5
    C2 --> C5
    C3 --> C5
    C4 --> C5
    C5 --> D["block-pack/"]
    C5 --> E["dist/index.js (BlockPointer via import.meta.url)"]
    D --> F["block-tools publish"]
    E --> F
Loading

Fix All in Claude Code

Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
turbo.json:15-17
The `PL_PKG_DEV` entry in `build.env` is no longer set by any root script after the migration to `PL_BUILD_*` env vars (the `build:dev` script that set it was removed from `package.json`). Keeping it in the cache-key env list unnecessarily widens the cache invalidation surface. If no individual sub-package still reads `PL_PKG_DEV`, it should be removed.

```suggestion
      "env": [
        "PL_DOCKER_REGISTRY_PUSH_TO",
```

### Issue 2 of 2
turbo.json:31-34
**Stale `build:dev` turbo task**

The root `package.json` no longer defines a `build:dev` script (it was replaced by the `build:dev-*` family), so this turbo task will never be invoked via `turbo run build:dev` at the workspace root. If individual sub-packages also no longer define `build:dev`, this task definition can be removed to keep the turbo config in sync with the actual script surface.

Reviews (1): Last reviewed commit: "MILAB-6497: enroll rarefaction on struct..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

Context used:

  • Context used - Terms is a types in codebase. Provide the list of ... (source)

@gemini-code-assist

Copy link
Copy Markdown

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

Comment thread turbo.json
Comment on lines +15 to +17
"env": [
"PL_PKG_DEV",
"PL_DOCKER_REGISTRY_PUSH_TO",

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 The PL_PKG_DEV entry in build.env is no longer set by any root script after the migration to PL_BUILD_* env vars (the build:dev script that set it was removed from package.json). Keeping it in the cache-key env list unnecessarily widens the cache invalidation surface. If no individual sub-package still reads PL_PKG_DEV, it should be removed.

Suggested change
"env": [
"PL_PKG_DEV",
"PL_DOCKER_REGISTRY_PUSH_TO",
"env": [
"PL_DOCKER_REGISTRY_PUSH_TO",
Prompt To Fix With AI
This is a comment left during a code review.
Path: turbo.json
Line: 15-17

Comment:
The `PL_PKG_DEV` entry in `build.env` is no longer set by any root script after the migration to `PL_BUILD_*` env vars (the `build:dev` script that set it was removed from `package.json`). Keeping it in the cache-key env list unnecessarily widens the cache invalidation surface. If no individual sub-package still reads `PL_PKG_DEV`, it should be removed.

```suggestion
      "env": [
        "PL_DOCKER_REGISTRY_PUSH_TO",
```

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

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant