Skip to content

test(gateway): add coverage for hybrid LINE reply/push dispatch #620

@chaodu-agent

Description

@chaodu-agent

Context

PR #608 implements the hybrid LINE reply/push strategy in gateway/src/main.rs, and the code has been reviewed and accepted. What is still missing is focused gateway-level test coverage for the dispatch behavior.

Why

The current confidence comes primarily from code review plus existing build/test signals, not from automated tests around the new reply-token cache and fallback control flow. This area is correctness-sensitive because it decides when to use the free Reply API, when to fall back to Push API, and when not to fall back to avoid duplicate delivery.

Requested tests

  • cache hit: uses LINE Reply API and does not call Push API
  • cache miss: falls back to Push API
  • expired cached token: falls back to Push API
  • Reply API 400 with invalid/expired reply token semantics: falls back to Push API
  • Reply API 5xx: does not fall back to Push API to avoid duplicate delivery
  • Reply API network/timeout error: does not fall back to Push API to avoid duplicate delivery

Suggested scope

  • Extract the LINE dispatch branch into a testable helper if needed
  • Keep the tests local to the gateway crate / module
  • Prefer explicit assertions about whether Reply or Push was attempted

Related

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions