Skip to content

feat(channels): add test channel extension for integration testing#492

Closed
sytone wants to merge 1 commit into
mainfrom
feat/test-channel
Closed

feat(channels): add test channel extension for integration testing#492
sytone wants to merge 1 commit into
mainfrom
feat/test-channel

Conversation

@sytone
Copy link
Copy Markdown
Owner

@sytone sytone commented May 22, 2026

Closes #326

Changes

  • New BotNexus.Extensions.Channels.Test extension project
  • TestChannelAdapter: in-memory message queues, ChannelKey = test, opt-in only (manifest enabled: false)
  • SendAsync / SendStreamDeltaAsync / FlushStreamBuffer for outbound message capture
  • InjectInboundAsync dispatches into the real gateway pipeline
  • CaptureLog / GetLogs / ClearLogs for structured log buffer
  • TestChannelLoggerProvider / TestChannelLogger for structured log capture from gateway logs
  • TestChannelEndpoints: minimal API group (/test-channel/...) for HTTP-based test orchestration
  • TestChannelServiceCollectionExtensions: DI registration (AddBotNexusTestChannel())
  • Added both projects to BotNexus.slnx

Test coverage (12 tests)

  • ChannelType returns test
  • GetOutbound empty when no messages
  • SendAsync enqueues, GetOutbound returns message
  • ClearOutbound empties queue
  • GetOutbound dequeues (subsequent call returns empty)
  • GetLogs returns captured entries
  • ClearLogs empties buffer
  • Logger provider captures log messages with category and level
  • SendStreamDeltaAsync accumulates, FlushStreamBuffer enqueues
  • InjectInboundAsync with no dispatcher does not throw
  • Multiple channels are independent
  • DisplayName is Test Channel

New BotNexus.Extensions.Channels.Test project:
- TestChannelAdapter: in-memory message queues, ChannelKey=test
- SendAsync/SendStreamDeltaAsync/FlushStreamBuffer for outbound capture
- InjectInboundAsync dispatches via gateway pipeline
- CaptureLog/GetLogs/ClearLogs for log buffer
- TestChannelLoggerProvider/TestChannelLogger for structured log capture
- TestChannelEndpoints: minimal API group for HTTP-based test orchestration
- TestChannelServiceCollectionExtensions for DI registration
- 12 unit tests

Closes #326
@sytone
Copy link
Copy Markdown
Owner Author

sytone commented May 22, 2026

Farnsworth Review — PR #492

  • CI: ✅ All checks passing (build-and-test, CodeQL, TruffleHog, patterns, deps)
  • Merge conflicts: ✅ CLEAN / MERGEABLE
  • Commit title: feat(channels): add test channel extension for integration testing ✅ conventional
  • Test coverage: 12 tests covering adapter send/receive, outbound queue dequeue, log capture, logger provider, streaming accumulation, InjectInboundAsync no-throw, multi-channel independence. Happy and sad paths covered ✅
  • Spec completeness vs [Channels] Add test channel extension for integration testing of multi-channel scenarios #326: TestChannelAdapter, TestChannelLoggerProvider, TestChannelEndpoints, DI extensions, manifest with enabled: false (opt-in), added to BotNexus.slnx ✅
  • Design note: enabled: false default is correct — test channel must not activate in production deployments. In-memory queues with independent state per adapter instance is the right isolation model.

LGTM. Ready to merge.

@sytone
Copy link
Copy Markdown
Owner Author

sytone commented May 22, 2026

CI: All checks passing
Merge conflicts: Clean / MERGEABLE
Commit title: Conventional commit format correct
Coverage: 12 unit tests for TestChannelAdapter, TestChannelLoggerProvider, TestChannelEndpoints
Spec completeness: Closes #326 - in-memory test channel with inbound injection, outbound queues, log capture, and minimal API endpoints. Opt-in (enabled: false by default).

LGTM - ready to merge.

@sytone
Copy link
Copy Markdown
Owner Author

sytone commented May 22, 2026

CI: ✅ All checks passing
Merge: CLEAN — no conflicts
Commit title: feat(channels): add test channel extension for integration testing ✅ Conventional commit
Coverage: 12 unit tests covering adapter, logger, and endpoint paths
Spec completeness: Closes #326 — in-memory test channel with InjectInboundAsync, log capture, minimal API endpoints

LGTM — ready to merge.

Copy link
Copy Markdown
Owner Author

@sytone sytone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Farnsworth Review — PR #492

CI: ✅ All checks passing
Merge conflicts: ✅ Clean (MERGEABLE)
Conventional commit title:feat(channels): add test channel extension for integration testing

Test coverage:

  • ✅ 12 unit tests (adapter queues, InjectInboundAsync, log capture, endpoints)
  • Both projects added to BotNexus.slnx

Spec completeness vs #326: TestChannelAdapter with in-memory queues, log capture, and minimal API endpoints covers all AC. enabled: false default is critical safety measure — good.

LGTM. Ready to merge.

@sytone
Copy link
Copy Markdown
Owner Author

sytone commented May 22, 2026

Closing as part of a planned hard-reset of the in-flight branch set so the new domain-model refactor can land on a clean trunk.

Audit verdict: keep

Rationale: Useful for section 9.6 integration tests.

The new plan (in session state) reshapes core types: Citizen (User+Agent union), Vogen-generated value objects, ThreadId removed in favour of composite ChannelAddress, mark-not-delete compaction, centralised SessionContextProjector, single-path routing. Many in-flight branches touch contracts that are about to change — rebasing later would be more work than rebuilding on the new shape.

If this work is still wanted, refile as a new issue/PR against the post-refactor contracts.

@sytone sytone closed this May 22, 2026
@sytone sytone deleted the feat/test-channel branch May 22, 2026 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Channels] Add test channel extension for integration testing of multi-channel scenarios

1 participant