Skip to content

Add Phase 5 & Phase 6 test coverage: Session/Agent and Server Routes#3

Merged
lknight merged 3 commits intodevfrom
copilot/test-coverage-plan-phase-5
Mar 13, 2026
Merged

Add Phase 5 & Phase 6 test coverage: Session/Agent and Server Routes#3
lknight merged 3 commits intodevfrom
copilot/test-coverage-plan-phase-5

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 13, 2026

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.tsSystemPrompt.provider() routing (all 6 branches: gpt-5/codex, gpt-*/o1/o3/beast, gemini-, claude/anthropic, trinity, fallback), instructions(), environment() with git/non-git repos
  • summary.test.tsSessionSummary.computeDiff() (empty/missing-snapshot cases), SessionSummary.diff() including unquoteGitPath via Storage round-trips with git-quoted octal-escaped paths
  • processor.test.tsSessionProcessor.create() structure: message getter identity, partFromToolCall() unknown-ID lookup, independent state across instances, abort signal lifecycle
  • Fixtures (test/session/fixtures/): messages-with-snapshots.json, session-diff-quoted.json

Phase 6 — Server Routes (test/server/)

All tests use Server.Default() + app.request() with x-opencode-directory header — consistent with existing server test pattern.

  • error.test.ts — pure unit: ERRORS object shape, errors() with 0/1/N codes
  • config.test.tsGET /config, PATCH /config (valid + invalid payload), GET /config/providers
  • provider.test.tsGET /provider (all/default/connected fields, connected ⊆ all), GET /provider/auth
  • mcp.test.tsGET /mcp empty status, disconnect idempotency
  • file.test.ts/find/file with limit, /file/status git untracked file, /file listing, /find/symbol (LSP disabled → [])
  • permission.test.tsGET /permission empty + populated via PermissionNext.ask(), POST once/reject reply flows
  • question.test.tsGET /question empty + populated via Question.ask(), POST reply/reject flows
  • experimental.test.ts/experimental/tool/ids (includes bash/read/write), /experimental/tool validation, /experimental/session pagination + directory filter
  • Fixtures (test/server/fixtures/): config-patch.json, file-find-query.json

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Covers the 11 previously untested source modules listed in TEST_COVERAGE_PLAN.md phases 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.ts full process() loop and server/routes/pty.ts/tui.ts remain 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

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

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
Copilot AI requested a review from lknight March 13, 2026 18:39
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
@github-actions
Copy link
Copy Markdown

Hey! Your PR title Add Phase 5 Session/Agent test coverage with fixture data doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

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.

Copy link
Copy Markdown
Owner

@lknight lknight left a comment

Choose a reason for hiding this comment

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

Больше тестов перед началом изменений

@lknight lknight marked this pull request as ready for review March 13, 2026 19:24
@lknight lknight merged commit 714a17e into dev Mar 13, 2026
6 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants