Skip to content

Add logline-pocket-runtime crate (LIP-0008)#2

Draft
danvoulez wants to merge 1 commit into
mainfrom
add-logline-pocket-runtime
Draft

Add logline-pocket-runtime crate (LIP-0008)#2
danvoulez wants to merge 1 commit into
mainfrom
add-logline-pocket-runtime

Conversation

@danvoulez
Copy link
Copy Markdown
Contributor

@danvoulez danvoulez commented May 18, 2026

Summary

Packages the existing canonical 9-slot shape validator from logline-who (validate_shape + LogLine) as a small Pocket Runtime guard for LLM translation drafts. Sits before canon, reduces entropy, never emits canonical receipts, never admits runtime actions, never executes.

The other slot crates (did, this, when, confirmed_by, if_ok, if_doubt, if_not, status) expose classifiers / parsers, not validity predicates — they always succeed and return enum variants. Reusing them here would force the Pocket Runtime to encode policy about which variants are "good" vs "bad", and that policy belongs to canon / constitutional-runtime, not to the entropy guard. They are deliberately not reused.

Tracks LIP-0008.

Public API

```rust
pub struct LogLineDraft { /* 9 Option slots + aux */ }
pub enum PocketRuntimeRuling {
AcceptCandidate { normalized, warnings },
Ghost { ghosts, partial },
Reject { errors },
}
pub fn check(draft: LogLineDraft) -> PocketRuntimeRuling
```

Decision precedence: Reject > Ghost > AcceptCandidate. Errors (malformed values) win over ghosts (missing values) because malformed signals an upstream bug, not just under-specified intent. Documented in src/lib.rs:

```rust
// Decision precedence: Reject > Ghost > AcceptCandidate.
// Errors (malformed values) win over ghosts (missing values) because
// a malformed slot signals an upstream bug, not just under-specified intent.
```

Artifact Honesty Receipt

Files changed

```
A crates/logline-pocket-runtime/Cargo.toml
A crates/logline-pocket-runtime/src/lib.rs
A crates/logline-pocket-runtime/tests/pocket_runtime.rs
M Cargo.toml (workspace.members += logline-pocket-runtime)
```

Validators reused

from item role here
`logline-who` `LogLine` struct canonical 9-string body; constructed only after per-slot pass clears
`logline-who` `validate_shape(&LogLine)` shared shape gate — Pocket Runtime inherits any future tightening for free
`logline-who` `LogLineError` shape error surface, mapped into `PocketError { slot: "(shape)", kind: "shape_invalid" }`

Only logline-who is a dependency. The Pocket Runtime crate is a leaf dependency on top of the existing canonical shape validator.

Validators NOT reused, with reason

item reason
`DidResolution::parse`, `MatterRef::parse`, `TemporalResolution::parse`, `EvidenceRequirement::parse`, `ReleaseRoute::parse`, `DoubtRoute::parse`, `RejectionRoute::parse` These are classifiers, not predicates. They always succeed and return enum variants. Using them would require Pocket Runtime to encode policy about which variants are "good" vs "bad" — that policy belongs to canon / constitutional-runtime, not to the entropy guard.
`logline-status::walk`, `logline-status::run`, `logline-status::run_with_context` Full runtime walk. Requires `Canon`, `Operation`, `RunContext`. Pocket Runtime sits before canon, so it cannot depend on canon-loaded state.
`SlotHouse` trait (`crates/who/src/slot.rs`) Requires `RunContext` and `RuntimeDecision`. Same reason — runtime concern.
`logline-who::validate_canon`, `validate_against_canon`, `is_prohibited` All require a loaded `Canon`. Pocket Runtime is canon-free by design.
`logline-who::parse_logline`, `parse_keyed_logline`, `parse_marked_logline` These parse textual LogLine surface syntax. Pocket Runtime works on already-structured `LogLineDraft` from the LLM Translator, not on raw text.

