Repository navigation
perf(flatpak): restore PCH cache hits with dependency freshness checks - #1767
Merged
Merged
Conversation
zackees
force-pushed
the
infra/1760-flatpak-compiler
branch
from
October 22, 2026 11:14
370f393 to
d23ae35
Compare
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.
Current status
Refs #1760. Ready for normal PR CI and merge queue after current checks pass. Actual v8 fresh-runner dependency and compiler consumption passed: OSTree fsck, all six dependency hits, 327 compiler hits / 3 misses, full application rebuild and all three validators. The installed consumer export passed the saved screen/camera/microphone/browser profile, authenticated unchanged C++ WebSocket v5, module and debug checks (310 browser frames). Evidence:
docs/ci-evidence/2026-10-22-flatpak-transfer-v8-qualified.json.Production cache adoption: one versioned manifest/source snapshot of
.flatpak-builder/cacheand.flatpak-builder/ccache, published only on trusted master after validators and successful compiler pruning. Downloads and transient build state are excluded. New-state hits suppress every legacy overlay; legacy restoration remains migration-only. The pinned action's own writer and standalone compiler writer are disabled. Existing backend, builder-family allocation, global budget and janitor policy remain unchanged; coordination is recorded on #1269.Latest regression RED
131f3630bfailed three tests plus one error before implementation; GREEN52c9c3cf8passes 88 focused checks. Same primary reviewer: PASS. No new workflows.The parent issue remains open: actual trusted Actions publication size/retention, at least three comparable warm whole-job observations, the 50% median target, final retrospective and cleanup still require evidence. Experimental artifact bytes are not future Actions cache sizes; the 418s v7 consumer is not a routine-production cohort. Trusted publication requires this qualified unit to land on master first.
CI follow-up
PR CI39799070573 exposed an old exact-hit test selecting the retired standalone Flatpak writer (StopIteration). Reproduced locally before correction;
c76d98228points the test at the actual projected-state publisher while preserving exact-hit, guard and key-equality assertions. Targeted15tests and full local CI self-tests1049tests passed (6skipped,95.279s); same primary reviewer PASS. Normal new-head PR CI remains required.Summary
Refs #1760. Enable the existing PCH-aware CMake compiler launcher inside Flatpak with real SDK compiler paths, dependency-mode freshness and compiler content checking. Restore builder state before standalone compiler metadata, reset counters after restores, and extend existing default-off diagnostics with controlled cold builds and forced full-application warm compiler reuse.
RED → GREEN
ed85e020c28a96689fa7b1c96cd328e9adcc03c1e90e8cbeb4dbd87144c521cbf89f1e9a713cc6f2ac81085f6c917459547d23ae358dThe original launcher-only fixture returned 42 after the header changed to 43, even with direct mode disabled. Dependency mode removes that stale preprocessor fallback. Production SDK GCC 16.2.0 / ccache 4.14 passed ten executable-output/cache-hit trials: cold, warm, preserved-size/mtime header/source/compiler changes, configuration change and warm hits after each. These isolated fixture trials are not whole-application performance evidence.
Real SDK GNU tar overlays demonstrated why restore order matters: newer-only and old-builder-then-new-compiler each retained two hits; old-builder-over-new-compiler lost both hits. All executable outputs remained correct. Evidence is committed in
docs/ci-evidence/2026-10-22-flatpak-cache-overlay.json.Diagnostics and controls
cache: trueto retain--ccache, and avoid republishing an exact immutable builder hit.flatpak-cold-buildskips current/legacy builder and compiler restores and both publications. It preserves the complete application, exports and validators. The pinned SDK/image and existing tool-input cache policy remain part of its disclosed setup.flatpak-pruned-build-probefirst rebuilds from dependency-only OSTree state, without inherited downloads/compiler results. Its second forced application rebuild uses only compiler state generated by the first, requires at least 100 hits and 80% cacheable hit fraction, rejects a cached application module, and repeats output validators. Extra diagnostic build costs stay separate from routine savings. No new workflow file or cache family/backend/allocation.Actual hosted qualification
Combined run 39764954474 used source
7b1df78a1ad9f98fb31b83b0f44784e0eb4c5df9:Controlled cold/probe run 39768771734 completed at reviewed frozen qualification source
2b253bc0dace3c35478d3a46664edc49f0db023f. Builder/current, legacy and compiler restores are confirmed skipped; counter reset passed. The initial cold builder action passed in790s. The isolated application rebuilt twice with all six dependency stages reused:728.798s cold,326.785s warm,328hits/2misses; both outputs passed validators. Local cache occupancy640,831,488B is not an Actions archive measurement. The fresh-runner installed app and saved-profile runtime passed (307green browser frames). Whole diagnostic Flatpak job2111s, all selected jobs130.933runner-minutes; overall workflow failed the retained macOS C-reference seek and consequent gate. Archive-size proxies cannot establish production transport/capacity.Review and current checks
GitHub reported a conflict after CEF #1763 and runtime #1771 merged. Rebased onto master
71382af39315b74c37c8352a772a13a719cead1d, preserving runtime/native inputs and gates. Range-diff leaves all implementation commits unchanged apart from the reviewed input/test unions. Same primary reviewer: no findings; 35 packaging/runtime tests plus reviewer workflow checks passed, and diff check is clean. Headd23ae358dpassed its PR CI run.No user-visible behavior change; feature ledger and Rust test tiers are not applicable to this build configuration slice. Rust compiler wrappers, C tests/public headers, the C++ WebSocket implementation, shipped plugins and release/debug coverage are preserved.
Explicit fresh-runner transfer qualification
RED
4f5841070fails for missing transfer/profile validation and manual consumer wiring. GREEN2a4f3d966adds default-offflatpak-compiler-transfer-probe: an explicit same-run Actions compiler artifact (one-day retention) plus one fresh hosted full-app consumer. It validates source SHA, manifest digest, SDK commit, compiler hashes/cache version, architecture and complete archive digest/inventory before overlaying compiler state last. It rejects unsafe paths/links, bounds payload/file count, resets counters, forces only a post-install checksum change, requires substantial real hits and runs all three validators. Consumer cache save/internal restore are disabled; ordinary production cache transport/families/budgets are unchanged.77 focused tests pass. Full lint passed in104.7s before final workflow integration fixes; targeted checks cover those fixes. Same primary review passed after preserving screenshot export, disk preparation/mounts and the local-gate exemption. Required PR CI is running. The next single frozen trial will report actual archive/storage/download and both job costs. Cross-runner proof and production/global-capacity adoption remain unproven; keep this PR draft.
First transfer trial failure and wrapper fix
Trial39776059128 built and validated the producer, then rejected Flatpak-builder's generated
bin/{cc,c++,gcc,g++}links during packing. Producer655s, builder505s. No compiler artifact; consumer/runtime jobs skipped. All remaining native outcomes and costs are retained; no unchanged rerun.RED
ac097e91areproduces the real wrapper layout. GREEN030daf8b0omits only the four exact upstream/usr/bin/ccachelauncher links and preserves matching destination wrappers. Every archivebinentry, archive link and unexpected source/destination link remains rejected, including wrong-target write-through fixtures.77focusedtests pass and sameprimaryreviewpassed. New required PRCI is running. No production adoption; next changed-source qualification waits for this gate and terminal prior trial.V5 upload and consumer bootstrap corrections
Trial39779603900 passed producer/build/validators and installed runtime(306browserframes). It packed699,105,280B, but the multiline container upload published only1,488B metadata and no tar. Its fresh consumer separately failed before download because bootstrap and vendor shared a step, so GITHUB_PATH had not applied. No actual cache transfer/reuse.
RED269c64b17 and3aa68f05a; reviewed GREENc907b9ef1 uses scalar-directory uploads, JSON-only measurement staging and separate bootstrap/vendor steps.79focusedtests pass. New required PRCI39782692458 is active; no changed-source qualification started yet. Remaining native jobs and final trial costs are retained. Draft adoption hold remains.
V6 transfer outcome and SDK preparation correction
Run39784005854 is terminal failure: producer passed (975s), actual698,963,464B artifact uploaded/downloaded and published digest matched, but consumer rejected profile before overlay/build. Same image digest; producer builder updated SDK/runtime before compilation, consumer had not performed corresponding preparation. Installed runtime passed. Whole trial135.9333 runner-min,22success2failure0cancel; no reuse/speedup claim.
RED7a27c9233 requires SDK preparation before profile check plus mismatch evidence without destination mutation. GREEN0a11befbd adds bounded dependency-only preparation and records both identities/differing fields while preserving exact rejection.81focused checks pass; same primary review PASS. New required PR CI pending; draft/adoption hold retained. Portable v6 evidence and documentation included.
Actual OSTree-cache transfer experiment (default off)
RED025785b2f/9426b236b; GREEN30c9bf3f4 adds a manual default-off
flatpak-dependency-transfer-proberequiring compiler transfer. Packs actual cache-only tar/zstd with bounded profile/digest/type/inventory checks; bare-user-only mode, opaque typed object links, fsck before pack and staged restore. Skips ordinary builder restore for this probe, restores dependency before compiler, and instruments existing pinned action to require all dependency hits plus real app rebuild. SDK prep uses separate state. Existing validators retained; no production allocation/transport/publication change.86focused checksPASS; full./lint42.3sPASS; same-primary reviewPASS withSDKstate caveat resolved. Fixtures exercise real archive/wrapper behavior butmockfsck; actual hostedOSTree preservation/reuse and costs remainunproven. V7 is frozen on earlier0a11befbd and stilllive. NewrequiredPRCI mustpass before a changed-code combinedtrial. Consumer artifact installed runtime is still required before any shipping decision; producer runtime alone does not prove that output. Draft/adoptionhold remains.
Consumer artifact runtime coverage before combined trial
RED8ccf524a3/GREENd5a4bc4c8 ensure combineddependency+runtime qualification uses the consumer's rebuilt export aftervalidators, with mutually exclusive producer/consumer upload of the same uniquely named artifact. Runtime explicitly waits forconsumer success incombinedmode and remains runnablewhen optionalconsumer is skipped inordinarymode.87focusedPASS; sameprimaryreviewPASS. Previous requiredCI39790066654 at30c9 passed; newcurrentCI pending. Preparedv8 branch fastforwarded beforeanydispatch; frozenv7 remainsunchanged/live. Actualconsumer runtime remainsunproven until hostedtrial.