Skip to content

test(catalog): pin the two model-preset convergence calls (#2465) - #2606

Merged
lidge-jun merged 1 commit into
devfrom
codex/route-inventory-fix
Aug 25, 2026
Merged

lidge-jun merged 1 commit into
devfrom
codex/route-inventory-fix

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Aug 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

tests/codex-convergence-contract.test.ts counts convergeCodexCatalog() calls per route file. #2465 added two /api/model-presets write paths, so model-routes.ts went 6 -> 8 and the inventory assertion went red on dev at 10c2570.

Raising the number alone would have been the wrong repair: the file's own comment says a count that only ever rises stops being a contract. So this raises the count and adds a companion assertion that names the two calls it accounts for — the "all" branch and the materialize branch of PUT /api/model-presets, both of which change which models reach the catalog. The "custom" branch only moves the marker and deliberately does not converge, which the new test also pins by expecting exactly 2 rather than 3.

Verification

bun test tests/codex-convergence-contract.test.ts
16 pass / 0 fail / 60 expect() calls

Falsified: reverting the count to 6 makes the inventory test fail; deleting one await convergeCodexCatalog() from the preset handler makes the new companion test fail while the (then-stale) count would still pass. Both directions checked.

Checklist

  • Targets dev
  • Focused regression test near the existing tests for the subsystem
  • No user-facing behavior change, so no docs-site/ update
  • No credential, auth, workflow or release-automation surface touched

Summary by CodeRabbit

  • Tests
    • Expanded convergence contract coverage for additional model routes.
    • Added verification that standard model preset updates trigger catalog convergence.
    • Documented that custom preset updates intentionally do not trigger convergence.

@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner August 25, 2026 19:14
@lidge-jun
lidge-jun merged commit bf64c24 into dev Aug 25, 2026
6 checks passed
@lidge-jun
lidge-jun deleted the codex/route-inventory-fix branch August 25, 2026 19:14
@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). label Aug 25, 2026
@coderabbitai

coderabbitai Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0517bfdc-27a2-40a9-91b6-629aaefdc98a

📥 Commits

Reviewing files that changed from the base of the PR and between 10c2570 and 43b50c7.

📒 Files selected for processing (1)
  • tests/codex-convergence-contract.test.ts

📝 Walkthrough

Walkthrough

The convergence contract tests now expect eight calls in model-routes.ts and verify two calls in the /api/model-presets PUT handler for the “all” and materialize branches.

Changes

Convergence contract coverage

Layer / File(s) Summary
Route and preset convergence assertions
tests/codex-convergence-contract.test.ts
The route inventory now requires eight convergence calls. A focused assertion verifies two calls in the model-preset PUT handler and documents the custom preset exception.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: ingwannu, robinbially

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/route-inventory-fix

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 43b50c7aac

ℹ️ 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 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 address that feedback".

Comment on lines +413 to +416
const handlerBody = source.slice(handlerStart, source.indexOf("url.pathname ===", handlerStart + 1));
// The "all" branch and the materialize branch each converge; "custom" only moves the marker,
// so it deliberately does not.
expect(handlerBody.match(/await convergeCodexCatalog\(\)/g)?.length).toBe(2);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Assert convergence in each preset branch

This assertion only counts two calls anywhere in the entire PUT handler, so it still passes if the required all or preset branch loses its convergence call while the custom branch gains one, even though the test explicitly intends to pin both write paths and ensure custom does not converge. Split the handler into branch-specific slices and assert one call in all, zero in custom, and one in the materialization path, or invoke each mode with a convergence spy.

Useful? React with 👍 / 👎.

agentHits pushed a commit to agentHits/opencodex that referenced this pull request Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant