Skip to content

Build graph cache survives a deleted or added source file: the key hashes build.w but not the directory listings it reads #2452

Closed

Description

@ehartford

Deleting src/compiler/foundation/InternPool.w (branch pool-owners, #2449) and running src/main build :dev in a worktree with a warm cache failed with

error: action target 'compiler-no-c-export' missing declared input: .../src/compiler/foundation/InternPool.w

build_cache_graph_key (src/BuildGraphCache.w:1453) is the hash of build.w, build/*.w, lib/std/build.w, the compiler fingerprint, with.toml and the recorded env reads. target_with_compiler_c_export_audit_inputs (build.w:892) enumerates src, rt and lib/std with ctx.fs().list_files at evaluation time, so the cached graph carries the listing of the evaluation that wrote it. A deleted file fails loudly (above). An added file is the silent case: it is not an input of compiler-no-c-export (or of any other listing-enumerated target) until something else invalidates the cache, so a new src/*.w with a @[c_export] passes the audit.

Fix shape: record every directory listing the evaluation reads in build.w.effects the way env reads are (env\t lines, build_cache_graph_env_fingerprint), and fold a fingerprint of those listings' current contents into the key; a changed listing re-evaluates. Workaround: delete out/.build-state/build-graph.cache.

Activity

  1. ehartford commented on Oct 25, 2026

    @ehartford
    ContributorAuthor

    Triage 2026-10-25, with v0.15.3.0 (main a261b65): reproduced with a minimal project. The graph cache key (build_cache_graph_key, src/BuildGraphCache.w:1463-1464) hashes the build sources, the compiler, with.toml, the target kind and the recorded env reads, but not the directory listings build.w read.

    $ cat build.w   # an Action target with one input per file under src/
        for f in ctx.fs().list_files("src"):
            t = t.input(f)
    $ with build :use-src   # green
    $ mv src/b.txt elsewhere; with build :use-src
    error: action target 'use-src' missing declared input: …/src/b.txt
    survey: 1 target(s) failed
    

    pre-release: deleting a file breaks the next build until the cache is cleared; recording list_files reads like env reads is small.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions