Skip to content

Commit fa908fb

Browse files
authored
Merge branch 'main' into claude/issue-154-20251028-1915
2 parents 5e6fc1e + 681aa5e commit fa908fb

File tree

5 files changed

+65
-0
lines changed

5 files changed

+65
-0
lines changed

.github/workflows/test.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,52 @@ jobs:
3030
config: '.markdownlint.jsonc'
3131
globs: '**/*.md'
3232

33+
codegen_check:
34+
runs-on: ubuntu-latest
35+
permissions:
36+
contents: read
37+
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v4
41+
42+
- name: "Install uv"
43+
uses: astral-sh/setup-uv@v6
44+
45+
- name: "Set up Python 3.10"
46+
uses: actions/setup-python@v5
47+
with:
48+
python-version: "3.10"
49+
50+
- name: "Install Node.js"
51+
uses: actions/setup-node@v4
52+
with:
53+
node-version: "20"
54+
55+
- name: "Install dependencies"
56+
run: make sync
57+
58+
- name: "Run codegen"
59+
run: make codegen
60+
61+
- name: "Run lint"
62+
run: make lint
63+
64+
- name: "Check for uncommitted changes"
65+
run: |
66+
if ! git diff --exit-code; then
67+
echo "Error: Modified files detected after running 'make codegen lint'."
68+
echo "Please run 'make codegen lint' locally and commit the changes."
69+
exit 1
70+
fi
71+
if [ -n "$(git ls-files --others --exclude-standard)" ]; then
72+
echo "Error: Untracked files detected after running 'make codegen lint'."
73+
echo "Untracked files:"
74+
git ls-files --others --exclude-standard
75+
echo "Please run 'make codegen lint' locally and commit the changes."
76+
exit 1
77+
fi
78+
3379
static_analysis:
3480
runs-on: ubuntu-latest
3581

@@ -66,6 +112,7 @@ jobs:
66112
test_quick:
67113
needs:
68114
- markdown_lint
115+
- codegen_check
69116
- static_analysis
70117
timeout-minutes: 10
71118
strategy:

AGENTS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@ make sync
216216
GitHub Actions workflows are in `.github/workflows/`:
217217

218218
- `test.yml` - Run tests across packages
219+
- `codegen_check` job - Ensures `make codegen lint` has been run before
220+
commits
221+
- `static_analysis` job - Runs linting and type checking per package
222+
- `test_quick` and `test_all` jobs - Run tests across Python versions and
223+
platforms
219224
- `publish.yml` - Publish packages to PyPI
220225
- `claude-on-mention.yml` - Claude Code assistant (can make PRs)
221226
- `claude-on-open-label.yml` - Claude triage assistant (read-only analysis)

DEVELOPING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ make precommit
100100

101101
This runs linting, type checking, and code generation.
102102

103+
**Important**: CI will fail if `make codegen lint` has not been run before
104+
committing. The `codegen_check` job in the test workflow verifies that
105+
running these commands produces no file changes, ensuring all generated
106+
code and formatting is up to date.
107+
103108
## Using Makefile in CI
104109

105110
The Makefile targets support per-project operations, making them

key-value/key-value-aio/src/key_value/aio/stores/mongodb/store.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,12 @@ async def _setup_collection(self, *, collection: str) -> None:
174174

175175
new_collection: AsyncCollection[dict[str, Any]] = await self._db.create_collection(name=collection)
176176

177+
# Index for efficient key lookups
177178
_ = await new_collection.create_index(keys="key")
178179

180+
# TTL index for automatic expiration of entries when expires_at is reached
181+
_ = await new_collection.create_index(keys="expires_at", expireAfterSeconds=0)
182+
179183
self._collections_by_name[collection] = new_collection
180184

181185
@override

key-value/key-value-sync/src/key_value/sync/code_gen/stores/mongodb/store.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,12 @@ def _setup_collection(self, *, collection: str) -> None:
181181

182182
new_collection: Collection[dict[str, Any]] = self._db.create_collection(name=collection)
183183

184+
# Index for efficient key lookups
184185
_ = new_collection.create_index(keys="key")
185186

187+
# TTL index for automatic expiration of entries when expires_at is reached
188+
_ = new_collection.create_index(keys="expires_at", expireAfterSeconds=0)
189+
186190
self._collections_by_name[collection] = new_collection
187191

188192
@override

0 commit comments

Comments
 (0)