Skip to content

perf(flatpak): restore PCH cache hits with dependency freshness checks - #1767

Merged
zackees merged 32 commits into
masterfrom
infra/1760-flatpak-compiler
Oct 22, 2026
Merged

zackees merged 32 commits into
masterfrom
infra/1760-flatpak-compiler

Conversation

@zackees

@zackees zackees commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

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/cache and .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 131f3630b failed three tests plus one error before implementation; GREEN 52c9c3cf8 passes 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; c76d98228 points 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

Regression RED GREEN
PCH-aware launcher and freshness ed85e020c 28a96689f
Preserve failed SDK-command diagnostics a7b1c96cd 328e9adcc
Reject older builder metadata over newer compiler manifests 03c1e90e8 cbeb4dbd8
Require build-local compiler counters 7144c521c bf89f1e9a
Explicit cold builder/compiler control 713cc6f2a c81085f6c
Forced full-application compiler reuse proof 917459547 d23ae358d

The 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

  • Explicit builder restore precedes standalone compiler restore; disable the action's duplicate restore. Keep cache: true to retain --ccache, and avoid republishing an exact immutable builder hit.
  • Reset only statistics after restores. Reports describe this build rather than inherited cumulative counters.
  • Default-off flatpak-cold-build skips 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.
  • Existing default-off flatpak-pruned-build-probe first 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:

  • Flatpak job succeeded in 677 seconds, builder action 552 seconds. Both builder restores missed; a 59,411,889-byte compiler archive restored but yielded 0 hits / 330 cacheable calls after a successful reset. This is not a representative warm sample.
  • Its freshly installed export and Debug extension passed the saved screen/camera/microphone/browser recording scenario, unchanged authenticated WebSocket v5, module inventory, CEF build ID, debugger source lines and clean shutdown. Browser verification decoded 308 green frames. Synthetic devices/software rendering do not qualify physical devices or hardware GPU.
  • Overall workflow failed its macOS C-reference media-seek assertion; evidence is retained on test: playing_seek_between_keyframes fails on slow runners (fixed 500 ms bound) #1765. All selected active jobs cost 118.95 runner-minutes, including failures and runtime qualification. No unchanged rerun was used.

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. Head d23ae358d passed 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 4f5841070 fails for missing transfer/profile validation and manual consumer wiring. GREEN 2a4f3d966 adds default-off flatpak-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 ac097e91a reproduces the real wrapper layout. GREEN 030daf8b0 omits only the four exact upstream /usr/bin/ccache launcher links and preserves matching destination wrappers. Every archive bin entry, 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-probe requiring 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.

@zackees
zackees force-pushed the infra/1760-flatpak-compiler branch from 370f393 to d23ae35 Compare October 22, 2026 11:14
@zackees
zackees marked this pull request as ready for review October 22, 2026 15:02
@zackees
zackees added this pull request to the merge queue Oct 22, 2026
Merged via the queue into master with commit 132dddd Oct 22, 2026
29 checks passed
@zackees
zackees deleted the infra/1760-flatpak-compiler branch October 22, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant