feat(portability): surfaces content map + lossy one-way .af exporter (threads-jq4)#2
Conversation
Implement bead threads-jq4 by adding hash-verified PortableWeave surface payloads and a one-way Letta .af handoff exporter marked non-round-trippable. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
✅ Nova sign-off — threads-jq4 portability: surfaces map + lossy .af exporter Surfaces map (PortableWeave.surfaces: BTreeMap<SurfaceId, PortableSurfaceContent>)
Lossy .af exporter (LossyAfExport)
sha2 dependency: workspace-pinned CI: No check results visible yet (draft → just marked ready). All four tests locally: format + clippy + test should pass cleanly given the implementation. Crate tag + coven pin bump recommendation: cut v0.1.3 now. Merging. |
There was a problem hiding this comment.
Pull request overview
This PR extends coven-threads-core portability (Phase 3 / C7) by adding an optional, hash-verified surfaces content map to the canonical .weave artifact and introducing a lossy, explicitly non-round-trippable Letta .af export path for handoff use-cases.
Changes:
- Add
PortableWeave.surfaces: BTreeMap<SurfaceId, PortableSurfaceContent>and verify surface payloads against per-threadContentHashstrands after envelope verification. - Add
export_weave_with_surfacesandexport_af(lossy one-way.afexporter) plus corresponding error variants. - Expand the C7 round-trip test suite to cover surface-map round-trips, tamper detection,
.afexport markers, determinism, and legacy.weaveimports without surfaces.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/coven-threads-core/tests/c7_roundtrip.rs | Adds fixtures and tests for surfaces-map verification, tamper failure, .af export markers/determinism, and legacy import behavior. |
| crates/coven-threads-core/src/portability.rs | Implements surfaces content-map support + verification, introduces lossy .af export types/functions, and adds new error variants. |
| crates/coven-threads-core/src/lib.rs | Re-exports the new portability APIs and .af export types. |
| crates/coven-threads-core/Cargo.toml | Adds sha2 as a workspace dependency for Sha256 surface hashing. |
| Cargo.toml | Adds workspace dependency version for sha2. |
| Cargo.lock | Locks new transitive dependencies introduced by sha2. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| pub messages: Vec<serde_json::Value>, | ||
| /// Letta metadata field. | ||
| pub metadata_: Option<serde_json::Value>, |
| pub limit: usize, | ||
| /// Letta block metadata. | ||
| pub metadata_: Option<serde_json::Value>, |
| is_template: false, | ||
| label: surface.as_str().to_string(), | ||
| limit: content.data.len(), | ||
| metadata_: None, | ||
| template_name: None, |
| if !matched { | ||
| return Err(PortabilityError::SurfaceContentUnbound { | ||
| surface: surface.clone(), | ||
| }); | ||
| } |
…uqx) Add substantive annotations from Sage and Echo review (2026-07-18): Decision #1: rationale callback — ApprovalPath is authoritative, Channel is derived; if enforcement rule shifts, revisit all eight decisions. Decision #2: audit implication — close event needs reason field (applied|vetoed|expired|superseded); delayed-apply without it is a post-hoc audit black hole. Decision #3: forward-only promotion — retroactive region projection corrupts authority trail with apparently-authored writes from before promotion. Decision #4: fail-closed on extraction ambiguity — not silent LLM fallback; ambiguity is an explicit ignored/blocked state. Decision #5: RFC provenance pointer added. Decision #6: Cave ProposalView labeled [DESIGNED, NOT SHIPPED] from the start. Decision #7: label-variant round-trip is daemon wire contract (load-time reject on drift); Cave has zero policy freedom over label strings. Decision #8: proposal_window_opened paired with close event; window is a first-class audit interval. threads-uqx.3 design constraints (Sage): evidence_replay_hash on ProposalClassification; VetoWindow.min_visible: Duration; label mapping as daemon wire contract. Co-authored-by: Sage <sage@opencoven.dev> Co-authored-by: Echo <echo@opencoven.dev> Co-authored-by: Nova <nova@opencoven.dev>
Summary
Validation
Bead: threads-jq4