Skip to content

Preserve Lake declarations and traces when vendoring - #3875

Open
joshlf wants to merge 1 commit into
mainfrom
Gxizdpw52bljtxjfng3ervgk5xnca6mow
Open

joshlf wants to merge 1 commit into
mainfrom
Gxizdpw52bljtxjfng3ervgk5xnca6mow

Conversation

@joshlf

@joshlf joshlf commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Vendoring must change dependency locations while retaining the declarations
which consume them. Stop each TOML require block at the next table so that
library and executable declarations survive. Add fixtures from the pinned
aesop and importGraph packages to cover those boundaries.

Reject symlinks outside the private archive roots before rewriting any
file. Keep path components separate in trace matching so a long absolute
path cannot trigger exponential regular-expression backtracking. These
changes let native Lake traces remain usable after archive relocation.

Authored by an AI agent acting on joshlf's behalf.


Latest Update: v12 — Compare vs v11

📚 Full Patch History

Links show the diff between the row version and the column version.

Version v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v8 v7 v6 v5 v4 v3 v2 v1 Base
v7 v6 v5 v4 v3 v2 v1 Base
v6 v5 v4 v3 v2 v1 Base
v5 v4 v3 v2 v1 Base
v4 v3 v2 v1 Base
v3 v2 v1 Base
v2 v1 Base
v1 Base
⬇️ Download this PR

Branch

git fetch origin refs/heads/Gxizdpw52bljtxjfng3ervgk5xnca6mow && git checkout -b pr-Gxizdpw52bljtxjfng3ervgk5xnca6mow FETCH_HEAD

Checkout

git fetch origin refs/heads/Gxizdpw52bljtxjfng3ervgk5xnca6mow && git checkout FETCH_HEAD

Cherry Pick

git fetch origin refs/heads/Gxizdpw52bljtxjfng3ervgk5xnca6mow && git cherry-pick FETCH_HEAD

Pull

git pull origin refs/heads/Gxizdpw52bljtxjfng3ervgk5xnca6mow

Stacked PRs enabled by GHerrit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T21:46:38.010082Z a1106d8 PR opened
🔒 Security Review ✅ Completed 2026-10-14T21:45:50.053584Z a1106d8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This was referenced Oct 14, 2026

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

Copy link
Copy Markdown
Contributor

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 introduces validate_vendoring_roots to prevent vendoring symlinks from escaping private roots, refines the TOML require block replacement regex to stop at any TOML table, and fixes a regex backtracking issue in trace prefix rewriting. It also adds comprehensive unit tests and fixtures. The review feedback suggests improving robustness by removing strict=True from path.resolve() to gracefully handle dangling symlinks, and replacing Path.is_relative_to with a Python 3.8-compatible alternative to ensure backward compatibility.

for name in directories + files:
path = Path(current) / name
if path.is_symlink():
target = path.resolve(strict=True)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Using strict=True in path.resolve(strict=True) will raise a FileNotFoundError if a broken or dangling symlink is encountered. It is common for repositories or vendored packages to contain dangling symlinks (e.g., in test fixtures or unused files). If this happens, the script will crash with a traceback instead of handling it gracefully.\n\nUsing strict=False (which is the default for resolve()) allows the path to be resolved as much as possible. If the resolved path points outside the allowed roots, it will still be correctly caught and raise the descriptive ValueError. If it points to a nonexistent path inside the allowed roots, it will be safely allowed.

Suggested change
target = path.resolve(strict=True)
target = path.resolve()

path = Path(current) / name
if path.is_symlink():
target = path.resolve(strict=True)
if not any(target.is_relative_to(parent) for parent in allowed):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Path.is_relative_to was introduced in Python 3.9. If this script is executed in an environment running Python 3.8 or older (which is still common in some CI/CD pipelines or older LTS distributions), it will raise an AttributeError at runtime.\n\nTo ensure compatibility with Python 3.8 and older, we can replace target.is_relative_to(parent) with an equivalent check using parent == target or parent in target.parents.

Suggested change
if not any(target.is_relative_to(parent) for parent in allowed):
if not any(parent == target or parent in target.parents for parent in allowed):

@codecov-commenter

codecov-commenter commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.94%. Comparing base (70fa387) to head (b593edb).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3875   +/-   ##
=======================================
  Coverage   92.94%   92.94%           
=======================================
  Files          16       16           
  Lines        2466     2466           
=======================================
  Hits         2292     2292           
  Misses        174      174           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Vendoring must change dependency locations while retaining the declarations
which consume them. Stop each TOML require block at the next table so that
library and executable declarations survive. Add fixtures from the pinned
aesop and importGraph packages to cover those boundaries.

Reject symlinks outside the private archive roots before rewriting any
file. Keep path components separate in trace matching so a long absolute
path cannot trigger exponential regular-expression backtracking. These
changes let native Lake traces remain usable after archive relocation.

gherrit-pr-id: Gxizdpw52bljtxjfng3ervgk5xnca6mow
Agent-authored-by: AI agent acting on joshlf's behalf

This branch has not been deployed

No deployments
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