Skip to content

feat: add unstable BytePath - #9730

Open
lloydrichards wants to merge 1 commit into
Effect-TS:mainfrom
lloydrichards:feat/bytepath
Open

lloydrichards wants to merge 1 commit into
Effect-TS:mainfrom
lloydrichards:feat/bytepath

Conversation

@lloydrichards

@lloydrichards lloydrichards commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Type

  • Feature

Description

Part of porting over the VirtualFileSystem as discussed with @fubhy on moving smaller building blocks first. Here i'm adding effect/BytePath for immutable POSIX path bytes, including filenames that cannot be represented as UTF-8. Very important for representing file system paths.

fromBytes, fromString and decodeString return Result with a BytePathError (NulByte, InvalidUtf16, InvalidUtf8 or InvalidBuffer). Each has an *Unsafe variant that throws instead. Input and exported bytes are copied, and text conversion is strict. Empty values and exact spellings are preserved. Values support equality, hashing, unsigned byte ordering, isAbsolute and inspection.

import { BytePath, Result, Schema } from "effect"

const path = BytePath.fromBytesUnsafe(new Uint8Array([47, 255]))

Array.from(BytePath.toBytes(path)) // [47, 255]
Result.isFailure(BytePath.decodeString(path)) // true

const json = Schema.toCodecJson(Schema.BytePath)
Schema.encodeSync(json)(path) // "L/8="

Schema.BytePath validates existing values. Schema.BytePathFromBytes copies bytes on decode and encode. Both derive Base64 JSON codecs and support Schema code generation.

Related

Closes EFF-2754

@effect-bot
effect-bot changed the base branch from main to v4/next-minor October 21, 2026 15:33
@lloydrichards lloydrichards changed the title Add unstable BytePath values and Schema codecs feat: add unstable BytePath values and Schema codecs Oct 21, 2026
@lloydrichards lloydrichards changed the title feat: add unstable BytePath values and Schema codecs feat: add unstable BytePath Oct 21, 2026
@changeset-bot

changeset-bot Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4202920

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 33 packages
Name Type
effect Patch
@effect/opentelemetry Patch
@effect/vitest Patch
@effect/ai-anthropic Patch
@effect/ai-cloudflare Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/ai-typesafe Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-deno Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/docgen Patch
@effect/doctest Patch
@effect/graphql-generator Patch
@effect/openapi-generator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File Name Current Size Previous Size Difference
arbitrary-combinators.ts 39.18 KB 39.18 KB 0.00 KB (0.00%)
basic.ts 7.08 KB 7.08 KB 0.00 KB (0.00%)
batching.ts 10.95 KB 10.95 KB 0.00 KB (0.00%)
brand.ts 6.71 KB 6.71 KB 0.00 KB (0.00%)
cache.ts 11.39 KB 11.39 KB 0.00 KB (0.00%)
config.ts 22.55 KB 22.55 KB 0.00 KB (0.00%)
differ.ts 21.70 KB 21.70 KB 0.00 KB (0.00%)
http-client.ts 26.51 KB 26.51 KB 0.00 KB (0.00%)
http-router.ts 36.02 KB 36.01 KB +0.01 KB (+0.04%)
logger.ts 11.76 KB 11.76 KB 0.00 KB (0.00%)
metric.ts 9.32 KB 9.32 KB 0.00 KB (0.00%)
optic.ts 6.93 KB 6.93 KB 0.00 KB (0.00%)
pubsub.ts 15.82 KB 15.82 KB 0.00 KB (0.00%)
queue.ts 12.64 KB 12.64 KB 0.00 KB (0.00%)
schedule.ts 11.63 KB 11.63 KB 0.00 KB (0.00%)
schema-bigdecimal.ts 13.89 KB 13.89 KB -0.00 KB (-0.01%)
schema-binary.ts 40.70 KB 40.70 KB 0.00 KB (0.00%)
schema-class.ts 21.40 KB 21.40 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 32.39 KB 32.39 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 27.59 KB 27.59 KB +0.00 KB (+0.01%)
schema-string-transformation.ts 15.13 KB 15.13 KB 0.00 KB (0.00%)
schema-string.ts 12.14 KB 12.14 KB 0.00 KB (0.00%)
schema-template-literal.ts 16.06 KB 16.06 KB 0.00 KB (0.00%)
schema-toArbitrary.ts 38.70 KB 38.70 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 25.79 KB 25.79 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 20.64 KB 20.64 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 20.81 KB 20.81 KB 0.00 KB (0.00%)
schema-toFormatter.ts 20.92 KB 20.92 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 25.51 KB 25.51 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 20.91 KB 20.91 KB 0.00 KB (0.00%)
schema.ts 20.59 KB 20.59 KB 0.00 KB (0.00%)
stm.ts 13.95 KB 13.95 KB 0.00 KB (0.00%)
stream.ts 10.19 KB 10.19 KB 0.00 KB (0.00%)

@lloydrichards
lloydrichards marked this pull request as ready for review October 21, 2026 16:24
@effect-bot
effect-bot force-pushed the feat/bytepath branch 2 times, most recently from 7870d9c to fdf57f7 Compare October 21, 2026 20:51
@tim-smart
tim-smart force-pushed the v4/next-minor branch 2 times, most recently from ee781bb to 9fe24b9 Compare October 21, 2026 22:20
@effect-bot
effect-bot force-pushed the feat/bytepath branch 2 times, most recently from 53e13de to 7c8ebdb Compare October 21, 2026 22:23
@tim-smart
tim-smart force-pushed the v4/next-minor branch 2 times, most recently from 8e6e2e0 to 005c3dd Compare October 21, 2026 22:39
@effect-bot
effect-bot force-pushed the v4/next-minor branch 3 times, most recently from ed5e85c to 1b0f32b Compare October 21, 2026 22:39
@effect-bot
effect-bot force-pushed the v4/next-minor branch 8 times, most recently from 6cab2e6 to 4e68a37 Compare October 22, 2026 00:37
@effect-bot
effect-bot force-pushed the v4/next-minor branch 4 times, most recently from c76ac0e to 2262361 Compare October 22, 2026 02:35

@fubhy fubhy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This deserves some extra consideration into whether our current Path module should instead be an enriched bytes data type instead of adding a new one in parallel here.

With node:path being entirely string based, this would then mean we'd have to ship our own platform dependent path string operations (join, split, etc.). But since node:fs offers bytes apis throughout it might be feasible.

Rust has a rich path manipulation story with various representations across both strings and buffers. Worth a look.

@lloydrichards
lloydrichards changed the base branch from v4/next-minor to main October 22, 2026 06:35
@fubhy fubhy added the vfs label Oct 22, 2026

This branch is waiting to be deployed

1 waiting (outdated) deployment
fork — 9a8b5378 Waiting Oct 21, 2026 by lloydrichards via approval-gate #22178
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants