Skip to content

fix(api): declare hot_first in response schema so it isn't stripped - #177

Merged
igorls merged 1 commit into
devfrom
fix/hot-first-response-schema
Jun 4, 2026
Merged

fix(api): declare hot_first in response schema so it isn't stripped#177
igorls merged 1 commit into
devfrom
fix/hot-first-response-schema

Conversation

@igorls

@igorls igorls commented Jun 4, 2026

Copy link
Copy Markdown
Member

Follow-up to #176. get_actions sets response.hot_first for observability, but extendResponseSchema never declared it — and fast-json-stringify only serializes declared properties, so the field was silently dropped from every response. That made it impossible to tell from the API whether hot-first routing engaged (it surfaced during live debugging of an operator deployment).

  • Declare hot_first next to hot_only in extendResponseSchema.
  • Assert both hot_only and hot_first in the schema unit test (would have caught this).

tsc clean; 121 unit tests pass. No behavior change beyond the field now appearing in responses.

get_actions sets response.hot_first for observability, but extendResponseSchema never
declared it. fast-json-stringify only serializes declared properties, so the field was
silently dropped from every response — making it impossible to tell from the API whether
hot-first routing engaged. Declare it next to hot_only, and assert both in the schema test.
Copilot AI review requested due to automatic review settings June 4, 2026 10:31

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request adds the hot_first boolean property to the response schema in extendResponseSchema and updates the unit tests to ensure both hot_only and hot_first are defined, preventing them from being silently stripped by fast-json-stringify. There are no review comments, and the changes look correct and well-tested.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Copilot AI 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.

Pull request overview

This PR fixes a response-schema omission in the shared extendResponseSchema helper so the hot_first field set by get_actions is actually serialized (fast-json-stringify only emits declared schema properties). It also strengthens the unit test to assert both hot_only and hot_first are present in the schema, preventing silent regressions.

Changes:

  • Declare hot_first in the base response schema returned by extendResponseSchema.
  • Extend the schema unit test to assert hot_only and hot_first are defined in the generated response schema.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/api/helpers/functions.ts Adds hot_first to the base response properties so it is serialized in API responses.
tests/unit/api-helpers.test.ts Adds assertions ensuring hot_only and hot_first are declared in the response schema.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@igorls
igorls merged commit 435d9cd into dev Jun 4, 2026
3 checks passed
@igorls
igorls deleted the fix/hot-first-response-schema branch June 4, 2026 10:35
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.

2 participants