Tests run

```
cargo fmt --check ✓ clean
cargo test -p logline-pocket-runtime ✓ 7/7 passed
cargo test --workspace ✓ 64 passed
⚠ 8 PRE-EXISTING failures (see Known ghosts)
```

The 7 Pocket Runtime tests:

```
complete_valid_draft_accepts_candidate ✓
missing_when_ghosts ✓
missing_if_doubt_ghosts ✓
missing_multiple_slots_ghosts ✓
invalid_status_rejects ✓
slot_validator_failure_rejects ✓
aux_is_preserved_but_not_required ✓
```

What is proven

  • `check` produces exactly one of three rulings on every input.
  • Missing or null slots produce `Ghost` with the partial draft intact, never silent acceptance.
  • Wrong JSON types, forbidden control characters, and over-sized values produce structured `Reject` with the offending slot named.
  • The `validate_shape` gate from `logline-who` is the authoritative shape check; this crate composes it, does not reimplement it.
  • `aux` is preserved verbatim in `AcceptCandidate`, ignored on Ghost / Reject path, and never rescues a missing 9-slot.
  • The Pocket Runtime crate is a leaf dependency: it depends only on `logline-who`, nothing else.

What is not proven

  • The Pocket Runtime is wired into any actual LLM Translator call site. It is a pure function; the integration is downstream.
  • Per-slot semantic correctness (e.g. that `when` is a valid timestamp, that `did` is a recognized verb). That belongs to canon and `constitutional-runtime` admission. Pocket Runtime only filters obviously hostile input.
  • Behavior under adversarial Unicode (e.g. mixed-script homoglyphs, RTL overrides). The current forbidden-char filter catches control bytes only.
  • That this crate participates in any receipt chain. It does not emit receipts; that is canon's job.

Known ghosts

  • `cargo test --workspace` reports 8 pre-existing failures in `logline-status` core tests (`tuple_hash_ignores_result_evidence_transport`, `changing_result_changes_result_and_receipt_hash`, `receipt_can_reference_input_receipt_hash`, `receipt_example_hashes_match_encoding_profile`, `receipt_hash_excludes_only_itself`, `receipt_schema_and_examples_parse_as_json`, `simulation_receipt_fixture_never_executes_or_releases`, `changing_transport_changes_receipt_hash_only`). These are LIP-0003-era tests for the legacy `result_hash` / `receipt_hash` model that LIP-0007 superseded. They were already failing on `main` before this PR — verified by `git stash`-ing my changes and re-running the workspace tests at the parent commit. They are out of scope for this PR but deserve a follow-up cleanup PR to align the engine's test suite with the current three-hash canon.
  • The Pocket Runtime accepts any non-control, non-oversized string in every slot. This is the entropy-guard contract, not the canon contract. Downstream gates (canon emission, constitutional admission, Tower, etc.) must do their own work.
  • `LogLineDraft.aux` is `Option`, not a typed map. The Pocket Runtime treats aux as opaque. A future LIP may constrain aux shape (e.g. forbid reserved key names) — when that happens, the rule lands here.

🤖 Generated with Claude Code

@danvoulez danvoulez force-pushed the add-logline-pocket-runtime branch from f673a88 to b6f3c99 Compare May 18, 2026 19:51
Packages the existing canonical 9-slot shape validator from logline-who
as a Pocket Runtime guard for LLM translation drafts. Other slot crates
(did, this, when, confirmed_by, if_ok, if_doubt, if_not, status) expose
classifiers / parsers, not validity predicates; those are deliberately
not reused here — encoding policy at the entropy guard would violate
its talent boundary.

Tracks LIP-0008.
Does not implement the translator.
Does not emit canonical receipts.
Does not execute or admit runtime actions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@danvoulez danvoulez force-pushed the add-logline-pocket-runtime branch from b6f3c99 to 463bc0e Compare May 18, 2026 19:56
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