Skip to content

Resolve the macOS system temp link in the output tests - #176

Merged
Blogbotana merged 1 commit into
masterfrom
test/macos-output-temp-link
Oct 22, 2026
Merged

Blogbotana merged 1 commit into
masterfrom
test/macos-output-temp-link

Conversation

@axisrow

@axisrow axisrow commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

What this changes

crates/host/src/output.rs test helper scratch() resolves the default temp root before
handing it to the validator, on macOS only. The system path /var/folders/... sits behind
the /var -> /private/var link, and resolve_destination rightly refuses a link anywhere
above the output, so six output::tests failed on macOS:

  • a_link_anywhere_above_the_output_is_refused
  • a_new_file_is_installed_whole_and_no_temporary_remains
  • a_failing_writer_leaves_no_output_and_no_temporary
  • an_existing_file_is_kept_unless_overwrite_is_asked
  • nothing_is_installed_until_every_staged_output_is_written
  • destinations_compare_by_directory_and_name

The production logic is untouched and stays strict: the fix is that tests hand the
validator a link-free root, the same convention the storage tests already follow.
Upstream CI does not run a macOS lane, so these failures were invisible there; on a
Mac the suite fails on a clean checkout of master.

How you verified it

  • Red: cargo test -p beamcraft-host --lib on clean master, macOS (Apple M5,
    aarch64): 36 passed; 6 failed, all six with InvalidArgument: the output directory, or one of its ancestors, is a link or not a directory
  • Green: same command after the fix: 42 passed; 0 failed
  • cargo fmt -p beamcraft-host -- --check
  • cargo clippy -p beamcraft-host -- -D warnings

Never-crash

  • Tests only; the one expect sits in test code, production paths unchanged

Provenance (clean-room)

  • No new dependencies, assets or third-party code

🤖 Generated with Claude Code

Issue tracking

Fixes #370

The default temp root sits behind the /var -> /private/var system link, and the
output validator rightly refuses a link anywhere above the output, so the six
output::tests failed on macOS while passing in CI, which has no macOS lane.
The test scratch helper now hands the validator the resolved root; production
logic is unchanged.

Co-Authored-By: Claude Code <[email protected]>
@axisrow
axisrow requested a review from Blogbotana as a code owner October 22, 2026 04:51

@axisrow axisrow left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Ревью PR #176 — одобряю

Один коммит против base 9291a96: тест-хелпер scratch в crates/host/src/output.rs на macOS отдаёт валидатору канонизированный корень временной директории (var ссылается на private/var), потому что валидатор вывода отказывает путям с симлинками выше вывода.

Проверил: правка только в тестовом модуле; fs::canonicalize в скоупе через use std::fs::{self, ...}, COUNTER и структура пути не тронуты; expect в тестах разрешён правилами крейса; на прочих платформах ветка не меняет поведение. Комментарий объясняет причину. Согласуется с известным поведением macOS-окружения тестов.

@Blogbotana Blogbotana left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agree. I just don't have Mac

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.

PR #176: Resolve the macOS system temp link in the output tests

2 participants