Skip to content

fix(sync): return not_started for unsynced episodes#91

Merged
shark0F0497 merged 1 commit into
mainfrom
fix/unexpected_404
Jun 12, 2026
Merged

fix(sync): return not_started for unsynced episodes#91
shark0F0497 merged 1 commit into
mainfrom
fix/unexpected_404

Conversation

@shark0F0497

Copy link
Copy Markdown
Collaborator

Pull Request Checklist

  • Code follows the style guidelines
  • Tests pass locally
  • Code is formatted
  • Documentation updated if needed
  • Commit messages follow conventional commits
  • PR description is complete and clear

Summary

This PR changes the episode cloud sync status endpoint so an existing episode with no sync log returns a normal not_started status instead of a 404.


Motivation

  • Opening an episode detail page currently calls GET /api/v1/sync/episodes/:id/status.
  • Episodes that have never been synced have no sync_logs row, which previously returned 404 no sync record found for this episode.
  • That 404 is a normal business state, not an error; it creates noisy browser Network/console output and forces frontend exception handling.

Changes

Modified Files

  • internal/api/handlers/sync.go - Return a virtual SyncJobResponse with status: "not_started" and id: 0 when the episode exists but has no sync log; preserve 404 for missing or soft-deleted episodes.
  • internal/api/handlers/sync_test.go - Add handler tests for 200 not_started and 404 episode not found behavior.
  • docs/designs/cloud-sync-ui-implementation.md - Document the new sync status endpoint contract.
  • docs/designs/episode-qa-checks-mcap-integrity.zh.html - Document the updated episode detail quality-check result modal behavior.

Added Files

  • None

Deleted Files

  • None

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)
  • Documentation update (documentation changes only)
  • Refactoring (code improvement without functional changes)
  • Performance improvement (code changes that improve performance)
  • Test changes (adding, modifying, or removing tests)

Impact Analysis

Breaking Changes

None

Backward Compatibility

Existing synced episodes still return the latest real sync log. Existing episodes with no sync logs now return 200 status=not_started instead of 404; clients that treated no-sync-log 404 as normal should handle this response as the same business state.


Testing

Test Environment

  • Local Go test environment
  • Swagger regenerated with go run github.com/swaggo/swag/cmd/swag@v1.16.6 init -g internal/server/server.go -o docs

Test Cases

  • Unit tests pass locally
  • Integration tests pass locally
  • E2E tests pass (if applicable)
  • Manual testing completed

Manual Testing Steps

Not performed.

Test Coverage

  • New tests added
  • Existing tests updated
  • Coverage maintained or improved

Commands run:

go test ./internal/api/handlers -run 'TestGetSyncStatus|TestListEpisodeSyncSummariesGroupsByEpisode' -v

Screenshots / Recordings

Not applicable.


Performance Impact

  • Memory usage: No change
  • CPU usage: No meaningful change
  • Throughput: No change
  • Lock contention: No change

Documentation


Related Issues

  • Related to episode detail sync status 404 handling

Additional Notes

  • not_started is a virtual response status for this endpoint and is not inserted into sync_logs.
  • 404 now means the episode is missing or soft-deleted.

Reviewers


Notes for Reviewers

  • Please review the endpoint contract in internal/api/handlers/sync.go.
  • Please confirm not_started is acceptable as a virtual status for existing episodes with no sync log.

Checklist for Reviewers

  • Code changes are correct and well-implemented
  • Tests are adequate and pass
  • Documentation is updated and accurate
  • No unintended side effects
  • Performance impact is acceptable
  • Backward compatibility maintained (if applicable)

@shark0F0497 shark0F0497 merged commit a456ca7 into main Jun 12, 2026
5 checks passed
@shark0F0497 shark0F0497 deleted the fix/unexpected_404 branch June 12, 2026 07:06
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.

1 participant