Skip to content
CAI
Software that uses CAICheck a score

jet/FsCodec

66.7

Adequate · 3 October 2026

1.8k

lines of production code

F#

primary language

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

FsCodec is an F\# library that provides extensible serialization and compression capabilities for event-sourced systems. It supports multiple backends, including System.Text.Json and Newtonsoft.Json, while offering conditional Brotli compression and in-memory boxing for efficient testing. The system handles complex F\# types like discriminated unions and type-safe enums, ensuring robust encoding and decoding of event data.

Features

Initial repository structure and documentation

The repository is initialized with the core solution structure, including project files for FsCodec, FsCodec.Box, FsCodec.NewtonsoftJson, and FsCodec.SystemTextJson, along with their respective test projects. This commit establishes the foundational build configuration via Directory.Build.props and Directory.Build.targets, sets up the .editorconfig for consistent F\# formatting, and adds comprehensive documentation in README.md, AGENTS.md, and CHANGELOG.md to guide development and usage of the event codec library.

(repo-wide) · high confidence

Introduce Newtonsoft.Json serialization support for FsCodec

Adds a new FsCodec.NewtonsoftJson library that provides serializers and deserializers for F\# types using Newtonsoft.Json. This includes a Codec for encoding/decoding event data to/from ReadOnlyMemory\<byte\>, a UnionConverter for handling discriminated unions with optional flattening and catch-all cases, and specialized converters for Option, TypeSafeEnum, StringId, and verbatim UTF-8 byte arrays. The package also exposes Options for configuring serializer settings (such as camelCase formatting and date parsing) and a Serdes module for high-performance serialization using recyclable memory streams and character pools.

src/FsCodec.NewtonsoftJson · high confidence

Introduce System.Text.Json codec with conditional compression and serialization options

The FsCodec.SystemTextJson library now provides a full implementation for encoding and decoding events using System.Text.Json, supporting both ReadOnlyMemory\<byte\> and JsonElement event bodies. This release adds a conditional compression feature that automatically compresses event bodies using Brotli when they exceed a minimum size and achieve sufficient compression gain, while also introducing configurable serialization options such as camelCase naming, null handling, and automatic conversion for discriminated unions and type-safe enums.

src/FsCodec.SystemTextJson · high confidence

New FsCodec.Box module for in-memory event serialization

The FsCodec.Box library introduces a new set of modules (ByteArray, Codec, Compression, CoreCodec) designed to serialize event bodies as boxed objects (obj) or compressed byte arrays, specifically targeting in-memory stores like Equinox's MemoryStore. This allows developers to efficiently test event-sourced decision processing and property-based tests without the overhead of JSON serialization or data sanitization. The module provides extension methods to adapt existing codecs to use byte arrays or attempt conditional compression, and exposes a Codec.Create API that leverages TypeShape's UnionContract to automatically map discriminated union cases to and from boxed objects.

src/FsCodec.Box · high confidence

Behavioural changes

FsCodec 3.0 introduces conditional Brotli compression and a generic Format type

The core library now supports encoding event bodies as a generic 'Format' type instead of being locked to byte arrays, allowing integrations to choose their own serialization format. A new Encoding module adds conditional Brotli compression (with Deflate kept for legacy compatibility), automatically compressing bodies only when they exceed a minimum size and gain threshold to optimize storage. The public API has been refactored with renamed interfaces (IEventCodec, IEventData, ITimelineEvent) and new helper types like StreamId and StreamName to improve type safety and usability.

src/FsCodec · high confidence

Test coverage

Added comprehensive test suite for FsCodec.SystemTextJson; Added test suite for FsCodec.NewtonsoftJson; Added tests for encoding, stream naming, and type-safe enums.

Dependencies

Update project dependencies and target frameworks

The project manifests have been updated to target netstandard2.1 across all source and test projects. Key dependency versions have been adjusted: FSharp.Core is set to 4.5.4, TypeShape to 10.0.0, System.Text.Json to 6.0.10, Newtonsoft.Json to 13.0.3, and Microsoft.IO.RecyclableMemoryStream to 3.0.0. Test projects now reference FsCheck.Xunit.v3 version 3.3.2 and Serilog.Sinks.Console version 5.0.1. Package validation is enabled with a baseline version of 3.0.0.

(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

Score

  • CAI 71 → 67 (-4.2)
  • Rubric changed (rubric-2026.09.13 → rubric-2026.10.1) — scores are not directly comparable.

Lenses

  • Code Health 93 → 93 (+0.0)
  • Architecture 93 → 96 (+3.6)
  • Maturity 63 → 56 (-7.8)
  • Readiness 65 → 65 (+0.0)
  • Security 83 → 83 (+0.0)

Resolved (2)

  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)

New (1)

  • Orphaned files with no living knowledge

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

Survey your own repository

jet/FsCodec 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 3 October 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 5d95f4b08a219b5eec773201d3a6c22adb9fc430 — the exact code this score is about.
  • Scored under rubric-2026.10.1 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-4f4226d619ea.