Skip to content

Julenmendieta/singleModelSelection#4

Merged
julenmendieta merged 7 commits into
mainfrom
julenmendieta/singleModelSelection
Jul 7, 2026
Merged

Julenmendieta/singleModelSelection#4
julenmendieta merged 7 commits into
mainfrom
julenmendieta/singleModelSelection

Conversation

@julenmendieta

@julenmendieta julenmendieta commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Greptile Summary

This PR simplifies the block from supporting a variable list of embedding cards (each a scope × model task) to a single (sequence, model) selection. The workflow's external contract — a list of EmbeddingTask — is intentionally preserved by wrapping the one selection in a 1-element array, so no downstream changes are required.

  • Model layer: Adds BlockDataV3 with a single EmbeddingSelection field, introduces migrateV2ToV3 that collapses the V2 card list to its first element, and enriches the subtitle to show dataset · scope · model parts progressively.
  • UI layer: EmbeddingCard.vue is renamed to EmbeddingSelector.vue, its config prop becomes optional so the dropdowns render before any input is connected, and MainPage.vue drops PlElementList in favour of the single-selector component.
  • Key types touched: EmbeddingSelection (new — single scope+model replacing EmbeddingCard), EmbeddingCardV2 (frozen migration-source type), BlockDataV3 (new current BlockData with embedding: EmbeddingSelection), embeddingInitializedForAnchor (init-guard replacing embeddingsInitializedForAnchor), EmbeddingSelector (renamed component, optional config, v-modelled on EmbeddingSelection).

Confidence Score: 4/5

Safe to merge; the single-selection redesign is well-executed and the migration chain is correct. The only gap is that the subtitle dataset-label can go stale after a collaborator renames the upstream block.

The migration, args projection, init-guard, and UI wiring are all logically consistent. Moving defaultBlockLabel from a reactive watchEffect to an event-driven setter in setInput means the subtitle label won't refresh if the upstream dataset is renamed by another user — it stays at whatever was last persisted until the current user re-picks the input.

ui/src/pages/MainPage.vue — specifically the setInput function where defaultBlockLabel is now set only on explicit user action rather than reactively.

Important Files Changed

Filename Overview
model/src/types.ts Introduces BlockDataV3 (single EmbeddingSelection replacing EmbeddingCardV2[]), freezes EmbeddingCardV2 as migration-source type, updates BlockData alias and doc-comments throughout.
model/src/dataModel.ts Adds migrateV2ToV3 (collapses embeddings list to first card), registers the V3 migration step, and updates the init value from [] to {}.
model/src/index.ts Replaces per-card task projection with single-selection projection; richer subtitle (label · scope · model); removes duplicate detection, sorting, and multi-task logic.
ui/src/app.ts Simplifies watchEffect to seed a single scope+model selection per anchor; removes per-card UUID generation and old multi-card seeding; clears embedding on anchor change.
ui/src/pages/MainPage.vue Removes PlElementList/PlBtnSecondary card list, replaces with single EmbeddingSelector; moves defaultBlockLabel update into setInput event handler (now event-driven rather than reactive watchEffect).
ui/src/pages/EmbeddingSelector.vue Renamed from EmbeddingCard.vue; config prop made optional; removed duplicate-detection alert; v-model type narrowed to EmbeddingSelection.
ui/src/pages/ReportTable.vue Replaces embeddings.length === 0 guard with selectionIncomplete computed (scope or model undefined); updates notReadyText strings.
pnpm-workspace.yaml Bumps block-tools (2.11.7→2.11.9), test (1.79.24→1.79.26), tengo-builder (4.0.12→4.0.14) catalog versions.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant User
    participant MainPage
    participant app.ts watchEffect
    participant Model (BlockDataV3)
    participant index.ts args λ

    User->>MainPage: selects input (setInput)
    MainPage->>Model (BlockDataV3): inputAnchor = ref, defaultBlockLabel = label
    app.ts watchEffect->>Model (BlockDataV3): anchor key changed → embedding = {}
    app.ts watchEffect->>app.ts watchEffect: waits for config.forAnchor === key
    app.ts watchEffect->>Model (BlockDataV3): embedding = {scope, model, fidelity}, embeddingInitializedForAnchor = key

    User->>MainPage: changes sequence/model
    MainPage->>Model (BlockDataV3): embedding = new EmbeddingSelection

    User->>MainPage: clicks Run
    MainPage->>index.ts args λ: reads data.embedding
    index.ts args λ->>index.ts args λ: validate scope + model + compat
    index.ts args λ-->>MainPage: BlockArgs { embeddings: [task] }
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 User
    participant MainPage
    participant app.ts watchEffect
    participant Model (BlockDataV3)
    participant index.ts args λ

    User->>MainPage: selects input (setInput)
    MainPage->>Model (BlockDataV3): inputAnchor = ref, defaultBlockLabel = label
    app.ts watchEffect->>Model (BlockDataV3): anchor key changed → embedding = {}
    app.ts watchEffect->>app.ts watchEffect: waits for config.forAnchor === key
    app.ts watchEffect->>Model (BlockDataV3): embedding = {scope, model, fidelity}, embeddingInitializedForAnchor = key

    User->>MainPage: changes sequence/model
    MainPage->>Model (BlockDataV3): embedding = new EmbeddingSelection

    User->>MainPage: clicks Run
    MainPage->>index.ts args λ: reads data.embedding
    index.ts args λ->>index.ts args λ: validate scope + model + compat
    index.ts args λ-->>MainPage: BlockArgs { embeddings: [task] }
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
ui/src/pages/MainPage.vue:37-46
**Stale subtitle label after upstream rename**

`defaultBlockLabel` is now set only inside `setInput`, whereas the old code used a `watchEffect` that re-ran whenever `inputOptions` changed. If a collaborator renames the upstream dataset block after the user has already connected it, the subtitle (`data.defaultBlockLabel · scope · model`) will keep showing the old name until the user explicitly re-selects the input. The `inputOptions` output is retentive and reactive, so adding a watched update just for this field (without touching `inputAnchor`) avoids the server-patch side effects that motivated removing the original watcher.

Reviews (1): Last reviewed commit: "Changeset" | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

@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 simplifies the sequence embeddings block by transitioning from a multi-card selection model (V2) to a single (sequence, model) selection model (V3). This includes adding data model migrations, updating validation logic to handle a single task, and redesigning the UI components to use a single dropdown-based selector instead of an element list. The review feedback focuses on improving robustness by suggesting optional chaining when accessing potentially uninitialized or undefined model data and embeddings in both the migration logic and various Vue components.

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/dataModel.ts
Comment thread ui/src/pages/EmbeddingSelector.vue
Comment thread ui/src/pages/MainPage.vue
Comment thread ui/src/pages/ReportTable.vue
Comment thread ui/src/pages/MainPage.vue
@julenmendieta julenmendieta merged commit 0d1eae7 into main Jul 7, 2026
11 checks passed
@julenmendieta julenmendieta deleted the julenmendieta/singleModelSelection branch July 7, 2026 11:30
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