Expand description
Catalog refresh workflow for the CLI.
§Overview
The refresh workflow is API-driven and runs in four phases:
- Preparation: ensure the catalog directories exist and clear stale temp files.
- Selection: load local metadata if present, query the update API, and turn the
response into a
current,patch, orfullplan. - Execution: current plans return immediately, full plans download and verify a full snapshot, and patch plans apply incremental SQL patches to a working copy.
- Finalization: atomically rename the refreshed temp files into place and clean up any leftover temporary artifacts.
§API Surface
refresh_catalogis the production entry point used by the CLI and targets the default update API.refresh_catalog_with_api_urlis a doc-hidden test hook that lets integration tests point the workflow at a mock server.apibuilds safe update URLs and fetches the update selection payload.plannerconverts the selection response plus local metadata into a concreteCatalogDownloadPlan.downloadhandles the full snapshot download, decompression, and final hash verification.patchapplies incremental SQL patches against a working copy and writes the refreshed metadata.metadataloads local metadata, derives metadata URLs, and validates hashes.
§Fallback Behavior
If a patch application fails, the workflow clears the temp files, re-queries the API for a full snapshot plan, and retries through the snapshot path.
§Cleanup
Temporary files are removed on both success and failure. The final catalog and metadata files are only replaced after the new versions have been fully built.
§Concurrency
This module does not take a file lock. If multiple CLI processes can target the same catalog root concurrently, that lock belongs at a higher layer.
Modules§
Constants§
Functions§
- clear_
temp_ 🔒file - refresh_
catalog - Refreshes the local catalog using the default update API endpoint.
- request_
full_ 🔒snapshot_ plan