Skip to main content

Module snapshot

Module snapshot 

Source
Expand description

Per-commit metric snapshots (ctx snapshot).

Exports one Parquet partition per commit (.ctx/snapshots/sha=<sha>/) with per-file and per-symbol metrics, near-duplicate pairs, and metadata, for longitudinal quality analysis via ctx sql --snapshots.

Each partition contains four files — symbols.parquet, files.parquet, dup_pairs.parquet, and meta.parquet — every row denormalized with commit_sha and committed_at so partitions can be unioned with a single read_parquet('.ctx/snapshots/*/*.parquet') glob per table.

Partitions are written to a sha=<sha>.tmp staging directory and moved into place with an atomic rename, so readers never observe a half-written snapshot. The capture core requires the duckdb feature; option and report types are available in every build so the CLI surface stays stable.

Structs§

BackfillOptions
Options for ctx snapshot backfill.
CaptureOptions
Options for a single snapshot capture.
SnapshotReport
The result of one snapshot capture.

Enums§

CaptureMode
How a snapshot was captured, recorded as capture_mode in meta.parquet.

Constants§

SNAPSHOTS_DIR
Default output directory for snapshot partitions, relative to the project root.
SNAPSHOT_SCHEMA_VERSION
Version of the snapshot Parquet schema, recorded in meta.parquet.

Functions§

backfill
Backfill snapshots for historical commits.
capture
Capture a snapshot of the repository at root (labeled with HEAD’s sha) into opts.out_dir/sha=<sha>/.
partition_dir_name
The partition directory name for a commit (sha=<sha>).