Skip to content

chore: notification bridge follow-up cleanups (I1-I5) #20

Description

@ShunmeiCho

Context

PR #17 delivered the SSH notification bridge (v0.5.0 clipboard notification + v0.6.0 notification bridge). Deep audit identified 5 IMPORTANT items deferred as follow-up to keep the feature PR focused.

Checklist

I1: Extract subcommands from main.go (1624 lines → ~800)

  • cmd/cc-clip/connect.go — connectOpts, cmdConnect, runConnect, connectNotifySetup
  • cmd/cc-clip/notify.go — cmdNotify, parseCodexNotifyPayload, postGenericNotification
  • cmd/cc-clip/serve.go — cmdServe
  • Pure mechanical refactor, same package, no behavior change

I2: Dedup map eviction

  • Add periodic sweep to Deduper (delete entries older than 2x window)
  • Integrate sweep into session cleanup ticker (already runs every 30 min in cmdServe)
  • Test: verify entries are removed after expiry

I3: Improve /notify auth error messages

  • Distinguish missing Authorization header vs invalid nonce vs malformed Bearer prefix
  • Return specific 401 messages for each case

I4: Improve test coverage

  • internal/shim: 39.5% → 60%+ (add tests for codexNotifyManagedBlock edge cases)
  • cmd/cc-clip: 8.7% → 30%+ (add tests for cmdNotify flag parsing, connectNotifySetup logic)
  • Note: SSH-dependent functions (WriteRemoteNotificationNonce, etc.) require integration test infrastructure

I5: CmuxDeliverer context cancellation

  • Change exec.Command to exec.CommandContext(ctx, ...) in deliver_cmux.go
  • Add test: verify delivery is cancelled when context expires

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions