Skip to content

feat(database): type the own properties of a schema codec as unknown values - #63

Merged
Upd4ting merged 1 commit into
campaign/integrationfrom
feat/codec-property-values
Nov 2, 2026
Merged

Upd4ting merged 1 commit into
campaign/integrationfrom
feat/codec-property-values

Conversation

@Upd4ting

@Upd4ting Upd4ting commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Why

Antony's goal is every AntelopeJS guardrails.ratchet.json deleted through verified PRs on campaign/integration. dms-database cannot lose its ratchet yet: its last contract row is fieldDescriptor.ts:193, where Object.entries(value) runs over FieldType = StringFieldType | IoTsCodec. IoTsCodec was an interface without an index signature, so TypeScript typed the entries as [string, any][]. A codec without a _tag reaches that branch, so no consumer guard can say what its values are.

What changed

  • IoTsCodec in src/staged-query/schema.ts is declared as a type alias instead of an interface. The members are the same. A type alias gets an implicit string index signature, so Object.entries on a codec types its own enumerable properties as [string, unknown].
  • TSDoc on the alias states why it is an alias.
  • No runtime export is added: Runtime API: 1 packages, 11 entries unchanged.
  • Test first: src/tests/field_type.test.ts fails to compile on the base (Type 'true' is not assignable to type 'false' on the check that the property type is not any), and passes with the alias.

Breaking

No for what a consumer can pass: the alias and the interface have the same members, so every value assignable to FieldType before still is. Only a consumer that read the entries of a FieldType and relied on any stops compiling. Measured by tgz-proof.sh on each consumer at its campaign/integration tip with this tarball (see Verification): only dms-database's one site breaks, and dms-database adapts in its own PR. No version change beyond the 0.3.0 that W6-2 already carries; this lands in the same release.

Verification

  • pnpm run checks on the committed head, Node 24: Checks: 8 passed, 0 failed.
  • api-diff (api-diff-slot.sh origin/campaign/integration): the only change is interface IoTsCodec becoming type IoTsCodec, in the root and /schema declarations. Suppressions unchanged (7 lint suppressions, 2 @ts-expect-error, 5 SAFETY:).
  • Tarball: antelopejs-interface-database-85eaeeb.tgz, sha256 47080aaffc290469fad1c7de6d71af983890fe42c42de358ea0943f7b40b8f5b, recorded in ~/.cache/campaign2/tgz/index.tsv.
  • Consumer proofs: each at its campaign/integration tip with the tarball applied, pnpm run checks on a tree with no dist. The one reported FAIL per proof is the pin check (integration pins other bytes, which holds for any unlanded producer); the checks line is the signal.
Consumer Checks
mongodb 8 passed, 0 failed
postgres 8 passed, 0 failed
rethinkdb 8 passed, 0 failed
interface-database-decorators 8 passed, 0 failed
interface-data-api 9 passed, 0 failed
dms 9 passed, 0 failed
dms-saas 9 passed, 0 failed
dms-builder 8 passed, 0 failed
dms-database 7 passed, 2 failed (typecheck, test): fieldDescriptor.ts(193,50): Argument of type 'unknown' is not assignable to parameter of type 'FieldType'

dms-database adapts in the follow-up PR: AntelopeJS/dms-database#105 (9 passed, 0 failed with this tarball).

Attention

  • The alias is the whole change. The values stay unknown: a consumer that wants a typed value must narrow it with a guard of its own. dms-database does that in the follow-up PR.

@Upd4ting
Upd4ting marked this pull request as ready for review November 2, 2026 12:43
@Upd4ting
Upd4ting merged commit e533a2f into campaign/integration Nov 2, 2026
7 checks passed
@Upd4ting
Upd4ting deleted the feat/codec-property-values branch November 2, 2026 12:43
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.

1 participant