Skip to content

<!-- Authored per the the-loop:writing skill. -->

Tasks: the listener measures its own share of the traffic ​

Phase 4 of 4. Derived mechanically from design.md and testing-plan.md. A DAG: tasks at the same indent are independent.

  • [x] 1. the_loop/channels/splitwatch.py — SPLIT_REMEDY, SPLIT_CAVEAT, SplitState, SplitWatch (for_config, observe, run_cycle), read_state, split_state_path, split_lines. Never raises; writes ids, counts and timestamps only. Requirements: R1.4–R1.8, R2.1–R2.6, R4.1, R4.2 Test: T1, T2, T3, T4
    • [x] 1a. tests/test_channels_splitwatch.py — the cycle, the escalation ladder, the rolling window, and every refusal. Test: T1, T2, T3, T4
  • [x] 2. doctor.central_channel — the private resolver made public, and consumer_verdict_text extended with SPLIT_REMEDY, so the doctor and the watch say the same sentence. Requirements: R4.1, R4.2 Test: T7
  • [x] 3. state.StateLayout.slack_split — <root>/local/slack-split.json, plus its GENERATED_PATHS entry (local). Requirements: R2.4 Test: T8
  • [x] 4. eventlog.EVENT_TYPES — channel.split_suspected, channel.split_cleared. Requirements: R2.1, R2.3 Test: T8
  • [x] 5. SlackChannelConfig.split_check_beats — the field, _split_check_beats's clamping, and the schema entry. Requirements: R1.4, R1.5 Test: T5, T8
  • [x] 6. run_socket_listener wiring — build the watch, feed observe from the heartbeat branch beside the existing emit, run a cycle at connect and on each reconcile deadline, guarded so a cycle never ends the listener. Requirements: R1.1, R1.2, R1.3, R1.7, R1.8 Test: T6
  • [x] 7. status reports it — slackSplit in lifecycle.status_all, split_line, the lifecycle_cmd rows, and channels.commands.render_status; ok untouched. Requirements: R3.1, R3.2, R3.3, R3.5, R3.6, R3.7 Test: T7
  • [x] 8. channels status reports it — the split check: line and the [!] finding. Requirements: R3.4, R3.6 Test: T7
  • [x] 9. Tests — tests/test_channels_splitwatch_integration.py covering T6, T7 and the redaction assertions of T9. Test: T6, T7, T9
  • [x] 10. Docs — docs/config/cli/channels-options.md (the key), docs/cli/commands/status.md and docs/cli/commands/channels.md (the new lines), docs/cli/commands/doctor.md (the remedy), docs/cli/state.md (the state file), docs/guide/slack.md (the rotation procedure, R4.3), docs/capabilities/channels.md and docs/capabilities/observability.md (the capability). Requirements: R4.3 Test: T8
  • [x] 11. Evidence — verification, security review, self-review, documentation. Test: T9, T10

Released under the MIT License.