Skip to content
CAI
Software that uses CAICheck a score

twitter/util

66.9

Adequate · 27 September 2026

53.2k

lines of production code

Scala

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a comprehensive Scala utility library providing foundational components for building robust JVM applications. It offers asynchronous concurrency primitives, I/O abstractions, and structured application lifecycle management, while also supporting Java interoperability through dedicated wrapper classes. The library extends functionality with modules for caching, serialization, configuration tuning, and observability, enabling developers to manage resources, metrics, and external integrations effectively.

How it got here

2010–2014 — Core library initialization and build migration

51 changes.

This period established the foundational util library ecosystem by introducing core asynchronous primitives, I/O abstractions, and specialized modules for logging, hashing, and caching. Concurrently, the project underwent a significant infrastructure shift, migrating the build system from Maven to Pants and Bazel while ensuring robust Java interoperability through comprehensive API wrappers and test suites.

2015–2017 — New module expansion and Java interoperability

40 changes.

This period focused on expanding the Twitter Util library with several new modules, including util-registry for self-registration, util-security for SSL/TLS handling, and util-tunable for runtime configuration management. Significant effort was also directed toward improving Java interoperability through new functional interfaces and collection conversion utilities, alongside the introduction of util-slf4j-api to modernize logging support.

2018–2023 — New utility modules and Scala 2.13 support

31 changes.

This period focused on expanding the Twitter Util library with new modules for JSON serialization, validation, mocking, and application lifecycle management, alongside significant improvements to core conversion and reflection utilities. Concurrently, the codebase underwent essential maintenance to ensure cross-building compatibility with Scala 2.13 and integrated Bazel build support across multiple components.

Features

Add Flask documentation theme and SBT version utility

The documentation build now includes a custom Sphinx theme based on Flask's design, featuring specific CSS styling for desktop and mobile views, a Pygments syntax highlighting style, and Google Analytics integration. Additionally, a utility script for extracting library versions from SBT build files has been added to support documentation generation workflows.

_doc/src/sphinx/\themes, doc/src/sphinx/utils · high confidence

Add Java-friendly companion object wrappers for Scala utilities

New Java adapter classes (Activities, Closables, Events, FuturePools, Monitors, Vars, Witnesses) are added to util-core, providing static factory methods and accessors that wrap the corresponding Scala companion objects. This allows Java consumers to instantiate and interact with core utility types like Activity, Var, Monitor, and FuturePool without dealing with Scala-specific syntax or module access patterns.

util-core/src/main/java/com/twitter/util · high confidence

Add Util project landing page

A new index.html file has been added to the site directory, serving as the main landing page for the Util project. This page introduces Util as a collection of Twitter's core JVM libraries and provides navigation links to the GitHub project, user guides, API documentation, and community channels like Gitter and Google Groups. It also includes information on contributing, referencing the Code of Conduct and contributing guidelines.

site · high confidence

Add util-jackson-annotations library with InjectableValue annotation

A new library, util-jackson-annotations, has been added to the codebase, providing the InjectableValue marker annotation. This annotation allows developers to mark annotation interfaces to define fields that should be injected into case classes via Jackson's InjectableValues mechanism, facilitating integration with Finatra's JSON and HTTP request handling.

util-jackson-annotations/src · high confidence

Added Java 8 lambda-compatible functional interfaces

New functional interfaces (JavaFunction, JavaConsumer, ExceptionalJavaFunction, ExceptionalJavaConsumer, ExceptionalSupplier) have been added to the util-function library to improve interoperability with Java 8 lambda expressions. These interfaces serve as single-abstract-method (SAM) versions of existing Twitter Util function types, allowing Java 8 users to pass lambdas directly where these specific functional contracts are required.

util-function/src/main/java/com · high confidence

Added code generation for Mockito argument capture utilities

Introduced a new code generation system in the \codegen\ directory to produce Scala test utilities for capturing arguments in Mockito mocks. This includes a Mako template (\ArgumentCapture.scala.mako\) and a Makefile that generates \ArgumentCapture.scala\ in \util-test\. The generated code provides \capturingAll\ and \capturingOne\ methods, supporting up to 22-ary method invocations, enabling easier verification of mock interactions with multiple arguments.

codegen · high confidence

Added command-line linter for configuration files

A new shell script, lint-configuration, has been added to the util-tunable module to serve as a command-line launcher for the configuration file linter. This tool allows users to validate configuration files by passing their paths as arguments, which are then forwarded to the underlying Bazel-run linter target. The associated BUILD file defines the target and tags it as Bazel-compatible.

util-tunable · high confidence

Added default expression schemas for common metrics

The \util-stats\ module now includes a \DefaultExpression\ utility object that provides pre-configured \ExpressionSchema\ definitions for standard metrics. This allows users to easily create schemas for success rate (with default thresholds of 99.5% and 99.97%), throughput, failures, and P99 latency by supplying their own underlying \Expression\ implementations, with appropriate units (Percentage, Requests, Milliseconds) and descriptions automatically applied.

util-stats/src/main/scala/com/twitter/finagle/stats/exp · high confidence

Initial release of asynchronous ZooKeeper bindings

This change introduces the \util-zk\ library, providing an asynchronous API for interacting with Apache ZooKeeper. It includes a \ZkClient\ for connection management and configuration, \ZOp\ traits for read operations with watch and monitor capabilities, and \AsyncCallbackPromise\ classes to bridge ZooKeeper callbacks to Twitter Futures. The implementation also features \LiftableFuture\ utilities for handling KeeperExceptions and a \NativeConnector\ for underlying connection handling, all packaged with Bazel-compatible build definitions.

util-zk/src/main/scala/com · high confidence

Initial release of the util-logging library

This change introduces the \util-logging\ library, providing a Scala wrapper around \java.util.logging\ with features such as lazy message evaluation, configurable formatters, and various handlers including console, file, syslog, and throttled output. It also includes a \Logging\ trait for easy integration with \twitter-server\ applications via command-line flags and a \HasLogLevel\ trait to associate log levels with exceptions.

util-logging/src/main/scala/com · high confidence

Introduce Tunable abstraction and JSON deserialization support

This change introduces the core \Tunable\ abstraction, allowing users to define configuration values that can be observed via \Var\ and mutated at runtime (e.g., \Tunable.mutable\). It adds \TunableMap\ support for accessing these tunables, including a \ServiceLoadedTunableMap\ mechanism to load configurations via service discovery. Additionally, it enables parsing JSON into \TunableMap\ structures by adding Jackson deserializers for \Duration\ and \StorageUnit\ types, and establishes the \util-tunable\ module with its dependencies in the build system.

util-tunable/src/main/scala/com/twitter/util/tunable · high confidence

Introduce application lifecycle event tracking

Added a new \Event\ sealed trait in the \util-app-lifecycle\ module to represent distinct phases of the application lifecycle, such as \Register\, \Init\, \Main\, and \Close\. This change enables applications to observe and react to specific lifecycle stages, providing a structured way to manage initialization and shutdown logic across the framework.

repository · high confidence

Introduce com.twitter.app.App with structured lifecycle and flag management

This change introduces the \com.twitter.app\ package, extracting application scaffolding from \util-core\ into a new \util-app\ module. It provides the \App\ trait, which manages command-line flag parsing via the \Flags\ and \Flag\ classes, and enforces a structured application lifecycle (init, premain, main, exit) with graceful shutdown handling. The update adds support for \GlobalFlag\ definitions (including Java-friendly \JavaGlobalFlag\), local flag scoping via \Flag.let\ and \Flag.letClear\, and lifecycle event observation through the \Lifecycle\ mixin. It also includes a resilient \LoadService\ mechanism for service loading and a new \CloseException\ to track errors during app closure.

util-app/src/main/scala/com/twitter/app · high confidence

Introduce experimental generic routing interfaces

The \util-routing\ module now provides a new set of base interfaces for routing inputs to destinations, including a generic \Router\[Input, Route\]\ abstract class, a \Generator\ for creating routers, and a \RouterBuilder\ for constructing them with optional validation. This change introduces a more flexible, polymorphic routing API that supports covariant output types and allows for custom route validation, though the module is marked as experimental with a high likelihood of future API changes.

util-routing · high confidence

Introduce lifecycle event observation capability

This change adds a new \util-app-lifecycle\ module that allows applications to observe key lifecycle events. It introduces an \Observer\ trait and a \Notifier\ class, enabling users to register listeners that receive notifications when lifecycle phases (such as \PreMain\, \PostMain\, and \Close\) begin, complete successfully, or fail. The module is built with strict dependency checking and is tagged as Bazel-compatible.

util-app-lifecycle · high confidence

Introduce util-lint library for configurable linting rules

A new \util-lint\ module has been added to provide a framework for defining and executing lint rules. This includes a \Rule\ trait for individual checks, a \Rules\ collection interface with a thread-safe \RulesImpl\ implementation, and a \GlobalRules\ singleton for managing global rule sets. The module also introduces a \withRules\ context manager, allowing tests to temporarily swap in isolated rule sets without affecting the global state, and is built as a Java 8 compatible Scala library with strict dependencies enabled.

util-lint/src/main/scala/com · high confidence

Introduce util-security module with Bazel build and ownership configuration

This change introduces the new util-security module, adding its initial BUILD file configured for Bazel compatibility and a PROJECT file defining the security team ownership structure.

util-security · high confidence

Introduce util-slf4j-api for SLF4J-based logging

Added a new library, util-slf4j-api, which provides a Scala-friendly wrapper around the SLF4J API. This allows users to decouple their logging code from a specific implementation, enabling them to choose their preferred SLF4J backend (such as Logback or Log4j2) rather than being tied to java.util.logging. The library includes a \Logging\ trait for easy integration into Scala classes and supports Java interoperability, with documentation recommending a migration from the existing \util-logging\ module to this new API-only approach.

util-slf4j-api · high confidence

Introduce util-slf4j-api with Scala-friendly logging wrapper

This change introduces the \util-slf4j-api\ module, providing a Scala-friendly wrapper around the SLF4J logging API. It adds a \Logger\ class that wraps \org.slf4j.Logger\ and a \Logging\ trait that allows classes to easily access a lazily-initialized logger. The implementation supports standard log levels (trace, debug, info, warn) with call-by-name parameters for efficiency, includes marker-aware logging methods, and handles Scala singleton objects correctly by stripping the \$\ suffix from class names.

util-slf4j-api/src/main/scala/com · high confidence

Introduce util-slf4j-jul-bridge module for safe java.util.logging to SLF4J bridging

A new utility module, util-slf4j-jul-bridge, has been added to safely bridge java.util.logging output to SLF4J. This module wraps the slf4j jul-to-slf4j dependency and provides a utility that installs the SLF4JBridgeHandler on the root logger. It includes protection against infinite recursion loops that can occur if the slf4j-jdk14 implementation is already present on the classpath, ensuring stable logging behavior when migrating legacy java.util.logging calls to SLF4J.

util-slf4j-jul-bridge · high confidence

Introduce util-test module with Pants build workaround

A new \util-test\ module has been added to provide testing utilities, specifically aggregating dependencies for ScalaTest and internal logging/testing libraries. To resolve a known Pants build system issue (pantsbuild/pants\#6678), the module includes a \PantsWorkaround.scala\ file that intentionally throws an exception, ensuring the build system correctly handles the artifact. The module is configured with strict dependency checking and tagged as Bazel-compatible.

util-test/src/main/scala · high confidence

Introduce util-thrift library for Thrift serialization and codec support

This change introduces the new \util-thrift\ module, providing a set of classes and traits for serializing and deserializing Apache Thrift objects. It includes \ThriftSerializer\ and its implementations (\JsonThriftSerializer\, \BinaryThriftSerializer\, \CompactThriftSerializer\) for converting Thrift objects to and from byte arrays and strings, as well as \ThriftCodec\ and its variants (\BinaryThriftCodec\, \CompactThriftCodec\) which implement the \Codec\ interface for type-safe encoding and decoding. The module depends on \libthrift\ and \jackson-databind\ to support both binary/compact and JSON-based Thrift protocols.

util-thrift/src/main/scala/com · high confidence

Introduces new asynchronous caching abstractions and Caffeine integration

This change introduces a new \FutureCache\ trait and its implementations within \util-cache\, providing a standardized API for asynchronous, in-process caching. It adds \AsyncMemoize\ for caching asynchronous function results, \EvictingCache\ wrappers to handle failure eviction, and a \Refresh\ utility for single-value caching with TTL. Additionally, it adds a \CaffeineCache\ implementation backed by the Caffeine library, allowing users to leverage Caffeine's performance for their asynchronous caching needs.

util-cache/src/main/scala/com · high confidence

Introduction of core asynchronous primitives and resource management utilities

This change introduces foundational components for asynchronous programming and resource lifecycle management in util-core. It adds the Awaitable and Await traits/objects to provide synchronous blocking waits for asynchronous results, including an all() method to wait on multiple awaitables. It introduces the Closable, ClosableOnce, and CloseOnce traits for managing resource cleanup, with support for sequential and concurrent composition. Additionally, it adds the Disposable and Managed traits for explicit resource management with automatic disposal, the Cancellable trait for supporting cancellation propagation, and the Base64Long utility for efficient long-to-string encoding. The change also includes the BatchExecutor and Batcher classes for batching asynchronous operations, and the Fiber and WorkQueueFiber abstractions for task scheduling.

util-core/src/main/scala/com/twitter/util · high confidence

Java-friendly APIs added for concurrent Offer, Spool, and Tx components

New Java wrapper classes (Offers, Spools, Txs) have been added to the concurrent package to provide idiomatic Java access to Scala-based Offer, Spool, and Tx companion objects. These classes expose static factory methods and constants (such as \newConstOffer\, \newSpool\, and \newTx\) that bridge Java collections and types to the underlying Scala implementations, improving Java-friendliness for users of these concurrent primitives.

util-core/src/main/java/com/twitter/concurrent · high confidence

Java-friendly MetricBuilder API for Finagle stats

Added a new Java-compatible interface for Finagle stats metrics, exposing static constants for metric types (Counter, UnlatchedCounter, CounterishGauge, Gauge, Histogram) via the new MetricTypes class. This allows Java consumers to access MetricBuilder.MetricType instances without dealing with Scala-specific syntax, alongside new Bazel build rules to package and publish the util-stats-java artifact.

util-stats/src/main/java · high confidence

New Command utility for streaming external process output

Added a new \Command\ class in \util-app\ that allows running shell commands and accessing their stdout and stderr via a streaming \Reader\ interface. This utility supports specifying a working directory and injecting extra environment variables for the executed process, enabling non-blocking, line-by-line processing of external command output.

util-app/src/main/scala/com/twitter/app/command · high confidence

New JMH benchmark suite for util components

Added a comprehensive set of JMH benchmarks for the util library, covering concurrency primitives (AsyncQueue, AsyncSemaphore, AsyncStream, Broker, Offer, LocalScheduler), I/O types (Buf, Pipe, Spool), utility classes (Duration, Time, Stopwatch, Local, Monitor, Promise, Future, Timer), and hashing (KetamaDistributor, KeyHasher). The benchmarks are built using Bazel and JMH, providing performance measurement capabilities for these core components.

util-benchmark/src · high confidence

New JVM monitoring and GC prediction capabilities

The util-jvm library now provides comprehensive visibility into JVM internals, including object allocation tracking (specifically Eden space), garbage collection pause times, and safepoint metrics. It introduces a GcPredictor component that estimates the time until the next garbage collection based on allocation rates and a Kalman filter estimator. Additionally, it exposes detailed memory pool statistics, metaspace usage, and supports heapster profiling integration.

util-jvm/src/main/scala/com · high confidence

New JVM shutdown hook and LoadService filtering flags in util-app

The util-app module now exposes three global flags to control application lifecycle and service loading. The new \enableJvmShutdownHook\ flag (defaulting to true) registers a JVM shutdown hook that automatically calls \app.quit()\, providing a graceful shutdown mechanism. Additionally, \loadServiceDenied\ allows users to specify a deny list of fully qualified class names to ignore during service loading, and \loadServiceIgnoredPaths\ lets users exclude specific packages from recursive directory scans, which can improve performance or resolve conflicts. These flags are defined in \com.twitter.finagle.util\ for historical compatibility.

util-app/src/main/scala/com/twitter/finagle · high confidence

New Java utility class for converting Java collections and Optionals to immutable Scala types

A new \Scala\ utility class has been added to the \util-core\ Java interop module, providing static methods to convert Java \List\, \Set\, and \Map\ instances into their corresponding immutable Scala \Seq\, \Set\, and \Map\ variants. Additionally, it includes a method to convert Java 8 \Optional\ objects into Scala \Option\ instances. This allows Java code to seamlessly interact with Scala's immutable collection types without relying on mutable adapters.

util-core/src/main/java/com/twitter/util/javainterop · high confidence

New Scala-based validation engine with Jakarta Validation 3.0 support

The util-validator module now provides a new validation implementation built on Jakarta Validation 3.0 (via Hibernate Validator) and Scala. This introduces a new validation engine that supports method and constructor parameter validation through the ScalaExecutableValidator, custom constraint mappings for Twitter-specific constraints (CountryCode, OneOf, UUID), and helper utilities for handling constraint violations and dynamic payloads. The module is structured into several sub-libraries (core, cfg, constraintvalidation, conversions, engine, executable, internal) and is tagged as Bazel-compatible.

util-validator/src/main · high confidence

New VirtualMachineErrorTerminator utility for controlled JVM shutdown

Added a new VirtualMachineErrorTerminator utility class that allows applications to detect and handle VirtualMachineErrors (such as OutOfMemoryError or StackOverflowError) by terminating the JVM in a controlled manner. The class uses a high-priority daemon thread to invoke System.exit() after releasing a safety buffer, ensuring shutdown hooks have a chance to run. It provides methods to initialize the terminator, check if the VM is currently terminating (to fail fast in parallel processing threads), and terminate the VM if a caught throwable is a VirtualMachineError. The build file for this new component is also added, configured for Java 8 with strict dependencies and fatal warnings.

util-core/src/main/java/com/twitter/service · high confidence

New com.twitter.io package with Buf, Reader, Writer, and ActivitySource APIs

The \com.twitter.io\ package has been introduced in \util-core\, providing a new set of low-level I/O abstractions. This includes \Buf\ for zero-copy byte buffers, \Reader\ and \Writer\ traits for stream-based I/O, and \ByteReader\/\ByteWriter\ for efficient binary encoding/decoding. The package also adds \ActivitySource\ for observing file and classpath resources, \BufInputStream\ for Java interoperability, and utility objects like \Files\, \Charsets\, and \StreamIO\. This represents a structural addition of new capabilities rather than a modification of existing behavior.

util-core/src/main/scala/com/twitter/io · high confidence

New com.twitter.util.mock package with idiomatic Mockito integration

A new \com.twitter.util.mock\ package has been introduced, providing a \Mockito\ trait that wraps \mockito-scala\ to offer idiomatic, Scala-style stubbing and verification syntax (e.g., \returns\, \was called\). This library is now buildable via Bazel and includes comprehensive test coverage for various mocking scenarios, including fixture-based tests and automatic mock resetting.

util-mock/src · high confidence

New command-line configuration linter for TunableMap files

A new command-line tool, \configuration-linter\, has been added to the \util-tunable\ module. This tool allows users to validate TunableMap configuration files by parsing them via \JsonTunableMapper\. When executed, it accepts file paths as arguments, attempts to parse each file, and reports success or failure for each, exiting with an error if any file fails to parse. This provides a dedicated utility for checking the validity of configuration files before deployment.

util-tunable/src/main/scala/com/twitter/util/tunable/linter · high confidence

New concurrency primitives: AsyncMeter, AsyncSemaphore, AsyncMutex, Once, and SpoolSource

The \com.twitter.concurrent\ package now includes several new asynchronous utilities. \AsyncMeter\ provides asynchronous rate limiting with configurable burst sizes, durations, and waiter limits, including helpers like \perSecond\ and \perSecondLimited\. \AsyncSemaphore\ offers a lock-free semaphore with fair, ordered permit acquisition and a configurable maximum waiter limit, while \AsyncMutex\ provides a simple asynchronous mutex built on top of the semaphore. \Once\ ensures a function is executed exactly once, with specific behavior when exceptions occur. Additionally, \SpoolSource\ allows for the creation and population of thread-safe Spool chains, enabling producers to push values into a stream that consumers can read from.

util-core/src/main/scala/com/twitter/concurrent · high confidence

New concurrent utilities: ForkingScheduler, Offer, and NamedPoolThreadFactory

The \util-core/concurrent-extra\ module now includes a \ForkingScheduler\ trait that allows forking \Future\ computations even when the scheduler is overloaded, supports limiting synchronous concurrency via \withMaxSyncConcurrency\, and can redirect tasks from \FuturePool\s. Additionally, an \Offer\ abstraction is introduced for two-phase commit-style communication between processes, and a \NamedPoolThreadFactory\ is provided to create named threads for easier debugging.

util-core/concurrent-extra · high confidence

New implicit conversion utilities for Duration, Storage, Strings, and Collections

This change introduces a new \com.twitter.conversions\ package in \util-core\ containing a suite of implicit classes that enhance standard Scala types with readable, fluent APIs. Users can now write \2000.nanoseconds\ or \5.gigabytes\ for \Duration\ and \StorageUnit\ conversions, use \mapKeys\, \invert\, and \toSortedMap\ on \Map\ instances, and apply \regexSub\, \quoteC\, \toCamelCase\, and \toSnakeCase\ to \String\ objects. Additional helpers include \foreachPartial\ and \findItemAfter\ for \Seq\, tuple manipulation methods like \toKeys\ and \groupByKeyAndReduce\, and implicit conversions of code blocks to \Runnable\ or \Callable\ via \ThreadOps\. The implementation also includes specific forwarders for \Int\ to \Long\ conversions in \DurationOps\, \StorageUnitOps\, and \U64Ops\ to ensure source compatibility with Scala 3.0.

util-core/src/main/scala/com/twitter/conversions · high confidence

New reflection utility objects for annotations, classes, and types

The util-reflect module now provides three new utility objects to simplify runtime reflection tasks. The \Annotations\ object offers methods to filter, find, and map annotations on classes and their constructors, including handling Scala-specific annotation metadata on case class fields. The \Classes\ object provides a safe \simpleName\ function that handles malformed class names which might otherwise throw an InternalError. The \Types\ object introduces memoized helpers for type inspection, including \isCaseClass\ to identify case classes, \asTypeTag\ to convert Class objects to TypeTags, and utilities for comparing TypeTags and extracting parameterized type names.

util-reflect/src/main/scala/com · high confidence

New security utilities for loading certificates, keys, and credentials

The util-security module now provides a comprehensive set of helpers for managing SSL/TLS assets and authentication data. Users can load and parse X.509 certificates and Certificate Revocation Lists (CRLs) from PEM files, including validation and filtering of invalid certificates. Private keys (PKCS\#8) can be read and converted into KeyManagers or TrustManagers for use with SSLContexts. Additionally, the module introduces NullSslSession and NullPrincipal for representing absent security contexts, and a Credentials helper to read YAML-based authentication files.

util-security/src/main/scala/com · high confidence

New util-cache-guava module for Guava-backed caching

A new \util-cache-guava\ module has been introduced, providing an adapter that implements the \util-cache\ interface using Google Guava caches. This includes \GuavaCache\ for standard caches and \LoadingFutureCache\ for loading caches, along with helper methods in the \GuavaCache\ companion object to integrate Guava's \LoadingCache\ with Twitter's \Future\-based asynchronous workflows. The module includes comprehensive Scala and Java tests to verify interrupt safety and correct caching behavior.

util-cache-guava · high confidence

New util-codec module with Base64 and GZIP string encoders

A new util-codec module has been introduced to house string encoding utilities, specifically adding Base64StringEncoder and a new Base64UrlSafeStringEncoder that uses Java's standard Base64 API for URL-safe encoding without padding. The module also includes GZIPStringEncoder for compressed string handling, which ensures thread safety by managing GZIP streams within method scope and explicitly closing them to prevent resource leaks. This module depends on util-core and is configured with strict dependencies and Java 8 platform compatibility.

util-codec/src/main/scala/com · high confidence

New util-hashing library with Hashable type-class and multiple hash algorithms

The new util-hashing module introduces a Hashable type-class for generic hashing, providing implementations for FNV (1 and 1A, 32 and 64-bit), Ketama (MD5-based), CRC32-ITU, Hsieh, Jenkins, and Murmur3 algorithms. It includes a Distributor trait for mapping hashes to nodes/partitions, a KeyHasher trait with Java-compatible forwarders, and a byName factory for configuration-driven algorithm selection. The library is built as a Scala 8-compatible, Bazel-compatible library with strict dependencies.

util-hashing/src/main/scala/com · high confidence

New util-jackson library for Scala JSON/YAML serialization

This change introduces the util-jackson library, providing Scala-friendly utilities for serializing and deserializing JSON and YAML data using Jackson. It includes simple parsing and writing helpers in the JSON and YAML objects, custom serializers and deserializers for Twitter Util types like Duration and Time, and specialized support for Scala case classes with validation and detailed error reporting.

util-jackson/src/main · high confidence

New util-registry library for library self-registration

A new \util-registry\ module has been added to provide a public interface for libraries to register metadata about themselves. This includes a \Library\ object that allows library owners to register their name and parameters under a dedicated namespace, and a \Formatter\ object that converts the registry state into a structured map for consumption (e.g., by admin endpoints). The module is built with strict dependencies and Bazel compatibility tags.

util-registry/src/main/scala/com · high confidence

New util-security-test-certs module for Bazel-based test certificate management

A new \util-security-test-certs\ module has been introduced to centralize test security assets, specifically moving RSA certificates, CRLs, and PKCS\#8 private keys into this dedicated location. The module includes a \BUILD.bazel\ file to manage these resources within the Bazel build system, ensuring they are tagged as \bazel-compatible\. This change provides a standardized, build-system-integrated repository for test certificates (including valid, expired, future-dated, and garbage data) and keys, supporting testing scenarios that require specific certificate states without relying on external or scattered resources.

util-security-test-certs · high confidence

New utility to safely bridge Java Util Logging to SLF4J

The \util-slf4j-jul-bridge\ module introduces a \Slf4jBridge\ trait and \Slf4jBridgeUtility\ object to facilitate the migration from legacy Java Util Logging (JUL) to SLF4J. The \Slf4jBridge\ trait can be mixed into a \com.twitter.app.App\ to automatically install the \SLF4JBridgeHandler\ during construction. The underlying utility includes safety checks to prevent infinite logging loops by detecting and avoiding installation if the conflicting \slf4j-jdk14\ dependency is present on the classpath, while also ensuring the handler is only installed once.

util-slf4j-jul-bridge/src/main/scala/com · high confidence

Open-source Util documentation with Sphinx and Flask theme

The Util documentation is now open-sourced and built using Sphinx, replacing the previous format. Users can now view the documentation via a new Sphinx-based site that includes a changelog, guides for util-stats, util-cookbook, util-jackson, and util-validator, and links to the API documentation. The site uses the Flask theme with a custom favicon and Twitter Bootstrap styling.

doc/src/sphinx · high confidence

Unified in-process ZooKeeper server factory for integration testing

The \util-zk-test\ module now provides a \ServerCnxnFactory\ abstraction that creates an in-process ZooKeeper server for integration tests. This factory automatically detects the ZooKeeper version at runtime (supporting both 3.3 and 3.4+ API structures) and exposes a consistent interface for starting, shutting down, and querying the local port of the test server, allowing tests to bind to available ports and configure maximum client connections.

util-zk-test/src/main/scala/com · high confidence

Architecture

Migrate util-core build system to Bazel

The util-core module has been converted from its previous build system to Bazel. This introduces a new BUILD file defining the \util-core-util\ and \scala\ library targets, which aggregate sources from concurrent, conversions, and io packages, and explicitly declare dependencies on scala-reflect, scala-collection-compat, and scala-parser-combinators. The build configuration enforces strict dependency checking and tags targets as Bazel-compatible. Additionally, a PROJECT file has been added to manage ownership for the module.

util-core · high confidence

Behavioural changes

Added Bazel build and project ownership files for util-app

The util-app module now includes a BUILD file defining Java and Scala source and test targets compatible with Bazel, alongside a PROJECT file specifying owners (jillianc, mbezoyan) and watchers ([e-mail redacted]) to support the migration to the Pants build system.

util-app · high confidence

Added workaround for Pants scoverage issue

A new class, PantsWorkaroundCore, has been added to the util-core module to address a known issue with Pants scoverage (pantsbuild/pants\#6678). This class throws an IllegalStateException at runtime, serving as a specific workaround for the build tool's coverage instrumentation behavior.

util-core/src/main/scala · high confidence

Build system workaround for Pants artifact publishing

A new \PantsWorkaroundCache\ class and its associated \BUILD\ target have been added to \util-cache/src/main/scala\ to address a known Pants artifact publishing issue (pantsbuild/pants\#6678). This workaround ensures the \util-cache\ Scala artifact is correctly aggregated and published by the build system, with the target explicitly configured for Java 8 compatibility and strict dependencies.

util-cache/src/main/scala · high confidence

Customized documentation sidebar and search box for Util

The documentation now uses custom Sphinx templates to provide a branded sidebar and search experience. The sidebar (sidebarintro.html) displays the 'Util' title with a description of 'Miscellaneous Idiomatic Scala Utilities & Wrappers, by Twitter' and links to the GitHub repository and issue tracker. The search box (searchbox.html) is also customized to show a 'Quick search' form and a specific blurb, replacing the default Sphinx search widget.

_doc/src/sphinx/\templates · high confidence

Deprecated Java utility class for Buf interoperability

The \Bufs\ utility class in \util-core\ has been marked as deprecated, indicating it will be removed once Scala 2.11 support is dropped. This class provides static methods to bridge Java code with the underlying Scala \Buf\ implementation, allowing Java users to create, convert, and inspect \Buf\ instances (e.g., from byte arrays, ByteBuffers, or strings) without directly accessing Scala internals.

util-core/src/main/java/com/twitter/io · high confidence

Deprecation of TestLogging trait in favor of slf4j

The TestLogging trait, previously used to configure logging levels and capture log output during unit tests, is now deprecated. Users are advised to migrate to slf4j for logging needs. The trait remains available but carries a deprecation annotation indicating it should not be used in new code.

util-test/src/main/scala/com/twitter/logging · high confidence

Establish project ownership for util-mock

The util-mock module now has a defined ownership structure, with jillianc and mbezoyan listed as owners and the csl-team:ldap group as watchers. This clarifies responsibility for the new mocking library introduced in this area.

util-mock · high confidence

Established ownership metadata for util-jackson modules

Added PROJECT files to the util-jackson and util-jackson-annotations directories to define code ownership and team watchers. This change registers jillianc, mbezoyan, and tapans as owners for the util-jackson module, and jillianc and mbezoyan for util-jackson-annotations, with the [e-mail redacted] list set as watchers for both, ensuring proper accountability and notification workflows for these Jackson utility libraries.

util-jackson, util-jackson-annotations · high confidence

Introduces aggregator library to resolve Pants build issue

A new \util-zk\ Scala library target has been added to act as an aggregator jar, exposing the \util-zk\ and \util-zk/coordination\ packages. This change includes a specific workaround class (\PantsWorkaroundZk\) to address a known Pants build tool issue (pantsbuild/pants\#6678), ensuring the library compiles and publishes correctly within the Pants build system.

util-zk/src/main/scala · high confidence

Introduction of GlobalFlagVisible annotation and Bazel-compatible build configuration

The util-app module now includes a new GlobalFlagVisible annotation to support the visibility of global flags within the internal flags implementation. Additionally, the module's build definition has been updated to be Bazel-compatible, enforcing strict dependencies and targeting Java 8.

util-app/src/main/java/com · high confidence

Java validation constraints moved to top-level package

The Java validation constraint annotations (such as CountryCode, OneOf, and UUID) and their associated error message resources have been relocated from nested sub-packages to the top-level com.twitter.util.validation package. This structural change simplifies the import paths for these constraints, making them easier to reference in application code without needing to navigate deeper package hierarchies.

util-validator-constraints · high confidence

Migrate util-codec to Bazel build system

The util-codec module now uses Bazel for compilation, testing, and benchmarking, replacing the previous build configuration. A new BUILD file defines the main library target and a test suite, both tagged as Bazel-compatible, while the PROJECT file has been updated to reflect the current owners for the module.

util-codec, util-zk-test · high confidence

Migrate util-zk to Bazel build system and update ownership metadata

The util-zk module is now built using Bazel, introducing a BUILD file that defines the main library target and a test suite, both tagged as bazel-compatible. This change replaces the previous build configuration, enabling compilation, testing, and benchmarking via Pants/Bazel. Additionally, the module's ownership and project metadata have been updated in the new PROJECT file, reflecting current team assignments and LDAP-based watcher groups.

util-zk · high confidence

Refactor stats receivers to use MetricBuilder and introduce new receiver implementations

The stats receiver API has been refactored to use \MetricBuilder\ for creating counters, stats, and gauges, replacing the previous string-based name arguments. This change introduces several new receiver implementations: \BroadcastStatsReceiver\ for fan-out, \DenylistStatsReceiver\ for filtering, \LazyStatsReceiver\ for deferred metric creation, and \CollisionTrackingStatsReceiver\ for detecting metric name collisions. Additionally, \CumulativeGauge\ now uses Caffeine for weak-reference management, and \InMemoryStatsReceiver\ has been updated to support the new schema and expression systems.

util-stats/src/main/scala/com/twitter/finagle/stats · high confidence

Scala 2.13 compatibility for util-core

The util-core module now supports cross-building for Scala 2.13 alongside Scala 2.12. This introduces version-specific implementations for SeqUtil (using \knownSize\ in 2.13+ vs \hasDefiniteSize\ in 2.12-), MapUtil (simplified HashMap construction in 2.13+), and HealthyQueue (adapting to the new mutable Queue API methods like \addOne\ and \prepend\ in 2.13+).

util-core/src/main/scala-2.12-, util-core/src/main/scala-2.13+ · high confidence

Updated project ownership for util-benchmark

The util-benchmark module now lists jillianc and mbezoyan as the designated owners in its PROJECT file, replacing previous ownership assignments.

util-benchmark · high confidence

Test coverage

Added JMH benchmarks for Local context substitution; Added Java API compilation and refresh tests for util-cache; Added Java and Scala test suites for the util-validator module; Added Java compatibility tests for StatsReceiver and MetricBuilder; Added Java compatibility tests for flags and service loading; Added Java compatibility tests for util-logging; Added Java compilation and unit tests for Buf API; Added Java compilation tests for concurrent utilities; Added Java compilation tests for the Registry utility; Added Java compilation tests for util-core APIs; Added Java unit tests for TunableMap; Added Java unit tests for util-jackson JsonDiff; Added compilation test for ServerCnxnFactory; Added compilation tests for JVM utility methods; Added comprehensive ScalaTest suite for util-logging components; Added comprehensive test coverage for util-stats components; Added comprehensive test suite for util-app; Added comprehensive test suite for util-core I/O components; Added comprehensive test suite for util-core components; Added comprehensive test suites for concurrent utilities; Added test coverage for JVM monitoring and statistics; Added test coverage for Thrift structure serialization; Added test coverage for util-reflect annotation and type utilities; Added test coverage for util-registry components; Added test coverage for util-security security primitives and file readers; Added test for ServerCnxnFactory; Added test resources and build configuration for util-hashing; Added test resources for Command and LoadService; Added test resources for ServiceLoadedTunableMap and JSON tuning scenarios; Added test resources for slf4j-api; Added test service provider files for LoadService scenarios; Added test suite for util-hashing components; Added tests for Base64 and GZIP string encoders; Added tests for Caffeine-based cache implementations; Added tests for Duration, Time, and LocalDateTime serialization in util-jackson; Added tests for Java interop with SLF4J Logger; Added tests for Java-to-Scala collection and Option conversions; Added tests for Mockito argument capture utilities; Added tests for VirtualMachineErrorTerminator; Added tests for ZkAsyncSemaphore and ShardCoordinator; Added tests for linting rule management and global rule scoping; Added tests for the Command class and its shell execution capabilities; Added tests for the new expression-based metrics API; Added tests for the util-slf4j-api logging module; Added tests for util-tunable core components; Added unit tests for ThriftCodec and ThriftSerializer; Added unit tests for util-core conversion operations; Added unit tests for util-zk components; Initial test suite for util-jackson; New testing utilities for Mockito argument capture and stats expression verification.

Dependencies

Initial dependency and build configuration for Twitter Util

This change introduces the foundational build configuration for the Twitter Util library, establishing the project's dependency baseline. The build.sbt file defines the release version as 24.8.0-SNAPSHOT and sets the primary Scala version to 2.13.6 with cross-build support for 2.12.12 and 3.0.2. Key third-party dependencies are pinned to specific versions, including Jackson 2.14.3, SLF4J 1.7.30, Guava 25.1-jre, Caffeine 2.9.3, and ScalaTest 3.1.2 (for Scala 2) / 3.2.9 (for Scala 3). Additionally, a requirements.txt file is added for the codegen component, specifying Mako \>=1.0.0.

(dependencies) · high confidence

Migration of util-logging to Pants build system

The util-logging module has been migrated from the legacy Maven layout to the Pants build system. This change introduces a new BUILD file that defines the library and test targets, replacing the previous build configuration, and updates the PROJECT file to reflect the new ownership structure. Users will now build and test this component using Pants, which standardizes the build process across the codebase.

util-logging · high confidence

Housekeeping

Added Bazel build and project ownership files for util-stats; Added project ownership metadata for util-validator; Initial repository structure and build tooling.

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

This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.

Score

  • CAI 33 → 67 (+34.1)
  • Rubric changed (rubric-2026.08.15 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 100 → 92 (-8.2)
  • Architecture 69 → 99 (+30.2)
  • Maturity 44 → 51 (+7.0)
  • Readiness 17 → 68 (+51.5)
  • Security 34 → 95 (+61.1)

Resolved (29)

  • Coverage not measured — test suite did not build
  • Dimension evaluation failed
  • Duplicated block (5 lines × 2) (util-core/src/main/java/com/twitter/service/VirtualMachineErrorTerminator.java)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • LLM evaluation failed
  • Leaked secret: private-key (util-security-test-certs/src/main/resources/keys/test-pkcs8-dsa.key)
  • Leaked secret: private-key (util-security-test-certs/src/main/resources/keys/test-pkcs8-ec.key)
  • Leaked secret: private-key (util-security-test-certs/src/main/resources/keys/test-pkcs8-garbage.key)
  • Leaked secret: private-key (util-security-test-certs/src/main/resources/keys/test-pkcs8.key)
  • Medium: security finding (details withheld)
  • Medium: security finding (details withheld)
  • Medium: security finding (details withheld)
  • Medium: security finding (details withheld)
  • No exposed public API
  • No tests found
  • Secret: generic-api-key (CHANGELOG.rst)
  • Secret: generic-api-key (CHANGES)
  • Secret: private-key (util-security-test-certs/src/main/resources/keys/test-pkcs8-dsa.key)
  • …and 9 more

New (149)

  • Allocations.newEdenGcListener (cognitive 23) (util-jvm/src/main/scala/com/twitter/jvm/Allocations.scala)
  • Annotations.findAnnotations (cognitive 16) (util-reflect/src/main/scala/com/twitter/util/reflect/Annotations.scala)
  • Buf.concat (cognitive 22) (util-core/src/main/scala/com/twitter/io/Buf.scala)
  • Buf.concat (cyclomatic 18) (util-core/src/main/scala/com/twitter/io/Buf.scala)
  • CaseClassDeserializer.parseConstructorValues (cognitive 21) (util-jackson/src/main/scala/com/twitter/util/jackson/caseclass/CaseClassDeserializer.scala)
  • Composite.equals (cognitive 30) (util-core/src/main/scala/com/twitter/io/Buf.scala)
  • Composite.process (cognitive 21) (util-core/src/main/scala/com/twitter/io/Buf.scala)
  • Composite.slice (cognitive 36) (util-core/src/main/scala/com/twitter/io/Buf.scala)
  • Composite.slice (cyclomatic 24) (util-core/src/main/scala/com/twitter/io/Buf.scala)
  • Context15.get (cognitive 16) (util-core/src/main/scala/com/twitter/util/Local.scala)
  • Context15.get (cyclomatic 16) (util-core/src/main/scala/com/twitter/util/Local.scala)
  • Context15.remove (cognitive 16) (util-core/src/main/scala/com/twitter/util/Local.scala)
  • Context15.remove (cyclomatic 16) (util-core/src/main/scala/com/twitter/util/Local.scala)
  • Context15.set (cognitive 16) (util-core/src/main/scala/com/twitter/util/Local.scala)
  • Context15.set (cyclomatic 16) (util-core/src/main/scala/com/twitter/util/Local.scala)
  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)
  • Dormant codebase
  • Duplicated block (10 lines × 2) (util-core/src/main/scala/com/twitter/util/Future.scala)
  • Duplicated block (10 lines × 2) (util-core/src/main/scala/com/twitter/util/Future.scala)
  • …and 129 more

Architecture

  • Containers 0 added · 0 removed · contexts 1 added · 0 removed · edges 0 added · 0 removed

Added bounded contexts (1)

  • repository

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

Survey your own repository

twitter/util 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 27 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 8ea6954b5f8afc602fc5abe66e3987272305ec32 — 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-d00c643c3f66.