Repository navigation
fix: key project id cache by full project identity - #1188
Chen Yufeiyang (feiiiiii5) wants to merge 2 commits into
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 462b77e0e7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
| return mock_state | ||
|
|
||
|
|
||
| def test_get_by_name_does_not_collide_across_project_groups(): |
There was a problem hiding this comment.
Move the cache regression tests into the collected core suite
The nox job in .github/workflows/checks.yaml reaches _run_core_tests() in py/noxfile.py, which passes only src/braintrust as pytest's collection target (pytest --help: [file_or_dir] [file_or_dir] [...]). The other nox sessions targeting tests/ collect only tests/api_codegen or tests/wheel, so none of these three new regression tests runs in the configured CI suite. This leaves the cross-group cache collision without CI regression coverage. Move these tests into the existing py/src/braintrust/test_framework2.py or another collected core module, consistent with AGENTS.md's instruction to “Keep tests close to the code they cover.”
AGENTS.md reference: AGENTS.md:L333-L333
Useful? React with 👍 / 👎.
|
Addressed the Codex finding about test collection. The three |
Summary
ProjectIdCache.get_by_name()posted the project's org, name, and group to the API, but cached the resulting ID underproject_namealone. A second lookup with the same name in a different project group returned the first group's ID without any API call. SinceProject.publish()and CLI push use this cache, two projects sharing a name across groups could have their prompts and parameters published to the wrong project.Fix
Key
_name_cacheby the full identity(org_name, project_name, project_group_name). The ungrouped (None) case stays distinct from a named group. Public API and single-group behavior are unchanged.Verification
test_framework2.py+ new module 25 passed; CLI push modules (test_push_evaluator.py,test_push.py) 15 passed.ruff checkandruff format --checkclean.Mocks only — no live API, network, or credentials. Full repo suite / nox matrix and Python 3.14 not run (verified on available 3.11 with plugin autoload disabled).