Skip to content

Cleanup external data path validation#27539

Merged
adrianlizarraga merged 30 commits intomainfrom
adrianl/InMemModel_ExtDataPath_SymLinkCheck
Mar 14, 2026
Merged

Cleanup external data path validation#27539
adrianlizarraga merged 30 commits intomainfrom
adrianl/InMemModel_ExtDataPath_SymLinkCheck

Conversation

@adrianlizarraga
Copy link
Contributor

@adrianlizarraga adrianlizarraga commented Mar 3, 2026

Description

  • Updates the ValidateExternalData() function:
    • Resolves symlinks when validating external data path for models loaded from memory.
      • Previously only did a lexical check that did not resolve symlinks. Now, we resolve symlinks.
    • Now requires external data path to exist.
    • Replace the (base_dir, model_dir) function parameters with just model_dir. base_dir was always derived from model_dir.
    • Skip validation for WASM builds that do not have a filesystem.
    • Return Status instead of throwing exceptions when std::filesystem functions fail.
  • Updates Graph::ConvertInitializersIntoOrtValues():
    • Prevents unnecessary calls to ValidateExternalData() for external data paths that have already been validated.

Motivation and Context

@adrianlizarraga adrianlizarraga requested a review from Copilot March 5, 2026 16:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@adrianlizarraga adrianlizarraga requested a review from Copilot March 5, 2026 19:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@adrianlizarraga adrianlizarraga marked this pull request as ready for review March 6, 2026 20:04
Copy link
Member

@yuslepukhin yuslepukhin left a comment

Choose a reason for hiding this comment

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

I am having a hard time reviewing since my tools are not working.

See the tests that I introduced in my DRAFT PR in connection with my comment.

@yuslepukhin
Copy link
Member

This is growing to be complicated. We will need a comprehensive documentation for this function detailing all what and why.

edgchen1
edgchen1 previously approved these changes Mar 13, 2026
@adrianlizarraga adrianlizarraga changed the title Resolve symlinks when validating external data path for models loaded from memory Cleanup external data path validation Mar 13, 2026
@adrianlizarraga adrianlizarraga merged commit 50f3cc3 into main Mar 14, 2026
91 checks passed
@adrianlizarraga adrianlizarraga deleted the adrianl/InMemModel_ExtDataPath_SymLinkCheck branch March 14, 2026 07: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.

4 participants