Skip to content

fix(up): skip unresolvable paths instead of failing the whole upload - #1043

Open
codyde wants to merge 4 commits into
masterfrom
railway/up-skip-broken-symlinks
Open

codyde wants to merge 4 commits into
masterfrom
railway/up-skip-broken-symlinks

Conversation

@codyde

@codyde codyde commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Problem

A single dangling symlink anywhere in the tree aborts railway up during indexing with No such file or directory, and no deployment is created. An exact-path .railwayignore rule cannot exclude it: follow_links(true) makes the walker stat the symlink target before the ignore rules are consulted for that entry, so the error is raised before matching happens.

Closes #1023.

Resolution

  • Treat a walk entry whose error is NotFound as skippable — a broken link, or a file removed mid-walk, has no contents to upload — and report it via reporter::warn, so it is structured under --json.
  • Any other error still fails the deploy; a permission or I/O error would mean a silently incomplete tarball.
  • Validate the root path up front. It reaches the walker as the same NotFound, and none of the three callers check it, so skipping it would turn a typo'd path into an empty but successful deploy.

Not follow_links(false): that regresses symlinked directories, which is what #296 fixed.

Verification

Real deploys, identical tree (backend/AGENTS.md dangling + /backend/AGENTS.md in .railwayignore):

before (5.30.4) after
exit code 1 0
deployment none created SUCCESS
--json stdout — valid JSON

Deployed app serves correctly, so real files still ship. Covered by 7 tests including symlinked-dir traversal, symlink loop stays fatal, and the missing-root and empty-dir/single-file boundaries.

codyde added 2 commits August 5, 2026 15:23
A dangling symlink anywhere in the tree aborted `railway up` during indexing
with "No such file or directory", creating no deployment. An exact-path
`.railwayignore` rule could not exclude it: `follow_links(true)` makes the
walker stat the symlink target before the ignore rules are consulted for that
entry, so the error is raised before matching happens.

Treat a walk entry whose error is `NotFound` as skippable — a broken link, or a
file removed mid-walk, has no contents to upload — and report it through
`reporter::warn` so it is structured under `--json`. Any other error still
fails the deploy, since that would mean a silently incomplete tarball.

Validate the root path up front: it reaches the walker as the same `NotFound`,
and no caller checks it, so skipping it would turn a typo'd path into an empty
but successful deploy.
@codyde codyde added the release/patch Author patch release label Aug 5, 2026 — with Railway App
codyde and others added 2 commits November 10, 2026 08:40
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ken-symlinks

Resolved src/controllers/upload.rs on top of #1308 (kept intact: canonical archive root, filter_entry escape check, DeployTarball/skipped_symlinks). Re-applied is_missing_path, the up-front project_path existence check (placed before #1308's canonicalize so the error stays 'no such path'), and the NotFound skip in the walk loop. #1308's filter_entry does not cover dangling links: with follow_links(true) walkdir errors with NotFound before the filter ever sees the entry. The skip only drops entries, so it cannot reintroduce an escape. Moved this PR's tests into a separate unresolvable_path_tests module (master's tests module is unix-only) and adapted them to DeployTarball.bytes.
@codyde codyde added release/skip Author no release and removed release/patch Author patch release labels Nov 10, 2026

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

release/skip Author no release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

railway up fails when an exact-path .railwayignore rule matches a dangling symlink

1 participant