Skip to content

fix(storage): root model file trees at the models prefix - #7074

Draft
tanishqgandhi1908 wants to merge 27 commits into
apache:mainfrom
tanishqgandhi1908:fix/model-file-tree-resource-prefix
Draft

fix(storage): root model file trees at the models prefix#7074
tanishqgandhi1908 wants to merge 27 commits into
apache:mainfrom
tanishqgandhi1908:fix/model-file-tree-resource-prefix

Conversation

@tanishqgandhi1908

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

DatasetFileNode.fromLakeFSRepositoryCommittedObjects hardcoded ResourceType.Datasets as the tree's leading segment. Models reuse that builder, so every model file node reported a path under /datasets/…:

/datasets/bob@texera.com/resnet/v1/weights/model.pt ← what a model tree returns today
/models/bob@texera.com/resnet/v1/weights/model.pt ← what it should return

FileResolver.resolve dispatches on that leading segment — /datasets/… resolves against the DATASET table, /models/… against MODEL. So any caller that takes a node's path and hands it to the presign endpoint resolves a model file against datasets: a 404 in the common case, and the wrong resource's file if the user happens to own a dataset with the same name as their model. Nothing in the stack hits this yet because no current caller round-trips a model node's path through FileResolver; the model management UI does, which is how it surfaced.

The fix makes resourceType a required parameter, so every call site must declare which resource it is building — no silent default that can drift again. The three dataset call sites pass ResourceType.Datasets; the three model call sites pass ResourceType.Models.

Datasets are unaffected. The file-population loop is moved verbatim, and the terminal sort makes creation order unobservable: every level is sorted by name before the tree is returned, so restructuring the two-pass creation cannot change output.

Any related issues, documentation, discussions?

Part of #6497 (Add model file storage and path resolution)
Related: #6495 (Add a resource-type prefix to logical paths),
Umbrella: #6494.

How was this PR tested?

sbt "FileService/test"
sbt "FileService/scalafixAll" "FileService/scalafmtAll"
FileService/test: 349 tests, 16 suites, 0 failures. ModelDownloadResourceSpec exercises the presign round-trip against a Testcontainers LakeFS + MinIO, so the /models/… prefix is verified end-to-end through FileResolver, not just in a unit test.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 5)

aicam and others added 27 commits July 1, 2026 13:57
… tests

Review fixes on apache#5911: use dataset owner email in retrieveLatestDatasetVersion,
replace brittle Option.get/.head with headOption, strip datasets prefix on
selection-modal reopen, clarify FileResolver docs; add FileResolver/DatasetFileNode
and frontend path-helper tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The datasets logical-path prefix strips four leading segments
(datasets/owner/dataset/version); update the cover-image test's input
path to include the prefix so the extracted relative path is the file
name, not an empty string.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Now that models are coming as a separate resource/table, the leading
resource-type segment is what selects the backing table, so an unprefixed
path can no longer be routed unambiguously. Make the "datasets" prefix
required instead of a tolerated fallback, and migrate existing data.

- FileResolver: a dataset path must start with the "datasets" segment;
  unprefixed paths are no longer treated as dataset paths.
- pytexera DatasetFileDocument: same rule, mirroring the backend.
- FileListerSourceOpExec: parse the now-prefixed datasetVersionPath
  (skip the "datasets" segment); extracted into a testable helper.
- Migration (sql/updates/29.sql): prepend "datasets/" to legacy paths
  stored in workflow.content and workflow_version.content, covering both
  the fileName (scan sources) and datasetVersionPath (file lister)
  operator properties. Only values whose first two segments match an
  existing (user.email, dataset.name) are rewritten, so local paths and
  URLs are left untouched; email format is irrelevant (owner may be a
  username without "@"). Uses create_missing=false and is idempotent.
- Example workflows: use datasets-prefixed paths.

Tests: FileResolverSpec and WorkflowExecutionsResourceSpec updated;
test_dataset_file_document.py updated; new FileListerSourceOpExecSpec.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…l-path-prefix

# Conflicts:
#	frontend/src/app/common/type/datasetVersionFileTree.spec.ts
…format python test

- dataset-selection-modal.component.spec.ts: expect the datasets-prefixed
  selectedPath in version (non-file) mode, matching the emitted path.
- test_dataset_file_document.py: apply ruff format (wrap an over-length line)
  so `ruff format --check` passes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The cover-image endpoints resolve a dataset path built as
{owner}/{name}/{coverImage}. With the prefix now required by FileResolver,
these must carry the datasets/ segment; add it in the set-cover,
get-cover redirect, and cover-url handlers so cover images resolve again.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…rage

# Conflicts:
#	common/workflow-core/src/test/scala/org/apache/texera/amber/core/storage/DocumentFactorySpec.scala
The explicit-access branch of listModels hardcoded size 0 while the public
branch computed it, so a user's own models reported no size. Compute it in
both, mirroring the dataset listing, and degrade to 0 rather than dropping
the row when LakeFS cannot answer.
DatasetFileNode.fromLakeFSRepositoryCommittedObjects hardcoded
ResourceType.Datasets as the tree's leading segment. Models reuse that
builder, so model file nodes reported paths under /datasets/... .
FileResolver dispatches on that segment, so presigning a model file by
its logical path resolved against the DATASET table -- a 404, or the
wrong resource's file when a user owns a same-named dataset.

Make resourceType a required parameter so every call site declares which
resource it builds, and extract the scaffolding the two builders
duplicated into buildVersionSkeleton and sortChildrenRecursively.
fromPhysicalFileNodes stays pinned to Datasets: physical on-disk trees
are dataset-only.

Datasets are unaffected -- the file-population loop is moved verbatim and
the terminal sort makes creation order unobservable.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions github-actions Bot added engine ddl-change Changes to the TexeraDB DDL labels Jul 29, 2026
@github-actions github-actions Bot added fix pyamber frontend Changes related to the frontend GUI infra common platform Non-amber Scala service paths labels Jul 29, 2026
@Yicong-Huang Yicong-Huang added the release/v1.2 back porting to release/v1.2 label Jul 29, 2026
@github-actions
github-actions Bot requested a review from xuang7 July 29, 2026 22:54
@github-actions

Copy link
Copy Markdown
Contributor

Backport auto-label report

This fix: PR was checked against each actively-supported release branch. release/* labels drive the post-merge backport, so add or remove one to change where this fix lands.

Release branch Analysis
release/v1.2 Change detected on this branch — label added; this fix is queued to backport here. Requested review from @xuang7.

Auto-label run.

@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @Ma77Ball, @Yicong-Huang, @aglinxinyuan
    You can notify them by mentioning @Ma77Ball, @Yicong-Huang, @aglinxinyuan in a comment.

@xuang7 xuang7 removed the release/v1.2 back porting to release/v1.2 label Jul 29, 2026
@xuang7
xuang7 removed their request for review July 30, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common ddl-change Changes to the TexeraDB DDL engine fix frontend Changes related to the frontend GUI infra platform Non-amber Scala service paths pyamber

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants