Skip to content

refactor: extract frozen DSL-agnostic harness core (structural only)#484

Merged
Tyler-R-Kendrick merged 1 commit into
mainfrom
claude/harness-core-package-d1vqiz
Jul 19, 2026
Merged

refactor: extract frozen DSL-agnostic harness core (structural only)#484
Tyler-R-Kendrick merged 1 commit into
mainfrom
claude/harness-core-package-d1vqiz

Conversation

@Tyler-R-Kendrick

@Tyler-R-Kendrick Tyler-R-Kendrick commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Summary

Pulls the frozen machinery every harness builds on into a new slm_training.harness_core package that supports any arbitrary DSL/AST. The OpenUI harnesses keep their DSL-specific policy and optimizations at their current import paths and keep iterating there. Purely structural — zero functional change to harnesses or training.

What moved (git mv, history preserved)

Old path New path
src/slm_training/versioning.py harness_core/versioning.py (registry paths re-anchored)
src/slm_training/lineage/ (9 modules) harness_core/lineage/
harnesses/model_build/checkpoint_reference.py harness_core/checkpoint_reference.py
harnesses/experiments/{efficiency_gain,scaling_fit}.py harness_core/{efficiency_gain,scaling_fit}.py
evals/{record_schema,eval_cache,score_policy}.py harness_core/{record_schema,eval_cache,score_policy}.py

Engine seams (DSL specifics stay in the harnesses)

  • harness_core/gate_engine.py — the ship-gate check loop (missing-suite fail-closed, fallback certification, min_n evidence floor, threshold loop) extracted verbatim behind a normalize_suite/default_min_n seam. model_build/ship_gates.py remains the OpenUI policy owner: DEFAULT_SHIP_GATES, MEANINGFUL_METRIC_POLICY, the slim-metric normalizer, payload assembly, gates.json writing — thresholds and payload byte-identical.
  • harness_core/promotion_engine.py — promotion checks extracted behind hard_categories/gate_evaluator parameters. experiments/promotion.py keeps HARD_CATEGORIES, the DSL-touching check_data_integrity, the ship-gate binding, and every original public signature (including the pre-existing threshold_version: custom:<sha> behavior when promotion invokes the default gate policy).

Zero call-site churn

Every old import path remains a sys.modules alias shim: old and new paths resolve to the same module objects, so class identity and monkeypatching behave identically through either path. No consumer files (scripts, tests, web, autoresearch) were touched.

Guarantees, enforced

  • tests/test_harness_core/test_import_hygiene.py — core has no DSL-coupled slm_training.* module-level imports (one grandfathered lazy exception allowlisted), and importing core never pulls torch.
  • tests/test_harness_core/test_gate_engine_golden.py — ship-gate payloads pinned byte-for-byte against a pre-extraction capture (default policy, fallback/legacy paths, custom thresholds).
  • tests/test_harness_core/test_shims.py — module identity across all 16 old/new path pairs.
  • versions.json: new harness.core component claims harness_core/; gates.ship additionally claims gate_engine.py so gate logic stays under gate discipline; no-bump: history notes on gates.ship, harness.experiments, evals.scoring.

Verification

  • Full suite before vs after on this environment: pre-existing pass/fail sets are byte-identical (the failing set is environment-dependent bridge/network tests, unchanged by this PR); 24 new core tests pass.
  • repo_policy, ruff check ., compileall, verify_version_stamps --check --base origin/main, validate_page_dsl --check, verify_checkpoint_references --check all green.

Docs

docs/design/harness-core.md (the freeze contract + seams + explicit non-goals/follow-ups), AGENTS.md engineering norm, repository-organization placement row.

🤖 Generated with Claude Code

https://claude.ai/code/session_011DARSmTTQtF2AzYBy6wosC


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Added centralized checkpoint provenance, lineage tracking, evaluation caching, scoring, scaling, gate-check, and promotion capabilities.
    • Added stable version stamping and efficiency-gain analysis.
    • Preserved existing import paths for compatibility while consolidating shared functionality.
  • Documentation

    • Documented the harness core architecture, placement rules, stability requirements, and versioning expectations.
  • Tests

    • Added coverage for gate behavior, import hygiene, compatibility paths, and stable output formatting.

@vercel

vercel Bot commented Jul 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
slm-training Ready Ready Preview, Comment Jul 19, 2026 8:46pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c2084089-b00b-47e6-8f6d-8f3154a9b666

📥 Commits

Reviewing files that changed from the base of the PR and between eda0d9e and 36977a8.

📒 Files selected for processing (38)
  • AGENTS.md
  • docs/design/harness-core.md
  • docs/repository-organization.md
  • scripts/check_changed.py
  • src/slm_training/evals/eval_cache.py
  • src/slm_training/evals/record_schema.py
  • src/slm_training/evals/score_policy.py
  • src/slm_training/harness_core/__init__.py
  • src/slm_training/harness_core/checkpoint_reference.py
  • src/slm_training/harness_core/efficiency_gain.py
  • src/slm_training/harness_core/eval_cache.py
  • src/slm_training/harness_core/gate_engine.py
  • src/slm_training/harness_core/lineage/__init__.py
  • src/slm_training/harness_core/lineage/data_cycle.py
  • src/slm_training/harness_core/lineage/evaluation_snapshot.py
  • src/slm_training/harness_core/lineage/interventions.py
  • src/slm_training/harness_core/lineage/merge.py
  • src/slm_training/harness_core/lineage/promotion.py
  • src/slm_training/harness_core/lineage/records.py
  • src/slm_training/harness_core/lineage/store.py
  • src/slm_training/harness_core/lineage/tracks.py
  • src/slm_training/harness_core/promotion_engine.py
  • src/slm_training/harness_core/record_schema.py
  • src/slm_training/harness_core/scaling_fit.py
  • src/slm_training/harness_core/score_policy.py
  • src/slm_training/harness_core/versioning.py
  • src/slm_training/harnesses/experiments/efficiency_gain.py
  • src/slm_training/harnesses/experiments/promotion.py
  • src/slm_training/harnesses/experiments/scaling_fit.py
  • src/slm_training/harnesses/model_build/checkpoint_reference.py
  • src/slm_training/harnesses/model_build/ship_gates.py
  • src/slm_training/lineage/__init__.py
  • src/slm_training/resources/versions.json
  • src/slm_training/versioning.py
  • tests/test_harness_core/__init__.py
  • tests/test_harness_core/test_gate_engine_golden.py
  • tests/test_harness_core/test_import_hygiene.py
  • tests/test_harness_core/test_shims.py

📝 Walkthrough

Walkthrough

Introduces a DSL-agnostic harness_core package containing shared provenance, lineage, evaluation, scoring, scaling, gate, and promotion machinery. Historical import paths become compatibility aliases, while documentation, version registration, routing, and contract tests are added.

Changes

Harness core extraction

Layer / File(s) Summary
Contract and registration
AGENTS.md, docs/design/harness-core.md, docs/repository-organization.md, scripts/check_changed.py, src/slm_training/harness_core/__init__.py, src/slm_training/resources/versions.json
Documents the frozen harness-core contract, registers harness.core, exposes core APIs, and expands changed-path test selection.
Provenance and lineage foundations
src/slm_training/harness_core/checkpoint_reference.py, src/slm_training/harness_core/versioning.py, src/slm_training/harness_core/lineage/*
Adds checkpoint references, version stamps, canonical lineage records, track recipes, and relocated lineage dependencies.
Evaluation, scaling, and scoring engines
src/slm_training/harness_core/{record_schema,eval_cache,scaling_fit,efficiency_gain,score_policy}.py
Adds canonical record normalization, fail-closed evaluation caching, scaling fits, efficiency metrics, and candidate score policies.
Gate and promotion delegation
src/slm_training/harness_core/{gate_engine,promotion_engine}.py, src/slm_training/harnesses/experiments/promotion.py, src/slm_training/harnesses/model_build/ship_gates.py
Centralizes gate and promotion checks and adapts existing OpenUI entry points to the shared engines.
Historical import compatibility
src/slm_training/evals/*, src/slm_training/harnesses/experiments/{efficiency_gain,scaling_fit}.py, src/slm_training/harnesses/model_build/checkpoint_reference.py, src/slm_training/lineage/__init__.py, src/slm_training/versioning.py
Replaces relocated implementations with module aliases preserving historical import paths and object identity.
Validation and selection coverage
tests/test_harness_core/*
Adds golden gate payload tests, import-hygiene checks, shim identity checks, and version-stamp validation.
Estimated code review effort: 4 (Complex) ~60 minutes

Possibly related PRs

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/harness-core-package-d1vqiz

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Pull the frozen machinery every harness builds on into a new
slm_training.harness_core package that supports any DSL/AST; the OpenUI
harnesses keep their DSL-specific policy and optimizations at their
current paths and keep iterating there.

- moved (git mv): versioning.py, lineage/ (9 modules),
  model_build/checkpoint_reference.py,
  experiments/{efficiency_gain,scaling_fit}.py,
  evals/{record_schema,eval_cache,score_policy}.py
- extracted engines: gate_engine.py (ship-gate check loop behind a
  normalize_suite/default_min_n seam) and promotion_engine.py
  (promotion checks behind hard_categories/gate_evaluator); the policy
  owners model_build/ship_gates.py and experiments/promotion.py keep
  every threshold, metric name, constant, and public signature
- every old import path remains a sys.modules alias shim: old and new
  paths resolve to the same module objects (class identity and
  monkeypatching unchanged); no call sites were touched
- hygiene enforced by tests/test_harness_core: no DSL-coupled
  module-level imports in core, torch-free core import, shim identity,
  and a golden characterization test pinning the ship-gate payload
  byte-identical to a pre-extraction capture
- registry: new harness.core component claims harness_core/; gates.ship
  additionally claims gate_engine.py; no-bump history notes on
  gates.ship, harness.experiments, evals.scoring
- tooling/docs: check_changed prefix map, AGENTS.md norm,
  repository-organization placement row, docs/design/harness-core.md

No functional change to harnesses or training: the full pre-existing
test suite passes/fails identically to the pre-change baseline in this
environment (the failing set is environment-dependent bridge/network
tests, byte-identical before and after).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DARSmTTQtF2AzYBy6wosC
@Tyler-R-Kendrick
Tyler-R-Kendrick force-pushed the claude/harness-core-package-d1vqiz branch from 9311adb to 36977a8 Compare July 19, 2026 20:45
@Tyler-R-Kendrick
Tyler-R-Kendrick merged commit be42469 into main Jul 19, 2026
3 of 4 checks passed
@Tyler-R-Kendrick
Tyler-R-Kendrick deleted the claude/harness-core-package-d1vqiz branch July 19, 2026 20:51
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