Skip to content

Migration guide: 0.21 → 0.22 (breaking changes for website, gardeneria, preferenceflow, in-the-dark) #620

Open

Description

@thomasfosterau

This issue collects every breaking change heading into the next release (the open "Version Packages" PR, #583) in one place, so the apps can migrate once. Entries are grouped by module, with the old spelling, the new spelling, and the PR that makes the change. Landed means the change is on trunk; pending means the PR is still open. Final as of trunk 442a256: every breaking change for 0.22.0 has landed, and the Version Packages PR (#583) carries all of their changesets.

Toolchain and peer

Change Old → new PR
effect peer ^4.0.0 → ^4.1.0 (on 4.0.6, Group.resource's ~Success resolves to any) #592, landed
@thomasfosterau/effect-ext ^0.1.0 → ^0.2.0 #589 / #593, landed

Error classes (ServerErrors, Client, Registry, Conformance, Middleware)

Change Old → new PR
Published Schema.TaggedError classes carry a nominal brand An object literal of the error's shape → new ServerErrors.NotFound({ … }) (instanceof and _tag narrowing are unaffected) #604, landed
status fields (Redirect, HttpError, JsonapiError, Client.ErrorResponse), ValidationFailure numeric path segments, UnsupportedIncludeDepth.maxDepth, ContractViolation.remaining Schema.Number → Schema.Int (a fractional, NaN or infinite value now fails) #618, landed

Wire format

Change Old → new PR
ApiError.make errors detail was also copied into meta.detail → only the top-level detail, and no empty meta: {} #573, landed
Negotiation error codes (Negotiation.errorResponse 406 / 415) not-acceptable / unsupported-media-type → not_acceptable / unsupported_media_type #605, landed

Client / Include

Change Old → new PR
Client.IncludedIndex, Include.Surface.targets ReadonlyMap → effect HashMap. Read with HashMap.get(index, key) (returns Option) instead of .get(key); iterate with HashMap.entries / HashMap.values. Code that only passes the index to related / walk / hydrate is unaffected. #615, landed

Query / FlatQuery (numbers)

Change Old → new PR
Query.Page.offset / number with fromString: false; FlatQuery.PageOffset, pageLimit, pagination, DefaultedPagination / RequiredPagination Schema.Number → Schema.Finite. Wire parsing (fromString: true) is unchanged. An annotation written Schema.Number becomes Schema.Finite. #618, landed

Registry / Client / Resource (any removed)

Change Old → new PR
Registry.RawHandler<R> request: any → request: never; R defaults to unknown (was any). A host calling a raw handler directly types the request and Context itself. #619, landed
Registry.Family<R> defaults to unknown (was any). Annotate Registry.Family<YourServices>. #619, landed
Registry.HandlersFor<G> error and requirement channels unknown (was any). satisfies Registry.FamilyFor<typeof group> is unaffected (ResourceHandlers.make / readOnly return NoInfer<…>). #619, landed
Registry.familyLayer / layer / webHandler HttpApi.HttpApi<any, any> → generic over the api. Pass the concrete api value, not one held as HttpApi<any, any>. #619, landed
Client.decodeInput S extends Schema.Top → S extends Schema.Codec<unknown, unknown, unknown, unknown>. Narrow a Schema.Top to a codec first. #619, landed
Resource.createAttributeFields / updateAttributeFields Record<string, Schema.Top> → CreateAttributes<A> / UpdateAttributes<A> (precise) #619, landed

Optional members and absent values (prefer-option-over-null)

The plan is on #533. Complete: all of it has landed — internal sites (#624), Client / Middleware (#625), type-level sentinels (#627), server modules (#628), Relationship descriptor key / order → Option (#629, decided on #626), schema-derived wire types (#630) and the last test sites plus Negotiation options (#631); the rule now runs at error. All four apps enable exactOptionalPropertyTypes, so the following applies to them:

  • Options no longer take an explicit undefined. Every options, config and request member typed readonly x?: T | undefined becomes readonly x?: T. Passing { x: maybe }, where maybe might be undefined, stops compiling: leave the key out when the value is absent. effect/no-conditional-empty-object-spread rejects ...(maybe === undefined ? {} : { x: maybe }), so copy this helper (the package uses the same one internally) and spread one call per key:
    import * as P from "effect/Predicate";
    
    // A named return type: an inline one trips `effect/no-known-value-widening`.
    type DefinedMember<K extends string, A> = { readonly [Prop in K]?: Exclude<A, undefined> };
    
    const definedMember = <const K extends string, A>(key: K, value: A): DefinedMember<K, A> => {
      const member: { [Prop in K]?: Exclude<A, undefined> } = {};
      if (P.isNotUndefined(value)) member[key] = value;
      return member;
    };
    
    Client.make(Api, { ...definedMember("baseUrl", env.API_URL), decodeErrors: true });
    For a value held as an Option, write the same shape with if (Option.isSome(value)) member[key] = value.value.
  • Results that may be absent become Option. This covers Middleware.negotiate / checkQueryParameters, Lid.LidMap.id, Handlers.resolveIncluded, the ApiError detail / source callbacks, Assemble viewerId, Handlers.withMeta and Document.href. Use Option.getOrUndefined to keep the old behaviour.
  • At the type level, "absent" is never instead of undefined. Only explicit type arguments are affected (Endpoint.*, Group.*, Resource.extend / attribute, Idempotency.applied, Query.Include).
  • Wire shapes are unchanged: data: null, links.next: null and nullable attributes stay as they are.
Module Change Old → new PR
Client MakeOptions (baseUrl, transformClient, transformResponse, decodeErrors), PageCursorOptions (key, defaultLimit, maxLimit) ?: T | undefined → ?: T #625, landed
Client related / walk data; indexIncluded LinkedResource | undefined → LinkedResource (pass {} for no data); included? optional parameter #625, landed
Client LooseInput<T>, PageFilters no | undefined members (build with Client.stripUndefined / leave the key out) #625, landed
Conformance Options (all members), WriteFixture (create, update, cleanup, clientId), format's width ?: T | undefined → ?: T #625, landed
Conformance Report.writes / samples, Write.id / detail, Finding.probe, Passed.note T | undefined → optional member #625, landed
Middleware negotiate ({ contentType?, accept? }) => Error | undefined → (headers: Headers.Input) => Option<Error> (pass request.headers) #625, landed
Middleware checkQueryParameters document | undefined → Option<document> #625, landed
Middleware contentTypeIsAcceptable / acceptIsAcceptable; QueryParameterOptions, SchemaErrorsOptions, QueryParameterCheck header: string | undefined → header?: string; options ?: T #625, landed
ApiError static title; make's detail / source callbacks string | undefined → Option<string>; callbacks return the value or an Option of it (Option.fromUndefinedOr(e.reason)) #625, landed
Negotiation Options (fallback, alternates) ?: T | undefined → ?: T #625, landed
Registry Options.respond, webHandler's disableLogger ?: T | undefined → ?: T #625, landed
ServerErrors SchemaIssueOptions (status, prefix), RespondOptions (materialise, override) ?: T | undefined → ?: T #625, landed
Endpoint / Group page / filter type parameters of Endpoint.list / collection / related / getRelationship / resource, ResourceEndpoint(s), ResourceOptions, Group.resource; Surface of Group.flat / flatReadOnly / FlatOptions / FlatReadOnlyOptions; Base of Endpoint.polymorphic absent sentinel undefined → never: an explicit undefined type argument becomes never (or is omitted); an explicit page / filter / include: undefined option is rejected (omit the key). Inference unchanged. #627, landed
Query Include's options type parameter; Options.page / filter undefined → never / omitted; Query.schema(r, { page: undefined }) is rejected (omit the key) #627, landed
Resource attribute's Clearable, extend / ExtendedId's custom id, Family's Base absent sentinel undefined → never; { clearable: undefined } is rejected (omit the key) #627, landed
Handlers paginatedRelationship's Self absent sentinel undefined → never; { self: undefined } is rejected (omit the key) #627, landed
Idempotency HeadersFor<O> / Applied<E, O>; applied O unconstrained, undefined meaning off → O extends Idempotency.Option (pass false or never for off); applied's option is optional #627, landed
Assemble unpaginatedCollection, UnpaginatedCollectionOptions, UnpaginatedCollectionDocument (Self / M) absent sentinel undefined → never; the maybe-passed self: string | undefined / meta: M | undefined (optional links / meta) is rejected: pass the key only when it is defined, and the document has links / meta exactly when one is passed #627, landed
Assemble Options (viewer, fields, include, includable, targets, depth, concurrency, capabilities), CollectionOptions.included, UnpaginatedCollectionOptions.query, Pagination.query, RelationshipInput (viewer, capabilities, included, fields), OwnedCapabilitiesOptions (canModerate, relationship), edgePage's input.query ?: T | undefined → ?: T #628, landed
Assemble OwnedCapabilitiesOptions.viewerId (viewer) => string | undefined → (viewer) => Option<string> ((v) => Option.fromNullishOr(v?.id)) #628, landed
Handlers data / collection / linkage / buildIncluded options (included, onResource, checkLinkage), ResolveIncludedOptions (depth, concurrency) ?: T | undefined → ?: T #628, landed
Handlers resolveIncluded paths: ReadonlyArray<string> | undefined → Option<ReadonlyArray<string>> (Option.fromUndefinedOr(query.include)); result Effect<ReadonlyArray<…> | undefined> → Effect<Option<ReadonlyArray<…>>> (pass it on with the Option form of the helper, someMember("included", included)) #628, landed
Handlers withMeta's compute M | undefined → Option<M> (Option.some({ … }), Option.none()) #628, landed
Handlers project; Fields fields: F | undefined → fields?: F; index signature ReadonlyArray<string> | undefined → ReadonlyArray<string> #628, landed
ResourceHandlers IncludeConfig (depth, concurrency), ReadOnlyConfig (viewer, capabilities, cache, include, maxPageLimit), Config (transact, hiddenWrite), RelatedConfig (includable, listQuery, viewer, capabilities, defaultPageLimit, maxPageLimit, concurrency) ?: T | undefined → ?: T #628, landed
ResourceHandlers GetRequest.query, RelatedRequest.query members without | undefined, include typed as Endpoint.FlatGetQuery decodes it (a request HttpApi decodes still assigns) #628, landed
Document DataDocument / CollectionDocument / LinkageDocument / Document options (included, meta, error), WireOptions.toManyMeta ?: T | undefined → ?: T #628, landed
Document href the Link | undefined overload is gone: Option.map(Option.fromUndefinedOr(link), Document.href) #628, landed
Endpoint / Group FlatDocumentOptions (included, toManyMeta), FlatRelatedOptions (query, included); FlatReadOnlyOptions (filters, toManyMeta), FlatOptions.hiddenWrites ?: T | undefined → ?: T #628, landed
Query / FlatQuery Options (include, fields, sort), FlatListOptions / flatList (filters, include); PaginationOptions.defaultLimit, SlugOptions (maxLength, reserved), idList's maxLength ?: T | undefined → ?: T #628, landed
FlatQuery suppliedValue field: Option<A> | undefined → field?: Option<A> #628, landed
Filter able's literal, LiteralCodecs.operators; Annotation.literal ?: T | undefined → ?: T; required T | undefined → optional member #628, landed
Resource make / extend options (id, maxUndeclaredMemberErrors), attribute / readOnlyAttribute's filterLiteral, Any (declaredAttributes, maxUndeclaredMemberErrors) ?: T | undefined → ?: T #628, landed
Resource AttributeDescriptor.annotations, attributeAnnotations (AttributeAnnotationsOf); a name-only family's maxUndeclaredMemberErrors required T | undefined → optional member, no key for an attribute without annotations; undefined → the default 12 (typed number) #628, landed
Lid LidMap.id; LidMap.resolveLinkage's relationships string | undefined → Option<string>; an optional parameter #628, landed
Relationship one / optional descriptors' key (One, Optional, one, optional); StorageKey K | undefined → Option<K> (Option.some("authorId"), Option.none() typed Option<never>); StorageKey string | undefined → string. Read with Option.getOrElse(descriptor.key, () => defaultColumn) instead of descriptor.key ?? defaultColumn; Option.getOrUndefined(descriptor.key) keeps the old shape #629, landed
Relationship paginated descriptors' order (Paginated, paginated) O | undefined → Option<O> (O extends Order<R>, never when undeclared). Option.isSome(descriptor.order) instead of descriptor.order !== undefined #629, landed
Relationship one / optional / paginated type parameters and options an explicit undefined type argument (Relationship.one<C, false, undefined>, Relationship.paginated<C, undefined>) is rejected: omit it or pass never; a maybe-undefined { key } / { order } is rejected: pass the key only when it is defined #629, landed
Assemble ResourceLike (relationships, links, links.self, meta), RelationshipObject (data, links, meta) ?: T | undefined → ?: T (a decoded resource still assigns; leave out a maybe-undefined member, e.g. ...definedMember("meta", row.meta)). null linkage is unchanged #630, landed
Client AnyDocument.included, IncludedResource (attributes, relationships, links, meta), DocumentMembers (meta, links, jsonapi), ResourceDocument / CollectionDocument included, LinkedResource.relationships, hydrate's document.included ?: T | undefined → ?: T (decoded documents still assign); readTotalCount's source is an optional parameter #630, landed
Conformance WritePayload (attributes, relationships, meta) ?: T | undefined → ?: T #630, landed
Negotiation Options.onExplicitRefusal, Options.extensions ?: T | undefined → ?: T (omit the key; spread definedMember("extensions", extensions) for a maybe-undefined value) #631, landed

Additive (no migration)

Activity

  1. thomasfosterau commented on Nov 12, 2026

    @thomasfosterau
    OwnerAuthor

    Claude Code maintains this issue's body. It's updated as each breaking PR in the #533 series lands. The issue-editing tool strips the attribution footer from the body on save, so this comment carries it instead.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions