Skip to main content

Shared schema, store, and target parsing for the gaptrace observability system

Project description

gaptrace-core

Shared kernel for the gaptrace observability system: the run-record schema, the single SQLite store, and the sNrN target parser. gaptrace-capture, gaptrace, and gaptrace-evaluate all depend on it — it depends on nothing.

You normally do not import this directly. Instrument pipelines with gaptrace_capture, evaluate with gaptrace_evaluate — both re-export the schema dataclasses. gaptrace_core exists so those packages share one store contract instead of three copies of it.

Zero-dependency guarantee

gaptrace_core imports only the Python standard library (sqlite3, dataclasses, json, re, pathlib, datetime). This is enforced by a test (tests/test_zero_deps.py) that imports the package in a subprocess and asserts nothing outside the stdlib was loaded.

What lives here

Module Contents
gaptrace_core.schema RunRecord and its child dataclasses (ChunkRecord, TokenBudget, TokenUsage, Turn, CacheEvent, ToolCallRecord), all tolerant of unknown kwargs
gaptrace_core.store store location, schema + migrations, and every persistence primitive (runs, eval scores, benchmark, policies)
gaptrace_core.targets parse_target_id("s4r3") -> (4, 3) — the one sNrN parser

Environment setup contract

gaptrace_core.store.connect() guarantees the environment before returning a connection:

  1. ~/.gaptrace/ exists (created if missing),
  2. ~/.gaptrace/runs.db exists (created if missing),
  3. the schema is at the latest version — fresh databases are created directly at the latest version; databases written by older package versions are migrated in place.

Any entry point — a library call, a CLI command, an example script — works on a fresh machine with no prior CLI invocation.

Schema version + migration story

One constant, gaptrace_core.store.SCHEMA_VERSION (currently "3"), recorded in the meta table. The migration chain walks old databases forward on first connect:

  • v1 → v2: adds eval_scores / risk_score / evaluated_at columns to runs; creates the benchmark and policies tables.
  • v2 → v3: creates the runs_fts FTS5 index over run queries (with insert/update/delete sync triggers, backfilled from existing rows) and drops the now-redundant idx_runs_query index.

A database reporting a version this package doesn't know raises RuntimeError rather than guessing.

DB location and layout

The store lives at ~/.gaptrace/runs.db (SQLite, WAL mode).

Table Columns
meta key, value — holds schema_version
sessions session_id, title, pipeline, created_at
runs session_id, run_seq, query, pipeline, created_at, run_data (JSON RunRecord), eval_scores (JSON), risk_score, evaluated_at
benchmark pipeline, factor, threshold, correlation, sample_count, updated_at
policies pipeline, policy_data (JSON), updated_at
runs_fts FTS5 index over runs.query

Runs are addressed as s{session_id}r{run_seq} (e.g. s2r3) everywhere — "run" is the data noun; capturing is the verb, and belongs to gaptrace-capture.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gaptrace_core-0.1.0.tar.gz (25.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gaptrace_core-0.1.0-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file gaptrace_core-0.1.0.tar.gz.

File metadata

  • Download URL: gaptrace_core-0.1.0.tar.gz
  • Upload date:
  • Size: 25.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gaptrace_core-0.1.0.tar.gz
Algorithm Hash digest
SHA256 896cd1ac1ff188b0ebd3e51dd1b9c91acf10425547345aa6de118653707cbf6e
MD5 f9e9b423ce57fe7d6f2cc46c660f02db
BLAKE2b-256 4b4963c66db2060840802692d2cfac34ffd5e7a83ad63158160bd53d25eb6d49

See more details on using hashes here.

File details

Details for the file gaptrace_core-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gaptrace_core-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gaptrace_core-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39ea2e49194f5c739e81bd84a7c32849816544ccef00a7d4f2b888bbf86a446b
MD5 d3c95c3cf440abdcf1593a269f8e6b05
BLAKE2b-256 d0c8ec5ca868eda5fa56a20ec0514b0e1d5fb99ff9587407d653a6cef79f01b4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page