Skip to content

test(session):add comprehensive test coverage for resume.go - #590

Merged
lizhengfeng101 merged 1 commit into
alibaba:mainfrom
StephenJarso:test/session-resume-coverage
Jul 30, 2026
Merged

test(session):add comprehensive test coverage for resume.go#590
lizhengfeng101 merged 1 commit into
alibaba:mainfrom
StephenJarso:test/session-resume-coverage

Conversation

@StephenJarso

@StephenJarso StephenJarso commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

add comprehensive test coverage for resume.go

Add 34 focused tests for session/resume.go, which previously had no dedicated test file. Tests cover every exported and unexported function:

  • SessionFilePath: empty ID rejection, valid path construction
  • CompletedCount: nil state, empty items, populated items
  • Item: nil state, missing key, found key, defensive copy verification
  • ValidateOptions: nil/workspace/empty/missing mode rejection, mode mismatch, range match/mismatch, commit match/mismatch, unsupported mode
  • applyResumeLine: session_start, review_item_done (with NewPath fallback and empty fingerprint skip), review_item_reused, review_item_failed (removal + empty fingerprint), unknown type, invalid JSON
  • applySessionStart: RepoDir preservation/override, SessionID preservation, all fields set
  • copyLlmComments: nil input, empty slice, deep copy with mutation isolation
  • LoadResumeState: nonexistent file, empty file, multiple records round-trip, invalid JSON, fail-then-redo replay sequencing

Description

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring (no functional changes)
  • Documentation update
  • CI / Build / Tooling

How Has This Been Tested?

  • make test passes locally
  • Manual testing (describe below)

Checklist

  • My code follows the project's coding style (go fmt, go vet)
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly (if applicable)
  • I have signed the CLA

Related Issues

add comprehensive test coverage for resume.go

Add 34 focused tests for session/resume.go, which previously had no
dedicated test file. Tests cover every exported and unexported function:

- SessionFilePath: empty ID rejection, valid path construction
- CompletedCount: nil state, empty items, populated items
- Item: nil state, missing key, found key, defensive copy verification
- ValidateOptions: nil/workspace/empty/missing mode rejection, mode
  mismatch, range match/mismatch, commit match/mismatch, unsupported mode
- applyResumeLine: session_start, review_item_done (with NewPath
  fallback and empty fingerprint skip), review_item_reused,
  review_item_failed (removal + empty fingerprint), unknown type,
  invalid JSON
- applySessionStart: RepoDir preservation/override, SessionID
  preservation, all fields set
- copyLlmComments: nil input, empty slice, deep copy with mutation
  isolation
- LoadResumeState: nonexistent file, empty file, multiple records
  round-trip, invalid JSON, fail-then-redo replay sequencing
@CLAassistant

CLAassistant commented Jul 29, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

Copy link
Copy Markdown
Contributor

OpenCodeReview: No supported files changed.

@StephenJarso StephenJarso left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The tests are running and have followed the contribution guidelines

@lizhengfeng101 lizhengfeng101 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@lizhengfeng101
lizhengfeng101 merged commit a47dfb2 into alibaba:main Jul 30, 2026
8 checks passed
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.

3 participants