Skip to content

chore: take the pure Schema helpers from @thomasfosterau/effect-ext - #553

Merged
thomasfosterau merged 1 commit into
trunkfrom
issue-552-effect-ext-schema-helpers
Nov 7, 2026
Merged

thomasfosterau merged 1 commit into
trunkfrom
issue-552-effect-ext-schema-helpers

Conversation

@thomasfosterau

Copy link
Copy Markdown
Owner

Summary

This adopts @thomasfosterau/effect-ext 0.1.0's pure Schema helpers wherever their published behaviour matches the local copies, and deletes those copies. It is tracked in effect-ext#37 and effect-ext#15.

Local Now Notes
FlatQuery.PageOffset, pageLimit, pagination (incl. defaultLimit: false) Bounded.PageOffset, pageLimit, pagination / requiredPagination Plain-value options are adapted to effect-ext's Option ones.
FlatQuery.Uuid, SLUG_PATTERN, slug, Slug Ids.* Same adaptation.
FlatQuery.idList, IdList, DEFAULT_MAX_ID_LIST Bounded.* Same adaptation.
FlatQuery.suppliedValue TriState.suppliedValue
ServerErrors.pathToJsonPointer Issues.pathToJsonPointer
internal/schemaExt.issueLeaves kept local Its behaviour differs from effect-ext's; see Notes.
closedStruct, validateMaxUndeclaredMemberErrors kept local effect-ext has no equivalent.
LiteralExact, Ast, Url — This package had no local copies of these.

The public API and the wire format are unchanged. Each export keeps its name, its plain-value option object and its declared Schema.* type. Bounded's Schema.Finite extends Schema.Number, so the declared types still hold. I checked each replaced helper side by side against the local one, and they produce identical decoded values, error messages (Expected an integer, the slug messages, the id-list bounds), JSON Schema and string-tree coercions ("NaN", "Infinity", "abc"). The existing wire and OpenAPI suites also pass unchanged.

Dependency shape. effect-ext is a runtime dependency (catalog ^0.1.0), not a peer. No effect-ext type reaches a published declaration, so a consumer never needs to share our copy. A new test enforces that. effect-ext peers effect ^4.0.0, the same as ours, so the effect peer floor doesn't move.

Cycle. Only the Bounded, Ids, Issues and TriState subpaths are imported, never /Negotiate or the barrel. Those subpaths import only effect's core.

Entry points. test/entry-points.test.ts now permits exactly those four subpaths. The schema tier reaches Bounded, Ids and TriState through FlatQuery; Issues is reached only from the HTTP tier. The test adds two checks:

  • effect-ext's own dist for those subpaths (JavaScript and .d.ts) resolves only effect's core, with no HTTP surface.
  • No dist/*.d.ts names effect-ext.

README, CONTRIBUTING and the /schema module doc change "effect alone" to say this.

Closes #552

Verification

Run in the worktree, in AGENTS.md order:

  • pnpm install --frozen-lockfile: pass
  • vp run build: pass
  • vp check: pass (0 errors; the warnings are the existing staged-rollout tier)
  • vp run check (sources, type-level tests, examples, emitted declarations): pass, 8/8 tasks
  • vp run -r test:unit: pass. Root 3974 tests, and the examples 50, 73 and 56. entry-points.test.ts ran all 27 cases against dist/, none skipped.
  • vp run docgen (every JSDoc @example compiled and executed): pass
  • vp run test:coverage, then vp exec fallow audit --base origin/trunk: pass. Its one complexity finding (visit in test/entry-points.test.ts) was already on trunk and is excluded as inherited.

Changeset

  • .changeset/effect-ext-schema-helpers.md (patch). It covers the new runtime dependency, which helpers now delegate to effect-ext, and the /schema entry point's new effect-ext externals.

Notes

  • Issues.leaves / Issues.pointers differ from issueLeaves. The difference shows when a struct-level check carries a message annotation and returns { path: ["b"], issue: new SchemaIssue.InvalidValue(...) }. ServerErrors.schemaIssueToErrors reports "b must equal a", but Issues.pointers reports "Expected a valid value". The local walk carries the nearest Filter down through Pointers (describedBy). effect-ext only formats from a Filter that sits directly over the bare InvalidValue, and Issues.leaves exposes no format node at all. So issueLeaves stays. This is a finding for effect-ext#37: once Issues carries the nearest Filter down, issueLeaves can go.
  • Dev-install side effect. effect-ext's optional peer @thomasfosterau/effect-jsonapi >=0.16.1 gets resolved in this workspace's own install. pnpm puts the published effect-jsonapi 0.20.1 under node_modules/@thomasfosterau/effect-ext/node_modules/. Nothing loads that copy, and a scoped overrides entry ("-") cannot drop a peer edge. A consumer's install is unaffected. The catalog comment records this.
  • The minimumReleaseAgeExclude entry for @thomasfosterau/* admits the fresh 0.1.0 release.
  • I couldn't read effect-ext#37 or Bump changesets/action from 3841a0683d3cfa6dae0f9bb335290003010fe3f0 to a45c4d594aa4e2c509dc14a9f2b3b67ba3780d0d #15 from this session, because access to that repository was refused. The mapping above comes from the published 0.1.0 .d.ts, dist and README.

Generated by Claude Code

…552)

FlatQuery's page window, UUID / id-list codecs, slugs and suppliedValue,
and ServerErrors.pathToJsonPointer, now delegate to effect-ext 0.1.0's
Bounded, Ids, TriState and Issues subpaths. Names, option objects and
declared types are unchanged, and no declaration names effect-ext, so it is
a runtime dependency rather than a peer. issueLeaves and closedStruct stay
local: Issues.pointers formats a struct-level check's message differently,
and effect-ext has no closed struct.

entry-points.test.ts now permits exactly those four subpaths, never
/Negotiate. It proves that they resolve only effect's core and that no
.d.ts names effect-ext.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y5G6PJCD4Y6tQPCM8tvdbz
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​thomasfosterau/​effect-ext@​0.1.08110010090100

View full report

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.

chore: take the pure Schema helpers from @thomasfosterau/effect-ext instead of keeping local copies

2 participants