feat(team-sync): #279 Phase 2 — team-mode integration for sync-and-brief#321
Merged
Merged
Conversation
Wires the existing BackendAdapter interface (shipped in #277, closed) into the sync-and-brief CLI flow. Phase 2 of #279 — the team-mode complement to Phase 1's solo-mode session magic (PR #318, merged). Order invariants: 1. BEFORE source pull: backend.pull_events() copies every peer's <email>.jsonl into the local .bicameral/events/ cache. The materializer's existing *.jsonl glob (events/materializer.py:73) picks them up alongside the operator's own events. Peer ingest is visible in the brief without manual action. 2. AFTER source ingest succeeds: backend.push_events() uploads each local <email>.jsonl to the shared backend. LocalFolderAdapter's sha-match skip (events/backends/local_folder.py:44-46) keeps re-invocations idempotent. Failure modes are non-blocking — backend pull/push errors log to stderr + ~/.bicameral/cli-errors.log but never block the brief. The hook wrapper's exit 0 framing makes this invisible to SessionStart users on a network outage. Solo mode (no team: config) is completely unaffected — same code path as before. The brief renderer gains an optional ## Team sync section showing peer_files_pulled + my_file_pushed. Omitted entirely when team_sync=None so solo-mode briefs render byte-identically to pre-Phase-2. Per #205 doctrine — the only operator-facing default in this new path (no team backend when team: config is absent) is a deterministic gate at events/backends/__init__.py::get_backend, not a skill-text-only claim. Backend errors return None safely. 12 tests in tests/test_sync_and_brief_team_mode.py — sociable per CLAUDE.md (real LocalFolderAdapter, real BicameralContext, real file system; no backend mocks). The headline two-machine round-trip test spans Alice's repo → shared remote_root → Bob's repo and verifies Alice's events land in Bob's cache after his next sync-and-brief. 3 new tests in tests/test_brief_renderer.py covering the Team sync section (present/absent/zero-counts). Full Phase 1 + Phase 2 sweep: 56 passed, 1 skipped (mcp[cli] env probe unchanged). docs/policies/sources-config.md extended with a "Team backend" section documenting config schema + failure modes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 2 of #279. Wires the existing `BackendAdapter` interface (shipped in #277) into the `sync-and-brief` CLI flow. The team-mode complement to Phase 1's solo-mode session magic (PR #318, merged).
Order invariants
Failure modes (non-blocking by design)
Brief renderer extension
The brief gains an optional `## Team sync` section showing `peer_files_pulled` + `my_file_pushed`. Omitted entirely when `team_sync=None` so solo-mode briefs render byte-identically to pre-Phase-2.
Per-#205 doctrine alignment
The only operator-facing default in this new code path — "no team backend when `team:` config is absent" — is a deterministic gate at `events/backends/init.py::get_backend` (returns `None`), NOT a skill-text-only claim. Backend errors return `None` safely. Per the doctrine just shipped in PR #320.
Test plan
Headline test: two-machine round-trip
`test_team_sync_round_trip_alice_to_bob_via_local_folder` — spans Alice's repo → shared `remote_root` → Bob's repo and verifies Alice's events land in Bob's cache after his next `sync-and-brief`. End-to-end across two `BicameralContext` instances + a real shared `LocalFolderAdapter`. No mocks on the backend, materializer, or file system.
Files
🤖 Generated with Claude Code