Skip to content
CAI
Software that uses CAICheck a score

tofu-tf/tofu

73.7

Strong · 20 September 2026

20.9k

lines of production code

Scala

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

Tofu is a Scala library that provides a unified kernel of concurrency primitives, error handling, and contextual execution abstractions, designed to interoperate seamlessly with Cats Effect, ZIO, and fs2. It features a modular architecture supporting Scala 2 and 3, offering comprehensive structured logging with automatic derivation and field masking, as well as utilities for database integration via Doobie and configuration management. The system focuses on providing type-safe, effect-agnostic tools for building robust functional applications across multiple runtime environments.

How it got here

2019 — Legacy API cleanup and migration

25 changes.

This period focused on removing a wide range of legacy typeclasses, effect types, and syntax extensions from the tofu core and related modules to eliminate custom abstractions. The project simultaneously overhauled its build system to support multiple Scala versions and migrated its documentation site to Astro, streamlining maintenance and modernizing the developer experience.

2021 — kernel expansion and Scala 3 migration

21 changes.

This period focused on significantly expanding the Tofu kernel module with new typeclasses for parallelism, error handling, context management, and time abstractions. Concurrently, the codebase underwent a major migration to Scala 3, replacing deprecated libraries with automatic typeclass derivation and introducing carrier abstractions to support both Cats Effect 2 and 3. The logging subsystem was also modernized with structured logging, field masking, and interop modules, accompanied by comprehensive test coverage for these new kernel and logging features.

2022 — Cats Effect 3 and Scala 3 migration

22 changes.

This period focused on migrating the codebase to support Cats Effect 3 and Scala 3, introducing dedicated interop modules for both runtime versions. Significant work included refactoring core concurrency primitives, updating the Doobie integration, and implementing Scala 3-specific kernel and derivation logic. The effort was complemented by expanded test coverage and new examples demonstrating the updated capabilities across Cats Effect and ZIO ecosystems.

2024–2025 — Scala 3 migration and interop expansion

6 changes.

This period focused on extending the tofu library's compatibility with Scala 3 by implementing kernel-level support for cats-effect and enhancing logging derivation using Magnolia 1. It also broadened ecosystem integration by adding comprehensive interop modules for ZIO 2 and log4cats, alongside new annotation-based controls for log field masking.

Features

Add Cats Effect 3 interop for fs2 streams

The fs2 interop module now supports Cats Effect 3 alongside the existing Cats Effect 2 implementation. This adds a new \ce3\ source tree containing type-class instances (such as \Lift\, \Chunks\, \Merge\, \Compile\, \Pace\, \Temporal\, \Region\, and \Broadcast\) that allow tofu's stream abstractions to work with \fs2.Stream\ under Cats Effect 3. The implementation adapts to CE3-specific APIs, such as using \Resource.ExitCase\ instead of \ExitCase\[Throwable\]\ for resource management and updating higher-kinded type lambdas for Scala 3 compatibility. Corresponding syntax helpers and compile-time tests are also provided to ensure type-class instances are correctly resolved.

modules/interop/fs2 · high confidence

Add Cats Effect 3 interop layer

This change introduces a new \ce3\ module providing interop support for Cats Effect 3. It includes implementations for core concurrency primitives such as Agents, SerialAgents, and Permits built on top of Cats Effect's Ref and Semaphore, as well as carriers for kernel features like timeouts, fibers, and scoped execution. The update also adds utilities for lifting effects between type constructors and provides syntax extensions for bracket operations and scoped execution.

modules/core/ce3/src/main · high confidence

Add ELK-compatible JSON logging layout with custom fields and argument grouping

Introduces a new \ELKLayout\ for Logback that outputs structured JSON compatible with Logstash, allowing users to merge, group, or collect logging arguments into specific fields. The layout supports injecting static custom fields via a \\<customFields\>\ XML tag and provides a \ConsoleContextLayout\ to expose context markers and logged values in MDC for pattern-based layouts. This change adds the core layout implementation, JSON parsing utilities for custom fields, and the underlying \EventLoggable\ logic to handle built-in event data, markers, arguments, and exceptions.

modules/logging/layout · high confidence

Add Logstash Logback encoder integration for structured logging

Users can now integrate the tofu logging library with Logstash via a new \logstash-logback\ interop module. This adds a \TofuLoggingProvider\ that extends Logback's \AbstractJsonProvider\, enabling structured JSON serialization of log events. The provider automatically serializes logged values and context markers into the JSON output, allowing users to leverage Logstash's JSON parsing capabilities with tofu's context-aware logging system.

modules/logging/interop/logstash-logback · high confidence

Add Scala 2 ZIO 1.x interop and logging support

