Repository navigation
fix(bindx): support @contember 2.2.0-alpha.19 and declare @contember/schema - #166
Merged
Merged
Conversation
@contember/schema 2.2.0-alpha.19 adds the `CheckConstraintViolation` execution error, which the engine reports when a write breaks a database check constraint. `ExecutionErrorTypes` is a complete record of the execution error types, so bindx no longer compiled against it (TS2739), and at runtime the type was not recognised: `isExecutionErrorType` returned false and it was classified `unknown`, which is retryable and has no code. - Bump the @contember/* dependencies and the Contember engine and CLI images from 2.2.0-alpha.17 to 2.2.0-alpha.19 together. - Classify `CheckConstraintViolation` as a `constraint` error, like the other constraint violations, with the `CHECK_CONSTRAINT` code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`errors/types.ts` derives `ExecutionErrorType` from `Result` in @contember/schema, and the published source and declarations import it, but the package did not declare it. A consumer that type-checks bindx resolved it only when another package happened to hoist it, and failed otherwise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`classifyError` and `getErrorCode` switched over plain strings with a default branch, so a new engine error type broke only `ExecutionErrorTypes` at compile time while these two quietly returned `unknown` and no code. They now look up `Record<ExecutionErrorType, ...>` maps, so all three fail the typecheck together. `isExecutionErrorType` checks own keys: with `in`, inherited names such as `toString` passed as error types and would now index the maps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
Review round 1
Checked: every place that maps execution error types, engine behaviour at v2.2.0-alpha.19 (check violations are sent with
Out of scope, predates this PR: |
Member
Author
Response to review round 1Only minor and nit findings, so no second round.
Out-of-scope note (unused Verified on fa90efe: |
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.
Why
An app moving to
@contember/*2.2.0-alpha.19 fails its typecheck inside@contember/bindx:CheckConstraintViolationexecution error.ExecutionErrorTypesis a completeRecordof the execution error types, so it no longer compiles (TS2739). At runtime the type was not recognised:isExecutionErrorTypereturnedfalseandclassifyErrorreturnedunknown, which is retryable and has no code.@contember/bindximports@contember/schema(errors/types.ts) without declaring it.ResourceExhausted, the other error type alpha.19 has over older engines, is already handled on main (since 2.2.0-alpha.17).What
@contember/*dependency and the Contember engine and CLI images (docker-compose, CI) from 2.2.0-alpha.17 to 2.2.0-alpha.19 together.CheckConstraintViolationasconstraint(not retryable) with theCHECK_CONSTRAINTcode, like the other constraint violations. The engine reports it with no path, so it resolves to an entity-level error.@contember/schemain@contember/bindx.bindx-client,bindx-generatorandexamplealready declare it; no other package imports it.Nothing else broke on alpha.19: typecheck, lint, the unit/react suite and
check:packpass unchanged.Decisions
packages/bindx/src/errors/types.ts(ExecutionErrorTypes,classifyError),packages/bindx/src/errors/errorPathResolver.ts(getErrorCode); tests intests/unit/errors/— 0148fb6; both mappings made exhaustive in fa90efe (review round 1)packages/bindx/package.json— 4093422package.jsonpins,bun.lock,docker-compose.yaml,.github/workflows/ci.yml— 0148fb6Verification
Local:
bun run typecheck— exit 0bun run lint— 0 errors (13 warnings, all present on main)bun run test— 2560 pass, 0 failbun run build && bun run check:pack— all 11 packages oktests/unit/errors/— 54 pass on fa90efe, including the newCheckConstraintViolationcasesStatus
🤖 Generated with Claude Code