Skip to content

ci: fix remaining failures + migrate to self-hosted runners#91

Merged
27Bslash6 merged 8 commits intomainfrom
fix/ci-remaining-failures
Apr 24, 2026
Merged

ci: fix remaining failures + migrate to self-hosted runners#91
27Bslash6 merged 8 commits intomainfrom
fix/ci-remaining-failures

Conversation

@27Bslash6
Copy link
Copy Markdown
Contributor

@27Bslash6 27Bslash6 commented Apr 24, 2026

Summary

  • Fix 4 stale observability tests (_inject_metrics_headers(None) behavior changed in fix: default L1-Status header for standalone CachekitIO usage #64, tests not updated)
  • Move test_saas_observability.py from integration/ to unit/ (pure Python, no Redis needed)
  • Mark redis.md and encryption.md doc examples as notest (require DI/env setup)
  • Migrate all workflow jobs to cachekit self-hosted runners (except summary gates + release-please)
  • Remove dtolnay/rust-toolchain, Swatinem/rust-cache, actions/cache, astral-sh/setup-uv (pre-installed on infra)
  • Replace kani-github-action composite action with direct install (upstream uses unpinned refs)

Test plan

  • CI passes on self-hosted runners
  • Security Fast passes
  • CodeQL passes
  • Observability tests pass in tests/unit/
  • Doc tests pass (make test-docs-examples)

Summary by CodeRabbit

  • Documentation

    • Updated Python code example formatting in Redis backend and encryption serializer documentation.
  • Chores

    • Updated CI/CD infrastructure configuration for improved workflow efficiency.
  • Tests

    • Updated unit test expectations for observability metrics headers.

_inject_metrics_headers(None) returns {'X-CacheKit-L1-Status': 'disabled'}
since #64, but 3 tests still expected {}. Session ID uniqueness test
used default function_identifier for all instances, producing identical IDs.
Every test in this file exercises pure Python functions
(_inject_metrics_headers, _FunctionStats, get_session_id) with zero
Redis or network I/O. Placing them in integration/ forced a pytest-redis
dependency for no reason.
- Mark redis.md and encryption.md examples as notest (require DI/env
  setup the doc test harness can't provide)
- Replace kani-github-action composite action with direct install on
  self-hosted runner — upstream action uses unpinned dtolnay/rust-toolchain
  and actions/checkout refs that violate org SHA-pinning policy
Move all jobs to cachekit runners except summary gates and
release-please (needs cross-platform matrix). Remove dtolnay/rust-toolchain
actions, Swatinem/rust-cache, actions/cache, and astral-sh/setup-uv —
all pre-installed on self-hosted infra. Replaces Kani composite action
with direct install to avoid upstream unpinned action refs.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 2026

Warning

Rate limit exceeded

@27Bslash6 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 48 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 13 minutes and 48 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3e567701-b538-47a7-9dc1-023c6b91da41

📥 Commits

Reviewing files that changed from the base of the PR and between 4c96a30 and c9f3840.

📒 Files selected for processing (9)
  • .github/workflows/ci.yml
  • .github/workflows/codeql.yml
  • .github/workflows/fuzz-smoke.yml
  • .github/workflows/security-deep.yml
  • .github/workflows/security-fast.yml
  • docs/backends/redis.md
  • docs/serializers/encryption.md
  • tests/unit/test_l1_only_mode.py
  • tests/unit/test_saas_observability.py
📝 Walkthrough

Walkthrough

GitHub Actions workflows are migrated from ubuntu-latest to cachekit runner, with redundant Rust setup and caching steps removed. Documentation code fences are marked as notest, and observability test expectations are updated for new metrics header behavior.

Changes

Cohort / File(s) Summary
Workflow Runner Migrations
.github/workflows/codeql.yml, fuzz-smoke.yml, security-deep.yml, security-fast.yml, security-medium.yml
All workflows updated to run on cachekit runner instead of ubuntu-latest. Several jobs have explicit Rust toolchain installation and caching steps removed (e.g., dtolnay/rust-toolchain, Swatinem/rust-cache, uv/Python setup steps), relying on cachekit for dependency management.
Documentation Code Formatting
docs/backends/redis.md, docs/serializers/encryption.md
Python code fence language specifier changed from python to python notest for Basic Usage examples, affecting doc tooling treatment.
Observability Test Updates
tests/unit/test_saas_observability.py
Test expectations revised to require _inject_metrics_headers(None) to return dict with X-CacheKit-L1-Status: disabled header, and session uniqueness tests now use distinct function_identifier values in _FunctionStats construction.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 With cachekit's swiftness, workflows now race,
Setup steps fade without a trace,
Metrics flow true with headers so bright,
Tests dance in sync—everything's right!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description clearly lists all major changes with context, but does not follow the required template structure with sections like Description, Motivation, Type of Change, checklists, and Testing. Restructure the description to follow the repository's template: add Description section, Motivation section, Type of Change checkboxes, Security/Documentation checklists, and Testing section with passing test criteria.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: fixing CI failures and migrating to self-hosted runners, which aligns with the primary objectives of the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ci-remaining-failures

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

cargo-deny-action uses Docker which breaks on self-hosted workspace
paths — replace with direct cargo-deny install. Add pip GHSA-58qw-9mgm-455v
ignore (pip tar/zip confusion, no fix available).
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/unit/test_saas_observability.py (1)

368-390: ⚠️ Potential issue | 🟡 Minor

Test no longer matches its stated intent — consider renaming or strengthening.

The docstring frames this as verifying "per-instance" uniqueness for "multi-wrapper scenarios (e.g., Locust load testing where multiple users each decorate the same function)". After this change, what is actually verified is per-function_identifier uniqueness. Per _FunctionStats._ensure_session_id (src/cachekit/decorators/wrapper.py), session_id is f"{get_session_id()}:{self._function_identifier}" with a process-scoped UUID — so two _FunctionStats instances created with the same function_identifier (precisely the "same function decorated by multiple users" scenario the docstring calls out) will still collide.

The change is fine to unblock CI, but the test now trivially passes because the three identifiers differ. Consider either:

  • renaming the test and updating the docstring to reflect what is actually tested (per-function-identifier uniqueness), or
  • adding a separate assertion for the multi-wrapper-same-function scenario if per-instance uniqueness is genuinely required (which would require an implementation change, not just a test change).
📝 Suggested docstring/name realignment (test-only)
-    def test_session_unique_per_stats_instance(self):
-        """Verify each _FunctionStats instance has its own unique session ID.
-
-        This is critical for multi-wrapper scenarios (e.g., Locust load testing where
-        multiple users each decorate the same function). Without per-instance session IDs,
-        different wrappers would collide and cause 'counters_decreased' validation errors.
-        """
+    def test_session_unique_per_function_identifier(self):
+        """Verify _FunctionStats instances with distinct function_identifier values produce
+        distinct session IDs.
+
+        Note: Within a single process, two _FunctionStats with the same function_identifier
+        will share a session ID, since session_id = f"{process_uuid}:{function_identifier}".
+        """
         stats1 = _FunctionStats(function_identifier="module.func_a")
         stats2 = _FunctionStats(function_identifier="module.func_b")
         stats3 = _FunctionStats(function_identifier="module.func_c")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/unit/test_saas_observability.py` around lines 368 - 390, The test name
and docstring for test_session_unique_per_stats_instance no longer match
behavior: _FunctionStats._ensure_session_id composes session IDs as
f"{get_session_id()}:{self._function_identifier}", so uniqueness is per
function_identifier, not per instance. Rename the test (e.g.,
test_session_unique_per_function_identifier) and update its docstring to state
it verifies per-function-identifier uniqueness, and keep using
_inject_metrics_headers and the existing assertions; if you instead want to
assert true per-instance uniqueness for the same function_identifier, add a new
test that creates two _FunctionStats with the same function_identifier and
asserts their session IDs differ—but note that making that test pass will
require changing _FunctionStats._ensure_session_id / get_session_id
implementation rather than just test code.
🧹 Nitpick comments (2)
docs/backends/redis.md (1)

9-9: Add explanatory comment for notest directive.

The notest directive is appropriate since this example requires a real Redis connection. However, an explanatory comment should be added to clarify why the example is skipped. As per coding guidelines from CONTRIBUTING.md:66-90: "Always include a comment explaining why the example is skipped."

📝 Suggested addition
 ```python notest
+# Real Redis connection required - not available in test environment
 from cachekit.backends import RedisBackend
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/backends/redis.md` at line 9, Add an explanatory comment after the
"python notest" directive in docs/backends/redis.md to explain why the example
is skipped (e.g., requires a real Redis connection not available in test
environment); specifically update the code block header that starts with "python
notest" and insert a short comment line clarifying the reason so readers and
automated checks understand why this example is excluded.
.github/workflows/fuzz-smoke.yml (1)

31-34: Optional: avoid mutating global rustup default on a persistent runner.

Since cargo +nightly fuzz run is already used at line 73, the rustup default nightly command is unnecessary. On the self-hosted cachekit runner, this mutates ~/.rustup/settings.toml, persisting the nightly default into unrelated subsequent jobs on the same runner. Installing the toolchain without flipping the default preserves better job isolation.

♻️ Suggested tweak
     - name: Install Rust nightly
       run: |
-        rustup toolchain install nightly
-        rustup default nightly
+        rustup toolchain install nightly --profile minimal
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/fuzz-smoke.yml around lines 31 - 34, The workflow sets the
global rustup default to nightly (rustup default nightly), which mutates runner
state; remove the rustup default nightly line and only install the toolchain
(keep rustup toolchain install nightly) so the job uses explicit toolchain
invocations like cargo +nightly fuzz run (already used at line 73) without
changing the runner-wide default.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/security-deep.yml:
- Around line 24-32: The Install Kani step currently uses "cargo +stable install
--locked kani-verifier" which is not pinned; update that command in the "Install
Kani" step to pin the binary version (e.g., add "--version 0.67.0" or the
intended release) so nightly runs are reproducible, and keep the subsequent
"cargo-kani setup" call; additionally add a preceding step to ensure the stable
toolchain exists on the runner (e.g., run rustup toolchain install stable or
equivalent) so "cargo +stable" will not fail on runners without a stable alias.

---

Outside diff comments:
In `@tests/unit/test_saas_observability.py`:
- Around line 368-390: The test name and docstring for
test_session_unique_per_stats_instance no longer match behavior:
_FunctionStats._ensure_session_id composes session IDs as
f"{get_session_id()}:{self._function_identifier}", so uniqueness is per
function_identifier, not per instance. Rename the test (e.g.,
test_session_unique_per_function_identifier) and update its docstring to state
it verifies per-function-identifier uniqueness, and keep using
_inject_metrics_headers and the existing assertions; if you instead want to
assert true per-instance uniqueness for the same function_identifier, add a new
test that creates two _FunctionStats with the same function_identifier and
asserts their session IDs differ—but note that making that test pass will
require changing _FunctionStats._ensure_session_id / get_session_id
implementation rather than just test code.

---

Nitpick comments:
In @.github/workflows/fuzz-smoke.yml:
- Around line 31-34: The workflow sets the global rustup default to nightly
(rustup default nightly), which mutates runner state; remove the rustup default
nightly line and only install the toolchain (keep rustup toolchain install
nightly) so the job uses explicit toolchain invocations like cargo +nightly fuzz
run (already used at line 73) without changing the runner-wide default.

In `@docs/backends/redis.md`:
- Line 9: Add an explanatory comment after the "python notest" directive in
docs/backends/redis.md to explain why the example is skipped (e.g., requires a
real Redis connection not available in test environment); specifically update
the code block header that starts with "python notest" and insert a short
comment line clarifying the reason so readers and automated checks understand
why this example is excluded.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 97b6cb50-2e53-4ef0-a7af-e5212722eaab

📥 Commits

Reviewing files that changed from the base of the PR and between da34f49 and 4c96a30.

📒 Files selected for processing (8)
  • .github/workflows/codeql.yml
  • .github/workflows/fuzz-smoke.yml
  • .github/workflows/security-deep.yml
  • .github/workflows/security-fast.yml
  • .github/workflows/security-medium.yml
  • docs/backends/redis.md
  • docs/serializers/encryption.md
  • tests/unit/test_saas_observability.py

Comment thread .github/workflows/security-deep.yml
- Pin kani-verifier to 0.67.0 for reproducible nightly runs
- Ensure stable toolchain before cargo +stable install
- Drop rustup default nightly in fuzz-smoke (already uses cargo +nightly)
- Rename test to test_session_unique_per_function_identifier (matches behavior)
- Add notest reason comments to redis.md and encryption.md
Security Deep: 2:00 UTC → 20:00 UTC (7 AM AEDT, results ready by morning)
CodeQL: 3:00 UTC Sunday → 20:00 UTC Sunday (7 AM AEDT Monday)
validate_encryption_config() checks the env var independently of the
inline master_key param passed to @cache.secure. The test was flaky
(68% fail rate on main) because it depended on whether CACHEKIT_MASTER_KEY
happened to be set from a prior test's singleton cache.
@27Bslash6 27Bslash6 merged commit 50c8fe0 into main Apr 24, 2026
33 checks passed
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