Skip to content

test(tuning): pin soundness boundaries (status vocab, hash canonicality, registry drift, marker round-trip, shared mode vocabulary)#1177

Merged
joeharris76 merged 1 commit into
developfrom
fix/tuning-soundness-tests
Jul 16, 2026
Merged

test(tuning): pin soundness boundaries (status vocab, hash canonicality, registry drift, marker round-trip, shared mode vocabulary)#1177
joeharris76 merged 1 commit into
developfrom
fix/tuning-soundness-tests

Conversation

@joeharris76

Copy link
Copy Markdown
Owner

Pull Request

Description

Implements TODO tuning-soundness-test-coverage-20260712 (review finding R7 — zero coverage on every tuning soundness boundary). Adds:

  • Validation-status vocabulary pin — AST-derived from the production emitters (adapter.py, models.py default), so a new status literal fails the test; removes the fictional "PASSED" fixtures (a value production never emits).
  • Hash canonicality — insertion-order stability, distinctness, and the truncation-posture contrast (full sha256 vs 16-char/64-bit hash_tuning_template) documented in assertions.
  • Capability-source drift test — generator registry (AST) vs compat map vs empirically-probed map_candidate_to_platform, with per-divergence EXPECTED_* allowlists (ADR-3-gated) and failure messages distinguishing new drift from stale allowlists. Drift-demo performed: removing mysql from the compat map failed 2 tests with explicit messages; reverted.
  • Resolver-marker ↔ coverage-parser round-trip — real resolve_tuning() output fed to the real parser; no hand-written strings.
  • Shared mode vocabulary artifacttests/unit/core/tuning/fixtures/tuning_mode_vocabulary.yaml pinning ADR-002's set {tuned, tuned-fallback, notuning, auto, custom} + not-recorded sentinel, asserted by pytest AND a vitest test (shell-out pattern matching the existing db-remediation-pin test).
  • Requested-vs-applied capture test — honestly named: pins today's tunings_applied == requested config gap through the real _setup_fresh_database_phases path with a recording connection; docstring defers verified-execution assertions to the ADR-001 applied-ledger TODO.

Narrowed w3 where #1174/#1167 already landed sync/registry tests (documented in the TODO notes). Moves the TODO to DONE.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactor / chore

Testing

  • tests/unit/core/tuning + tests/unit/cli/test_tuning* + tests/uat/test_tuning_coverage.py — 555 passed; results-explorer vitest — 768 passed full run (4/4 new); ruff + tsc --noEmit clean
  • Opus review: NO FINDINGS (verified the tests derive from production sources rather than mirroring constants; allowlists accurate; vitest shell-out matches the established CI-safe pattern; fixture matches ADR-002 exactly and is not gitignored)

Public Contract Check

  • Test-only change (+ one committed test fixture); no contract surfaces.
  • Contract-map impact — none.
  • No count claims.

Documentation

  • N/A (tests). Truncation posture documented in test docstrings/messages.
  • No behavior changes.
  • API wording unaffected.

Code Quality

  • ruff/tsc clean; both suites green.
  • No production code touched (the coverage.py scope allowance went unused).
  • The tests ARE the coverage addition.
  • Contracts valid.

Artifact Hygiene

  • No raw artifacts (fixture is a small YAML spec, consumer: both test suites, ~20 lines).
  • Fixture deliberately placed outside data/ directory names (repo .gitignore blankets those).

Notes

Part of the tuning remediation batch (#1161). The requested-vs-applied test is designed to be superseded by tuning-applied-ledger-and-validation-status-20260712.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QTnjb2i44JUL71kmu9sk1t


Generated by Claude Code

…ty, registry drift, marker round-trip, shared mode vocabulary)

Adds the six test-only work units from the 2026-07-12 tuning review's
finding R7, re-scoped against what #1174 (canonical platform keys) and
#1167 (generator registry completeness) already landed:

- w1: removes the fictional "PASSED" validation-status fixtures in
  test_tpc_tuning_template_parity.py and pins the real vocabulary
  (NOT_APPLICABLE/APPLIED/FAILED_TO_SAVE/NOT_VALIDATED) via AST-derived
  extraction from adapter.py/models.py, not a hand-copied set.
- w2: hash canonicality for BenchmarkTunings.get_configuration_hash
  (full 64-char sha256, insertion-order stable) and
  profile_validation.hash_tuning_template (16-char truncated; collision
  posture documented in the assertion message).
- w3: cross-source drift test between get_ddl_generator()'s registry,
  _PLATFORM_COMPATIBILITY_MAP, and platform_capabilities.map_candidate_
  to_platform's supported set, narrowed to skip the compat-map/
  known-platforms sync #1174 already covers. Every current divergence is
  an explicit allowlisted entry (ADR-3 gates consolidation); the test
  fails on new or stale drift only.
- w4: feeds resolve_tuning()'s real info_messages into coverage.py's
  real status_from_log_text() (no hand-written marker strings).
- w5: adds the shared ADR-2 tuning_mode vocabulary artifact (tests/unit/
  core/tuning/fixtures/tuning_mode_vocabulary.yaml, kept out of a
  gitignored data/ dir) asserted identically by a Python test and a
  vitest test (via the db-remediation-pin.test.ts shell-out pattern) --
  pins the ADR-2 target contract, not current-emitter compliance.
- w6: a stub-adapter/recording-connection harness pinning today's
  tunings_applied = requested-config behavior (not verified-executed
  statements), named and documented as such pending the applied-ledger
  TODO.

Verified: tests/unit/core/tuning, tests/unit/cli/test_tuning*, and
tests/uat/test_tuning_coverage.py all green (555 passed); results-explorer
vitest suite green (768 passed); drift-demo performed and reverted (removing
_PLATFORM_COMPATIBILITY_MAP's "mysql" entry failed 2 of the new w3 tests
with clear stale-allowlist messages).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QTnjb2i44JUL71kmu9sk1t
@joeharris76 joeharris76 enabled auto-merge (squash) July 16, 2026 02:41
@joeharris76 joeharris76 merged commit b4334b0 into develop Jul 16, 2026
23 of 26 checks passed
@joeharris76 joeharris76 deleted the fix/tuning-soundness-tests branch July 16, 2026 03:09
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.

2 participants