Skip to content

Conversation

@jensens
Copy link
Member

@jensens jensens commented Oct 22, 2025

Summary

Fixes #34: The offline configuration setting and --offline CLI flag are now properly respected to prevent VCS fetch/update operations.

Current Status: Demonstrating the Bug

Failing Test

The first commit adds test_offline_prevents_vcs_operations() that demonstrates the issue:

Test scenario:

  1. Create repo and perform initial checkout
  2. Add new content to remote repo
  3. Try to update with offline=True
  4. FAILS: Update happens anyway, fetching new content

Error:

AssertionError: assert {PosixPath('.../bar')} == {PosixPath('.../foo')}
Extra items in the left set:
PosixPath('.../bar')

The test shows that "bar" was fetched even though offline=True was set.

Root Cause

There are two separate bugs that both need fixing:

Bug #1: main.py ignores offline configuration (line 92)

if not args.no_fetch:
    fetch(state)

Problem: Only checks --no-fetch CLI flag, completely ignores the configuration's offline setting.

What happens:

  • User sets offline = true in mx.ini → fetch() is still called
  • User uses --offline CLI flag → sets config offline=true, but fetch() is still called
  • Only --no-fetch CLI flag actually skips fetch()

Bug #2: processing.py hardcodes offline=False (line 201)

workingcopies.checkout(
    sorted(packages),
    verbose=False,
    update=True,
    submodules="always",
    always_accept_server_certificate=True,
    offline=False,  # BUG: Should use state.configuration.settings
)

Problem: Even if we fix Bug #1, the fetch() function itself passes offline=False hardcoded.

Next Steps

  • Fix main.py to check offline setting before calling fetch()
  • Fix processing.py to pass offline setting from configuration
  • Verify test passes
  • Run linting
  • Update CHANGES.md
  • Mark PR ready when CI is green

Test Plan

# Currently fails:
pytest tests/test_git.py::test_offline_prevents_vcs_operations -v

# After fix, should pass

- main.py: Check offline configuration before calling fetch()
- processing.py: Pass offline setting from config instead of hardcoded False
- vcs/common.py: Skip all updates when offline mode is enabled
- CHANGES.md: Document the fix
@jensens jensens marked this pull request as ready for review October 22, 2025 10:55
@jensens jensens merged commit 241db6e into main Oct 22, 2025
23 checks passed
@jensens jensens deleted the fix/34-offline-setting-not-respected branch October 22, 2025 10:56
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.

Problems cloning repositories

2 participants