Repository navigation
perf(image): bake the build-time placeholder manifest into the Nix image - #802
Merged
Merged
Conversation
Add a TestFileStructure case asserting the Nix image ships /root/assets/.placeholder-manifest.txt (non-empty, in-image workspace paths, listing a known placeholder-bearing file) so init-workspace.sh can take its fast substitution path. RED cannot be observed locally without a full image build; the gate runs in CI against the built image. Refs: #718
The Nix bootstrap layer now generates
/root/assets/.placeholder-manifest.txt (the file init-workspace.sh reads
beside itself) by grep-listing every workspace asset carrying a
{{SHORT_NAME}}/{{ORG_NAME}}/{{GITHUB_REPOSITORY}} token, at its in-image
runtime path and LC_ALL=C sorted for bit-reproducibility. Previously the
image shipped without the manifest, so workspace init always fell back to
a slow runtime find+grep; the fast substitution path now fires. Output is
unchanged (the fallback already produced correct results).
Refs: #718
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
assets/init-workspace.shreads a build-time manifest at$SCRIPT_DIR/.placeholder-manifest.txt(/root/assets/.placeholder-manifest.txtin the image) to take a fast substitution path, falling back to a slow runtime
find+grepover the whole scaffold when it is absent (logging"Manifest not found, searching at runtime (slower)"). The Nix image never generated thismanifest, so workspace init always took the slow path. The old Debian
Containerfileproduced it viagrep -rlover the workspace assets.This bakes the manifest at image build time so the fast path fires. Output is
unchanged — the runtime fallback already produced correct results; this is a
startup-time optimization only.
Changes
flake.nix— thebootstraplayer now generates/root/assets/.placeholder-manifest.txtbygrep -rl-listing every workspaceasset carrying a
{{SHORT_NAME}}/{{ORG_NAME}}/{{GITHUB_REPOSITORY}}token, rewritten to the in-image runtime path (
/root/assets/workspace/...)and
LC_ALL=C sorted for bit-reproducibility. Token set mirrors the runtimefallback in
init-workspace.sh; matches how the DebianContainerfilebuiltit. Excludes
.git/.venv/.pre-commit-cache.tests/test_image.py— newTestFileStructure::test_placeholder_manifest_bakedasserting the baked image ships the manifest: present, non-empty, every line an
in-image workspace path, and a known placeholder-bearing file
(
pyproject.toml) listed.CHANGELOG.md—### Changedentry under## Unreleased.Verification
nix eval .#packages.x86_64-linux.devcontainerImage.drvPath— flake evaluatesclean.
nix fmt flake.nix— 0 changes (formatting gate satisfied).grep -rl … | sortoutput over the real assets locally(18 placeholder-bearing files); the only build-specific step is stripping the
$outstore prefix viased.pytest --collect-onlyconfirms the new test collects.Caveat: I did not run a full
nix build .#devcontainerImage/ the image-contenttest here (needs a full image build + a running podman container). The new
test_placeholder_manifest_bakedgate runs against the built image in CI.Refs: #718