agent-desktop/crates/ffi/tests
Lahfir 791c52e0bd fix(session): harden session-first trace against review findings
Multi-agent brutal review (6 personas) surfaced defects reproduced against the
real binary; fixes below.

P0:
- Corrupt/legacy session.json no longer bricks every command in that session:
  read_manifest degrades an unparseable manifest to "no manifest" (trace off,
  skipped by list/gc) instead of propagating INTERNAL; SessionManifest gains
  serde defaults so an older-binary manifest still parses.
- version/skills run before session/context construction, so they no longer
  require $HOME (broke CI/sandbox use).
- new_session_id includes the pid, ending cross-process session-id collisions
  (two concurrent agents previously shared one dir ~32% of the time).

P1:
- write_private_file uses a unique per-writer tmp name, ending the concurrent
  rename ENOENT race for the pointer/manifest/refmap.
- batch preserves prior results when an item's context construction fails,
  instead of discarding the whole batch response.
- gc no longer reaps a live session: liveness also covers recent snapshot
  activity and a not-yet-ended session created within the window.
- explicit --trace validates its destination eagerly (fail-fast), restoring the
  loose-permission check for commands that never emit an event; the session
  segment sink stays lazy.

Quality:
- split session/mod.rs -> session/gc.rs and refs_store_tests -> a sibling to
  stay under the 400-LOC limit; dedup context sink resolution and the trace
  ensure_writer error arm.
- add regression guards: corrupt-manifest-degrades, session-id-includes-pid,
  gc-leaves-recently-created, force-overrides-live-pointer, trace-off-once-ended,
  and an FFI one-segment-per-process assertion.
2026-06-30 22:18:05 -07:00
..
common feat: complete FFI C-ABI surface (Phase A) — handshake, pipeline entrypoints, log callback (#67) 2026-06-25 19:24:06 -07:00
c_abi_actions.rs feat: complete FFI C-ABI surface (Phase A) — handshake, pipeline entrypoints, log callback (#67) 2026-06-25 19:24:06 -07:00
c_abi_execute_by_ref.rs feat: complete FFI C-ABI surface (Phase A) — handshake, pipeline entrypoints, log callback (#67) 2026-06-25 19:24:06 -07:00
c_abi_init.rs feat: complete FFI C-ABI surface (Phase A) — handshake, pipeline entrypoints, log callback (#67) 2026-06-25 19:24:06 -07:00
c_abi_inputs.rs fix: harden agent-desktop reliability (#54) 2026-06-20 15:43:42 -04:00
c_abi_json_commands.rs feat: complete FFI C-ABI surface (Phase A) — handshake, pipeline entrypoints, log callback (#67) 2026-06-25 19:24:06 -07:00
c_abi_layout.rs feat: complete FFI C-ABI surface (Phase A) — handshake, pipeline entrypoints, log callback (#67) 2026-06-25 19:24:06 -07:00
c_abi_lifecycle.rs feat: complete FFI C-ABI surface (Phase A) — handshake, pipeline entrypoints, log callback (#67) 2026-06-25 19:24:06 -07:00
c_abi_log_callback.rs feat: complete FFI C-ABI surface (Phase A) — handshake, pipeline entrypoints, log callback (#67) 2026-06-25 19:24:06 -07:00
c_abi_passthrough.rs feat(ffi): Phase B and C — Python smoke harness, parity gates, build.rs codegen (#77) 2026-06-26 19:14:14 -07:00
c_abi_roundtrip.rs feat: complete FFI C-ABI surface (Phase A) — handshake, pipeline entrypoints, log callback (#67) 2026-06-25 19:24:06 -07:00
c_abi_session.rs feat: complete FFI C-ABI surface (Phase A) — handshake, pipeline entrypoints, log callback (#67) 2026-06-25 19:24:06 -07:00
c_abi_session_trace.rs fix(session): harden session-first trace against review findings 2026-06-30 22:18:05 -07:00
c_abi_snapshot.rs feat: complete FFI C-ABI surface (Phase A) — handshake, pipeline entrypoints, log callback (#67) 2026-06-25 19:24:06 -07:00
c_abi_wait.rs feat: complete FFI C-ABI surface (Phase A) — handshake, pipeline entrypoints, log callback (#67) 2026-06-25 19:24:06 -07:00
c_header_compile.rs fix: harden agent-desktop reliability (#54) 2026-06-20 15:43:42 -04:00
c_header_double_include.rs feat: complete FFI C-ABI surface (Phase A) — handshake, pipeline entrypoints, log callback (#67) 2026-06-25 19:24:06 -07:00
codegen_exhaustiveness.rs feat(ffi): Phase B and C — Python smoke harness, parity gates, build.rs codegen (#77) 2026-06-26 19:14:14 -07:00
error_lifetime.rs fix: harden agent-desktop reliability (#54) 2026-06-20 15:43:42 -04:00