Skip to content
CAI
Software that uses CAICheck a score

TimWSpence/cats-stm

50.1

Adequate · 20 September 2026

1.3k

lines of production code

Scala

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is a Software Transactional Memory (STM) library for the cats-effect ecosystem, providing transactional data structures such as TVar, TMVar, TQueue, and TDeferred. It enables optimistic concurrency control by allowing users to compose atomic transactions with automatic retry logic on contention. The library supports cross-platform execution across JVM, JavaScript, and Native environments and includes benchmarks and examples to demonstrate its usage.

Features

Add STM operation type constants for cross-platform support

A new \STMConstants\ object has been added to the \core/js-native\ source directory, defining integer constants (0–8) for various STM operations such as Pure, Alloc, Bind, HandleError, Get, Modify, OrElse, Abort, and Retry. This change supports cross-building the STM library for both JavaScript and Native platforms by providing shared constant definitions.

core/js-native · high confidence

Add STM usage examples for account transfers and the Santa Claus problem

The examples module now includes two new Scala files demonstrating the STM library in action. Main.scala provides a simple account transfer example between two users (Tim and Steve), illustrating basic TVar operations like get, modify, and check within a commit. SantaClausProblem.scala implements the classic concurrent programming puzzle, using STM transactions to manage gates and groups for elves and reindeer, showcasing more complex coordination patterns like join/await semantics and non-deterministic choice (orElse).

examples · high confidence

Added STM transaction benchmarks

A new benchmark suite has been added to measure the performance of STM (Software Transactional Memory) operations. The \TxnBenchmark\ class in \benchmarks/src/main/scala/io/github/timwspence/cats/stm/TxnBenchmarks.scala\ uses JMH to benchmark \get\, \set\, \bind\, and \orElse\ operations on \TVar\ instances, allowing users to track throughput and performance characteristics of the STM implementation.

benchmarks · high confidence

Added STM-like transactional memory abstractions

Introduced new core abstractions for software transactional memory (STM) in the shared codebase. The \STMLike\ trait provides the foundational interface for transactional variables (\TVar\) and transactional computations (\Txn\), including operations for committing, retrying, and error handling. Additionally, \TDeferred\ adds support for transactional deferred values, allowing threads to wait for a value to be completed within a transaction, with support for mapping and invariant transformations.

repository · high confidence

STM core implementation and transactional data structures

The core library now includes the STM runtime and a suite of transactional data structures (TVar, TMVar, TQueue, TSemaphore, TDeferred) along with their corresponding property and unit tests. This adds the foundational capability for optimistic concurrency control within the cats-effect ecosystem, allowing users to compose transactions that atomically update shared state with automatic retry logic on contention.

core/jvm, core/shared · high confidence

Removals

Removal of STM implementation and demo application

The STM (Software Transactional Memory) implementation files (STM.scala, TVar.scala) and the Main demo application have been removed from the source code. This eliminates the ability to use transactional variables and atomic commits within the application.

src/main/scala · high confidence

Behavioural changes

Major API overhaul and documentation site migration

The library has undergone a significant API rewrite that changes how transactions are executed and how the STM runtime is accessed. Users must now explicitly obtain an STM runtime instance via \STM.runtime\[IO\]\ and use its methods (e.g., \stm.commit\, \stm.check\) instead of the previous global \STM.atomically\ entry point. The API also introduces new convenience types like \TQueue\ and \TMVar\, and changes transaction creation from \TVar.make\ to \TVar.of\. Additionally, the project documentation has been migrated to Docusaurus, requiring a new build process via \sbt docs/docusaurusCreateSite\.

(repo-wide) · high confidence

Test coverage

Added property-based tests for STM transaction laws

Added a new test suite in the \laws\ module that validates the correctness of the STM implementation against standard functional programming laws. The tests verify that \Txn\ instances satisfy \Monoid\, \MonadError\, \MonoidK\, and \Defer\ laws, and that core STM operations (such as \get\, \set\, \retry\, and \abort\) adhere to expected algebraic properties like idempotency and commutativity.

laws · high confidence

Dependencies

Migrate to sbt-typelevel and upgrade core dependencies

The build system has been migrated to the sbt-typelevel plugin, which standardizes metadata (organization, licenses, developers) and enables cross-compilation for JVM, JS, and Native platforms. This change upgrades cats-effect from 1.2.0 to 3.6.3, cats-core to 2.10.0, and updates the test suite to use Munit 1.0.0-M11 with scalacheck-effect-munit 2.0.0-M2 and discipline-munit 2.0.0. The project now targets Scala 2.12.21, 2.13.16, and 3.4.1, and includes new subprojects for benchmarks, documentation, and examples.

(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 50.

Lenses

  • Code Health 93
  • Architecture 69
  • Maturity 36
  • Readiness 55
  • Security 64

Changes since last survey

  • 300 commits — 294 feature/other, 6 fixes

By area

  • (repo) — 129 commits
  • (root) — 65 commits
  • project/plugins.sbt — 46 commits
  • project/build.properties — 28 commits
  • .github/workflows — 23 commits
  • core/shared — 4 commits
  • laws/src — 3 commits
  • benchmarks/src — 1 commit
  • examples/src — 1 commit

Notable commits

  • fix: Revert commit(s) 6296d69
  • fix: Revert commit(s) 630b32f, 73c53dd
  • fix: Revert commit(s) 83f83f1, 144d534
  • fix: Revert commit(s) 89b8531
  • fix: Revert commit(s) b02e5e4
  • fix: Revert commit(s) d8b9257, cdb9065
  • change: Add 'Reformat with scalafmt 3.10.1' to .git-blame-ignore-revs
  • change: Add 'Reformat with scalafmt 3.10.2' to .git-blame-ignore-revs
  • change: Add 'Reformat with scalafmt 3.7.17' to .git-blame-ignore-revs
  • change: Downgrade munit-scalacheck because native
  • change: Downgrade scala-native again as things don't seem to be published for 0.5.x
  • change: Less boxing in TLog
  • change: Make scala 3 happy part 2
  • change: Make scala 3 happy part 3
  • change: Make scala 3 happy part 4
  • change: Merge branch 'main' into update/cats-effect-3.5.1
  • change: Merge branch 'main' into update/nscplugin-0.4.14
  • change: Merge branch 'main' into update/sbt-scalajs-1.12.0
  • change: Merge branch 'main' into update/sbt-scalajs-1.13.0
  • change: Merge branch 'main' into update/scala-library-2.12.18
  • …and 280 more

Architecture

  • 0 containers · 1 bounded contexts · 0 dependency edges (baseline)

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

Survey your own repository

TimWSpence/cats-stm 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 30e12ad1f67a6990821ee59c78d747e18ab4e222 — 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.