Skip to content

Cache native CI dependencies while rebuilding current Server outputs - #826

Merged
rmcdaniel merged 5 commits into
mainfrom
fix/325-native-cargo-cache
Oct 28, 2026
Merged

rmcdaniel merged 5 commits into
mainfrom
fix/325-native-cargo-cache

Conversation

@rmcdaniel

@rmcdaniel rmcdaniel commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Shared Server fixture jobs repeatedly compile the same locked native dependencies. In run 40572465856, native-test jobs took 537–1,024 seconds, with 449–923 seconds in their combined bootstrap/build/test step. Those combined timings include tests and setup, so they do not isolate compiler time.

Restore Cargo registry/git dependencies and target dependencies in all three native job families. Only successful main push native tests save a cache. Exact keys include OS, architecture, lockfile, Cargo manifest, vendored crates, Cargo configuration, and workflow/compiler configuration, with no fallback prefixes. Each job removes the current Server package's cached outputs before building, and the writer removes them before saving, so current source and provenance are rebuilt. PRs and merge groups only restore caches. Existing jobs, matrices, commands, checks, permissions, and resource limits are preserved.

Validation on current head 86e232d0fd160863abcdee4d30bc3d1a7d21a450, combined with merged #824 (d3aec375): all 2,561 startup comparator tests across 59 files passed, all 41 aggregate/partition tests passed, all 74 workflow-isolation policy tests passed, and central action policy plus the full Docker workflow-isolation check passed. A before/after workflow comparison confirms existing jobs, matrices, commands, limits and permissions are preserved relative to that main. The partition contract recognizes cache restoration and package cleanup as preparation shared by every part. The adapter-cache test keeps its original safety checks within the adapter job; its obsolete workflow-wide cache count previously rejected the new native caches before fixture startup.

Cold qualification passed: 56 successful checks and one skipped. Merged through the normal queue as 5c41317e2c546bda0441c1f6585f6adca5079753; merge-group checks and all 43 cold main jobs passed. The main writer seeded a 270,100,378-byte cache. Same-commit warm repeats passed: the slowest PostgreSQL native-tests job fell from 952 to 759 seconds (20.3%); the writer's Cargo test-build phase fell from 164 to 110 seconds and compiled crates from 200 to 5, while its whole job varied from 462 to 498 seconds. No whole-pipeline or sustained-throughput speedup is claimed. No Rust build or test ran locally. Full timing conditions and authoritative hosted evidence are recorded in the final benchmark comment.

Related: #325, measured CI handoff.

@rmcdaniel

Copy link
Copy Markdown
Member Author

Security review of exact 1bac383a12fea30f03ca448aa505e8fff00659ca: blocking correction required.

The hosted central-policy preflight rejected all three new restore blocks because their broad restore-keys do not partition trusted and untrusted events. The repository contract also rejects the restore/discard steps because they are unclassified every-part setup.

For useful cross-commit PR reuse without accepting an untrusted cache writer, use one exact shared key (no restore-keys, no commit SHA) covering runner OS/architecture and all dependency/toolchain inputs: this workflow, rust/Cargo.lock, rust/Cargo.toml, and rust/vendor/**. Keep PR/merge-group restore-only; retain the existing successful protected-main/native-tests-only save guard; keep package cleanup before every build and before save. An exact shared key with that protected save condition is the central-policy-approved trust model. Classify the two new setup steps as every-part setup in the repository contract.

The scoped paths exclude Cargo credentials/config, action/image references are immutable, and I found no separate secret or permission expansion. I will re-review the corrected exact head.

@rmcdaniel

Copy link
Copy Markdown
Member Author

Security re-review of corrected exact head ea3b84e33442192c804cc8ee34588d2eed9bdc92: the prior blocker is resolved; no remaining security finding in the cache trust/key/package-clean scope.

The broad restore prefix and commit-specific key are gone. All readers now use one exact key covering runner OS/architecture, the pinned workflow/toolchain/build flags, lockfile, root manifest, Cargo configuration, and every vendored dependency input. PR and merge-group runs remain restore-only; only a successful protected-main native-tests run can save. Cached paths exclude Cargo credentials/configuration, and the current Server package outputs are removed before every build and again before save.

Hosted central action-policy validation has passed on this exact head. The existing aggregate/partition contract step has also passed; broader cold runtime qualification and measured warm speedup remain owning delivery gates, not security-review claims.

@rmcdaniel

Copy link
Copy Markdown
Member Author

At current head ea3b84e33442192c804cc8ee34588d2eed9bdc92, the central action policy and existing aggregate/partition contract steps passed after the exact-key correction. Security's scoped re-review found no remaining cache trust/key/package-clean issue.

Cold Shared run 40593626884 is not passing. At 22:45 UTC, it has two executed failures:

Normal job-log retrieval was unavailable while the run was active, and a direct completed-job log download timed out. No runtime/fixture cause is inferred from those transport failures, and no rerun, check relaxation or merge has been requested. The remaining matrix jobs continue. Next: classify the retained failures, combine the independently owned #824 workflow changes through the normal path, then obtain clean protected qualification, a successful main cache seed and an equivalent warm measurement. No timing improvement is claimed yet.

@sonarqubecloud

Copy link
Copy Markdown

@rmcdaniel

Copy link
Copy Markdown
Member Author

General qualification update: head 86e232d0fd160863abcdee4d30bc3d1a7d21a450 has 56 successful checks and one skipped check. Shared Server run 40601231224 passed, including the cold native builds/tests and fixture families. The PR is first in the normal merge queue; its ruleset is active with no bypass actors.

The previous head's startup failures were the adapter-only test's obsolete workflow-wide cache count. The corrected test scopes those existing safety assertions to the adapter job. All 2,561 startup comparator tests, 41 partition tests, 74 workflow-isolation tests, central action policy and the full isolation checker pass on this head, combined with merged #824.

Next: let merge-group qualification complete, verify a successful main-only cache seed, then compare an equivalent warm run. The cold success proves qualification, not a speedup; no runtime improvement is claimed yet.

Merged via the queue into main with commit 5c41317 Oct 28, 2026
57 checks passed
@rmcdaniel

Copy link
Copy Markdown
Member Author

Merged #826 is now qualified on main 5c41317e2c546bda0441c1f6585f6adca5079753: Shared run 40608043560, attempt 1 passed all 43 jobs.

The main native-tests writer job 122557876595 saved the trusted cache successfully. Cache API metadata confirms a 270,100,378-byte entry scoped to refs/heads/main, created at 00:42:48 UTC. Cold writer execution took 462 seconds, including 378 seconds in the combined Rust-test/codec step and four seconds saving the cache. The combined step is not a compiler-only measurement.

Warm measurement is underway on the same commit. First repeat the writer to confirm a cache hit, then repeat the slowest database native-tests job (postgres-storage (existing-php-matrix, native-tests), cold 952 seconds). This checks both cache operation and the slower path rather than extrapolating from the writer alone. All cold results and existing checks are preserved. No speedup or sustained throughput claim is made yet.

@rmcdaniel

Copy link
Copy Markdown
Member Author

Merged through the normal queue as 5c41317e2c546bda0441c1f6585f6adca5079753. The cold main Shared Server fixtures run passed all 43 jobs and seeded one 270,100,378-byte cache from the successful main writer. Both targeted warm attempts passed at that same immutable commit, using unchanged commands and resource settings on fresh hosted runners.

Sample Cold Warm Result
Codec/native-tests writer, whole job 462 s 498 s No whole-job speedup
Writer, combined test/codec step 378 s 397 s Non-build time varied
Writer, Cargo test-build phase 164 s 110 s Dependency compilation reused
Slowest PostgreSQL native-tests job 952 s 759 s 20.3% lower elapsed time
PostgreSQL combined bootstrap/test step 848 s 660 s 22.2% lower elapsed time

The writer's compiler log contains 200 unique compiled crate names cold and 5 warm; the workspace package is compiled twice in both attempts. The warm writer restored the main cache and skipped saving under the existing exact-hit condition. This demonstrates dependency reuse while preserving a fresh workspace build. Hosted runner variation and one repeated sample per job limit the timing conclusion. These are job measurements, not a full-pipeline or sustained-throughput benchmark.

Evidence: cold main run, attempt 1, warm writer, attempt 2, warm PostgreSQL job, attempt 3. General resumed one product PR at a time and will use actual CI queue/run times to preserve the CI-first delivery rule. Required checks, matrices, coverage and merge-queue limits were retained.

@rmcdaniel
rmcdaniel deleted the fix/325-native-cargo-cache branch October 28, 2026 02:21
@rmcdaniel

Copy link
Copy Markdown
Member Author

Security post-merge delta review of exact merge 5c41317: no additional security finding.

I compared the previously cleared head ea3b84e with final PR head 86e232d, then compared the cache workflow and cache contract test between that head and the merge tree. The native cache restore/save key, paths, package-clean ordering, and protected-main-only writer logic are unchanged. The later cache-test change only scopes the pre-existing adapter-cache assertions to the adapter job now that the workflow also contains the separately reviewed native cache; the other workflow delta is the independently qualified #824 fixture integration. The two cache files in the final head and merge tree are identical.

The final PR checks, protected merge-group qualification, and 43-job main run passed. This closes the exact-tree cache trust review and supplements the earlier corrected-head review; timing conclusions remain General delivery evidence, not a Security claim.

rmcdaniel added a commit that referenced this pull request Oct 28, 2026
The artifact summary keeps a test report's last 64 KiB. The comparator
report is about 450 KiB, so #826's one failing test (reported early) was
missing from its retained summary, and the failure needed a local
reproduction to find.

When a test summary is cut to its tail, the summary also writes
<report>.failures.txt: every TAP `not ok` line with its diagnostic block,
within the same per-file and total limits, recorded with derived_from and
the failure count. A whole report or a passing one gets no excerpt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant