Skip to content

feat(config): config model, preset merge, canonical fingerprint (T02) - #2

Merged
prateekchaplot merged 2 commits into
mainfrom
feat/config-fingerprint
Nov 15, 2026
Merged

prateekchaplot merged 2 commits into
mainfrom
feat/config-fingerprint

Conversation

@prateekchaplot

Copy link
Copy Markdown
Owner

T02 — Config + fingerprint (ARCHITECTURE §14.2)

Closes out task T02. Dependent tasks per the shared-file protocol (§14.4): T03 (uses fp8 for per-fingerprint table naming), T04 (consumes CaliperConfig).

What

  • src/caliper/config.py: CaliperConfig (pydantic, frozen, extra="forbid") with the §9.7 binding fields; load_config(user_path, preset); fingerprint() (SHA-256 of canonical JSON of the §11.2 binding fields); fp8(); ConfigError naming the offending key path (§11.4)
  • configs/caliper.sample.toml, configs/v1.toml, configs/v2.toml, configs/v3.toml — exact §9.7 contents
  • tests/unit/test_config.py — 36 tests (merge semantics, §9.7 binding, fingerprint stability/per-field sensitivity, key-path errors)

Decisions recorded (docs/TASKS.md Notes)

  1. Merge order (§11.2 ambiguity): user config deep-merged over the preset (user wins) — only reading consistent with A2's Ollama fallback; FR-10 identity enforced by the fingerprint gate (§7.8), not merge order.
  2. prompt_template_sha256: placeholder (SHA-256 of empty string) until T11 freezes the template; T11 replaces it in all four TOML files.
  3. high_confidence_threshold: initialized 0.60 (not pinned in §9.7); re-verify at T16.

Verification

  • uv run pytest — 38 passed
  • ruff check + ruff format --check — clean
  • mypy (strict, src/caliper) — clean

⚠️ Frozen downstream: preset values + fingerprint algorithm are now load-bearing (T03+ depend on them).

CaliperConfig (pydantic, frozen, extra=forbid) with the section 9.7 binding
fields; load_config deep-merges the user config over the version preset;
fingerprint() is the SHA-256 of canonical JSON of the binding fields, fp8()
the 8-char table suffix. Invalid configs are rejected with the offending
key path (section 11.4). Ships configs/{caliper.sample,v1,v2,v3}.toml and
unit tests for merge semantics, preset contents, fingerprint stability and
per-field sensitivity, and key-path validation errors.
@prateekchaplot
prateekchaplot merged commit 9b0f9bb into main Nov 15, 2026
2 checks passed
@prateekchaplot
prateekchaplot deleted the feat/config-fingerprint branch November 15, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant