Keats/tera
66.8
Adequate · 30 September 2026
15.5k
lines of production code
Rust
primary language
2
measurements over time
What this system is
This system is the Tera template engine, a Rust-based library for parsing and rendering templates into output formats like HTML. It features a complete architectural rewrite that compiles templates into a custom bytecode instruction set executed by a new virtual machine, enabling optimized performance and support for reusable UI components. The engine provides extensive capabilities for data manipulation through a rich set of filters and functions, including base64 encoding, date formatting, and JSON serialization, while enforcing strict type safety and detailed error reporting.
Features
Add Tera template engine and license symlink
This change introduces the Tera template engine to the project by adding a LICENSE symlink pointing to the root license file and a new Python script (bytes.py) for analyzing bytecode and AST of literal array/map subscripts. The inclusion of the license file addresses the missing license text in published crates, while the Python script appears to be a utility for inspecting Python code structure, potentially for development or testing purposes related to the new Tera integration.
tera · medium confidence
New Tera2 component examples and performance benchmarks
The examples directory now includes a comprehensive dashboard demo (\dashboard.rs\ and associated templates) showcasing Tera2 component features such as hierarchical namespacing, typed parameters with defaults, rest parameters, spread operators, body slots, recursive components, and nested component usage. Additionally, new standalone examples (\basic/main.rs\, \big\_table.rs\, \teams.rs\) demonstrate basic template rendering, large table iteration, and loop performance benchmarking using the \black\_box\ hint.
tera/examples · high confidence
New contrib filters and functions for base64, dates, formatting, and more
The \tera-contrib\ crate now provides a suite of additional Tera filters and functions that must be explicitly registered by the user. This includes \b64\_encode\ and \b64\_decode\ for base64 handling (with URL-safe and padding options), \date\ for parsing and formatting datetimes using ICU and Jiff (supporting locales and timezones), \filesize\_format\ for human-readable sizes, \format\ for Rust-style string formatting, \json\_encode\ for JSON serialization, \get\_random\ and \shuffle\ for randomization with optional seeding, \regex\_replace\ and \matching\ for regex operations, \slug\ for URL slugs, and \urlencode\/\urlencode\_strict\ for URI encoding. These are delivered as a separate package to allow independent versioning from the core Tera crate.
tera-contrib/src · high confidence
Removals
Removal of template engine source modules
The source files defining the template engine's core components—specifically the lexer, parser, and AST (Abstract Syntax Tree)—have been deleted from the \src\ directory. This removes the implementation details for parsing template syntax, including support for features like loops, macros, filters, and variable interpolation, effectively stripping the library of its template processing capability.
src · high confidence
Behavioural changes
Complete rewrite of the internal Value type and serialization system
The internal representation of template data (Value) has been completely rewritten to improve performance and correctness. The new system introduces a dedicated Key type for map keys, supporting 128-bit integers and optimized string storage via Arc. Serialization and deserialization are now handled by custom, high-performance serde adapters that include a 'magic passthrough' mechanism to avoid cloning Value instances during nested serialization. The change also refines number handling with a unified Number enum for arithmetic operations and ensures deterministic map output ordering when the preserve\_order feature is disabled.
tera/src/value · high confidence
Introduce new parser, compiler, and bytecode instruction set
The template parsing engine has been replaced with a new architecture that compiles templates into a custom bytecode instruction set. This change introduces a new AST structure in \ast.rs\, a bytecode compiler in \compiler.rs\, and a detailed set of execution instructions in \instructions.rs\ (including optimized paths for attribute access and spread operators). The lexer in \lexer.rs\ and the parser in \parser.rs\ have been rewritten to support these new instructions, enabling features like list comprehensions, component calls, and spread syntax while enforcing stricter limits on recursion depth and expression complexity.
tera/src/parsing · high confidence
New virtual machine interpreter with optimized for-loop iteration and component support
The template rendering engine has been replaced with a new virtual machine located in \tera/src/vm\. This new interpreter introduces a dedicated \ForLoopIterator\ that optimizes iteration over arrays, maps, strings, and bytes, supporting grapheme-aware iteration when the \unicode\ feature is enabled. The VM also adds native support for rendering components, including recursion depth limiting, implicit parameter resolution, and autoescape handling. Additionally, the interpreter enforces stricter type safety by erroring on ordering operations between incompatible types and improves error reporting by attaching source spans to rendering errors.
tera/src/vm · high confidence
Tera 2.0: Major engine rewrite with components, custom delimiters, and improved error reporting
This release introduces a complete rewrite of the Tera template engine, bringing significant new capabilities and behavioral changes. Users can now define and render reusable UI components with explicit argument types and metadata, and customize template syntax by setting custom block, variable, and comment delimiters. Error reporting has been overhauled to provide detailed, source-span-aware diagnostic messages similar to Rust's compiler output, including better handling of circular includes and extends. The context API now supports bare variable capture in the \context!\ macro and uses \Cow\<'static, str\>\ for keys to improve performance. Additionally, the engine enforces stricter validation for argument types and ranges, adds a \range\ function with a maximum length limit to prevent denial-of-service, and introduces new filters like \escape\_xml\, \values\, and \keys\.
tera/src · high confidence
Test coverage
Added fuzzing targets for template expressions, tags, and templates; Added performance benchmarks for HTML escaping, template rendering, and value serialization; Added realistic template benchmarks for performance testing; Expanded test coverage for Tera rendering, components, and introspection; Snapshot test suite for template parsing and compilation.
Dependencies
Rust edition upgrade to 2024 and workspace restructuring
The Tera template engine and the tera-contrib extension library have been upgraded to the Rust 2024 edition. The project structure has been reorganized into a Cargo workspace containing the core \tera\ crate (version 2.4.0) and the \tera-contrib\ crate (version 0.3.0), replacing the previous single-crate layout. This change introduces new optional dependencies for performance and functionality, including \ahash\ for fast hashing, \unicode-segmentation\ for grapheme handling, and \pulldown-cmark-escape\ for optimized HTML escaping, alongside a new fuzzing harness for the parser.
(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 63 → 67 (+3.5)
- Rubric changed (rubric-2026.09.11 → rubric-2026.09.18) — scores are not directly comparable.
Lenses
- Code Health 83 → 83 (-0.0)
- Architecture 100 → 96 (-3.7)
- Maturity 48 → 53 (+5.0)
- Readiness 74 → 77 (+3.1)
- Security 70 → 76 (+5.9)
- Performance 85 (new)
Resolved (4)
- Documentation: no installation or build instructions (README.md)
- Hotspot: tera/src/parsing/ast.rs (tera/src/parsing/ast.rs)
- Hotspot: tera/src/tera.rs (tera/src/tera.rs)
- Hotspot: tera/src/value/mod.rs (tera/src/value/mod.rs)
New (8)
- Inconsistent error handling and return types for lookup operations. Kwargs.get returns TeraResult (implying it might fail or wrap the value), while Context.get returns Value directly (likely panicking or returning a default on miss). Kwargs.must_get suggests a variant that panics or errors, but Context lacks a must_get equivalent, making the API surface for accessing context data inconsistent between Kwargs and Context.
- Inconsistent parameter ordering for 'to' (write) variants. render_str_to includes autoescape before write, whereas render_component_to and render_block_to do not have an autoescape parameter in the same position (or at all, relying on global/state settings). More critically, render_to (for named templates) does not expose autoescape in the signature, while render_str_to does. This inconsistency in how autoescaping is handled across similar 'render to writer' methods is confusing.
- Incorrect return types for as_array and as_bytes. as_map returns Map, but as_array and as_bytes return String. This is likely a typo in the API definition (should probably return Vec<Value> and Vec<u8> or similar). Returning String for an array or bytes conversion is semantically incorrect and inconsistent with as_map.
- Off the main sequence: tera
- Outdated: indexmap
- Outdated: jiff
- Outdated: rand
- Redundant naming for identical functionality. render_str and one_off appear to perform the same operation (rendering a string template rather than a named template). The distinction is unclear from the signature alone, and having two methods for the same logical action creates confusion.
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
Keats/tera 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 30 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 6ead3c0ffa1e731f58694f94130253a559da68f4 — the exact code this score is about.
- Scored under rubric-2026.09.18 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-cb25ca4feafa.