Skip to content

Migrate the 12 hand-rolled producer build.rs key builders onto build_helper::env_key (#2699 remainder) #4369

Closed

Description

@noahgift

Sub-issue of #2870 (P-1.1). Remainder of #2699, per cop scoping (aprender-77, 09:15Z 2026-09-25).

Twelve producer build.rs files each hand-roll the CONTRACT_<C>_<E> key format. #2699 made aprender_contracts::build_helper::env_key public and tested it equal to the key the macro reads (contract_env_key!). Any hand-rolled copy that drifts binds nothing, silently.

done_when: every producer build.rs builds its keys with env_key, or build-depends on a crate that does. No format!("CONTRACT_…") key construction is left in any build.rs, and a guard fails if one reappears.

Activity

  1. added this to the 0.72.0 milestone on Sep 25, 2026
  2. noahgift commented on Sep 25, 2026

    @noahgift
    ContributorAuthor

    Measured while doing #4368 (commit ba895e0): 9 of the 10 producer build.rs files (aprender-compute, -core, -db, -orchestrate, -present-cli, -present-core, -rag, -serve, -train) read binding.yaml from ../../../provable-contracts/contracts/<crate>/binding.yaml. That sibling-repo path has been gone since APR-MONO, so each one emits CONTRACT_BINDING_SOURCE=none and no binding vars. Build-script output confirms it: keys=0 for all nine. Their #[contract] sites bind nothing (53 in aprender-core alone). In-tree, only contracts/aprender/binding.yaml exists. Repointing them turns on #4368's registry check and every YAML pre/postcondition for those sites, so expect #4371-class prose breakage. Scope is pending with the cop (aprender-77).

  3. modified the milestones: 0.72.0, 0.70.0 on Sep 25, 2026
  4. noahgift commented on Sep 25, 2026

    @noahgift
    ContributorAuthor

    Phase 1 landed on batch/0.70.0 @12e86b1e1 (fold owner 59): all 12 producer build.rs now use provable_contracts::build_helper::env_key; aprender-contracts' own build.rs include!s the same src/env_key.rs. Guard build_helper::tests::no_build_rs_hand_rolls_the_contract_key (≥12 files scanned, case table); planted mutant in rag/build.rs → RED at :52. Key equality 3510/3522 identical; the 12 diffs are binding entries with contract ../gguf-format-…, unreadable under both builders (pre-existing). Still open (phase 2): producers read the sibling ../../../provable-contracts/contracts//binding.yaml, which resolves only on the main checkout, so worktrees/CI emit BINDING_SOURCE=none; vendoring in-tree + fail-loud turns enforcement on and needs measuring first.

  5. noahgift commented on Sep 25, 2026

    @noahgift
    ContributorAuthor

    Phase 2 pushed to batch/0.70.0 @ 596f06d.

    • All 10 producer build.rs files now read contracts/<name>/binding.yaml in-tree via CARGO_MANIFEST_DIR. The dead ../../../provable-contracts/ sibling path is gone. It resolved only on the main checkout, against a stale Aug-18 copy, so worktrees and CI ran with BINDING_SOURCE=none. This also fixes the main-checkout build of aprender-compute, which was failing on a missing wgpu-forward-pass-v1 row.
    • 8 binding files were vendored: trueno, trueno-db, batuta, presentar, trueno-rag, realizar, entrenar, simular.
    • 34 rows were added for #[contract] sites that had no row: aprender 26, realizar 6, trueno 1, entrenar 1 (cuda). 5 of them are status: partial because the contract they cite does not exist in-tree: forward-pass-v1, gemm-v1, sampling-v1, wgpu-forward-pass-v1, backward-pass-v1.
    • New guard: build_helper::tests::producer_bindings_are_in_tree. It is green on this commit and goes RED on both planted mutants (a reverted sibling path, and a missing binding file).
    • Verified on the rebased tree: cargo check --all-targets on the 10 producers passes (rc 0), --bin apr --features cuda passes (rc 0), fmt passes (rc 0), and the aprender-contracts lib passes 1779.
    • Out of scope, still sibling reads: serve's architecture-requirements-v1.yaml (falls back to the hand-written file) and tensor-names-v1.yaml (rerun-if-changed only).
  6. added a commit that references this issue on Sep 26, 2026
  7. modified the milestones: 0.70.0, 0.70.1 on Sep 26, 2026
  8. 2 remaining items

  9. added 4 commits that reference this issue on Sep 28, 2026
  10. modified the milestones: 0.70.1, 0.71.0 on Oct 4, 2026
  11. noahgift commented on Oct 12, 2026

    @noahgift
    ContributorAuthor

    evidence for close: 989cb01 (#4655), ancestor of main 6bd89b0. Checked at main: the test no_build_rs_hand_rolls_the_contract_key is in crates/aprender-contracts/src/build_helper.rs, and git grep 'format!("CONTRACT_' over crates/*/build.rs finds nothing; producers use env_key.

  12. noahgift commented on Oct 12, 2026

    @noahgift
    ContributorAuthor

    Cop batch close (FLOW-004 drain, ≤43/d): fix verified on main — merged #4655 ; ancestor of origin/main: 989cb01 . Evidence: #4369 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions