Skip to content

Migrate vj-gene-usage onto structurer + BlockModelV3 - #36

Merged
julenmendieta merged 4 commits into
mainfrom
chore/vj-gene-usage-structurer-v3
Jun 22, 2026
Merged

Migrate vj-gene-usage onto structurer + BlockModelV3#36
julenmendieta merged 4 commits into
mainfrom
chore/vj-gene-usage-structurer-v3

Conversation

@vadimpiven

@vadimpiven vadimpiven commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Migrates vj-gene-usage onto the block-tools structurer and from V1 to BlockModelV3.

Commits

  1. chore: structurer refresh + SDK upgrade — tool-managed layout (oxlint/oxfmt, ts-builder, regenerated configs across model, ui, workflow, block, test). SDK → model/ui-vue 1.79.14, workflow-tengo 6.6.3, tengo-builder 4.0.8, block-tools 2.11.0. Removes the empty placeholder test/src/wf.test.ts and orphaned model/ui vitest.config.mts.
  2. feat: BlockModelV3 model — see below.
  3. chore: changeset.

V3 design

V1 field V3 channel
datasetRef, scChain, allele args (analysis inputs)
customBlockLabel args — the workflow uses it as the trace label
defaultBlockLabel data — subtitle only (label sync no longer stales the block)
weightedFlag, 3× GraphMakerState data — UI/view state
  • .upgradeLegacy folds V1 args + uiState into unified data; persisted projects upgrade in place.
  • .args throws on missing dataset (replaces argsValid); .done(2).done().
  • UI: defineAppdefineAppV3, app.model.args/ui.*app.model.data.*. Block-label watchEffect kept (tolerated exception), repointed to data. Dropped the dead customBlockLabel ??= '' and the redundant setInput (the dropdown's v-model already writes datasetRef).
  • The three graphs stay the standard <GraphMaker> component (graphState in data).

Verification

pnpm build:dev + check (tsc + oxlint + oxfmt) + pnpm test all green (turbo 9/9). Changeset validated (note: packages are …vj-usage.*, not vj-gene-usage).

Not done: runtime legacy-upgrade check against a saved V1 project (needs a backend) — recommended before merge.

CI workflows left identical to main (structurer drift unrelated to the migration).

Greptile Summary

This PR migrates the vj-gene-usage block from BlockModel V1 to BlockModelV3 with the structurer toolchain, folding the previously split args / uiState channels into a single unified data channel (BlockData). A DataModelBuilder with .upgradeLegacy handles in-place migration of persisted V1 projects, and all UI bindings move from model.args.* / model.ui.* to model.data.*.

  • V3 data model: blockDataModel declares a "v1" versioned DataModelBuilder; .upgradeLegacy merges legacy BlockArgs+UiState into BlockData with safe nullish defaults; .args() now throws on a missing datasetRef instead of using .argsValid().
  • UI cleanup: defineAppdefineAppV3, removes the redundant setInput function and the dead customBlockLabel ??= '' initialisation; the syncDefaultBlockLabel watchEffect is retained and repointed to data.
  • Key terms touched: BlockData (new unified V3 state — holds analysis inputs, view state, and derived labels), BlockArgs (workflow-facing projection of BlockData, datasetRef required), LegacyBlockArgs / LegacyUiState (V1 on-disk shapes consumed once by upgradeLegacy), blockDataModel (DataModelBuilder instance wiring version, upgrade, and init), platforma (the new BlockModelV3 export — replaces model), upgradeLegacy (one-time migration from V1 split state to unified BlockData), defineAppV3 (Vue app factory for V3, replacing defineApp).

Confidence Score: 4/5

The migration is well-executed and safe to merge; the only outstanding gap is the absence of a runtime test for the legacy upgrade path against a real persisted V1 project, which the author already flags.

The model, UI, and data-model wiring are all internally consistent. The upgradeLegacy fallback defaults are correct, initData is sound, and all model.args.* / model.ui.* references have been updated. The single comment is a style nit about migration-internal types leaking into the public API. No logic errors were found in the changed paths.

model/src/index.ts — the export * from "./types" line inadvertently exposes LegacyBlockArgs and LegacyUiState as public API. Worth tightening before the package version is widened.

Important Files Changed

Filename Overview
model/src/index.ts Core migration: BlockModel V1 → BlockModelV3, new platforma export replaces model, args projection added with required-field guard, subtitle/sections updated to read from ctx.data. LegacyBlockArgs and LegacyUiState inadvertently exported publicly.
model/src/dataModel.ts New file: DataModelBuilder wiring — declares "v1" version, upgradeLegacy folds V1 args+uiState into unified BlockData with safe nullish defaults, initData seeds fresh blocks correctly.
model/src/types.ts New file: defines BlockData (unified V3 state), BlockArgs (workflow-facing projection), LegacyBlockArgs and LegacyUiState (migration-only shapes). Separation is clear and well-documented.
ui/src/app.ts defineApp → defineAppV3, all model.args.* / model.ui.* repointed to model.data.*; drops dead customBlockLabel ??= '' init; syncDefaultBlockLabel watchEffect retained and repointed correctly.
ui/src/pages/Settings.vue Removed redundant setInput function and @update:model-value handler; all bindings moved from model.args to model.data; logic is simpler and correct.
ui/src/pages/VUsage.vue All model.ui.* → model.data.*; watch on isRunning that closes the settings tab preserved and correctly repointed.
block/index.js Now exports a dev-v2 blockSpec with __dirname folder reference; uses CJS module.exports consistent with package.json having no type: module.
test/src/wf.test.ts Deleted placeholder-comment-only test file; no actual tests were present.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant UI as UI (Vue)
    participant Data as model.data (BlockData)
    participant Args as model.args (BlockArgs)
    participant WF as Workflow

    Note over Data: V1 Legacy Upgrade path
    Data->>Data: upgradeLegacy(LegacyBlockArgs, LegacyUiState) → BlockData

    Note over UI,WF: Normal V3 runtime path
    UI->>Data: v-model bindings write datasetRef, allele, scChain, customBlockLabel, weightedFlag, plotStates
    UI->>Data: watchEffect writes defaultBlockLabel
    Data->>Args: "args() lambda validates and projects (throws if datasetRef === undefined)"
    Args->>WF: datasetRef, scChain, allele, customBlockLabel
    WF-->>Data: outputs.pf, outputs.isRunning
    Data-->>UI: subtitle reads ctx.data.customBlockLabel or ctx.data.defaultBlockLabel
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"}}}%%
sequenceDiagram
    participant UI as UI (Vue)
    participant Data as model.data (BlockData)
    participant Args as model.args (BlockArgs)
    participant WF as Workflow

    Note over Data: V1 Legacy Upgrade path
    Data->>Data: upgradeLegacy(LegacyBlockArgs, LegacyUiState) → BlockData

    Note over UI,WF: Normal V3 runtime path
    UI->>Data: v-model bindings write datasetRef, allele, scChain, customBlockLabel, weightedFlag, plotStates
    UI->>Data: watchEffect writes defaultBlockLabel
    Data->>Args: "args() lambda validates and projects (throws if datasetRef === undefined)"
    Args->>WF: datasetRef, scChain, allele, customBlockLabel
    WF-->>Data: outputs.pf, outputs.isRunning
    Data-->>UI: subtitle reads ctx.data.customBlockLabel or ctx.data.defaultBlockLabel
Loading

Fix All in Claude Code

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

---

### Issue 1 of 1
model/src/index.ts:7
**Internal migration types in public API**

`export * from "./types"` re-exports `LegacyBlockArgs` and `LegacyUiState` as part of the package's public contract. These types exist solely for the one-time `upgradeLegacy` call in `dataModel.ts` and have no meaning for downstream consumers. Leaking them signals that callers might need to handle legacy shapes, and complicates future type-level changes to the migration path.

Consider being explicit about what is public — either use named exports or add an `@internal` JSDoc tag and exclude them with a barrel re-export.

Reviews (1): Last reviewed commit: "chore: add changeset for structurer + V3..." | 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)

Adopt the tool-managed block layout (oxlint/oxfmt, ts-builder, regenerated
configs across model, ui, workflow, block, test) and the full SDK upgrade to
latest (model/ui-vue 1.79.14, workflow-tengo 6.6.3, tengo-builder 4.0.8,
block-tools 2.11.0).

Remove dead test scaffolding: the empty placeholder test/src/wf.test.ts
(oxlint no-empty-file) and the orphaned model/ui vitest.config.mts.

CI workflows left unchanged from main (structurer drift — app-name casing,
test:false->true, S3 bucket secret rename, Slack reorder — is unrelated).
Replace the V1 model (BlockModel + withArgs/withUiState/argsValid/done(2)) with
BlockModelV3 + a DataModelBuilder:

- model/src/types.ts: unified BlockData (datasetRef, scChain, allele, block
  labels, weightedFlag, three GraphMakerState plot states), workflow-facing
  BlockArgs (datasetRef + scChain + allele + customBlockLabel), legacy shapes.
- model/src/dataModel.ts: .upgradeLegacy folds V1 args + uiState into data; .init
  seeds defaults.
- index.ts: .args projects analysis params + customBlockLabel (the workflow's
  trace label) and throws on missing dataset (replaces argsValid). ctx.args->
  ctx.data; .done(2)->.done().
- UI: defineApp->defineAppV3; app.model.args/ui.*->app.model.data.*. Block-label
  watchEffect kept (tolerated exception), repointed to data. The three graphs stay
  hand-rolled (<GraphMaker> + graphState in data). Dropped the dead
  customBlockLabel ??= '' and the redundant setInput (v-model already writes
  datasetRef).

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request migrates the block to the BlockModelV3 and upgrades the SDK dependencies to their latest versions. Key changes include unifying the persisted state under app.model.data and updating the UI components to bind to this new structure. The review feedback highlights three main improvement opportunities: first, using loose equality checks (== null) for datasetRef in model/src/index.ts to robustly handle both null and undefined values from the UI dropdown; and second, refining the isRunning transition check in ui/src/pages/VUsage.vue to explicitly verify a false to true transition, preventing the settings panel from closing prematurely on initial load.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread model/src/index.ts
Comment thread model/src/index.ts
Comment thread ui/src/pages/VUsage.vue
Comment thread model/src/index.ts
Export only the public BlockData/BlockArgs from the model entry instead of
`export * from './types'`, which also re-exported the internal
LegacyBlockArgs/LegacyUiState (used solely by upgradeLegacy).
@julenmendieta
julenmendieta self-requested a review June 22, 2026 15:58
@julenmendieta
julenmendieta merged commit a6d206b into main Jun 22, 2026
11 checks passed
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.

2 participants