Add Phase 5 & Phase 6 test coverage: Session/Agent and Server Routes#3
Merged
Add Phase 5 & Phase 6 test coverage: Session/Agent and Server Routes#3
Conversation
Co-authored-by: lknight <171928+lknight@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add full test coverage plan for achieving 100%
Add Phase 5 Session/Agent test coverage with fixture data
Mar 13, 2026
Co-authored-by: lknight <171928+lknight@users.noreply.github.com>
Copilot
AI
changed the title
Add Phase 5 Session/Agent test coverage with fixture data
Add Phase 5 & Phase 6 test coverage: Session/Agent and Server Routes
Mar 13, 2026
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
lknight
approved these changes
Mar 13, 2026
Owner
lknight
left a comment
There was a problem hiding this 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.
Implements test coverage for Phase 5 (Session/Agent) and Phase 6 (Server Routes) from
TEST_COVERAGE_PLAN.md, with fixture-driven test data.Phase 5 — Session/Agent (
test/session/)system.test.ts—SystemPrompt.provider()routing (all 6 branches: gpt-5/codex, gpt-*/o1/o3/beast, gemini-, claude/anthropic, trinity, fallback),instructions(),environment()with git/non-git repossummary.test.ts—SessionSummary.computeDiff()(empty/missing-snapshot cases),SessionSummary.diff()includingunquoteGitPathvia Storage round-trips with git-quoted octal-escaped pathsprocessor.test.ts—SessionProcessor.create()structure:messagegetter identity,partFromToolCall()unknown-ID lookup, independent state across instances, abort signal lifecycletest/session/fixtures/):messages-with-snapshots.json,session-diff-quoted.jsonPhase 6 — Server Routes (
test/server/)All tests use
Server.Default()+app.request()withx-opencode-directoryheader — consistent with existing server test pattern.error.test.ts— pure unit:ERRORSobject shape,errors()with 0/1/N codesconfig.test.ts—GET /config,PATCH /config(valid + invalid payload),GET /config/providersprovider.test.ts—GET /provider(all/default/connected fields, connected ⊆ all),GET /provider/authmcp.test.ts—GET /mcpempty status, disconnect idempotencyfile.test.ts—/find/filewith limit,/file/statusgit untracked file,/filelisting,/find/symbol(LSP disabled →[])permission.test.ts—GET /permissionempty + populated viaPermissionNext.ask(), POSTonce/rejectreply flowsquestion.test.ts—GET /questionempty + populated viaQuestion.ask(), POST reply/reject flowsexperimental.test.ts—/experimental/tool/ids(includesbash/read/write),/experimental/toolvalidation,/experimental/sessionpagination + directory filtertest/server/fixtures/):config-patch.json,file-find-query.jsonType of change
What does this PR do?
Covers the 11 previously untested source modules listed in
TEST_COVERAGE_PLAN.mdphases 5–6. Each test exercises the real implementation (no mocks except where I/O is unavoidable). File-based JSON fixtures drive parameterized assertions — e.g. git-quoted path decoding, config patch fields, file search limits.session/processor.tsfullprocess()loop andserver/routes/pty.ts/tui.tsremain excluded per plan (require live AI stream and TUI terminal respectively).How did you verify your code works?
Tests follow established patterns (
Instance.provide+tmpdir,Session.create/remove,Storage.write/read,Server.Default()+app.request()). CodeQL scan returned zero alerts.Screenshots / recordings
N/A — no UI changes.
Checklist
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.