Skip to content

Commit f9fee84

Browse files
committed
feat: initial cachekit v0.1.0-alpha oss release
Comprehensive Redis caching with: - Zero-config @cache decorator - L1 (in-memory) + L2 (Redis) dual-layer caching - Zero-knowledge encryption (@cache.secure) - Circuit breaker & adaptive timeouts - Rust acceleration (LZ4 + Blake3)
0 parents  commit f9fee84

File tree

270 files changed

+75542
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

270 files changed

+75542
-0
lines changed

.cargo/config.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Miri configuration for undefined behavior detection
2+
# MUST be at workspace root - Cargo only reads .cargo/config.toml from workspace root, not package directories
3+
4+
# Environment variables for Miri execution
5+
[env]
6+
# Miri flags for comprehensive undefined behavior detection
7+
# -Zmiri-strict-provenance: Catches pointer provenance violations (use-after-free, invalid pointer arithmetic)
8+
# -Zmiri-symbolic-alignment-check: Detects alignment violations symbolically (not just concrete addresses)
9+
# These flags provide maximum UB detection without false positives
10+
MIRIFLAGS = "-Zmiri-strict-provenance -Zmiri-symbolic-alignment-check"
11+
12+
# Target configuration for Miri
13+
# Miri requires explicit target specification for sanitizer compatibility
14+
[target.'cfg(miri)']
15+
# Use Miri as the test runner for all tests when running under Miri
16+
# This ensures comprehensive coverage of test suite with UB detection
17+
runner = "miri"

.dockerignore

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Git
2+
.git
3+
.gitignore
4+
.gitattributes
5+
6+
# Python
7+
__pycache__
8+
*.pyc
9+
*.pyo
10+
*.pyd
11+
.Python
12+
*.egg-info/
13+
dist/
14+
build/
15+
.venv/
16+
venv/
17+
env/
18+
.env
19+
.env.*
20+
21+
# Testing
22+
.pytest_cache/
23+
.coverage
24+
htmlcov/
25+
.tox/
26+
pytest.ini
27+
coverage.xml
28+
29+
# Type checking
30+
.pyright_cache/
31+
.mypy_cache/
32+
33+
# Linting
34+
.ruff_cache/
35+
36+
# IDE
37+
.vscode/
38+
.idea/
39+
*.swp
40+
*.swo
41+
*~
42+
.DS_Store
43+
44+
# Rust and build artifacts
45+
target/
46+
rust/target/
47+
rust/fuzz/
48+
Cargo.lock
49+
50+
# Documentation (but keep README.md for build metadata)
51+
docs/
52+
53+
# CI/CD
54+
.github/
55+
.gitlab-ci.yml
56+
.circleci/
57+
58+
# Build outputs (temporary docker extraction directories)
59+
.dist-linux-build/
60+
dist-linux/
61+
dist-linux-test/
62+
63+
# Misc
64+
logs/
65+
reports/
66+
*.log
67+
tmp/
68+
temp/
69+
.cache/

.github/pull_request_template.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
## Description
2+
3+
Brief description of the changes in this PR.
4+
5+
## Motivation
6+
7+
Why are these changes needed? What problem do they solve?
8+
9+
## Type of Change
10+
11+
- [ ] Bug fix (non-breaking)
12+
- [ ] New feature (non-breaking)
13+
- [ ] Breaking change
14+
- [ ] Documentation update
15+
16+
---
17+
18+
## Documentation Validation Checklist
19+
20+
**For PRs that change public APIs or features:**
21+
22+
- [ ] If public API changed: Updated `docs/features/*.md` or created new feature doc
23+
- [ ] Manually tested ALL code examples by copy-paste to Python REPL
24+
- [ ] Clicked all links in documentation (internal and external)
25+
- [ ] If competitive claims changed: Ran `pytest tests/competitive/ -v` and updated `docs/validation/VALIDATION_LOG.md`
26+
- [ ] Code examples are copy-paste executable (tested in REPL)
27+
- [ ] Feature documentation includes: TL;DR, Quickstart, Deep Dive, Troubleshooting sections
28+
- [ ] Added/updated cross-links to related features in `docs/`
29+
30+
**For PRs that DON'T change public APIs:**
31+
- [ ] No documentation changes required
32+
33+
---
34+
35+
## Testing
36+
37+
- [ ] Unit tests added/updated
38+
- [ ] Integration tests added/updated
39+
- [ ] Tests pass: `make test-critical`
40+
- [ ] No test regressions
41+
42+
---
43+
44+
## Additional Notes
45+
46+
Any additional context or notes for reviewers?

.github/workflows/ci.yml

Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
permissions:
10+
contents: read
11+
pull-requests: read
12+
checks: write
13+
14+
env:
15+
CARGO_TERM_COLOR: always
16+
RUST_BACKTRACE: 1
17+
REDIS_DISABLE_HIREDIS: true
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
# Fast version consistency check
25+
version-check:
26+
name: Version Sync
27+
runs-on: ubuntu-latest
28+
timeout-minutes: 5
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- name: Check Python ↔ Rust version consistency
33+
run: |
34+
PYTHON_VERSION=$(grep -E "^version = " pyproject.toml | head -1 | cut -d'"' -f2)
35+
RUST_VERSION=$(grep -E "^version = " rust/Cargo.toml | head -1 | cut -d'"' -f2)
36+
37+
echo "Python: $PYTHON_VERSION"
38+
echo "Rust: $RUST_VERSION"
39+
40+
if [ "$PYTHON_VERSION" != "$RUST_VERSION" ]; then
41+
echo "❌ Version mismatch!"
42+
exit 1
43+
fi
44+
echo "✅ Versions in sync: $PYTHON_VERSION"
45+
46+
# Fast format & lint checks (parallel)
47+
quick-check:
48+
name: Format & Lint
49+
runs-on: ubuntu-latest
50+
timeout-minutes: 10
51+
steps:
52+
- uses: actions/checkout@v4
53+
54+
- name: Install uv
55+
uses: astral-sh/setup-uv@v3
56+
with:
57+
enable-cache: true
58+
59+
- name: Set up Python
60+
run: uv python install 3.12
61+
62+
- name: Set up Rust
63+
uses: dtolnay/rust-toolchain@stable
64+
with:
65+
components: rustfmt, clippy
66+
67+
- name: Cache Rust dependencies
68+
uses: Swatinem/rust-cache@v2
69+
with:
70+
workspaces: rust
71+
72+
- name: Cache Python virtual environment
73+
uses: actions/cache@v4
74+
with:
75+
path: .venv
76+
key: venv-${{ runner.os }}-py3.12-${{ hashFiles('**/pyproject.toml', '**/uv.lock', 'rust/**/*.rs', 'rust/**/Cargo.toml') }}
77+
restore-keys: |
78+
venv-${{ runner.os }}-py3.12-
79+
80+
- name: Install dependencies (if not cached)
81+
run: |
82+
uv sync --extra dev
83+
84+
- name: Check Python formatting
85+
run: |
86+
uv run ruff format --check .
87+
88+
- name: Lint Python
89+
if: success() || failure()
90+
run: |
91+
uv run ruff check .
92+
93+
- name: Scan Python dependencies for CVEs
94+
if: success() || failure()
95+
run: |
96+
uv run pip-audit --desc
97+
98+
- name: Type check Python
99+
if: success() || failure()
100+
run: |
101+
uv run basedpyright
102+
103+
- name: Check Rust formatting
104+
if: success() || failure()
105+
run: |
106+
cd rust && cargo fmt --check
107+
108+
- name: Lint Rust
109+
if: success() || failure()
110+
run: |
111+
cd rust && cargo clippy -- -D warnings
112+
113+
# Critical test suite (parallel matrix)
114+
test-critical:
115+
name: Tests (Python ${{ matrix.python-version }})
116+
runs-on: ubuntu-latest
117+
timeout-minutes: 15
118+
strategy:
119+
fail-fast: false
120+
matrix:
121+
python-version: ["3.12", "3.13"]
122+
123+
services:
124+
redis:
125+
image: redis:7-alpine
126+
ports:
127+
- 6379:6379
128+
options: >-
129+
--health-cmd "redis-cli ping"
130+
--health-interval 10s
131+
--health-timeout 5s
132+
--health-retries 5
133+
134+
steps:
135+
- uses: actions/checkout@v4
136+
137+
- name: Install uv
138+
uses: astral-sh/setup-uv@v3
139+
with:
140+
enable-cache: true
141+
142+
- name: Set up Python
143+
run: uv python install ${{ matrix.python-version }}
144+
145+
- name: Set up Rust
146+
uses: dtolnay/rust-toolchain@stable
147+
148+
- name: Cache Rust dependencies
149+
uses: Swatinem/rust-cache@v2
150+
with:
151+
workspaces: rust
152+
153+
- name: Cache Python virtual environment
154+
uses: actions/cache@v4
155+
with:
156+
path: .venv
157+
key: venv-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml', '**/uv.lock', 'rust/**/*.rs', 'rust/**/Cargo.toml') }}
158+
restore-keys: |
159+
venv-${{ runner.os }}-py${{ matrix.python-version }}-
160+
161+
- name: Install dependencies (if not cached)
162+
run: |
163+
uv sync --extra dev
164+
165+
- name: Run critical tests
166+
env:
167+
REDIS_URL: redis://localhost:6379
168+
run: |
169+
make test-critical
170+
171+
# Markdown documentation tests
172+
test-docs:
173+
name: Documentation Examples
174+
runs-on: ubuntu-latest
175+
timeout-minutes: 10
176+
steps:
177+
- uses: actions/checkout@v4
178+
179+
- name: Install uv
180+
uses: astral-sh/setup-uv@v3
181+
with:
182+
enable-cache: true
183+
184+
- name: Set up Python
185+
run: uv python install 3.12
186+
187+
- name: Set up Rust
188+
uses: dtolnay/rust-toolchain@stable
189+
190+
- name: Cache Rust dependencies
191+
uses: Swatinem/rust-cache@v2
192+
with:
193+
workspaces: rust
194+
195+
- name: Cache Python virtual environment
196+
uses: actions/cache@v4
197+
with:
198+
path: .venv
199+
key: venv-${{ runner.os }}-py3.12-${{ hashFiles('**/pyproject.toml', '**/uv.lock', 'rust/**/*.rs', 'rust/**/Cargo.toml') }}
200+
restore-keys: |
201+
venv-${{ runner.os }}-py3.12-
202+
203+
- name: Install dependencies (if not cached)
204+
run: |
205+
uv sync --extra dev
206+
207+
- name: Run markdown documentation tests
208+
run: |
209+
make test-docs-examples
210+
211+
# Summary job (required for branch protection)
212+
ci-success:
213+
name: CI Success
214+
runs-on: ubuntu-latest
215+
needs: [version-check, quick-check, test-critical, test-docs]
216+
if: always()
217+
steps:
218+
- name: Check all jobs succeeded
219+
run: |
220+
if [[ "${{ needs.version-check.result }}" != "success" ]] || \
221+
[[ "${{ needs.quick-check.result }}" != "success" ]] || \
222+
[[ "${{ needs.test-critical.result }}" != "success" ]] || \
223+
[[ "${{ needs.test-docs.result }}" != "success" ]]; then
224+
echo "❌ One or more jobs failed"
225+
exit 1
226+
fi
227+
echo "✅ All CI checks passed"

0 commit comments

Comments
 (0)