Skip to content

[codex] add snapshot import cache metadata - #71

Merged
codeasier merged 1 commit into
mainfrom
codex/snapshot-import-cache-metadata
Jul 28, 2026
Merged

codeasier merged 1 commit into
mainfrom
codex/snapshot-import-cache-metadata

Conversation

@codeasier

@codeasier codeasier commented Jul 18, 2026 •

Copy link
Copy Markdown
Owner

What changed

  • add SHA-256 based SnapshotDB import reuse keyed by import format version and exact device selection
  • persist provenance in a validated pt_snap_metadata table and preserve atomic database replacement
  • add pt-snap metadata, --force, Python API metadata access, and an MCP metadata tool
  • add regression, contract, wheel smoke coverage, bilingual docs, and the completed spec package

Why

Large PyTorch snapshot pickles can take significant time and resources to replay. Repeated imports previously rebuilt the same database with no reliable compatibility check or provenance information.

Impact

Identical imports now reuse the existing database. Legacy or incompatible databases rebuild once, users can force a rebuild, and CLI/API/MCP callers can inspect normalized metadata. MCP import remains out of scope.

Validation

  • pytest -q (354 passed)
  • ruff check src tests --no-cache
  • black --check src tests
  • python -m basedpyright (0 errors, 0 warnings)
  • built and installed a wheel; verified real snapshot import, second-run reuse, metadata JSON, and vendored backend packaging

Closes #77

@codeasier codeasier left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Two correctness issues found in metadata validation.

Comment thread src/pt_snap_cli/core/import_metadata.py Resolved
Comment thread src/pt_snap_cli/core/import_metadata.py Resolved
Comment thread src/pt_snap_cli/core/import_metadata.py Resolved
Comment thread src/pt_snap_cli/core/import_metadata.py Resolved
Comment thread src/pt_snap_cli/core/import_metadata.py Resolved
Comment thread src/pt_snap_cli/core/import_metadata.py Resolved
Comment thread src/pt_snap_cli/core/import_metadata.py Resolved
Comment thread src/pt_snap_cli/core/import_service.py Resolved
Comment thread src/pt_snap_cli/context.py Resolved
Comment thread src/pt_snap_cli/core/import_metadata.py Resolved
Comment thread src/pt_snap_cli/core/import_metadata.py Resolved
Comment thread src/pt_snap_cli/core/import_service.py Resolved
Comment thread src/pt_snap_cli/context.py Resolved
@codeasier
codeasier marked this pull request as ready for review July 28, 2026 06:08
@codeasier
codeasier force-pushed the codex/snapshot-import-cache-metadata branch from f7a7037 to ae44b0e Compare July 28, 2026 06:12
@codeasier
codeasier merged commit bccd7fd into main Jul 28, 2026
5 checks passed
@codeasier
codeasier deleted the codex/snapshot-import-cache-metadata branch July 28, 2026 06:14
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.

[FEATURE] 缓存并复用相同快照的 SnapshotDB 导入结果(子任务 #72-5)

1 participant