Skip to content

fix(meson): allowlist configure outputs, skip on no-op, purge on clear (closes #710) - #732

Merged
zackees merged 1 commit into
mainfrom
fix/710-meson-snapshot-allowlist
Jun 14, 2026
Merged

zackees merged 1 commit into
mainfrom
fix/710-meson-snapshot-allowlist

Conversation

@zackees

@zackees zackees commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Three coordinated fixes for #710 — stale clang PCH resurrected by zccache meson configure snapshot, silently defeating #pragma once dedup.

1. Strict allowlist on archive_dir

is_configure_output(rel) + is_configure_output_dir(rel) whitelist only meson-owned configure outputs:

  • build.ninja
  • compile_commands.json
  • meson-info/**
  • meson-private/**
  • meson-logs/**

Everything else is skipped at the walker — *.obj, *.pch, *.input_hash, *.d.cache, target subdirs (tests/, examples/, subprojects/<sub>/build/), ninja state (.ninja_log, .ninja_deps). The poisoned-PCH restore path is gone.

2. Skip persist on "Directory already configured."

When meson prints the no-op signal, nothing was produced this invocation — the build dir is whatever was already there. Persisting that state is what captured the built tree in the #710 repro. Now we detect the marker and short-circuit before persist with a skip persist key=… reason=already-configured log line.

3. Request::Clear purges cache_root/meson-configure/

The poisoned v2 entries were self-sustaining: zccache clear left them in place and the same key kept hitting. handle_clear now does a best-effort remove_dir_all on the meson-configure directory under the daemon's cache root.

4. Cache key bump v2 → v3

Forces existing v2 entries (the poisoned ones the repro produced) to miss out and re-capture under the new allowlist. No protocol change.

Test plan

  • soldr cargo fmt --all
  • soldr cargo clippy -p zccache --lib --tests -- -D warnings — clean
  • soldr cargo test -p zccache --lib meson_cache — 6/6 pass, including:
  • soldr cargo test -p zccache --lib clear_handler — passes (no regression)
  • soldr cargo build -p zccache --bins — clean

Closes #710.

🤖 Generated with Claude Code

… meson-configure on clear (closes #710)

Three coordinated fixes for the FastLED stale-clang-PCH poisoning:

1. archive_dir now uses a strict allowlist (is_configure_output +
   is_configure_output_dir) — only build.ninja, compile_commands.json,
   and the meson-info/, meson-private/, meson-logs/ subtrees enter the
   snapshot. Everything else (target subdirs, *.obj, *.pch, *.input_hash,
   *.d.cache, *.dll, *.exe, .ninja_log/.ninja_deps, etc.) is skipped at
   the walker. Restoring an entry can no longer resurrect a built tree.

2. After meson returns, scan stdout for "Directory already configured."
   and skip the persist call. That was the entry path that captured a
   pre-existing built tree in the original repro — without something
   freshly produced, there is nothing legitimate to cache.

3. handle_clear now also removes cache_root/meson-configure/. Previously
   `zccache clear` left the (poisoned v2) snapshot directory untouched
   ("Artifacts removed: 0") and the same key hit again, making the
   poisoning self-sustaining.

KEY_DOMAIN_TAG bumped v2 -> v3 so any existing v2 entries miss-out and
are re-captured under the allowlist (and purged on next clear). No
protocol change.

Tests added inline in `meson_cache::tests` (6 new):
- allowlist_keeps_meson_configure_outputs
- allowlist_rejects_build_outputs_and_pch_sidecars
- dir_allowlist_lets_walker_skip_target_subdirs
- no_op_reconfigure_detected_in_stdout
- no_op_detection_does_not_false_positive_on_normal_configure
- archive_dir_only_captures_allowlisted_entries  (the integration
  reproducer: synthesizes the exact #710 poison files and confirms the
  walker excludes them while still capturing the configure outputs)

Closes #710.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@zackees
zackees merged commit 34f56c3 into main Jun 14, 2026
26 checks passed
@zackees
zackees deleted the fix/710-meson-snapshot-allowlist branch June 14, 2026 09:42
zackees added a commit that referenced this pull request Jun 14, 2026
Ships four PRs that landed on top of 1.12.2:

- #730 — test(wedge): deterministic `wedge_detection_returns_wedged_on_recv_timeout`
- #731 — diagnostics(persist): enrich the `os error 2` WARN with src/dst/errno/exists/size/gap_ms (#728 criterion 1)
- #732 — fix(meson): allowlist configure outputs, skip-persist on no-op, purge meson-configure on clear (closes #710, KEY_DOMAIN_TAG v2->v3)
- #733 — test(daemon): synthetic burst-link reproducer for #726 (closes #729)

Closes #710, #729 (already closed on merge); ships the #728/#731 diagnostics so the next FastLED `all-with-examples` repro can capture rich logs for criteria #2–#3.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
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.

meson configure: snapshot captures build outputs from already-built dirs; restored stale clang PCH silently defeats #pragma once

1 participant