Repository navigation
build(effect): upgrade to effect 4.0.0-rc.117 and native Arbitrary - #292
Merged
Merged
Conversation
Move effect from 4.0.0-beta.97 to 4.0.0-rc.117 (peer ^4.0.0-rc.117) and migrate to the release-candidate API: - Schema.asClass is gone: the 12 model schemas extend their schema directly. - withStatics puts its statics on a fresh subclass. It used to mutate its input, which is now the shared schema itself (e.g. Schema.String). - TaggedErrorClass -> TaggedError, transformOrFail -> transformEffect. - SchemaIssue.InvalidValue takes no actual value. rc.113 removed the fast-check bridge. Property tests and @kitz/vitest's prop now run Effect's native Arbitrary checker, and the new assertProperty is the synchronous counterpart. The models' Type-side schemas now encode their own invariants, so Arbitrary.schema of every canonical model yields only valid values across the whole valid domain: - FileName: its fields are a Stem and an Extension with no further dot, plus a canonical-split check. - Extension: rejects ill-formed Unicode. - The path text patterns carry the u flag, so generation includes astral text. Schema.withArbitraryHints, every *.Realistic variant, and all generation hooks are removed. Full-range ascent generation exposed the 4096 ceiling. join now saturates there, as RelDir.parent already did, and relative relativeTo returns None when the walk up would exceed it, where both used to throw.
jasonkuhrt
added a commit
that referenced
this pull request
Sep 23, 2026
Adds the Property Tests section (assertProperty, it.effect.prop, check options) that #292's migration left undocumented, and notes in the @kitz/effect ledger that reintroducing realistic generation is open.
jasonkuhrt
added a commit
that referenced
this pull request
Sep 23, 2026
* chore: retire monorepo-era skills, rules and docs The repository collapsed to the single @kitz/effect package, but its agent tooling still described the deleted monorepo. CONTRIBUTING.md (loaded into every agent's context) taught bun commands and packages that no longer exist. - Delete skills whose subject is gone: auditing-project, authoring-global-scripts, syncing-tsconfig-paths, refreshing-docs, kitz-cli-output (@kitz/core Str.Builder), kitz-fs (@kitz/fs). - Update committing-changes, filing-issues, kitz-functions and kitz-services to @kitz/effect examples; kitz-services now shows Effect v4's Context.Service and Schema.TaggedError with method-syntax interfaces. - Rewrite error-conventions (Schema.TaggedError, fully qualified tags, upstream failures pass through) and domain-boundary-extraction (namespaces inside @kitz/effect instead of 40+ packages). - Rewrite root CONTRIBUTING.md for the single-package workspace; keep the TS2742 and TS7056 declaration-emit guidance, generalized off @kitz/core. - Retire docs/superpowers/queue.md (its open items moved to the maintainer's session record; GitHub issues stay the public backlog) and repoint the package ledger's dead queue links to #290 and the literal-duality spec. - Drop Cwd.ts's comment about the removed repository error helper. * chore.docs: document the native property runner in @kitz/vitest Adds the Property Tests section (assertProperty, it.effect.prop, check options) that #292's migration left undocumented, and notes in the @kitz/effect ledger that reintroducing realistic generation is open.
jasonkuhrt
added a commit
that referenced
this pull request
Sep 23, 2026
AGENTS.md says oxlint warnings are blocking, but nothing enforced it: CI's `vp lint` exits 0 on warnings, and unused-code detection was off in both oxlint (`eslint/no-unused-vars`) and TypeScript (`noUnusedLocals`), both since the collapse commit with no recorded reason. Dead code from #292's removals went unnoticed as a result. - Enable `eslint/no-unused-vars` at `warn` (per AGENTS.md, severities stay at warn), ignoring `_`-prefixed args and vars. - CI (`pr.yml`) and the `check` task run `vp lint --deny-warnings`. A planted unused import now fails lint with exit 1. - Remove the dead code it found: the unused `Result` import in `RelFile.ts`, the vestigial `input` parameter of `illFormedUnicode` (now a constant issue: rc.117 `InvalidValue` retains input only under `reportInput` parse options, which the analyzer does not have), and the unused `infer $Character` binding in `AfterLastScan` (now `${string}${infer $Rest}`, verified equivalent, including for astral characters). - Test edits (fallout of #292's property-test rewrite): remove the unused `someRelFile` declarations in `isDescendantOf.test.ts` and `isWithin.test.ts`.
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.
Follow-up to #291 (the toolchain upgrade, now merged).
Summary
effectfrom 4.0.0-beta.97 to 4.0.0-rc.117 and migrates to the release-candidate API.Arbitrary. rc.113 removed the fast-check bridge.Versions
effect(catalog, devDependency)4.0.0-beta.974.0.0-rc.117(latestrctag)effectpeer of@kitz/effect^4.0.0-beta.97^4.0.0-rc.117rc.117 has no dependencies, so the
allowBuilds: msgpackr-extractentry that beta.97's native dependency needed is gone. pnpm reports +1 −19 packages: the neweffectreplaces beta.97 and its dependency tree.Effect release-candidate API migration
Schema.asClassremoved (beta.102). The 12 model schemas now extend their schema directly:Abs,AbsDir,AbsFile,Any,Dir,Extension,File,FileName,Rel,RelDir,RelFile,Segment.withStaticsfix. It now puts its statics on a fresh subclass. It used to mutate its input: before, that input was the wrapper classasClasscreated; now it is the schema itself, possibly a shared one such asSchema.String. The JSDoc records why.Schema.TaggedErrorClass→Schema.TaggedErrorforCwdError(beta.104).SchemaGetter.transformOrFail→SchemaGetter.transformEffectat 7 codec sites (rc.113).SchemaIssue.InvalidValueno longer takes the actual value (beta.103). This changes 6 issues inanalyzer.tsandfileUrl.ts..claude/rules/effect-reference.mdis rewritten for rc.117.Native
Arbitrary@kitz/vitest'sit.effect.propandit.propnow runArbitrary.checkEffect, mirroring@effect/vitest's rc-era property API:Arbitrary.formatCheckFailure's report.timeout.arbitrary.assertPropertyis new: a synchronous assertion for use inside ordinary tests, replacingFastCheck.assert(FastCheck.property(…)).assertProperty,ArbitraryInput,Arbitraries,ArbitrariesValues,PropertyTestOptions.Baseline decisions
Schema.withArbitraryHintsis removed, with its tests.*.Realisticvariant is removed:Segment,FileName,AbsDir,AbsFile,RelDir,RelFile,Any. So are the realistic text patterns (core/realisticText.ts) and the generation-onlymaxSegments.FileName:stemis aStem: non-empty, well-formed text with no/or NUL.extensionis anExtensionwith no further dot../.., and cannot contain a dot thatsplitExtensionwould split on.stemwasS.StringandextensionanyExtension. That is why 16 laws failed on native generation.Extensionnow rejects ill-formed Unicode, asSegmentand every path codec already did.Extension.make('.\uD800')used to succeed, although no path can carry that extension.uflag is now on theSegment,Extension, andStempatterns. For[^/\0]it does not change what validation accepts. It does make generation reach astral characters: without it, native generation never emits one.AscentandSegments:S.Array(Segment)is inlined into the dir models.models/arbitrary.tsis nowmodels/ascent.ts, holdingAscent,maxAscent, andsaturateAscent.{ report: true }tests are deleted.Ascent ceiling (baseline choice)
Generating ascent over its full 0..4096 range reaches the ceiling. At the ceiling,
joinandrelativeTothrew a defect fromAscent.makewhenever a result needed more than 4096..steps. This made therelativeTolaws fail intermittently.joinnow saturates at 4096, asRelDir.parentalready did, sojoin(dir, '../'×k)still equalsk.parentsteps.relativeToandRel.relativeToon relative paths returnNonewhen the walk up exceeds 4096. That fits the "when representable" contract theirOptionalready expressed.join,relativeTo,Rel.relativeTo, andRelDir.parent.relativeToon absolute paths is documented as total. It still throws when the base has more than 4096 segments that the target does not share (packages/effect/src/path/core/relativeTo.ts:20-25). Generated inputs never reach this, and such a base would exceed PATH_MAX, but the model can represent it. Fixing it needs a design decision: bound segment counts, or returnOption.Sampling proof
Every public path model was sampled with
Arbitrary.schema(Model)from the built package: 3 seeds × 3000 samples each. Each sample had to be valid, round-trip through decode∘encode to an equal value, and re-encode to the same canonical string. Text shares are measured on the encoded string.checkEffectNegative control: the old
FileNameType side (stem: S.String, anyExtension), run through the same check, gives 24.9% non-canonical values (748 of 3000).Where generation lands. This matters for the open design question about realistic generation:
relativeTolaw rarely exercises the equal-ascent (shared-prefix) branch, which therelativeTo(join(base, r), base)law builds on purpose. Under the old 0..8 bias it was about 1 in 9, assuming a uniform draw.docs/learnings/effect-arbitrary.mdis rewritten with rc.117's verified native semantics (and re-verification probes), and it keeps the history of the beta-era fast-check bridge.Test edits
Rewritten for native
ArbitraryThe laws and input domains are unchanged.
FastCheck.assert(FastCheck.property(…))sites becomeassertProperty([…], ([…]) => …):path/_.test.ts26isWithin5relativeTo5isDescendantOf3ensureAbs2join2isAncestorOf1order1S.toArbitrary(M)→Arbitrary.schema(M).FastCheck.oneofover schema-derived arbitraries →Arbitrary.schema(S.Union([…])), which also picks uniformly. Over non-schema arbitraries → a localoneOfbuilt onArbitrary.flatMapover a generated boolean.FastCheck.array(x, { maxLength: 6 })→Arbitrary.array(x, { maxLength: 6 }).FastCheck.record→Arbitrary.all..map→Arbitrary.map.FastCheck.integer({ min: 0, max: 8 })→S.Int.check(S.isBetween({ minimum: 0, maximum: 8 })).vitest/src/index.test.ts:FastCheck.constant(1)→Arbitrary.Constant(1).path/_.test.ts"%s encodes 500 sampled values":FastCheck.sample(arb, 500)→Arbitrary.sampleEffect(arb, { count: 500 }), now over the canonical schemas only.Law correction
relativeTo.test.ts, "relative relativeTo is Some exactly when target ascent is not shallower than base ascent" gains a second condition: "…and the walk up fits the ascent ceiling". The old law claimedSomefor results that need more than 4096..steps, and noRelvalue can represent those. The walk-up count comes fromRel.commonAncestor, so the law also checks that the two APIs agree. Thejoin(base, value) === targethalf of the law is unchanged.Deleted
schema/_.test.ts: thewithArbitraryHintsdescribe block (8 tests, 2 of them{ report: true }).path/_.test.ts:{ report: true })Realistic.*cases of "%s encodes 500 sampled values"arb.RealisticfixturesMechanical
tuple/_.test.ts: theTuple.make('a', 42)type is now['a', 42]rather than[string, number]. Effect beta.104 madeTuple.makepreserve literals.schema/_.test.ts:withStatics(S.asClass(S.String))→withStatics(S.String).The suite went from 394 to 371 passing tests, plus the same 1 expected failure. The difference is exactly the 23 deleted tests.
Other
@effect/tsgogroups were re-probed on this code: style 18 (allunnecessaryTypeofType), review 71 (schemaSync46,missingPipeableSignature23,deterministicKeys1,strictEffectProvide1). The template comments carry these numbers.packages/effect/README.mdandCONTRIBUTING.md(the peer range, the property-testing section, and two ledger rows) and.claude/rules/test-correctness.mdmatch the native API.Verification
With build and task caches cleared:
vp format --check,vp lint(0 warnings across 87 files),vp run check:types,vp run build,vp run check:package(publint and attw clean): all pass.vp test run: 21 files, 371 passed, 1 expected fail. The suite also passed 25 consecutive runs, each seeding its generation randomly.pnpm install --frozen-lockfile: passes; every lockfile entry is older than one day.pnpm peers check: clean.