Skip to content

[WIP] Add build badges for Windows, Linux, and Mac - #3

Closed
zackees with Copilot wants to merge 1 commit into
mainfrom
copilot/add-badges-to-readme
Closed

zackees with Copilot wants to merge 1 commit into
mainfrom
copilot/add-badges-to-readme

Conversation

Copilot AI commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original prompt

Add built badges, one for windows linux and mac, each separate and put it on the readme


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Copilot AI requested a review from zackees March 26, 2026 14:55
@zackees zackees closed this Mar 26, 2026
zackees added a commit that referenced this pull request May 24, 2026
#353) (#375)

Issue #353 reports 0% hit rate in cross-runner `actions/cache@v4` scenarios
despite #320's load-classifier fix shipping. Root cause is suspected to be one
of:

1. The cross-runner case re-enters a different cold-classifier branch.
2. A code path embeds runner-specific state in cache keys.
3. Toolchain reinstall between runs shifts a hash input.

The investigation chain in the issue text rules out (2) for the rustc binary
(content hash, not absolute path; verified in `daemon/server/rustc.rs:76`) and
filters env_vars to `CARGO_*` minus volatile-path variants. But the issue
explicitly asks the maintainer to document `ZCCACHE_PATH_REMAP=auto`'s
auto-detection contract — specifically, the silent-fallback case where the env
var is set but `find_git_root` returns None.

This PR makes that case visible. The `[DIAG] depgraph_check` log line now
includes:

    key_root=<resolved-path-or-cwd-fallback>
    path_remap=<auto|auto_no_git|off>

`auto_no_git` is the new tag: `ZCCACHE_PATH_REMAP=auto` was requested but
`.git/` was not detected anywhere up the CWD ancestry, so `effective_compile_args`
silently fell through without inserting `--remap-path-prefix`. Two runners that
both think they're applying remap but disagree on whether git was found will
produce divergent `key_root` values, divergent `context_key` hashes, and the
`cold_skip` symptom #353 describes.

Helper `diag_path_remap_state(client_env, worktree_root.is_some()) -> &str`
lives in `daemon/server/keys.rs` next to `path_remap_auto_enabled` to keep
handle_compile.rs under the 1500-LOC `loc_guard` cap.

Acceptance criterion #3 from the issue (miss_reason in journal) was already
shipped in #322; this PR adds the complementary human-readable diagnostic for
log-grep bisection. With these two tags present, the cross-runner experiment
in soldr's `cache-delta-experiment.yml` can diff the per-runner DIAG lines and
say definitively whether the regression is (1) key drift or (2) load-side.
zackees added a commit that referenced this pull request Jun 14, 2026
… with src/dst/errno/exists/size/gap_ms (#731)

Under FastLED `all-with-examples` burst link load (#726 evidence section)
the daemon emits "failed to persist artifact output: The system cannot
find the file specified. (os error 2)" without enough context to tell
whether ninja deleted the output mid-flight (TOCTOU), whether zccache
computed the wrong destination, or whether Defender quarantined the file.

This patch addresses the first half of #728 — adding the diagnostic
fields the WARN needs to distinguish those failure modes. The
root-causing under FastLED+Defender repro (criteria #2-#3) belongs to a
later iteration on a Windows runner with real burst-link load.

Two layers of enrichment:

1. `persist::enrich_persist_err` (new) wraps the io::Error returned from
   `persist_artifact_file` and `persist_artifact_output` with
   `src=<path> src_exists_now=<bool> src_size_now=<bytes|?> dst=<path>
   errno=<Some(N)|None>: <orig>`. For payload writes (no source file)
   the src= block is omitted. A single best-effort `fs::metadata(src)`
   captures whether the file is gone *now* — cheap, since we only run it
   on the error path.

2. The two existing WARN sites (`handle_compile/miss_store.rs:387` and
   `handle_compile_multi.rs:879`) add `gap_ms` — the wall-clock between
   "linker-success-recorded" (immediately before each persist tokio::spawn)
   and "persist-attempt-started" (inside the blocking task, before the
   persist call). Captured per-job so burst-link queue starvation shows
   up as a large gap distinct from instant-vanish ENOENT.

Tests in `crates/zccache/src/daemon/server/tests/pack.rs`:
- `persist_artifact_paths_err_includes_diagnostics_for_missing_source`
  asserts all five new fields appear and `src_exists_now=false`,
  `src_size_now=?` for a missing source.
- `persist_artifact_output_err_includes_dst_diagnostics` asserts the
  payload-write error path includes `dst=` + `errno=` but omits `src=`.

Refs #728

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
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]>
zackees added a commit that referenced this pull request Jun 20, 2026
)

Sweeps every consumer-facing slice that landed in zccache#782's v1→v2
migration (slices 21, 23, 24, 25) and pounds on each one concurrently
with adversarial inputs. Closes criterion #3 of the goal anchor —
"rock stable through stress and adversarial tests with the v2 api".

## 12 new tests

**Concurrency (4)**
- \`service_definition_install_64x32_concurrent_writes\` — 64 threads ×
  32 writes = 2048 concurrent ServiceDefinitionBuilder::install_in,
  each in its own tempdir. 30s wall-clock budget.
- \`cache_manifest_publish_32x16_concurrent\` — 512 concurrent
  CacheManifestBuilder::publish_in.
- \`probe_local_socket_800x_concurrent_unreachable_returns_bounded\` —
  16 threads × 50 probes = 800 concurrent probes against an
  unreachable endpoint; bounded wall clock (15s budget) catches a
  helper-thread leak or deadline regression.
- \`dual_write_servicedef_and_manifest_16x_concurrent\` — daemon-startup
  shape: 16 threads each dual-writing servicedef + manifest into the
  same per-thread tempdir; asserts distinct files + correct extensions.

**Adversarial inputs (5)**
- \`service_definition_install_rejects_every_malformed_name\` — BAD-Caps,
  empty, slash, backslash, NUL, space, tab, 65-char overlength.
- \`service_definition_decode_never_panics_on_random_garbage\` — 256
  deterministic-PRNG fuzz inputs including pathological length-delimited
  + varint headers.
- \`probe_local_socket_rejects_full_adversarial_input_set\` — empty,
  bare-NUL, embedded-NUL, control chars, 8 KiB overlength.
- \`v2_program_pipe_rejects_every_malformed_sid\` — 7 bad SID shapes
  × 4 pipe_idx values (0, 1, 0xDEAD_BEEF, u32::MAX).
- \`endpoint_round_trips_adversarial_strings\` — Unicode, emoji,
  embedded NUL, 4 KiB path.

**Defense-in-depth truncation sweeps (2)**
- \`service_definition_decode_truncation_sweep_never_panics\` —
  truncate at every byte 0..N of a maximal proto; assert no panic.
- \`cache_manifest_decode_truncation_sweep_never_panics\` — same
  pattern for v2 CacheManifest.

**Boundary (1)**
- \`v2_program_pipe_handles_maximal_inputs\` — u32::MAX pipe_idx +
  max-length sid + program-name "zccache" composes cleanly.

## What this caught while authoring

The "trailing-" service name pattern is ACCEPTED by v1's
\`validate_service_name\`, not rejected — my initial test assumption was
over-strict. Adjusted the adversarial set to only sweep names v1
demonstrably rejects (NUL, space, tab, slash, uppercase, overlength).
This kind of contract drift is exactly what stress tests are for.

## Test plan

- [x] \`soldr cargo test -p zccache --test v2_stress_adversarial_test\` —
  12 passed in 6.5s on Windows MSVC.
- [x] \`soldr cargo clippy -p zccache --tests -- -D warnings\` clean.

## Goal-criterion coverage

zccache#782 goal criterion #3 ("rock stable through stress and
adversarial tests with the v2 api"): this PR is the evidence.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
zackees added a commit that referenced this pull request Jul 11, 2026
…1044) (#1045)

* fix(daemon-core): address COW materialization follow-up findings (#1042)

Fixes 4 of the 5 confirmed correctness bugs and the confirmed test-coverage
regression from the post-merge review of #1040 (issue #1042):

- artifact_io.rs: write the digest sidecar for a blob's final name *before*
  the publishing rename, not after — a digest-write failure can no longer
  leave an orphaned, undigested blob visible in the cache (finding #1).
- artifact_io.rs: persist_artifact_file tries a hardlink before falling
  back to a full copy, restoring the STORE-direction fast path that
  commit 49dd59c dropped when it switched to reflink-then-copy
  (finding #4/#5). break_output_hardlink_before_compile already
  unconditionally detaches any shared alias (OS link-count based, not
  registry-based) before a compiler writes to that path again, so sharing
  an inode with the freshly-compiled source is safe.
- link_registry.rs / write_cached.rs: commit_hardlink_registration no
  longer marks a blob suspect on a merely-unresolvable output identity
  (only on a genuine identity mismatch), and a commit failure now falls
  back to a copy the same way a failed std::fs::hard_link already does,
  instead of hard-failing the whole materialization (finding #3).
- fs_caps.rs: cap the per-volume-pair capability cache at 4096 entries,
  clearing it wholesale when exceeded — a cheap, self-correcting bound on
  the previously-unbounded growth (finding #6, PLAUSIBLE/low severity).
- tests/write_cached.rs: restored deterministic hardlink-tier assertions
  in 4 tests (including the issue #197 poisoning regression test) that had
  been weakened to silently skip their actual invariant when the hardlink
  tier wasn't taken (finding #5).

Finding #2 (evicting valid pre-existing/pre-#1039 blobs with no digest
sidecar) was investigated but NOT fixed as originally scoped: a first
attempt trusted any digest-less blob with hardlink_count <= 1, but that
heuristic is unsound — a since-deleted alias could have poisoned the blob
before being removed, and link count only reflects the present, not
whether a risky mutation window existed in the past. This was caught by
the existing failed_restart_eviction_restores_readonly_and_retries_after_alias_delete
regression test. Reverted to the original conservative eviction. Finding
#1's fix already eliminates the primary real-world trigger (a
freshly-persisted blob can no longer become visible without its digest);
the remaining cost is a one-time cache miss for blobs written by a
pre-#1039 zccache version on upgrade, which is the safer trade-off.

Added regression tests for findings #1, #3, #4, and the reverted-#2
investigation. Local: 434/434 zccache-daemon-core unit tests pass on
Windows; Docker Linux validation pending.

* fix: harden COW persistence and parallelize rust-plan restore

Closes #1042\nCloses #1044

* style: format COW and restore changes

* fix: preserve compiler output writability on store hardlinks

* test: allow shared inode store fast path

* fix: migrate legacy COW blob digests

Closes #1046

* test: skip hardlink-only cases on unsupported filesystems
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