Fix #70: Implement HTTP caching for offline mode#71
Merged
Conversation
Previously, offline mode only skipped VCS operations but still fetched HTTP-referenced requirements/constraints files. This created an inconsistent "offline" experience where network requests were still made. Changes: - Add HTTP content caching to .mxdev_cache/ directory - Online mode: fetch from HTTP and cache for future use - Offline mode: read from cache, error if not cached - Cache key: SHA256 hash (first 16 chars) of URL - Add comprehensive tests for cache hit/miss/revalidation Implementation: - Add _get_cache_key(), _cache_http_content(), _read_from_cache() - Modify resolve_dependencies() to accept offline/cache_dir params - Thread offline state through process_io() and process_line() - Update read() to pass offline state from configuration Documentation: - Improve help text for -n/--no-fetch, -f/--fetch-only, -o/--offline - Add "Offline Mode and HTTP Caching" section to README.md - Document cache location and workflow examples - Update CHANGES.md with bug fix entry All 190 tests pass, including 5 new HTTP caching tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #70 - Offline mode now properly handles HTTP-referenced requirements/constraints files through caching.
Problem
Previously, offline mode (
-o/--offline) only skipped VCS operations but still fetched HTTP-referenced requirements/constraints files. This created an inconsistent "offline" experience where network requests were still made despite the flag.Solution
Implemented HTTP content caching:
.mxdev_cache/Changes
Implementation
_get_cache_key(),_cache_http_content(),_read_from_cache()resolve_dependencies()to acceptofflineandcache_dirparametersprocess_io()andprocess_line()read()to pass offline state from configurationDocumentation
-n/--no-fetch,-f/--fetch-only,-o/--offlineTesting
test_http_cache_online_mode: Verify caching during online fetchtest_http_cache_offline_mode_hit: Verify cache read in offline modetest_http_cache_offline_mode_miss: Verify error on cache misstest_cache_key_generation: Verify deterministic cache keystest_http_cache_revalidates_in_online_mode: Verify cache updatesTest Results
All 190 tests pass (including 5 new HTTP caching tests).
Checklist
.mxdev_cache/added to.gitignore