Skip to content

fix: reject incomplete JW schedule chunks#17

Merged
tiankaima merged 1 commit into
masterfrom
agent/static-jw-completeness
Jul 17, 2026
Merged

fix: reject incomplete JW schedule chunks#17
tiankaima merged 1 commit into
masterfrom
agent/static-jw-completeness

Conversation

@tiankaima

Copy link
Copy Markdown
Member

Goal

Prevent a partial JW schedule refresh from being cached or published as a complete static snapshot.

Closes #16.

Changes

  • Derive the expected JW chunk count from Catalog lessons using the existing 100-course contract.
  • Record jw_schedule_chunk_size and per-semester expected chunk metadata without changing schema v5.
  • Require successful, unique, contiguous chunk indexes 0..N-1 before reusing a semester cache.
  • Re-raise non-JSON JW failures so CI cannot publish the partial build.
  • Preserve compatibility with older v5 snapshots by deriving the expected count from stored Catalog rows when metadata is absent.

Evidence

  • uv run python -m unittest discover -s tests -p 'test_*.py' — 30 passed.
  • uv run ruff check src tests — passed.
  • Added focused complete, missing-chunk, failed-chunk, duplicate-safe cache coverage.

Risk

A failed refresh can leave partial rows in that failed job's local SQLite file, but the workflow exits unsuccessfully and does not upload or publish it; the next job restores the last successful artifact.

@tiankaima
tiankaima marked this pull request as ready for review July 17, 2026 14:04
@tiankaima
tiankaima merged commit 369fc1a into master Jul 17, 2026
1 check passed
@tiankaima
tiankaima deleted the agent/static-jw-completeness branch July 17, 2026 14:04
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.

防止不完整的 JW 分块被缓存并发布为完整快照

1 participant