Skip to content

Serve a schema under the activity of a model bound to it - #799

Open
tombeckenham wants to merge 1 commit into
mainfrom
756-gemini-image-models-links-schema-points-at-the-image-activit
Open

tombeckenham wants to merge 1 commit into
mainfrom
756-gemini-image-models-links-schema-points-at-the-image-activit

Conversation

@tombeckenham

@tombeckenham tombeckenham commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

A Gemini image model has activity: image and binds the shared v1beta/models/{modelsId}:generateContent route, which is filed under chat. Schema reads required the URL activity to equal the route's filed activity, so the record's own _links.schema was a 404.

resolveEndpointAlias (src/server/schema-binding.ts) now resolves a route under the activity it is filed under, or under the activity of a model whose stored schemaEndpointId names it. The model-id alias (/v1/schemas/gemini/image/<rawId>, and POST /v1/validate with a model id) no longer requires the route's activity to equal the model's. An activity no bound model has is still a 404.

Not changed: GET /v1/schemas/gemini/image (the activity map) still lists only routes filed under image.

Test: src/server/schemas-api.worker.test.ts - direct read, alias read, and the still-404 case.

Fixes #755

Summary by CodeRabbit

  • Bug Fixes
    • Endpoint lookups now find routes filed under a different activity when a model for the requested activity is bound to that route.
    • Looking up a route by a model’s ID now returns the route’s filed activity, even when it differs from the model’s stored activity.
    • Routes without a model binding remain unavailable under other activities.

A Gemini image model binds the shared generateContent route, which is
filed under chat, so the record's own _links.schema was a 404. A schema
read now resolves under the route's filed activity or under the activity
of a model whose stored binding names it; the model-id alias no longer
requires the route's activity to equal the model's.
@changeset-bot

changeset-bot Bot commented Dec 4, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: e0e5c6b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Schema endpoint lookup now supports models whose activity differs from the activity under which their bound endpoint is filed. A test checks direct lookup, model-alias lookup, and an unbound activity.

Changes: Schema endpoint activity resolution

Layer / File(s) Summary
Resolve endpoints across activities
src/server/schema-binding.ts, src/server/schemas-api.worker.test.ts
Direct lookup accepts an endpoint when a model for the requested activity is bound to it. Model-alias lookup resolves the bound endpoint without requiring matching activities. Results report the endpoint’s filed activity. The test covers both lookup paths and an unbound activity.

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

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to e0e5c

This change makes the schema link for Gemini image models resolve when the model's route is filed under chat, which addresses the reported 404. The test covers the main cases. A narrow transitional case remains: legacy rows that have not yet been re-polled can still 404 on the direct link. That case is not a merge blocker.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Serve a schema under the activity of a model bound to it" matches the main change. The PR makes a route resolve under the activity of a model that binds it, so the schema is served under th…
Linked Issues check Passed [#755] Requirement: a Gemini image model's _links.schema must resolve when the model has activity image and schemaEndpointId v1beta/models/{modelsId}:generateContent, which is filed under chat. …
Out of Scope Changes check Passed All changes support the #755 objective. The schema-binding.ts edits change only the resolution rules for bound-model activities and the ResolvedEndpoint.activity doc comment. The test adds one case fo…
Full details: Title check

Explanation

The title "Serve a schema under the activity of a model bound to it" matches the main change. The PR makes a route resolve under the activity of a model that binds it, so the schema is served under the model's activity. The title is specific and does not list files. It does not mention the alias-lookup change, but the PR objectives say that change is part of the same fix.

Full details: Linked Issues check

Explanation

[#755] Requirement: a Gemini image model's _links.schema must resolve when the model has activity image and schemaEndpointId v1beta/models/{modelsId}:generateContent, which is filed under chat. The fix in src/server/schema-binding.ts (resolveEndpointAlias) changes the direct lookup. It now accepts a route when its filed activity equals the requested activity, or when a model with that provider, the requested activity, and a schemaEndpointId equal to the route id exists. For the issue example, the direct read under image finds the chat-filed route and the bound image model, so the read returns 200. The model-id alias path no longer requires the route activity to equal the model activity; it resolves through the model binding and returns the route's filed activity. The new test in src/server/schemas-api.worker.test.ts covers the direct read, the alias read with aliasedFrom, and a 404 for an activity with no bound model. The issue allows serving the schema under image or linking to the filed location; the PR takes the first option for bound models. Not verified: the test run itself, and the models import and schema column names, which I did not read directly. The diff uses them consistently with existing code.

Full details: Out of Scope Changes check

Explanation

All changes support the #755 objective. The schema-binding.ts edits change only the resolution rules for bound-model activities and the ResolvedEndpoint.activity doc comment. The test adds one case for the new behavior and cleans up its inserted row. The PR description states that GET /v1/schemas/gemini/image (activity map) is unchanged; the diff does not touch that code. No unrelated changes appear in the reviewed hunks.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e774c3dc-3dce-4d7e-b344-4a1fe205c8e9
Commits

Reviewing files that changed from the base of the PR and between 949105a and e0e5c6b.

Files selected for processing: 2

  • src/server/schema-binding.ts
  • src/server/schemas-api.worker.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

This branch has not been deployed

No deployments
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.

Gemini image models: _links.schema points at the image activity, schema is filed under chat (404)

1 participant