Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Validation Cache

Status: Current Last updated: 2026-05-19 16:54 EDT

The CHAT-core validation cache, used by chatter validate. Distinct from the audio-task cache used by Batchalign for FA / UTR ASR / media conversion: this cache stores parse + validate results keyed by file path + options.

crates/talkbank-transform/src/unified_cache/.

Architecture

flowchart TD
    req["Validation request\n(path + options)"]
    key["Cache key\n(path + check_alignment flag)"]
    db["SQLite WAL\n~/.cache/talkbank-chat/\ntalkbank-cache.db"]
    hit["Cache hit\n→ return stored result"]
    miss["Cache miss\n→ parse + validate + store"]

    req --> key --> db
    db -->|found + version match| hit
    db -->|not found or stale| miss
    miss --> db

Configuration

ConfigValueWhy
BackendSQLite via sqlxConcurrent reads (WAL), atomic writes, zero-config
Pool size16 connectionsMatches validation worker count
mmap256 MBFast random access for 95k+ entries
InvalidationVersion field + 30-day TTLSchema changes auto-invalidate; stale entries pruned
BridgeEmbedded single-threaded tokio runtimeSync workers call rt.block_on() for async SQLite

Schema

file_cache table (see crates/talkbank-transform/migrations/20260101000000_initial.sql):

ColumnRole
path_hashBLAKE3 hash of the resolved path (part of the lookup key)
file_pathResolved file path, indexed for path-based maintenance ops
content_hashHash of the file content; mismatch invalidates the entry
versionSchema/code version, mismatch invalidates the entry
cached_atInsertion timestamp
check_alignmentWhether alignment validation was requested
is_validCached validation outcome (0/1)
roundtrip_testedWhether roundtrip equivalence was checked
roundtrip_passedRoundtrip result when tested
parser_kindParser backend (tree-sitter or re2c)

The lookup key is the compound unique index (path_hash, version, check_alignment, parser_kind); file_path is a secondary index used by maintenance operations (orphan pruning, etc.).

Database location

PlatformPath
macOS~/Library/Caches/talkbank-chat/talkbank-cache.db
Linux~/.cache/talkbank-chat/talkbank-cache.db
Windows%LocalAppData%\talkbank-chat\talkbank-cache.db

Invalidation

  • Schema changes: bump the version field; old entries become unreachable.
  • Time-based: entries older than 30 days are pruned.
  • Manual: pass --force to bypass cache lookups for a particular validation run.

Per project policy, do not delete the cache directory without explicit request, see the cache-policy section of talkbank-tools/CLAUDE.md.

See also

  • Audio-task cache, Batchalign’s per-utterance cache for FA / UTR ASR / media conversion.

This page last changed: 2026-06-19 (commit c82a6d03). The whole book last changed: 2026-09-16 (commit 34d249d8).