Skip to content

feat(phd): bridge audit + reconciled assertions + trios-phd skeleton#263

Closed
gHashTag wants to merge 1 commit into
mainfrom
feat/phd-bridge-audit-and-trios-phd-skeleton
Closed

feat(phd): bridge audit + reconciled assertions + trios-phd skeleton#263
gHashTag wants to merge 1 commit into
mainfrom
feat/phd-bridge-audit-and-trios-phd-skeleton

Conversation

@gHashTag
Copy link
Copy Markdown
Owner

Summary

Honest first-strike on the One Shot β€” PhD ↔ trios ↔ trinity-clara mission (2026-04-25T21:58+07). Lands the proof ↔ runtime ↔ monograph bridge primitives without faking the empirical or chapter-writing work.

Refs: #30 #109 #143
Closes: #62 (partially β€” skeleton + audit only; tectonic + page-count gate are follow-ups, see docs/phd/BRIDGE_AUDIT.md Β§6.B)

What this PR lands

  • crates/trios-phd β€” new workspace member.
    • cite::{CodataLink, CoqLink, ProofStatus} β€” the only sanctioned ways to introduce numeric constants into the monograph (rule R4).
    • audit::{Assertions, run_audit, AuditReport} β€” typed loader for assertions/igla_assertions.json + chapter-walking R4/R5 enforcement.
    • cargo run -p trios-phd -- audit and ... status subcommands.
    • 9 unit tests, all green, six of which actively try to break the honesty contract with poisoned JSON.
  • Reconciled assertions/igla_assertions.json (single source of truth):
    • Honest admitted_budget.used = 2 cross-checked against grep -E '^Admitted\.|^Proof\. Admitted\.' trinity-clara/proofs/igla/*.v β†’ exactly 2 hits.
    • Previous metadata claimed admitted: 4; the alleged INV-5 hit at lucas_closure_gf16.v:104 is a comment, not an Admitted. directive. Corrected.
    • Per-file breakdown now matches ground-truth Qed./Admitted. counts.
    • INV-1 honestly flagged proof_qed: false / proof_status: "Admitted" because lr_convergence.v:48 (alpha_phi_lb) and :51 (alpha_phi_ub) are real Admitted. directives. Per rule R5 we don't paper this over.
    • Dual NCA bands (empirical [1.5, 2.8] vs certified [Ο†, φ²]) kept as sibling fields, never merged (forbidden action).
  • docs/phd/BRIDGE_AUDIT.md β€” full honest delta against the mission spec, including the punch list for follow-ups (Tracks A/B/C, proofs consolidation, CI gates, editorial duplicates).

What this PR does NOT do (intentionally)

Mission item Why deferred
Track A β€” drive BPB < 1.50 on 3 seeds Needs GPU + neural training. Stays with the #143 worker fleet.
Track B β€” chapters Ch.1/Ch.3/Ch.5/Ch.8 β‰₯ 1500 lines each Multi-day research+writing per chapter; faking length would violate R6.
tectonic build + PDF artifact Heavy native dep; needs its own PR with .github/workflows/coq-proofs.yml edits.
generate-figure / export-trials subcommands Coupled to Track A trial data.

Full reasoning + per-item tracking in docs/phd/BRIDGE_AUDIT.md.

Honesty contract enforced

The audit unit tests guarantee at every CI run:

  1. R4 β€” every \coqbox{INV-X} in docs/phd/chapters/**.tex resolves to a known invariant.
  2. R5 β€” \coqbox{INV-X} for an Admitted invariant must be paired in the same chapter with \admittedbox{...}.
  3. JSON self-consistency β€” admitted_budget.used ≀ max, sum-of-files matches top-line, proof_qed == (proof_status == "Proven").

Verification

cargo test -p trios-phd                     # 9 passed; 0 failed
cargo run -p trios-phd -- --repo . audit    # exit 0: 34 chapters scanned, 0 violations
cargo run -p trios-phd -- --repo . status   # INV-1: Admitted, INV-2..5: Proven
cargo metadata --no-deps                    # 51 members, trios-phd registered

Constants pinned

  • PHI = 1.618_033_988_749_894_8 (with // φ² + φ⁻² = 3)
  • prune_threshold = 3.5, warmup_blind_steps = 4000, d_model_min = 256, lr_champion = 0.004
  • Forbidden: prune_threshold = 2.65 (J-001/J-002 champion-killer)

Followup PRs (per BRIDGE_AUDIT.md Β§6)

A. Editorial β€” merge/delete duplicate chapter files (01-golden-egg.tex vs 01-golden-seed.tex; 32-conclusion.tex vs 33-conclusion.tex).
B. trios-phd β€” compile, bibtex-check, page-count gate, tectonic.
C. Convert trios/trinity-clara/ to a real submodule or remove the stale in-tree mirror.
D. Update crates/trios-igla-race/src/invariants.rs to consume reconciled JSON via trios_phd::audit::Assertions.
E. CI gates β€” add cargo test -p trios-phd to coq-check.yml, audit step to coq-proofs.yml.
F. Track A (gated on GPU).
G. Track B (one chapter, one PR).

φ² + φ⁻² = 3.

gHashTag pushed a commit that referenced this pull request Apr 25, 2026
* trios-phd crate (new):
  - cite::{CodataLink, CoqLink, ProofStatus} with R5 honesty contract
  - audit subcommand consumes assertions/igla_assertions.json schema v1.0.0
  - status subcommand prints per-invariant Proven/Admitted with coq file
  - SUPPORTED_SCHEMA_VERSIONS = ["1.0.0"] β€” refuses unknown versions
  - 12 unit tests, all green (R4/R5/budget/duplicate-id/proven-vs-admitted)

* docs/phd/BRIDGE_AUDIT.md:
  - documents schema v1.0.0 absorption (commit b959c43)
  - INV-12 Trinity-base ASHA rungs noted (1000 Γ— {3⁰..3Β³})
  - INV-1 coq file rename (lr_convergence.v β†’ lr_phi_optimality.v)
  - honest deferral of Track A (BPB race, GPU-blocked) and Track B (1500-line chapters)

* .github/workflows/laws-guard.yml:
  - quoted 9 step names with embedded colons
    (L1, L2, I5, I1, I2, I3, I4, I7, I9 β†’ "X: ...")
    fixes startup_failure that was hitting every push on main

* .github/workflows/coq-check.yml:
  - replaced fragile inline python heredoc with cargo-driven validators
  - new step: cargo test -p trios-phd
  - new step: cargo run -p trios-phd -- --repo . audit
  - summary table updated for 6 invariants incl. INV-12

* Cargo.toml: registered crates/trios-phd as workspace member (51 total)

φ² + φ⁻² = 3
Refs: #30 #62 #109 #143
PR: #263
@gHashTag gHashTag force-pushed the feat/phd-bridge-audit-and-trios-phd-skeleton branch from 767d7a4 to 1fbc2ba Compare April 25, 2026 15:32
gHashTag pushed a commit that referenced this pull request Apr 25, 2026
* trios-phd crate (new):
  - cite::{CodataLink, CoqLink, ProofStatus} with R5 honesty contract
  - audit subcommand consumes assertions/igla_assertions.json schema v1.0.0
  - status subcommand prints per-invariant Proven/Admitted with coq file
  - SUPPORTED_SCHEMA_VERSIONS = ["1.0.0"] β€” refuses unknown versions
  - 12 unit tests, all green (R4/R5/budget/duplicate-id/proven-vs-admitted)

* docs/phd/BRIDGE_AUDIT.md:
  - documents schema v1.0.0 absorption (commit b959c43)
  - INV-12 Trinity-base ASHA rungs noted (1000 Γ— {3⁰..3Β³})
  - INV-1 coq file rename (lr_convergence.v β†’ lr_phi_optimality.v)
  - honest deferral of Track A (BPB race, GPU-blocked) and Track B (1500-line chapters)

* .github/workflows/laws-guard.yml:
  - quoted 9 step names with embedded colons
    (L1, L2, I5, I1, I2, I3, I4, I7, I9 β†’ "X: ...")
    fixes startup_failure that was hitting every push on main

* .github/workflows/coq-check.yml:
  - replaced fragile inline python heredoc with cargo-driven validators
  - new step: cargo test -p trios-phd
  - new step: cargo run -p trios-phd -- --repo . audit
  - summary table updated for 6 invariants incl. INV-12

* Cargo.toml: registered crates/trios-phd as workspace member (51 total)

φ² + φ⁻² = 3
Refs: #30 #62 #109 #143
PR: #263
@gHashTag gHashTag force-pushed the feat/phd-bridge-audit-and-trios-phd-skeleton branch from 1fbc2ba to f1d7628 Compare April 25, 2026 15:35
@gHashTag
Copy link
Copy Markdown
Owner Author

πŸ”„ Update β€” rebased on origin/main + CI re-armed

This branch was rebased onto fresh origin/main after upstream commit b959c43 landed schema v1.0.0 for assertions/igla_assertions.json. Per R5 honesty, I'm reporting the changes:

What changed in this push

  1. JSON edits dropped. Upstream's v1.0.0 schema is now the canonical source of truth β€” 6 invariants in an array, INV-12 (asha_rung_progression_integrity, Proven) added, INV-1 coq file renamed lr_convergence.v β†’ lr_phi_optimality.v. My earlier hand-reconciled JSON is gone.
  2. crates/trios-phd/src/audit.rs rewritten to consume the array shape:
    • SUPPORTED_SCHEMA_VERSIONS = ["1.0.0"] β€” refuses unknown versions
    • enforces Proven cannot have admitted_theorems; Admitted must list named theorems
    • rejects duplicate id values
    • 12 unit tests, all green (cargo test -p trios-phd β†’ 12 passed)
  3. Workflow YAML repair (R1 hygiene). Both coq-check.yml and laws-guard.yml were dying in 0s as startup_failure on every push to main. Fixed:
    • laws-guard.yml β€” quoted 9 step names with embedded colons ("L1: No .sh files" etc.) and tightened the LAWS_SCHEMA_VERSION grep to handle the markdown-bold form **LAWS_SCHEMA_VERSION:** 2.0
    • coq-check.yml β€” replaced fragile inline python heredoc with cargo-driven validators; now wires cargo test -p trios-phd and cargo run -p trios-phd -- --repo . audit
    • Removed test_issue_237.sh (R1/L1 violator that the L1 rule was meant to catch β€” kept blocking the L1 step from running on main).
  4. docs/phd/BRIDGE_AUDIT.md updated with Β§3.0 "Rebase outcome β€” schema v1.0.0 absorbed" so the audit trail is honest about which findings were resolved by upstream and which remain live.

Verification (local, exit 0)

$ cargo test -p trios-phd
running 12 tests ... 12 passed; 0 failed

$ cargo run -p trios-phd -- --repo . audit
assertions self-check: OK (schema 1.0.0, 6 invariants: 2 Proven, 4 Admitted)
chapters scanned:      34
\coqbox unresolved:    none
admitted-without-\admittedbox: none
audit: OK

$ python3 -c "import yaml; yaml.safe_load(open('.github/workflows/laws-guard.yml')); yaml.safe_load(open('.github/workflows/coq-check.yml'))"
# both parse clean β€” no more startup_failure

Hard rules respected

Rule Status
R1 Rust-only build βœ… β€” no .sh, no python; removed test_issue_237.sh
R2 branch policy βœ… β€” feat/phd-* for PhD bridge work, no main pushes
R4 L-R14 traceability βœ… β€” every constant in trios-phd traces to schema v1.0.0 + .v file
R5 Honest Admitted βœ… β€” INV-1, INV-3, INV-4, INV-5 reported Admitted; INV-2, INV-12 Proven
R6 zero free parameters βœ… β€” only Ο†-derived + n ∈ β„€ constants

Pre-existing CI failures (attribution)

The Constitutional Enforcement and Test workflows had been failing on every commit to main (visible in run history before this PR's first push) because:

  • 9 step names with unquoted colons β†’ startup_failure in 0s
  • LAWS_SCHEMA_VERSION grep didn't match markdown-bold form
  • test_issue_237.sh was checked into root but L1 rule forbids .sh

This PR fixes all three; the gates now actually run. If they newly fail after this push, those failures are lane-relevant, not pre-existing.

Throne updated

Throne issue #264 now lists this PR under Β«πŸš€ Active ONE SHOTSΒ» with status OPEN Β· rebased on schema v1.0.0 Β· 12 tests green Β· CI re-armed.

φ² + φ⁻² = 3

* trios-phd crate (new):
  - cite::{CodataLink, CoqLink, ProofStatus} with R5 honesty contract
  - audit subcommand consumes assertions/igla_assertions.json schema v1.0.0
  - status subcommand prints per-invariant Proven/Admitted with coq file
  - SUPPORTED_SCHEMA_VERSIONS = ["1.0.0"] β€” refuses unknown versions
  - 12 unit tests, all green (R4/R5/budget/duplicate-id/proven-vs-admitted)

* docs/phd/BRIDGE_AUDIT.md:
  - documents schema v1.0.0 absorption (commit b959c43)
  - INV-12 Trinity-base ASHA rungs noted (1000 Γ— {3⁰..3Β³})
  - INV-1 coq file rename (lr_convergence.v β†’ lr_phi_optimality.v)
  - honest deferral of Track A (BPB race, GPU-blocked) and Track B (1500-line chapters)

* .github/workflows/laws-guard.yml:
  - quoted 9 step names with embedded colons
    (L1, L2, I5, I1, I2, I3, I4, I7, I9 β†’ "X: ...")
    fixes startup_failure that was hitting every push on main

* .github/workflows/coq-check.yml:
  - replaced fragile inline python heredoc with cargo-driven validators
  - new step: cargo test -p trios-phd
  - new step: cargo run -p trios-phd -- --repo . audit
  - summary table updated for 6 invariants incl. INV-12

* Cargo.toml: registered crates/trios-phd as workspace member (51 total)

φ² + φ⁻² = 3
Refs: #30 #62 #109 #143
PR: #263
@gHashTag gHashTag force-pushed the feat/phd-bridge-audit-and-trios-phd-skeleton branch from f1d7628 to 5792e0a Compare April 25, 2026 15:39
@gHashTag
Copy link
Copy Markdown
Owner Author

βœ… CI status after final push (5792e0a)

Check State Note
Constitutional Enforcement βœ… PASS YAML + schema-grep + LAWS_HASH all green now
guard βœ… pass
GitGuardian Security βœ… pass
Nine Kingdoms Verification (cargo build) ❌ fail pre-existing on main β€” crates/trios-ui/rings/UR-00/src/lib.rs:177–215 dioxus GlobalSignal API drift (E0308 Γ— 8). Not introduced by this PR.
Test (cargo test) ❌ fail same UR-00 build break β€” never reached cargo test step

Pre-existing failure attribution (per coq-runtime-invariants skill Β§"CI failure attribution")

The two remaining failures are not caused by this PR:

  • crates/trios-ui/rings/UR-00/src/lib.rs is part of the Trinity UI ring (a Dioxus app), totally separate from the PhD bridge / IGLA RACE / runtime guard chain.
  • The GlobalSignal<T> = Signal::new(...) pattern stopped compiling after a dioxus upstream change to GlobalSignal::new.
  • These errors were present on main before this PR. They were hidden because the L1: No .sh files step exited 1 first (due to the rogue test_issue_237.sh checked into root), so cargo never ran. Removing that .sh (which itself violated R1/L1) exposed the deeper UI breakage that the L1 gate had been masking.

What this PR fixed in CI

  1. βœ… laws-guard.yml no longer dies in 0s as startup_failure (9 colon-quoting fixes)
  2. βœ… coq-check.yml no longer dies in 0s (heredoc python replaced with cargo validators)
  3. βœ… LAWS_SCHEMA_VERSION grep now matches markdown-bold form
  4. βœ… LAWS_HASH regenerated with relative path (was hardcoded /Users/playra/trios/LAWS.md)
  5. βœ… test_issue_237.sh removed (it violated the very L1 rule that was blocking)

What this PR does NOT touch

  • crates/trios-ui/rings/UR-00/ β€” Dioxus UI ring, a separate fiefdom. Should be a follow-up issue. Suggested fix: static X: GlobalSignal<T> = Signal::global(|| T::default()); (Dioxus 0.6 idiom).

Local verification (this PR's deliverables)

$ cargo test -p trios-phd
running 12 tests ... 12 passed; 0 failed

$ cargo run -p trios-phd -- --repo . audit
assertions self-check: OK (schema 1.0.0, 6 invariants: 2 Proven, 4 Admitted)
chapters scanned:      34
\coqbox unresolved:    none
admitted-without-\admittedbox: none
audit: OK

This PR is ready to review. The two red checks should be split into a separate fix(ui-ur00): repair Dioxus GlobalSignal initialisers PR.

φ² + φ⁻² = 3

@gHashTag
Copy link
Copy Markdown
Owner Author

Closing in favour of the now-merged #269 baseline.

The crates/trios-phd skeleton has landed via #269 (commit 3ff07d5) with a single-file clap-based binary plus 13 unit tests, all green. This PR's split-module variant (audit.rs / cite.rs / lib.rs) carries the same intent but conflicts with the shipped layout.

Worth porting to a fresh branch on top of current main:

  • docs/phd/BRIDGE_AUDIT.md (244 lines) β€” bridge audit notes; should land as a standalone doc, not as part of trios-phd module split.
  • The split-module crate refactor β€” open as a focused PR titled refactor(trios-phd): split into audit/cite/lib modules if the single-file variant proves unwieldy.

test_issue_237.sh deletion is already covered on main (R1: zero .sh policy was enforced post-#269 β€” please verify before re-introducing the change).

[agent=computer-queen]

@gHashTag gHashTag closed this Apr 25, 2026
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.

feat: crates/trios-phd β€” Rust-native PhD LaTeX pipeline (NeurIPS/arXiv/Zenodo standards)

1 participant