Skip to content

fix(MILAB-5944): tsv from remote fails - #38

Merged
PaulNewling merged 6 commits into
mainfrom
pnewling/MILAB-5944-tsv-from-remote-fails
Mar 18, 2026
Merged

fix(MILAB-5944): tsv from remote fails#38
PaulNewling merged 6 commits into
mainfrom
pnewling/MILAB-5944-tsv-from-remote-fails

Conversation

@PaulNewling

@PaulNewling PaulNewling commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a prerun workflow template that imports the assay file and exposes it via file.exportFile()
  • Model exposes the prerun result via ctx.prerun?.resolveAny({ field: 'assayFile' })?.getFileHandle()
  • Two-path approach for column detection:
    • Local (upload://) files: read bytes directly via lsDriver.getLocalFileContent() — immediate, no prerun round-trip needed
    • Remote (index://) files: ReactiveFileContent reads bytes reactively via assayFileHandle once the prerun completes — works for storages not locally mounted
  • Fix dropdowns spinning forever when file is removed (return [] vs undefined when no file is selected)
  • Fix assayFileHandle output: changed from retentiveOutput to output so stale handles don't block reactivity when the file changes

Why

lsDriver.getLocalFileContent() throws "Storage X is not mounted locally" for files from remote Platforma storages. The call was also unawaited, so the error was silently swallowed — the block appeared to accept the file but column detection never ran, leaving it permanently unconfigurable.

ReactiveFileContent cannot resolve bytes from the prerun output handle for local files (causes the column detection to spin forever), so the two-path approach is necessary — local files bypass the prerun for byte reading, remote files go through it.

Test plan

  • Local TSV file
  • Remote TSV file
  • Other filetypes still work
  • Invalid file shows "No sequence columns found" error
  • Clearing file clears selections and stops spinners

Video shows:

  1. Remote TSV file
  2. Clearing file clears selections
  3. Local TSV File
Screen.Recording.2026-03-17.at.11.19.30.AM.mov
Screenshot 2026-03-17 at 9 01 16 AM Screenshot 2026-03-17 at 11 23 43 AM

Replace lsDriver.getLocalFileContent() with the ReactiveFileContent
pattern used by samples-and-data. A new prerun template imports the
file via file.importFile() and exports it as a blob; the model exposes
it via ctx.prerun.getFileHandle(); the UI uses ReactiveFileContent
(blobDriver) to read bytes reactively and detect columns.

This makes column detection work for files from remote Platforma
storages, not just locally-mounted ones.
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical limitation in assay file import, where files stored in remote Platforma storages were not correctly processed due to reliance on local file system access. By introducing a prerun workflow that imports the selected file and exposes it as a blob, and then leveraging a reactive file content pattern in the UI, the system can now uniformly handle assay files from both local and remote sources. This change significantly enhances the usability and robustness of the assay file import functionality, providing a more consistent user experience.

Highlights

  • Remote File Import Support: Implemented a new mechanism to support importing assay files from remote Platforma storages, resolving an issue where column detection failed for non-local files.
  • Reactive File Content Pattern: Transitioned from lsDriver.getLocalFileContent() to a ReactiveFileContent pattern, utilizing a prerun workflow to import files and expose them as blobs, which works consistently for both local and remote files.
  • Model and UI Integration: Updated the model to expose the file handle from the prerun workflow and refactored UI components to reactively read file bytes, ensuring seamless processing of assay files regardless of their origin.
  • Dependency Updates: Updated various package dependencies across the project, including @milaboratories/graph-maker, @platforma-sdk/block-tools, @platforma-sdk/model, @platforma-sdk/ui-vue, @platforma-sdk/tengo-builder, and @platforma-sdk/workflow-tengo.
Changelog
  • .changeset/remote-tsv-file-import.md
    • Fix assay file import to support remote (non-local) files. Previously, column detection used lsDriver.getLocalFileContent() which only works for locally-mounted files. Files from remote storages would silently fail, leaving the block unconfigurable. Now uses a prerun workflow step to import the file and expose it as a blob, and ReactiveFileContent in the UI to read it via blobDriver — the same pattern used by samples-and-data. This works for both local and remote files.
Activity
  • No specific activity has been recorded for this pull request.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@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 effectively refactors the assay file import process to support remote storage, which is a significant improvement. The approach of using a prerun workflow and ReactiveFileContent is solid. I've included a couple of suggestions in ui/src/pages/MainPage.vue to enhance code maintainability and clarity.

Comment thread ui/src/pages/MainPage.vue Outdated
Comment thread ui/src/pages/MainPage.vue Outdated
retentiveOutput keeps the old assayFileHandle after fileHandle is
cleared, so assayFileBytes never updates and importColumns stays
undefined. Return [] instead of undefined from sequenceColumnOptions
and otherColumnOptions when no file is selected, so the dropdowns
show empty rather than a loading spinner.
Local (upload://) files now read directly from disk via
getLocalFileContent() for immediate column detection — same as the
original behaviour, no prerun round-trip needed. Remote (index://)
files continue to use the assayFileBytes watch once the prerun
completes. A guard prevents double-processing if both paths fire.
Comment thread workflow/src/prerun.tpl.tengo
Comment thread workflow/src/main.tpl.tengo
Comment thread model/src/index.ts
Comment thread ui/src/importFile.ts
Comment thread ui/src/pages/MainPage.vue
Comment thread ui/src/pages/MainPage.vue
Comment thread ui/src/pages/MainPage.vue
Comment thread ui/src/pages/MainPage.vue
Comment thread ui/src/fastaParser.ts

/**
* Process FASTA file and convert to table format
*/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This function combined file I/O (lsDriver.getLocalFileContent) with FASTA parsing in one place, which made it impossible to reuse for remote files. The logic has been split:

  • I/O moved into setFile in MainPage.vue: local files (upload://) are read immediately via lsDriver.getLocalFileContent(); remote files (index://) arrive later as bytes from the prerun blob via ReactiveFileContent.
  • Parsing (parseFastaContentfastaToTable → split into rawData) is now inlined in processFileBytes in importFile.ts, which receives Uint8Array bytes regardless of where they came from.

parseFastaContent and fastaToTable remain in this file unchanged.

@PaulNewling PaulNewling changed the title Fix assay file import for remote storages fix(MILAB-5944): tsv from remote fails Mar 17, 2026
@PaulNewling
PaulNewling marked this pull request as ready for review March 17, 2026 18:38
Switch assayFileHandle from retentiveOutput to output, unify local/remote
file handling through a single watch with { immediate: true }, and simplify
setFile to a synchronous function — removing the local-file fast-path that
bypassed the prerun.
Re-introduce the two-path approach for reading file bytes:
- Local (upload://) files: read directly via lsDriver — immediate, no prerun round-trip
- Remote (index://) files: watch assayFileBytes once the prerun imports the file

ReactiveFileContent cannot resolve bytes from the prerun output handle for local
files, causing processFileBytes to never be called and the 'No sequence columns
found' error to silently disappear.
@PaulNewling
PaulNewling merged commit 55aec88 into main Mar 18, 2026
8 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.

1 participant