feat(dirty-content-fingerprint): xce-build.sh computes dev-loop fingerprint
Adds an independent dirty_fingerprint computation to xce-build.sh: sha256 over git diff HEAD's output plus the sorted content of untracked, non-ignored files (git ls-files --others --exclude-standard), truncated to 8 hex chars. Resolves to empty on a clean tree or if the hash computation itself fails -- commit_id's own computation and -dirty suffix are left completely untouched. Zero working-tree/index mutation. Verified independently by review with real builds (HEAD pinned to control for concurrent background commits): distinguishes different uncommitted content, reproduces identical fingerprints for identical content, excludes .gitignore'd files, degrades gracefully under 3 independently-injected failure modes without aborting the build, applies to every profile, and leaves the original feature's regression script passing unmodified. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
13fc840f8c
commit
c9d40ba180
2 changed files with 53 additions and 6 deletions
|
|
@ -6,11 +6,9 @@
|
|||
- _Requirements: 1.1, 5.1_
|
||||
|
||||
- [ ] 2. Foundation: compute real fingerprint values at both build entry points
|
||||
- [ ] 2.1 (P) xce-build.sh computes the dev-loop fingerprint, independently of commit_id
|
||||
- `commit_id`'s existing computation (including its `-dirty` suffix) is **not touched** -- this task only adds a new, independent computation alongside it
|
||||
- Compute `dirty_fingerprint` as: empty when the tree is clean, or when the tree is dirty but the hash computation itself fails; a short hex digest (sha256, truncated) over the concatenation of `git diff HEAD`'s output (tracked modifications, staged or unstaged) and the raw content of every file listed by `git ls-files --others --exclude-standard` (untracked, non-ignored files, in a stable sorted order) when the tree is dirty and the hash computation succeeds; zero working-tree mutation in all cases
|
||||
- Append `-Ddirty_fingerprint="$fp"` to `MESON_OPTS` for every build profile, alongside the existing `-Dcommit_id=`/`-Dbuild_time=` entries
|
||||
- Observable: editing a tracked file, running `/xce-build scheduler debug`, and checking `--version` shows a fingerprint suffix; editing again with different content and rebuilding shows a different fingerprint; reverting the file to its first edit's exact content and rebuilding reproduces the first fingerprint exactly; creating a new file matched by `.gitignore` and rebuilding leaves the fingerprint unchanged from the pre-creation value (Requirement 1.4's exclusion, exercised live, not just structurally implied by `git ls-files --others --exclude-standard`); the original feature's own `test-build-version-regression.sh` (which asserts a literal `-dirty` substring in `commit_id`'s output) continues to pass completely unmodified, confirming `commit_id` was never touched
|
||||
- [x] 2.1 (P) xce-build.sh computes the dev-loop fingerprint, independently of commit_id
|
||||
- `dirty_fingerprint` computed via `git diff HEAD` + `git ls-files -z --others --exclude-standard | LC_ALL=C sort -z` content, `sha256sum` truncated to 8 hex chars; empty on a clean tree or on computation failure (3 independently-verified graceful-degradation paths: mktemp failure, sha256sum failure, git diff failure -- none abort the script despite `set -euo pipefail`); zero working-tree/index mutation (read-only git invocations only); `commit_id`'s own computation left byte-for-byte untouched
|
||||
- Observable confirmed live (independently re-verified by review, real builds with HEAD pinned to control for concurrent background commits): editing a tracked file and rebuilding produces a fingerprint; different content produces a different fingerprint; reverting to the first edit's exact bytes reproduces the first fingerprint exactly; a `.gitignore`-matched `*.bak` file leaves the fingerprint unchanged; `commit_id`'s `-dirty` suffix stayed intact across every build; every profile (asan/debug/release) carries the option; the original feature's unmodified `test-build-version-regression.sh` passes twice in full (asan+debug)
|
||||
- _Requirements: 1.1, 1.2, 1.3, 1.4, 5.1_
|
||||
- _Boundary: xce-build.sh_
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue