Repository navigation
Commit 5fb9f54
* test(daemon): failing test for depfile restoration on hit (#643)
Pins the bug: when zccache wraps `clang++ -MD -MF <depfile>` (the shape
emitted by build systems with `deps = gcc`), a cache hit currently
restores only the `.obj` — the user's `.d` is silently absent. The
downstream build tool then records zero dependencies for the object and
stops recompiling when included headers change, producing stale objects
and `undefined symbol` link errors after `git pull`.
Wires `current_depfile_dest: Option<NormalizedPath>` into
`CachedHitMaterializeRequest` so the caller can supply *this build's*
`-MF` destination on a hit (independent of where the depfile lived when
the miss recorded it). The handler body intentionally does not yet
consume the field — the next commit implements the restore and flips
this test from RED to GREEN.
Refs #643.
* fix(daemon): restore depfile on cache hit (#643)
When zccache wraps `clang++ -MD -MF <depfile>` (the shape build systems
emit for `deps = gcc`), the miss path now captures the user's depfile
bytes as a second artifact output, and the hit path writes them back
alongside the `.obj` to the *current* build's `-MF` destination.
Before this fix, only the `.obj` was restored on a hit. The build tool
then read an absent depfile, recorded zero dependencies for the object,
and stopped recompiling when included headers changed — silently
producing stale objects and `undefined symbol` link errors after
`git pull`.
The depfile destination on hit is derived from the current request's
dep_flags (not the cached basename), so renamed-output / cross-worktree
hits restore the depfile to the correct place. Legacy single-output
artifacts cached before this fix keep working unchanged: the hit-path
materializer only consults `current_depfile_dest` when the artifact
actually has a second payload. Cache-file mtime preservation is
unchanged — the depfile write goes through the same
`write_payloads_par_with_mtime_floor` path the `.obj` already used.
Touched layers:
- `depgraph::depfile::user_depfile_destination` — single source of truth
for "where does the current build want its depfile?"
- `pipeline::handle_compile_request` — on miss, after parse_depfile_path
succeeds in `UserSpecified` / `UserDefault`, also reads the depfile
bytes and threads them into `MissArtifactStoreRequest::user_depfile`.
- `miss_store::store_single_output` — extends the artifact with a second
output when `user_depfile` is `Some`.
- `cached_hit::materialize_cached_compile_hit` — extra
`current_depfile_dest` field; routes payloads[1] to it when both the
artifact has two outputs and the field is `Some`.
- `hit_branches::{try_fast_hit, try_depgraph_cached_hit}` — derive
`current_depfile_dest` from passed-in `dep_flags`, also stamp it into
the new `RequestCacheEntry::depfile_path` so the ultra-fast request
cache path restores the depfile on subsequent hits.
- `request_cache::RequestCacheEntry` + `keys::request_cache_entry` —
store the depfile destination as a `CachedRequestPath` so
cross-worktree fast-path hits rebase it to the new root.
Coordinated with FastLED/FastLED — downstream stale-build investigation.
Closes #643.
* chore(tasks): revert unrelated tasks/todo.md rewrite
The depfile-fix work accidentally overwrote the in-progress Static
Library (.a) Caching planning content with its own scratch notes.
This commit restores tasks/todo.md to main's content so the PR is
scoped only to the depfile-on-cache-hit fix.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
1 parent 67d1533 commit 5fb9f54
8 files changed
Lines changed: 402 additions & 6 deletions
File tree
- crates/zccache/src
- daemon/server
- handle_compile
- tests
- depgraph
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
36 | 46 | | |
37 | 47 | | |
38 | 48 | | |
| |||
52 | 62 | | |
53 | 63 | | |
54 | 64 | | |
| 65 | + | |
55 | 66 | | |
56 | 67 | | |
57 | 68 | | |
| |||
82 | 93 | | |
83 | 94 | | |
84 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
85 | 107 | | |
86 | 108 | | |
87 | 109 | | |
88 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
89 | 115 | | |
90 | 116 | | |
91 | 117 | | |
| |||
217 | 243 | | |
218 | 244 | | |
219 | 245 | | |
| 246 | + | |
220 | 247 | | |
221 | 248 | | |
222 | 249 | | |
| |||
246 | 273 | | |
247 | 274 | | |
248 | 275 | | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
249 | 462 | | |
250 | 463 | | |
251 | 464 | | |
| |||
297 | 510 | | |
298 | 511 | | |
299 | 512 | | |
| 513 | + | |
300 | 514 | | |
301 | 515 | | |
302 | 516 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
58 | 69 | | |
59 | 70 | | |
60 | 71 | | |
| |||
99 | 110 | | |
100 | 111 | | |
101 | 112 | | |
| 113 | + | |
102 | 114 | | |
103 | 115 | | |
104 | 116 | | |
| |||
122 | 134 | | |
123 | 135 | | |
124 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
125 | 142 | | |
126 | 143 | | |
127 | 144 | | |
| |||
144 | 161 | | |
145 | 162 | | |
146 | 163 | | |
| 164 | + | |
147 | 165 | | |
148 | 166 | | |
149 | 167 | | |
| |||
180 | 198 | | |
181 | 199 | | |
182 | 200 | | |
| 201 | + | |
| 202 | + | |
183 | 203 | | |
184 | 204 | | |
185 | 205 | | |
186 | 206 | | |
187 | 207 | | |
188 | 208 | | |
189 | 209 | | |
| 210 | + | |
190 | 211 | | |
191 | 212 | | |
192 | 213 | | |
| |||
217 | 238 | | |
218 | 239 | | |
219 | 240 | | |
| 241 | + | |
220 | 242 | | |
221 | 243 | | |
222 | 244 | | |
| |||
239 | 261 | | |
240 | 262 | | |
241 | 263 | | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
242 | 269 | | |
243 | 270 | | |
244 | 271 | | |
| |||
265 | 292 | | |
266 | 293 | | |
267 | 294 | | |
| 295 | + | |
268 | 296 | | |
269 | 297 | | |
270 | 298 | | |
| |||
287 | 315 | | |
288 | 316 | | |
289 | 317 | | |
| 318 | + | |
| 319 | + | |
290 | 320 | | |
291 | 321 | | |
292 | 322 | | |
293 | 323 | | |
294 | 324 | | |
295 | 325 | | |
296 | 326 | | |
| 327 | + | |
297 | 328 | | |
298 | 329 | | |
299 | 330 | | |
| |||
336 | 367 | | |
337 | 368 | | |
338 | 369 | | |
| 370 | + | |
339 | 371 | | |
340 | 372 | | |
341 | 373 | | |
| |||
0 commit comments