fix: declare the enum field under the name the wire uses - #1844
Merged
Conversation
|
Coverage Impact This PR will not change total coverage. 🚦 See full report on Qlty Cloud »🛟 Help
|
Tonours
force-pushed
the
fix/prd-993-schema-field-enums
branch
from
August 24, 2026 14:30
8b2d369 to
476e799
Compare
nbouliol
approved these changes
Aug 24, 2026
forest-bot
added a commit
that referenced
this pull request
Aug 24, 2026
## @forestadmin/forestadmin-client [1.43.1](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/forestadmin-client@1.43.0...@forestadmin/forestadmin-client@1.43.1) (2026-08-24) ### Bug Fixes * declare the enum field under the name the wire uses ([#1844](#1844)) ([1fde29c](1fde29c))
forest-bot
added a commit
that referenced
this pull request
Aug 24, 2026
## @forestadmin/mcp-server [1.23.1](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/mcp-server@1.23.0...@forestadmin/mcp-server@1.23.1) (2026-08-24) ### Bug Fixes * declare the enum field under the name the wire uses ([#1844](#1844)) ([1fde29c](1fde29c)) ### Dependencies * **@forestadmin/agent-client:** upgraded to 1.14.2 * **@forestadmin/forestadmin-client:** upgraded to 1.43.1
forest-bot
added a commit
that referenced
this pull request
Aug 24, 2026
## @forestadmin/agent-bff [1.20.1](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/agent-bff@1.20.0...@forestadmin/agent-bff@1.20.1) (2026-08-24) ### Bug Fixes * declare the enum field under the name the wire uses ([#1844](#1844)) ([1fde29c](1fde29c)) ### Dependencies * **@forestadmin/agent-client:** upgraded to 1.14.2 * **@forestadmin/forestadmin-client:** upgraded to 1.43.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

fixes PRD-993
What
ForestSchemaFielddeclaredenum: string[] | null. The wire sendsenums. Renamed the property to the name the payload actually carries, and updated the 38 fixture sites that wrote the old name.Why
Nothing ever confronted the declared type with the received JSON.
ForestHttpApi.getSchemaends in a bare cast (permissions/forest-http-api.ts:74), so a wrong declaration survived indefinitely.Every producer and sibling type already said
enums:agent/src/utils/forest-schema/generator-fields.ts:71enums: [...(column.enumValues ?? [])].sort()private-api/src/serializers/schemas/field.js:9enumsforestadmin-client/src/schema/types.ts:78,318enums: null | string[]forestadmin-client/src/types.ts:170enum← the outlierA consumer reading
field.enumgotundefined, always. The one real reader,agent-bff/src/openapi/collect-unfolding.ts:183, already readfield.enumsand was typed loosely enough not to complain — so the rename closes a latent hole rather than opening one.This is not cosmetic. The same class of mismatch already shipped a 500:
ForestSchemaAction.fields[].enumsis declaredstring[]while the agent sendsnullfor every dynamic-form action, so[...field.enums]threw aTypeErrorand everyGET /agent/v1/contextfailed against such an agent. Guarded in #1838.Scope and safety
Not a breaking change despite touching an exported interface.
enumnever existed on any payload, so no consumer can have been reading it successfully —undefinedbefore, compile error after, which is the point. Kept asfix:rather than a major.No runtime behaviour changes. No production
srcreads.enumon a schema field anywhere in the monorepo; the remaining.enumhits arez.enum(zod) and JSON-Schema keywords.Note for the reviewer
The fixture renames in
agent-bffandmcp-serverare load-bearing, not tidying. Without them 11 suites inagent-bffand themcp-servertool suites fail to compile under ts-jest with TS2561.Worth knowing why that is easy to miss:
agent-bff/tsconfig.jsonsets"include": ["src/**/*"], soyarn builddoes not typecheck tests. A root build passes clean while the test suites are red. Onlyyarn testcatches it.How to test
Green on this branch: forestadmin-client 284/284, agent-bff 1084/1084, mcp-server 892/892. Lint 0 errors.
Known limitation
The type-level fix has no test that can fail for it in isolation.
forestadmin-client/test/schema/index.test.tscompares a hand-built fixture against itself, so it mirrors the type rather than exercising it. The real regression guard is theagent-bffandmcp-serversuites, which do fail to compile when the names disagree.Follow-ups, deliberately not in this PR
ForestSchemaAction.fields[].enumstostring[] | nullto match the wire; theArray.isArrayguard from feat(agent-bff): serve the agent schema contract on GET /agent/v1/context #1838 stays either wayopenapi/unfolded-paths.ts:367andopenapi/collect-unfolding.ts:183can drop their accommodations.enumon a schema field. That cannot be checked from this repo and is still open.Definition of Done
General
Security