This change introduces the \modules/interop/zio1\ module for Scala 2, providing a comprehensive bridge between the Tofu effect system and ZIO 1.x. It adds core typeclass instances (such as \Errors\, \Start\, \Concurrent\, and \WithRun\) that allow ZIO effects to be used seamlessly within Tofu abstractions, along with a dedicated logging subsystem (\ZLogs\) that integrates ZIO's environment model with Tofu's structured logging and context propagation. The implementation includes ZIO-specific concurrent primitives (like \QVar\ and \Agent\ wrappers) and ensures type-safe context handling via ZIO's \Has\ service layer.

modules/interop/zio1 · high confidence

Add Scala 2-specific config and environment utilities

This change introduces new Scala 2-specific source directories (scala-2) for the config and env modules, adding core configuration parsing logic (ConfigItem, Configurable, ConfigError) and environment-aware monadic execution (Env, EnvBio). The config module provides type-safe parsing of Typesafe Config files into domain objects using Magnolia derivation, while the env module offers a context-aware monad built on Monix Task with support for parallel traversal, error handling, and memoization. These additions are specific to Scala 2 and do not affect Scala 3 code paths.

modules/util · high confidence

Add Scala 3 support for logging and Show derivation

The logging derivation module now supports Scala 3, introducing new implementation files that leverage Magnolia 1 and Scala 3's \Mirror\ for automatic derivation. This enables automatic generation of \Loggable\ instances for logging and \Show\ instances for string representation, including support for masking sensitive fields and handling sealed traits. Users can now use the \derived\ method in Scala 3 to automatically derive logging and show behaviors for case classes and sealed traits.

modules/logging/derivation/src/main/scala-3 · high confidence

Add ZIO 2 interop instances and functions

The \modules/interop/zio2/core\ module now provides a comprehensive set of typeclass instances and utility functions to integrate ZIO 2 with the tofu library. This includes implementations for \ZioTofuInstance\, \RioTofuInstance\, \ZioTofuWithRunInstance\, \ZioTofuBiInstance\, and others, enabling features like error handling, resource management, and environment access. The module also exposes \zioFunctions\ for exposing ZIO effects and \zioOptics\ for environment optics, along with corresponding implicit definitions in \implicits.scala\ to make these instances available automatically.

modules/interop/zio2/core · high confidence

Add ZIO 2 logging examples with structured context and ELK formatting

The examples/zio2 directory now includes a complete logging demonstration for ZIO 2, featuring a logback configuration that outputs structured logs in ELK format via the ConsoleAppender. The example code showcases how to attach custom logging contexts (such as user details, request IDs, and counts) to ZIO effects using ZLogAnnotation, manage logging spans for timing, and integrate these features with ZIO's dependency injection layers.

examples/zio2 · high confidence

Add ZIO 2 logging interop with structured context support

This change introduces a new logging interop module for ZIO 2, providing a \TofuZLogger\ that bridges ZIO's logging infrastructure to SLF4J. It enables structured logging by capturing ZIO-specific context such as \LogSpan\s and annotations alongside tofu's own \ZLogAnnotation\ values. The module exposes \ZLogs\ and \ZLogging\ layers (plain, contextual, and with custom context providers) and includes a \ZLogAnnotation\ API for attaching typed, structured data to the log context via ZIO aspects.

modules/interop/zio2/logging · high confidence

Add cats-mtl interop layer for Tofu kernel

This change introduces a new interop module that bridges Tofu's kernel abstractions (WithContext, WithLocal, Raise, Errors) with the corresponding cats-mtl typeclasses (Ask, Local, Raise, Handle). It provides both explicit conversion functions and implicit derivation instances, allowing users to seamlessly use Tofu's context and error-handling capabilities with libraries expecting cats-mtl interfaces, and vice versa.

modules/kernel/interop · high confidence

Add field masking and annotation-based filtering to log derivation

The logging derivation module now supports masking sensitive fields in log output and ignoring specific optional fields. Users can apply masking modes (such as full masking, regex-based masking, or custom functions) to individual fields using annotations, and can use the \ignoreOpt\ annotation to exclude \None\ values from the log output entirely. This is exposed via the new \loggable\ and \show\ derivation objects.

modules/logging/derivation/src/main/scala · high confidence

Add implicit conversion from tofu Logging to log4cats StructuredLogger

The \log4cats-legacy\ interop module now provides an implicit conversion that allows a \tofu.logging.Logging\[F\]\ instance to be used directly as a \log4cats.StructuredLogger\[F\]\. This enables users to seamlessly integrate tofu's logging infrastructure with libraries expecting log4cats interfaces, supporting all standard log levels (trace, debug, info, warn, error) including context maps and exception causes.

modules/logging/interop/log4cats-legacy · high confidence

Add interop modules for log4cats and refined

New interop modules have been added to support integration with external libraries. The log4cats module provides an implicit conversion from the project's Logging abstraction to log4cats' StructuredLogger, enabling structured logging capabilities. The refined module adds a Loggable instance for refined types, allowing values wrapped in refined types (such as PosInt, PosLong, and NonEmptyString) to be logged by unwrapping them to their underlying base types.

modules/logging/interop/log4cats, modules/logging/interop/refined · high confidence

Added Scala 2 example applications for logging and database integration

The ce2 example module now includes runnable Scala 2 applications demonstrating tofu's logging and database capabilities. This adds a cargo-transport web server example (using http4s) that showcases three logging styles—simple, service-based, and auto-derivation—along with a Doobie-based example for transactional database operations. A logback configuration is also provided to output logs in both plain text and structured JSON formats.

examples/ce2 · high confidence

Added Scala 2-specific Shapeless tagged type logging support

The logging interop module now includes Scala 2-specific implementations for handling Shapeless tagged types. A new implicit derivation allows \Loggable\ instances to be automatically created for tagged types (e.g., \Int @@ Tag\), ensuring they log their underlying value correctly. This change is part of the preparation for Scala 3 compatibility by isolating Scala 2-specific syntax and dependencies into the \scala-2\ source directory.

modules/logging/interop/shapeless · high confidence

Added random and UUID generation capabilities

The tofu kernel now includes new \GenRandom\ and \GenUUID\ typeclasses that allow generating random numbers and UUIDs within an effect context. \GenRandom\ provides methods for generating random longs and integers, supporting both standard and secure random sources, while \GenUUID\ offers a method for generating random UUIDs and their string representations. Both generators are designed to work seamlessly with various Cats data types like \Kleisli\, \OptionT\, \EitherT\, \StateT\, \IorT\, \ContT\, \WriterT\, and \RWST\ through provided implicit instances.

modules/kernel/src/main/scala/tofu/generate · high confidence

Cats Effect 2 interop layer for core concurrency primitives

This change introduces a new \ce2\ module that provides Cats Effect 2 implementations for tofu's core concurrency abstractions. It adds specific carriers and syntax for \Ref\, \Semaphore\, \Agent\, \SerialAgent\, \Permit\, \QVar\, and \Atom\, allowing these primitives to be backed by Cats Effect 2 types (e.g., \Ref\[F, A\]\, \Semaphore\[F\]\). The implementation includes interop classes like \SemRef\ and \PermitSemaphore\ to bridge tofu's internal types with Cats Effect 2, and adds syntax extensions for lifting these concurrent structures between effect types.

modules/core/ce2/src/main · high confidence

Introduce logging derivation annotations for field masking and visibility control

A new \derivation-annotations\ module has been added to the logging library, providing Scala annotations to control how case class fields are serialized in logs. Users can now apply \@hidden\ to exclude fields entirely, \@masked\ (with modes like Full, Erase, or custom patterns) to redact sensitive data, \@unembed\ to flatten nested structures, and \@ignoreOpt\ to suppress None values from output.

modules/logging/derivation-annotations · high confidence

Introduce new streams module with core abstractions and syntax

The \modules/streams\ area now provides a comprehensive set of streaming abstractions and corresponding syntax extensions. Core traits include \Broadcast\ for concurrent fan-out, \Chunks\ for batched processing, \Compile\ for folding and draining streams, \Emits\/\Evals\ for lifting effects, \Merge\ for interleaving, \Pace\ for throttling and delaying, \ParFlatten\ for concurrent flattening, \Region\ for resource management, and \Temporal\ for time-based grouping. These are exposed via a unified \tofu.syntax.streams.all\ syntax object, enabling fluent operations like \broadcast\, \chunks\, \drain\, \eval\, \merge\, \throttled\, and \groupWithin\ on effect types. The module also includes Scala 2.12, 2.13, and 3 specific internal implementations to handle collection factory compatibility.

modules/streams · high confidence

Introduces kernel-level time, clock, sleep, timezone, and timeout abstractions

The kernel module now provides a comprehensive set of time-related typeclasses (\Clock\, \Sleep\, \TimeData\, \TimeZone\, and \Timeout\) that wrap Java time APIs in a pure, effect-system-agnostic way. \Clock\ exposes real-time and monotonic clock access, \Sleep\ handles duration-based pauses, \TimeData\ facilitates conversion between \Instant\ and various Java 8 date-time types (like \ZonedDateTime\ or \LocalDate\) respecting time zones, and \TimeZone\ offers system and available zone management. \Timeout\ adds support for \timeoutTo\ operations. All abstractions include automatic support for Cats transformer stacks (e.g., \Kleisli\, \OptionT\, \EitherT\, \StateT\), allowing time operations to work seamlessly within complex effect compositions.

modules/kernel/src/main/scala/tofu/time · high confidence

New CalcM effect type with tail-recursive execution

The kernel module introduces CalcM, a new bi-functor-based effect type for computations that combine state, errors, and resource requirements, along with its supporting infrastructure (Calc, Flux, Embedded, and CalcT). CalcM provides a stack-safe, tail-recursive execution model via runTailRec and runTailRecSingle, ensuring that deep recursive computations do not cause stack overflows. It includes instances for MonadError, Bind, and Bitraverse, and supports state translation and local context modification, enabling users to build complex, composable data-processing pipelines with guaranteed tail-call optimization.

modules/kernel/src/main/scala/tofu/data · high confidence

New Console and Display abstractions in the kernel

The \tofu.common\ package now includes a \Console\ trait and implementation that wraps standard input/output streams using the \Delay\ effect, allowing users to perform IO-bound console operations in a generic effect context. Additionally, a \Display\ type class has been introduced to provide configurable, performant string conversion for various Scala types (including primitives, collections, and options), extending Cats' \Show\ with features like custom separators, indentation, and bracket styles. These additions are re-exported in the \tofu.common\ package object alongside existing \TimeData\ and \TimeZone\ types.

modules/kernel/src/main/scala/tofu/common · high confidence

New Tofu-Doobie example with structured logging and CE3 migration

The examples/ce3 module now includes a complete Tofu-Doobie integration example (TofuDoobieExample.scala) demonstrating database operations with Cats Effect 3, including transactional storage of persons and departments. The example uses doobie 1.0.0-RC13 with the new LogHandler\[F\[\_\]\] API for structured logging, replacing the previous tofu embed log handler. A new logback.groovy configuration file provides both plain-text and JSON (ELK) logging appenders to support structured log output.

examples/ce3 · high confidence

New and reorganized syntax extensions in the kernel module

The \tofu.syntax\ package has been reorganized into the \modules/kernel\ module, with several files (either, monadError, optics, timeout) moved from core. This change introduces a comprehensive suite of new syntax extensions for collections (including \mapAccumL\, \scanL\, \foldWhileM\), context management (\ask\, \local\, \runContext\), error handling (\raise\, \handle\, \attempt\), and effectful option/either types (\foption\, \feither\, \fior\). It also adds syntax for parallel execution (\parReplicate\, \parTraverseN\), resource guarantee (\bracket\, \guarantee\), and scoped execution (\scoped\, \blocking\, \calculation\), while updating existing syntax like \timeout\ to use the new \FindRaise\ mechanism.

modules/kernel/src/main/scala/tofu/syntax · high confidence

New documentation site built with Astro and Starlight

The project website has been replaced with a new documentation site powered by Astro and the Starlight theme. This change introduces a structured documentation layout with autogenerated sections for Core, Logging, Contextual, Concurrent, Higher-Kind, Optics, Utilities, and Streams, along with a blog feature and a link validator. The site configuration sets the deployment base to '/tofu' and includes a custom theme, favicon, and social links to GitHub, Telegram, and Javadoc. Visual assets, including the Tofu logo and an optics hierarchy diagram in both light and dark modes, have been added to support the new documentation content.

website · high confidence

New internal kernel infrastructure for context handling and type derivation

The \tofu.internal\ package in the kernel module has been expanded with several new foundational components. \ContextBase\ introduces a hierarchy of implicit instances (\ContextBaseInstances1\ through \5\) that provide \WithRun\, \WithLocal\, \WithProvide\, \WithContext\, and \Unlift\ capabilities for \ReaderT\-wrapped effects, enabling more flexible context propagation. New type-companion traits (\DataEffectComp\, \EffectComp\, \Effect2Comp\, \Effect3Comp\, \DataComp\) are added to streamline type-class instance resolution. Additionally, \FoldableStream\ provides a lazy, foldable stream structure backed by \Eval\, while \NonTofu\ and \IsTofu\ offer workaround implicits for Scala 2.12 derivation and type prioritization. The \CachedMatcher\ and \Newtype1Covariant\ files were moved from the core module to the kernel module.

modules/kernel/src/main/scala/tofu/internal · high confidence

New kernel typeclasses for parallelism, error handling, and contextual execution

The kernel module introduces several new typeclasses to expand effect capabilities. BoundedParallel adds parTraverse and parTraverseN for bounded concurrent traversal. Errors provides a structured API for raising, handling, and recovering from errors via Raise, Handle, and Restore traits. Fire and Race enable fire-and-forget execution and race conditions. Perform replaces UnliftIO with PerformVia for managing continuations and cancellation. Contextual execution is modernized with WithContext, WithLocal, WithProvide, and WithRun, which deprecate the older Context, Local, and Provide traits to improve type inference. Additionally, Guarantee offers bracket-style finalization, Delay supports lazy evaluation, Init handles initialization, and Scoped allows for scoped transformations like blocking or calculation isolation.

modules/kernel/src/main/scala/tofu · high confidence

Project initialization and documentation overhaul

The repository has been initialized with a comprehensive set of configuration files, including a Dockerfile and docker-compose.yml for local development, .jvmopts to set a 4GB heap limit, and updated .scalafmt.conf enforcing Scala 2.13/3 dialects and version 3.8.6. The README has been significantly expanded to include build badges, a detailed module list (such as tofu-logging and tofu-doobie), adopter logos, and contributing guidelines, while supporting files like CODEOWNERS, CONTRIBUTORS.md, and .scala-steward.conf have been added to streamline maintenance.

