Skip to main content

Internal Architecture

This section explains how datamitsu works under the hood. Understanding the internal execution model helps wrapper maintainers optimize tool configurations and advanced users debug unexpected behavior.

How It All Fits Together​

When you run datamitsu check, the system moves through a startup phase and then four stages:

  1. Startup and Config Load resolves the repository root and evaluates every config source into the merged configuration everything downstream reads.
  2. File Discovery performs one gitignore-aware repository walk, sorts the resulting inventory, and shares it with bundled checks and the planner.
  3. Task Planning groups matched files into tasks based on tool priorities, scopes, and project boundaries. Overlapping globs are detected and resolved.
  4. Parallel Execution runs task groups sequentially by priority level, but tasks within each group run in parallel across available CPU cores.
  5. Cache Update records per-file passes for independent operations and complete unit/repository verdicts for coarser operations.

Why This Matters​

For wrapper maintainers: Understanding how priorities and overlap detection work lets you write tool configurations that maximize parallelism. Misconfigured priorities can serialize tools that could run in parallel, slowing down CI pipelines.

For advanced users: Knowing how file discovery and caching interact explains why certain files are or aren't processed, and how to force cache invalidation when needed.

Components​

Each stage has its own detailed documentation:

ComponentWhat It DoesKey Concepts
Startup & Config LoadResolves the repo root, evaluates configConfig-evaluation cache, git-root memo, extension-based type stripping
Task PlanningGroups inventory into prioritized tasksGranularity, widening, overlap detection, CWD selection
Parallel ExecutionRuns tasks, fail-fast by defaultTwo-layer model, context cancellation, progress tracking
File DiscoveryBuilds one shared, sorted repository inventory.gitignore traversal, project auto-detection, inventory reuse
Caching StrategyTracks file passes and unit/repo verdictsXXH3-128 keys, guards, TTL, concurrent persistence
WASM Output ParsersSandboxed parsers + formatting diff-in-coreRust→WASM, SHA-256 trust, https or OCI source, wazero, Myers diff

Reading Order​

If you're new to datamitsu's internals, read in this order:

  1. Startup and Config Load -- what every invocation pays before anything else
  2. File Discovery -- how files enter the system
  3. Task Planning -- how files become tasks
  4. Parallel Execution -- how tasks run
  5. Caching Strategy -- how results persist between runs

If you're debugging a specific issue, jump directly to the relevant component page.