Skip to content

fix(dinn): wire DINN reasoner to live routes + DSSE-signed receipts (additive, no v11 bump)#106

Open
stephenlutar2-hash wants to merge 1 commit into
mainfrom
pinns-dinn-finish
Open

fix(dinn): wire DINN reasoner to live routes + DSSE-signed receipts (additive, no v11 bump)#106
stephenlutar2-hash wants to merge 1 commit into
mainfrom
pinns-dinn-finish

Conversation

@stephenlutar2-hash
Copy link
Copy Markdown
Member

scope: pinns-dinn-finish — ADDITIVE, NOT a v11 doctrine bump

Completes the existing DINN code already in amaru (per founder redirect: no new pinns-core repo — the PINN/DINN home is amaru + uds-mesh). Every change is additive; no route was removed and no doctrine number was bumped.

What this fixes

The central wiring bug. serve.py registered the SPA catch-all @app.get("/{path:path}") before app.mount("/api/amaru", ...) and the 16 explicit /api/amaru/v1/* routes. Starlette matches in registration order, so the catch-all shadowed the mounted DINN sub-app and every /v1/* route — they returned SPA HTML instead of JSON, which broke the DINN web panel's runDinn() res.json() call.

Verified live before fix:

  • GET /api/amaru/v3/doctrine → 200 JSON (registered before the catch-all)
  • GET /api/amaru/chakra/dinn, /v1/honest, /v1/brainz → 200 HTML (shadowed)

Changes (all additive)

  • serve.py — moved the SPA catch-all to the end of the module (after the mount + explicit routes). Behavior byte-identical; only its registration position moved.
  • sidecar/src/amaru/app.py — corrected the DINN monitor's stale "v9 (456/14/6)" string to canonical v11 (749/14/163, replay c7c0ba17); added doctrine_replay_hash, lambda_status (Conjecture 1 — NOT a theorem), slsa (L1 honest). Added two endpoints:
    • GET /chakra/dinn/v1/healthz — reachability + DSSE signing availability
    • GET /chakra/dinn/receiptfinal_state_hash, ledger_digest, stop_reason (convergence|max_iter), residual_loss, DSSE envelope
  • sidecar/src/amaru/dinn_dsse.py (NEW) — inline DSSE signer mirroring root szl_dsse.py: keyid szlholdings-cosign, ECDSA P-256 over DSSEv1 PAE, private key from env SZL_COSIGN_PRIVATE_PEM, embedded public key for offline verify, honest UNSIGNED fallback (no fabricated signatures).
  • sidecar/tests/test_dinn_receipt.py (NEW) — 5 tests, all pass.
  • web/index.html — "Emit DSSE-signed receipt" button + runDinnReceipt() + verbatim Bekenstein ANALOGY-ONLY disclaimer.

Honesty (preserved verbatim)

every DINN ships its Lean obligation as a sorry placeholder — none is claimed proven

The DSSE signature attests the receipt bytes, not any physics/governance guarantee. Bekenstein-DINN is ANALOGY ONLY. Λ uniqueness remains Conjecture 1 (never a theorem). SLSA L1 (honest).

Doctrine version note

Doctrine v12 (781/14/194) was declared 2026-06-01 as a monotone superset (axiom set identical, replay hash unchanged); v11 citations remain valid. This DINN response intentionally keeps the v11 numbers the live /v3/doctrine endpoint currently serves. A v12 bump is a separate doctrine-agent change — deliberately not made here to avoid scope creep. Coordinated with doctrine_drift_resolver.

Verification

cd sidecar && PYTHONPATH=src python3 -m pytest tests/test_dinn_receipt.py -q   # 5 passed
python3 -c "import ast; ast.parse(open('serve.py').read())"                     # syntax OK

Founder UI actions required (do NOT merge without founder)

  1. amaru HF Space must rebuild/redeploy to pick up the serve.py route-order fix.
  2. Set the SZL_COSIGN_PRIVATE_PEM secret in the amaru Space runtime so receipts are SIGNED; otherwise the endpoint returns the honest UNSIGNED envelope.

Do not merge — additive PR for founder review. Coordinated with doctrine-drift and platform-CI agents.

Author: Yachay yachay@szlholdings.dev · Co-Authored-By: Perplexity Computer Agent

…additive)

Scope: pinns-dinn-finish — ADDITIVE, NOT a v11 doctrine bump.

This completes the existing DINN code already in amaru (no new repo created;
the PINN/DINN home is amaru + uds-mesh per founder redirect). Changes:

* serve.py — ROUTE-ORDER FIX (the central wiring bug). The SPA catch-all
  "/{path:path}" was registered BEFORE app.mount("/api/amaru", ...) and the
  16 explicit /api/amaru/v1/* routes. Starlette matches in registration order,
  so the catch-all SHADOWED the mounted DINN sub-app and every /v1/* route —
  they returned SPA HTML instead of JSON, breaking the DINN web panel's
  runDinn() res.json() call. The catch-all is now registered LAST (behavior
  byte-identical; only its position moved). No route removed.

* sidecar/src/amaru/app.py — corrected the DINN monitor's stale "v9
  (456/14/6)" doctrine string to the canonical v11 numbers
  (749/14/163, replay c7c0ba17) served by /api/amaru/v3/doctrine; added
  doctrine_replay_hash, lambda_status (Conjecture 1 — NOT a theorem),
  slsa (L1 honest). Added two ADDITIVE endpoints:
    - GET /chakra/dinn/v1/healthz  (reachability + signing availability)
    - GET /chakra/dinn/receipt     (final_state_hash, ledger_digest,
      stop_reason convergence|max_iter, residual_loss, DSSE envelope)

* sidecar/src/amaru/dinn_dsse.py — NEW inline DSSE signer mirroring root
  szl_dsse.py: keyid szlholdings-cosign, ECDSA P-256 over DSSEv1 PAE, private
  key from env SZL_COSIGN_PRIVATE_PEM, embedded public key for offline verify,
  honest UNSIGNED fallback (NO fabricated signatures).

* sidecar/tests/test_dinn_receipt.py — NEW, 5 tests (v11 monitor, healthz,
  receipt shape, unsigned fallback, signed ECDSA round-trip). All pass.

* web/index.html — added an "Emit DSSE-signed receipt" button + runDinnReceipt()
  and a verbatim Bekenstein ANALOGY-ONLY disclaimer.

HONESTY (preserved verbatim): every DINN ships its Lean obligation as a `sorry`
placeholder — none is claimed proven. The DSSE signature attests the receipt
bytes, NOT any physics or governance guarantee. Bekenstein-DINN is ANALOGY ONLY.
Lambda uniqueness remains Conjecture 1 (never a theorem). SLSA L1 (honest).

Note: Doctrine v12 (781/14/194) was declared 2026-06-01 as a monotone superset;
v11 citations remain valid, so this DINN response keeps the v11 numbers that the
live /v3/doctrine endpoint currently serves. A v12 bump (if desired) is a
separate doctrine-agent change, intentionally NOT made here to avoid scope creep.

Co-Authored-By: Perplexity Computer Agent <agent@szlholdings.com>
Signed-off-by: Yachay <yachay@szlholdings.dev>
stephenlutar2-hash added a commit that referenced this pull request Jun 1, 2026
…en PRs (Doctrine v11) (#109)

## Foundational fix — unblocks all open amaru PRs

### Problem

`tests/test_telemetry_and_health.py::test_healthz_includes_git_sha_and_otel_flag`
fails on `main`. This is the single failing required check ("Python
sidecar — existing chakra tests") that blocks **every** open amaru PR
(#105, #106, #107, and others).

The `sidecar/src/amaru/version.py` module already resolves `GIT_SHA`,
`GIT_SHA_SHORT`, `BOOT_TS`, and `telemetry.otel_active()` already exists
— but the `/healthz` handler in `app.py` never surfaced them. The test
expects `gitSha`, `gitShaShort`, `bootTs`, and `otel` in the body.

### Fix
Adds 4 keys to the `/healthz` JSON body, reusing the already-resolved
values. **Additive, zero-bandaid** — no behavior change to chakras /
scheduler / receipts.

```diff
+from . import telemetry as _telemetry
+from . import version as _version
...
     "version": __version__,
+    "gitSha": _version.GIT_SHA,
+    "gitShaShort": _version.GIT_SHA_SHORT,
+    "bootTs": _version.BOOT_TS,
+    "otel": _telemetry.otel_active(),
```

### Verification
Reproduced the exact CI env (`pip install -e ".[dev]"`, no
opentelemetry) in a clean venv:
- Before: `test_healthz_includes_git_sha_and_otel_flag` FAILED
- After: **53 passed, 1 skipped** — full `tests/` suite green

### Doctrine
Doctrine v11 (749/14/163 LOCKED). SLSA L1 (honest). No doctrine bump.

Sign: Yachay. Perplexity Computer Agent.

Signed-off-by: stephenlutar2-hash <yachay@szlholdings.dev>
Co-authored-by: stephenlutar2-hash <yachay@szlholdings.dev>
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