(repo-wide) · high confidence

Scala 2 logging derivation implementation added

The logging derivation module now includes a dedicated Scala 2 implementation located in the \scala-2\ source directory. This adds concrete derivation logic for \Loggable\ and \Show\ typeclasses using Magnolia 1, enabling automatic logging and string representation generation for case classes and sealed traits. It also provides default derivation mechanisms for unary and binary effect algebras (including custom log levels and error reporting) via the \loggingMid\, \loggingMidTry\, and \loggingBiMid\ objects, ensuring Scala 2 users have access to the same automatic logging capabilities as other supported versions.

modules/logging/derivation/src/main/scala-2 · high confidence

Scala 2-specific typeclass derivation implementations added

The \modules/derivation\ module now includes Scala 2-specific implementations for automatic typeclass derivation using Magnolia 1. This adds derived instances for \Display\ (with configurable indentation and field labels), \Merge\ (semigroup-style merging for case classes, options, and primitives), \Init\, and higher-kinded operations like \RepresentableK\, \Embed\, and \ContextEmbed\. These changes enable automatic derivation of these typeclasses for Scala 2 users, supporting nested structures and complex data types.

modules/derivation · high confidence

Scala 3 kernel implementation for cats-effect interop and typeclass instances

This change introduces the Scala 3-specific implementation of the tofu kernel module, enabling support for both cats-effect 2 and cats-effect 3. It adds a macro-based interop layer (\Interop\) that delegates to the respective cats-effect kernels at compile time, and provides carrier macros for core capabilities such as fibers, scoped execution, delays, time operations, and concurrent primitives (Atoms, QVars, Agents, Permits). Additionally, it implements \RepresentableK\ instances for various effect types to support higher-kinded transformations, ensuring the kernel functions correctly on Scala 3.

modules/kernel/src/main/scala-3 · high confidence

Removals

Removal of ELKLayout for Logback integration

The ELKLayout class, which previously formatted Logback logging events into a structure suitable for the ELK stack (Elasticsearch, Logstash, Kibana), has been removed from the codebase. This change eliminates the specific layout implementation that handled timestamp, logger name, thread name, level, message, markers, arguments, and exception details for Logback-based logging configurations.

logging/layout · high confidence

Removal of Embed type class

The \Embed\ type class, which previously provided an \embed\ method for transforming \F\[T\[F\]\]\ into \T\[F\]\ using a \FlatMap\ instance, has been removed from the codebase.

core/src/main/scala/tofu/higherKind · high confidence

Removal of EmbedLogging and SyncLogging implementations

The \EmbedLogging\ and \SyncLogging\ classes in the structured logging implementation have been removed. This eliminates the specific logging adapters that previously wrapped underlying loggers using \FlatMap\ and \Sync\ effects respectively, changing how logging operations are executed within the \tofu.logging.impl\ package.

logging/structured/src/main/scala/tofu/logging/impl · high confidence

Removal of GenRandom and GenUUID typeclasses

The \GenRandom\ and \GenUUID\ typeclasses, along with their companion objects and implementations, have been removed from the \tofu.generate\ package. This eliminates the ability to generate random 8-bit numbers, integers within a range, and UUIDs within the \F\ effect type using these specific abstractions.

core/src/main/scala/tofu/generate · high confidence

Removal of Lift and Unlift typeclasses

The Lift and Unlift typeclasses, along with their companion objects containing implicit instances (such as the ReaderT derivation), have been removed from the core library. This eliminates the ability to explicitly lift effects between different monadic contexts or unwrap nested effect layers using these specific abstractions.

core/src/main/scala/tofu/lift · high confidence

Removal of Selective typeclass from tofu.control

The \Selective\ typeclass and its implementation in \tofu.control\ have been removed from the codebase. This eliminates the \select\, \selectRight\, \orElses\, \whens\, and \unlesss\ methods previously provided by this trait, along with the associated \optionMonoid\ instance. Users relying on this specific control abstraction for handling optional effects within the \F\[\_\]\ context will no longer have access to these operations via this module.

core/src/main/scala/tofu/control · high confidence

Removal of custom parallelism typeclasses and syntax

The \Paralleled\ and \Splitting\ typeclasses, along with their corresponding syntax extensions (\paralleled.scala\ and \splitting.scala\), have been removed from the \parallel\ module. This eliminates the library's custom abstraction for parallel execution and non-empty parallel operations, meaning users can no longer use these specific typeclasses or their associated extension methods (such as \parSequence\, \parTraverse\, and \parMapN\ variants) provided by this component.

parallel · high confidence

Removal of deprecated memoization API

The deprecated \Memoize\ typeclass, its associated syntax extensions (\cached\, \cachedUnsafe\), and the \Task\ instance have been removed from the \memo\ module. Users must migrate to the \Cached\ and \CachedFunc\ abstractions that replaced these APIs in version 0.4.18.

memo · high confidence

Removal of legacy ConcurrentOps and Daemon/Actor abstractions

The \ConcurrentOps\ object, which provided \limitedTraverse\ for batched parallel traversal, has been removed. Additionally, the \Daemon\ and \Actor\ types (including the \Daemonic\ typeclass and associated syntax) have been deleted from the codebase, eliminating the previous mechanism for running background processes and implementing actor-style message passing.

concurrent/src/main · high confidence

Removal of legacy Context, Errors, and concurrency typeclasses

The \Context\, \Errors\, \Execute\, \Fire\, \Guarantee\, \Timeout\, and \MakeRef\ typeclasses and their associated instances have been removed from the \tofu\ core package. This deletion eliminates the library's previous custom abstractions for environment context (\Context\/\Local\/\RunContext\), error handling (\Raise\/\Handle\/\Errors\), and concurrency primitives (\Fire\/\Start\/\Race\/\Timeout\), requiring users to migrate to the underlying Cats Effect types (such as \ReaderT\, \ApplicativeError\, and \Concurrent\) or newer tofu abstractions that replace these deleted components.

core/src/main/scala/tofu · high confidence

Removal of legacy logging typeclasses and factories

The \Loggable\, \Logging\, and \Logs\ typeclasses and their companion objects have been removed from the \tofu.logging\ package. This eliminates the previous API surface for defining custom log value representations, creating service-based or context-aware logging instances, and managing logging providers via the \Logs\ abstraction, effectively cleaning up deprecated or unused logging infrastructure in favor of newer implementations.

logging/structured/src/main/scala/tofu/logging · high confidence

Removal of legacy optics classes and Monocle interop

The \optics/core\ module has removed its legacy polymorphic optics hierarchy (including \PContains\, \PEquivalent\, \PSubset\, \PProperty\, \PItems\, \PFolded\, \PReduced\, \PRepeated\, \PDowncast\, \PUpcast\, \PExtract\, and \PUpdate\) along with supporting classes like \PSame\, \PChoice\, and \Category2\. Additionally, the \optics/interop\ module, which provided bidirectional conversion between these legacy optics and Monocle types (such as \Iso\, \Lens\, \Prism\, \Traversal\, \Fold\, and \Getter\), has been deleted. This change eliminates the legacy API surface and its external dependencies on Monocle.

optics/core · high confidence

Removal of legacy syntax extension objects

The \bracket\, \concurrent\, \consume\, \context\, \error\, \fire\, \functionK\, \lift\, and \selective\ syntax objects in \core/src/main/scala/tofu/syntax\ have been removed. This eliminates the implicit classes and extension methods previously provided by these modules (such as \bracketIncomplete\, \focused\ on \Ref\, \raise\/\handle\ operations, and \lift\ for effect types), requiring users to adopt the updated syntax APIs or dependencies that now provide these capabilities.

core/src/main/scala/tofu/syntax · high confidence

Removal of manual Magnolia-based logging derivation

The manual implementation of \Loggable\, \Show\, and related annotations (\hidden\, \masked\, \unembed\) in the derivation module has been removed. This deletes the custom Magnolia-based macro logic that previously handled field filtering, masking, and structural logging, indicating a shift away from this specific derivation approach in favor of other mechanisms.

logging/derivation/src/main · high confidence

The \Calc\ data type, which provided a stateful computation DSL with support for reading, writing, error handling, and deferred execution, has been removed from the \tofu.data\ package. Consequently, the \ICalc\ type alias and the \PArray\ alias defined in \data.scala\ are no longer available, breaking any code that relied on this specific effect type for managing state and errors.

data · high confidence

Removal of the legacy \`Env\` effect type

The \Env\ trait and its associated companion object methods (in \EnvFunctions\) and traversing utilities (in \EnvTraversing\) have been removed from the codebase. This eliminates the previous \Env\[E, A\]\ abstraction that wrapped Monix \Task\ execution with an environment context, along with its syntax for sequencing, traversing, and error handling. Users relying on this specific effect type will need to migrate to the current implementation.

env/src/main · high confidence

Behavioural changes

Carrier abstractions for kernel capabilities

The kernel module now provides carrier traits for core capabilities (such as Fibers, Finally, ScopedExecute, Time, and Concurrent primitives) that bridge the gap between Cats Effect 2 and Cats Effect 3. These carriers allow the library to abstract over the different runtime requirements of each Cats Effect major version, ensuring that kernel-level features like agents, atoms, and parallelism work correctly regardless of the underlying effect type.

modules/kernel/src/main/scala/tofu/internal/carriers · high confidence

Doobie module refactored for Cats Effect 3 and Doobie 1.0 compatibility

The doobie integration has been restructured to support Cats Effect 3 and Doobie 1.0-RC13. The core database effect types (ConnectionCIO, ConnectionRIO) and the Txr transactor facade have been updated to use the new Cats Effect 3 APIs (e.g., MonadCancelThrow instead of BracketThrow) and the new Doobie package structure (org.typelevel.doobie). Logging capabilities have been adapted to the new Doobie 1.0 LogHandler API, including support for batch parameters and statement labels in log events. The module now provides separate implementations for Cats Effect 2 (core-ce2) and Cats Effect 3 (core-ce3) to maintain backward compatibility.

modules/doobie · high confidence

Introduces Unlift and Rebase abstractions for effect transformation

The kernel module now provides the \Unlift\ and \Rebase\ typeclasses to manage transformations between different effect types. \Unlift\ serves as a successor to \UnliftIO\, enabling bidirectional lifting and unlifting between effect contexts (e.g., \F\ to \G\ and back), while \Rebase\ allows transforming higher-kinded structures across different effect layers using \FunctorK\ or \Embed\. This change also includes a migration of \IsoK\ to the kernel module and updates its syntax imports to align with the new \funk\ syntax package.

modules/kernel/src/main/scala/tofu/lift · high confidence

Kernelized concurrent data structures and added Permit type

The concurrent module has been refactored to move core data structures—Agent, SerialAgent, Atom, QVar, and the new Permit type—into the kernel. This change introduces a unified creation pattern using \Make\ type aliases and companion objects (e.g., \Agent.Make\, \Atom.Make\) that support both same-effect and cross-effect construction, while deprecating the older \Agents\ and \SerialAgents\ objects. The new \Permit\ type provides a purely functional semaphore with cancelable blocking, and \QVar\ gains a conversion to \Atom\ via \toAtom\. These changes standardize how concurrent state and synchronization primitives are instantiated and used within the library.

modules/kernel/src/main/scala/tofu/concurrent · high confidence

Migrate concurrent-ce2 module to Scala 2 source directory

The \modules/core/concurrent-ce2\ module has been reorganized to support Scala 2 explicitly by moving its source files into the \src/main/scala-2\ directory. This change accompanies the broader project preparation for Scala 3, ensuring that Scala 2-specific code is isolated. The diff shows the creation of new Scala 2 source files for core concurrent abstractions like \ContextT\, \Daemon\, \Gatekeeper\, and various syntax helpers, alongside the relocation of existing files like \MakeDeferred\ and \MakeMVar\ into this new structure. This is a structural change to the build layout rather than a change in runtime behavior for users of the Scala 2 version.

modules/core/concurrent-ce2 · high confidence

Migration to Scala 3 and Cats Typeclass Derivation

The tofu.control module has been migrated to Scala 3, replacing the deprecated simulacrum library with tofu.internal.EffectComp for automatic typeclass instance derivation. This change removes the @typeclass annotations from traits such as Consume, ContravariantFilter, Optional, Partial, and Switch, while introducing new control abstractions including Selective (with support for OptionT, EitherT, ReaderT, and WriterT), ApplicativeZip, and a suite of delegate implementations (FunctorDelegate, ApplyDelegate, ApplicativeDelegate) to streamline typeclass composition.

modules/kernel/src/main/scala/tofu/control · high confidence

New QVarSM implementation for queue-based variable semantics

The QVarSM abstract class has been added to the kernel module, providing a new state-machine implementation for the QVar concurrent variable. This change introduces a manual request queue with controlled offsets to manage read and take operations, allowing for more precise handling of pending requests and cancellation scenarios compared to previous implementations.

modules/kernel/src/main/scala/tofu/concurrent/impl · high confidence

Reorganized enumeratum logging interop module structure

The \LoggableEnum\ trait has been moved from the \enums\ directory to the \modules/logging/interop/enumeratum\ location, aligning with the project's new modular structure for logging interop libraries. This change reorganizes the codebase to better separate concerns, placing the enumeratum-specific logging logic alongside other logging integrations rather than in a generic enums folder.

modules/logging/interop/enumeratum · high confidence

Scala 2-specific macro interop for Cats Effect 2 and 3

The kernel module now includes Scala 2-specific macro implementations that delegate to Cats Effect 2 and 3 kernels. This adds macro-based carriers and instance resolution for core capabilities—including scoped execution, concurrent structures (atoms, QVars, agents, permits), timing (clock, sleep, timeout), and parallelism (fibers, fire, race)—ensuring these features are correctly wired for both Cats Effect 2 and 3 runtimes.

modules/kernel/src/main/scala-2 · high confidence

Scala 3 support for the higherKind kernel module

The higherKind module now supports Scala 3 alongside Scala 2.12 and 2.13. This change introduces version-specific source directories (scala-2.12, scala-2.13, scala-3) to handle language differences, including updated compatibility shims for types like LazySeq and annotation aliases. It also provides Scala 3-specific implementations for syntax helpers like funk (using ContextNT instead of the Scala 2 Arbitrary pattern) and higher-kinded macros, ensuring that type class derivation and function transformations work correctly across all supported Scala versions.

modules/kernel/higherKind · high confidence

Structured logging module refactored for Scala 3 support and new type-safe annotations

The structured logging module has been updated to support Scala 3, introducing version-specific source files (scala-2.12, scala-2.13, and scala-3) to handle macro and typeclass differences. Key additions include \LogAnnotation\ for type-safe logging of specific field types, \SingletonEnumLoggable\ for compile-time enum case name collection in Scala 3, and \LocationMacroInstances\ for macro-based location-aware logging in both Scala 2 and 3. The \Logging\ and \Logs\ traits have been restructured with new \RepresentableK\ instances and middleware support (\LoggingMid\), while \Loggable\ instances now provide more granular control over field naming and masking.

modules/logging/structured/src/main · high confidence

Test coverage

Added Scala 3-specific tests for derived logging and singleton enums; Added comprehensive test suite for Cats Effect 3 core modules; Added comprehensive test suites for Cats Effect 2 core modules; Added test coverage for structured logging components; Added test suites for kernel components; Added tests for derived loggable samples and logging middleware behavior; Added tests for location-aware logging syntax; Added tests for logging derivation, masking, and discrimination; Removed ReadWriteTests; Removed obsolete RaiseSute test file; Removed stack-safety tests for Env monad operations; Removed test file Apple.scala; Removed test suite for derived loggable serialization.

Dependencies

Major build system and dependency overhaul

The project's build configuration has been significantly updated: SBT has been upgraded from version 1.3.0-RC2 to 1.11.7, and the plugin suite has been refreshed (including sbt-scalafix, sbt-mdoc, sbt-typelevel-sonatype, sbt-scalafmt, sbt-tpolecat, sbt-ci-release, and sbt-projectmatrix). The dependency definitions have been completely rewritten to support Scala 2.12, 2.13, and 3.3, introducing versioned artifacts for Cats (2.13.0), Cats Effect (2.5.5 and 3.7.0), Circe (0.14.15), Doobie (0.13.4 and 1.0.0-RC13), ZIO (1.0.18 and 2.1.24), and Log4cats (1.7.0 and 2.7.1), while also adding new dependencies like Glass, Kind-Projector, and Better Monadic For.

project · high confidence

Website migrated to Astro and Starlight

The documentation site has been rebuilt using Astro 5.16.1 and the Starlight theme (0.35.1), replacing the previous Docusaurus setup. This change introduces new dependencies for image optimization (sharp 0.34.2), blog functionality (starlight-blog 0.24.0), and link validation (starlight-links-validator 0.17.0) to the website build.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 74.

Lenses

  • Code Health 97
  • Architecture 94
  • Maturity 69
  • Readiness 75
  • Security 71

Changes since last survey

  • 300 commits — 272 feature/other, 28 fixes

By area

  • (repo) — 139 commits
  • project/Dependencies.scala — 66 commits
  • project/plugins.sbt — 18 commits
  • .github/workflows — 15 commits
  • (root) — 12 commits
  • modules/logging — 12 commits
  • modules/core — 10 commits
  • modules/kernel — 5 commits
  • modules/doobie — 4 commits
  • website/src — 4 commits
  • docs/logging — 3 commits
  • modules/interop — 3 commits
  • project/build.properties — 3 commits
  • .github/mergify.yml — 1 commit
  • docs/tofu.logging.recipes.auto.md — 1 commit
  • modules/util — 1 commit
  • website/astro.config.mjs — 1 commit
  • website/package-lock.json — 1 commit
  • website/static — 1 commit

Notable commits

  • fix: Fix DerivedLoggableScala3Suite for Scala 3.4.1 and higher
  • fix: Fix bug with zioTofuBiInstance, add tests for zio2-core module, add logging mid test with bug related function for zio2 logging.
  • fix: Fix compilation
  • fix: Fix review comments - rename PermitSem to PermitSemaphore
  • fix: Fix symbol exists check, update tpolecat plugin.
  • fix: Fix test name
  • fix: Fix tofu module publishing. (#1370)
  • fix: Merge pull request #1188 from Mee-Tree/fix/masking
  • fix: Merge pull request #1283 from Grryum/zio2-withrun-instance-fix-with-test
  • fix: Merge pull request #1323 from susliko/fix-logging-representablek
  • fix: Merge pull request #1427 from tofu-tf/fix-site-deploy
  • fix: Merge pull request #1428 from tofu-tf/fix-site-deploy
  • fix: Merge pull request #1471 from Equwece/fix-loggable-enum-tests
  • fix: Revert "without base"
  • fix: fix funK scala3 type infer (#1335)
  • fix: fix javadoc link (#1440)
  • fix: fix mdoc
  • fix: fix: Masking for contramapped loggables
  • fix: fix: avoid compiler issue related to missing ref to symbol from provided dependency (#1367)
  • fix: fix: avoid double docs uplooad to gh-pages (#1368)
  • …and 280 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

tofu-tf/tofu was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 20 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 1e8fca4f9a7fe165076100bee5b3ce99526e65b7 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-b51f968c9b10.