Typed effects with env and v0.3.0 release#6
Conversation
Adds PROJECT.md for two-part initiative: verified law tests (functor/monad/error/capability) and test utilities (assertions, TestRuntime, capability test doubles). Creates PROJECT.md with requirements and constraints.
6-phase milestone: law infrastructure, functor/monad laws, error/capability laws, fluent assertions, TestRuntime, and capability test doubles. Initializes STATE.md and phase directories.
Single plan: EffectLawSupport utility with observational effect equivalence assertions, plus LawInfrastructureTest smoke tests.
One plan: FunctorLawsTest (identity, composition) and MonadLawsTest (left identity, right identity, associativity), each tested with success, failure, and suspend effect inputs.
…, and associativity
One plan: ErrorChannelLawsTest (catchAll identity, mapError identity, mapError composition, attempt round-trip) and CapabilityHandlerLawsTest (orElse identity, compose associativity). 14 tests total.
…nd compose associativity
One plan: EffectAssert fluent chain + EffectAssertions entry point with eager execution, 8 assertion methods (succeeds/fails/with/predicate/andReturn/andError), handler overload, and 22-test validation suite.
…nterfaces not allowed)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Phase 11: finalize on() intersection bound (C extends F & Capability<R>), commit user's forType() changes, and write end-to-end LayerIntegrationTest. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Note: Java JLS §4.4 forbids additional bounds when the first bound is a type variable (F), so the exact intersection `C extends F & Capability<R>` does not compile. The existing `C extends F` already transitively enforces the Capability bound since Builder<F extends Capability<?>>. The forType() factory and Builder<F> generics from the user's changes are retained as-is. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Documents the full Milestone 2 API: phantom types (Empty/With), HandlerEnv, EffectWithEnv, Layer (succeed/fromEffect), horizontal and vertical layer composition, API reference tables, and design notes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- CapabilityHandler.builder() marked @deprecated(since="0.3.0") — points to forType() and HandlerEnv.of()+and() for multi-family environments - HandlerEnv.of() updated to use forType() internally (avoids deprecation warning in production code) - CAPABILITIES.md: consolidate sections 6+7 into a single forType() section - TYPED_EFFECTS.md: replace remaining builder() reference with forType() All existing call sites continue to compile (forRemoval=false). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Milestone 1 (Phases 1-6): Effect Laws & Test Utilities — 11 algebraic laws, EffectAssertions, TestRuntime, TestCapabilityHandler - Milestone 2 (Phases 7-11): Type-Safe Layer System — HandlerEnv, EffectWithEnv, Layer (succeed/fromEffect/and/andProvide), forType() API - ROADMAP.md collapsed to two-line summaries with archive links - STATE.md updated with all decisions and notes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@greptileai can you review this PR for me? |
2 similar comments
|
@greptileai can you review this PR for me? |
|
@greptileai can you review this PR for me? |
Greptile SummaryThis PR introduces a phantom-type layer system ( Confidence Score: 5/5Safe to merge — all remaining findings are P2 style/documentation suggestions with no correctness impact. Prior review concerns (singleton EMPTY_INSTANCE allocation, Builder generics, Layer.fromEffect intermediate variable) are all addressed. The Sleep refactor, phantom-type layer system, and TestRuntime virtual clock are well-tested with comprehensive law and integration tests. The only open issue is a stale Javadoc comment. No files require special attention. Important Files Changed
Class Diagram%%{init: {'theme': 'neutral'}}%%
classDiagram
class EffectWithEnv~R,E,A~ {
-Effect~E,A~ effect
+of(Effect) EffectWithEnv~R,E,A~$
+pure(Effect) EffectWithEnv~Empty,E,A~$
+map(Function) EffectWithEnv~R,E,B~
+flatMap(Function) EffectWithEnv~R,E,B~
+run(HandlerEnv~R~, EffectRuntime) A
+effect() Effect~E,A~
}
class HandlerEnv~R~ {
-CapabilityHandler handler
+of(Class, ThrowingFunction) HandlerEnv~C~$
+fromHandler(CapabilityHandler) HandlerEnv~R~$
+empty() HandlerEnv~Empty~$
+and(HandlerEnv~S~) HandlerEnv~With~R,S~~
+toHandler() CapabilityHandler
}
class Layer~RIn,E,ROut~ {
<<interface>>
+build(HandlerEnv~RIn~) Effect~E,HandlerEnv~ROut~~
+succeed(Class, ThrowingFunction) Layer~Empty,RuntimeException,C~$
+fromEffect(Class, Function) Layer~RIn,E,C~$
+and(Layer) Layer~RIn,Throwable,With~ROut,S~~
+andProvide(Layer) Layer~RIn,Throwable,With~ROut,S~~
}
class TestRuntime {
-TestClock clock
+create() TestRuntime$
#performSleep(Duration)
}
class TestClock {
-AtomicLong virtualNanos
+advance(Duration)
+currentTime() Duration
+reset()
}
EffectWithEnv --> HandlerEnv : run uses
HandlerEnv --> Layer : built by
TestRuntime --|> DefaultEffectRuntime
TestRuntime --> TestClock
Reviews (3): Last reviewed commit: "fix: document intentional local var in L..." | Re-trigger Greptile |
| @@ -0,0 +1,13 @@ | |||
| # Roux v0.2.2 | |||
There was a problem hiding this comment.
Release notes version mismatch
The PR title is "Typed effects with env and v0.3.0 release", but the only release-notes file added is RELEASE_NOTES_0.2.2.md, which describes a v0.2.2 patch. There is no RELEASE_NOTES_0.3.0.md anywhere in this diff.
If this PR is intended as the v0.3.0 release, the significant new features — EffectWithEnv, HandlerEnv, Layer, phantom types (Empty/With), virtual-time TestRuntime, and the Sleep effect node — should all be documented in a dedicated RELEASE_NOTES_0.3.0.md.
|
@greptileai i did not push some changes, pushed all the changes now |
| java.util.List<Effect<E, A>> effects | ||
| ) implements Effect<Throwable, A> {} | ||
| /** Suspends execution for the given duration. Interpreted by the runtime. */ | ||
| record Sleep<E extends Throwable>(Duration duration) implements Effect<E, Unit> {} |
There was a problem hiding this comment.
Sleep is a source-breaking sealed subtype addition
Sleep is added as a new permitted subtype of the public sealed interface Effect. Any consumer code that performs an exhaustive switch expression over all Effect variants will now fail to compile with a missing case error. For example:
// Previously compiled; now fails after upgrading
return switch (effect) {
case Effect.Pure<E,A> p -> ...
case Effect.Fail<E,A> f -> ...
case Effect.Suspend<E,A> s -> ...
// ... (all prior cases) ...
// missing: case Effect.Sleep<?> s -> ... ← compile error
};Since Effect is a public API and sealed interfaces enforce exhaustiveness at compile time, this is a source-breaking change. It should be called out explicitly in the v0.3.0 migration notes, noting that any custom EffectRuntime implementations must add a Sleep branch.
Phase 12: Greptile code quality fixes (HandlerEnv.empty static constant, forType @SuppressWarnings, Thread.sleep(Duration) precision fix). Phase 13: RELEASE_NOTES_0.3.0.md with breaking-change migration guide. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
HandlerEnv.empty() static constant, forType @SuppressWarnings, Thread.sleep(Duration) precision fix. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…is truncation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Version bump (build.gradle + README + PUBLISHING), CHANGELOG [0.3.0] entry, RELEASE_NOTES_0.3.0.md with features, breaking changes, migration checklist. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Highlights, breaking-change migration guide, known limitations, installation snippets, and full changelog compare link. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@greptileai fixed your comments, give me a confidence score to merge |
|
Confidence score: 72/100 Here's the breakdown of what's still open:
The two P1s are the blockers. For a library release ( Address the P1s and this is easily merge-ready. Tip: You can customize Greptile's behavior for this repo with |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@greptileai can you check for confidence now? |
No description provided.