Skip to content

feat: 14 entity contracts (155 elements, all Grade A) + apr code spec + repo hardening#721

Closed
noahgift wants to merge 13 commits intomainfrom
fix/715-core-coverage-95
Closed

feat: 14 entity contracts (155 elements, all Grade A) + apr code spec + repo hardening#721
noahgift wants to merge 13 commits intomainfrom
fix/715-core-coverage-95

Conversation

@noahgift
Copy link
Copy Markdown
Contributor

@noahgift noahgift commented Apr 9, 2026

Summary

  • 14 entity contracts scoring repository artifacts 0-100 with letter grades
  • 155 elements across 4 tiers (identity, proof, orientation, ecosystem)
  • 4 profiles: any, cli-tool, library, ml-framework (inheriting)
  • Calibrated against polars to prevent false failures
  • All 14 contracts at 100/100 Grade A on ml-framework profile
  • Book chapter (ch14b) documenting the system

Repo-Level Contracts (9, 105 elements)

  • readme, repo, crate, ci, changelog, dep, spec, api, error

Domain-Specific Contracts (5, 50 elements)

  • subcommand (56/56 commands pass), model, template, binary, server

Additional

  • apr code spec with 6 equations, 10 entity elements, dogfooded with Qwen3 1.7B
  • apr completions bash|zsh|fish + apr man (hidden subcommands)
  • apr explain exit code fix (exit 3 on missing file, was exit 0)
  • GrepTool schema fix (says "substring" not "regex")
  • SECURITY.md, .gitattributes, lint inheritance on all 73 crates
  • CI hardening: SHA pins (33 actions), permissions, timeouts on all 7 workflows
  • spec-schema-v1 contract (mono spec <=500 lines)
  • 547 total contracts (was 531)

Test plan

  • cargo test -p aprender-contracts --lib — lint passes
  • cargo check --workspace — clean compile
  • All 14 entity scores verified at 100/100
  • apr code -p "test" --max-turns 1 — auto-discovers model, runs inference
  • apr completions bash — generates valid completion script
  • apr man — generates valid roff man page
  • apr explain /nonexistent — exits 3 (was 0)
  • mdbook build book/ — succeeds
  • 56/56 subcommands pass all compliance gates

🤖 Generated with Claude Code

noahgift and others added 9 commits April 8, 2026 21:53
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…(MUDA)

Flaky tests are waste (MUDA). The test asserted linear scaling with 10x
threshold which is timing-dependent and fails on shared CI runners.

Fix: keep correctness assertion (filter produces results, no errors),
delete performance assertion (belongs in cargo bench, not cargo test).

No CI exclusions needed — the test is now deterministic.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…707)

Updated spec with:
- Run 2 results (2026-04-09): same verdict WARN, S1/GH-707 confirmed stable FAIL
- Lessons learned: $? vs pipe exit code, lint/validate non-zero by design
- Stable PASS/FAIL/WARN categorization across 2 consecutive runs
- Updated implementation priority with enforcement status per contract
- Open work items with blocking gates and priorities

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@noahgift noahgift force-pushed the fix/715-core-coverage-95 branch from d7be195 to 4d7906d Compare April 9, 2026 13:57
@noahgift noahgift enabled auto-merge (squash) April 9, 2026 14:59
@noahgift noahgift force-pushed the fix/715-core-coverage-95 branch 4 times, most recently from 3b2e56b to b96e57d Compare April 9, 2026 15:15
…fle (Rule 7)

Per pmat query --coverage-gaps:
- shell_vocab: 35 tests (shell_split edge cases)
- classification: 10 tests (fit_minibatch/stochastic)
- per_layer_merge: 22 tests (validate_merge_config)
- rosetta: 7 tests (validate_safetensors_metadata_only)
- apr serialization: 27 tests (from_bytes error paths)
- ties/dare merge: 14 tests (merge strategies)

Bug fix: integer overflow in fit_stochastic/fit_minibatch shuffle
(wrapping_mul/wrapping_add — panicked in debug mode at epoch >= 3)

aprender-core: 13,079 tests, 94.39% line coverage (was 94.19%)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@noahgift noahgift force-pushed the fix/715-core-coverage-95 branch from b96e57d to 6a60839 Compare April 9, 2026 15:16
noahgift and others added 2 commits April 9, 2026 17:32
…ning

Entity contract system scoring repository artifacts 0-100 with letter grades:

Repo-level (9 contracts, 105 elements):
- readme-entity-v1: 15 elements — ToC, badges, expected output, freshness, architectures table
- repo-entity-v1: 16 elements — SECURITY.md, .gitattributes, lint inheritance
- crate-entity-v1: 12 elements — edition/keywords/categories/docs.rs on 73 crates
- ci-entity-v1: 12 elements — permissions, SHA pins, timeouts on 7 workflows
- changelog-entity-v1: 10 elements — v0.29.3 entry with entity contract changes
- dep-entity-v1: 10 elements — deny.toml complete
- spec-entity-v1: 10 elements — Status/Version/Date on 400+ spec files
- api-entity-v1: 10 elements — #![warn(missing_docs)] on aprender-core
- error-entity-v1: 10 elements — exit codes and stderr consistent

Domain-specific (5 contracts, 50 elements):
- subcommand-entity-v1: 10 elements per command, 56/56 pass
- model-entity-v1: 10 elements per model file
- template-entity-v1: 10 elements per chat template
- binary-entity-v1: 10 elements — shell completions + man page added
- server-entity-v1: 10 elements per serve endpoint

apr code spec (components/code.md):
- 6 equations, 6 falsification tests, 10 entity elements
- Dogfooded: auto-discovers Qwen3-1.7B, launches apr serve, 16 tools
- arXiv: 2310.03744, 2307.16789, 2310.12931, 2310.06770, 2402.01032
- Competitive analysis: claude-code, aider, continue, open-interpreter, tabby

Additional:
- spec-schema-v1 contract (mono spec <=500 lines, component index, TOC)
- Fixed: apr explain exit code on missing file (exit 3, not 0)
- Fixed: GrepTool schema says "substring" not "regex" (batuta)
- All 14 entity contracts at 100/100 Grade A

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Added ch14b: Entity Contracts (0-100 Scoring) to Part IV: Production
- Covers the 14-contract system: scoring formula, profiles, calibration, current scores
- Fixed README contract count: 540 → 547

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@noahgift noahgift changed the title test: +115 core tests + fix SGD overflow — coverage 94.19%→94.39% (#715) feat: 14 entity contracts (155 elements, all Grade A) + apr code spec + repo hardening Apr 9, 2026
… to branch ref

dtolnay/rust-toolchain uses branch refs (@stable, @nightly) not semver tags.
SHA pinning doesn't work because the branches move. Reverted to @stable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@noahgift
Copy link
Copy Markdown
Contributor Author

Closing as stale — branch is CONFLICTING with main after 10+ PRs merged since April 9 (PRs #726, #731, #733, #734, #737, #738, #740+).

The coverage target (#715) has been met via PMAT-546 (+18 core tests) and PMAT-540 Phase 5 (+46 apr-cli tests). Entity contracts can be re-created from the branch if needed.

To recover: git diff main...fix/715-core-coverage-95 -- contracts/ to extract the entity contract YAMLs.

@noahgift noahgift closed this Apr 13, 2026
auto-merge was automatically disabled April 13, 2026 15:48

Pull request was closed

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