Skip to content

Require scenario="flight" if no internet#375

Open
taldcroft wants to merge 3 commits intomasterfrom
no-internet-requires-flight-scenario
Open

Require scenario="flight" if no internet#375
taldcroft wants to merge 3 commits intomasterfrom
no-internet-requires-flight-scenario

Conversation

@taldcroft
Copy link
Member

@taldcroft taldcroft commented Jan 22, 2026

Description

This is a potentially impacting PR to be strict about the scenario if there is no internet. The driver here is to avoid silently providing incorrect results for commands or states for no internet.

The current behavior is that the default scenario=None will fall back to using the commands available in the archive ($SKA/data/kadi/cmds2.h5) if there is no internet. That was put in place intentionally so things would not break horribly without internet, but in hindsight avoids the golden rule to "not guess". This falling-back behavior applies to the new custom command sheet as well, which is simply ignored if there is no internet. This caused the regression test failure on cheru.

This PR changes get_cmds to require scenario="flight" if there is no internet. Other commands like get_observations, get_states, get_continuity all call get_cmds, so the new requirement applies across the board to all kadi commands operations

It also removes the kadi.commands.commands_v2.HAS_INTERNET global constant. This was previously set at import time, but since internet can come and go, that strategy was inherently unreliable.

Interface impacts

Requires scenario="flight" if there is no internet. This can be set globally via the environment variable KADI_SCENARIO="flight" (either programatically or in a shell).

This might require changes in downstream code, e.g. mica.starcheck.get_starcheck_catalog ends up calling get_observations, so now that would fail without internet.

Testing

Unit tests

  • Mac
(ska3-flight-2026.1rc5) ➜  kadi git:(no-internet-requires-flight-scenario) git rev-parse --short HEAD
f1faca5

With Internet

(ska3-flight-2026.1rc5) ➜  kadi git:(no-internet-requires-flight-scenario)  pytest
=========================================== test session starts ============================================
platform darwin -- Python 3.13.11, pytest-9.0.2, pluggy-1.6.0
rootdir: /Users/aldcroft/git
configfile: pytest.ini
plugins: anyio-4.12.1, timeout-2.4.0
collected 219 items                                                                                        

kadi/commands/tests/test_commands.py .........................................................s..... [ 28%]
.........................                                                                            [ 40%]
kadi/commands/tests/test_filter_events.py ..                                                         [ 41%]
kadi/commands/tests/test_states.py ...............................................x................. [ 70%]
.........                                                                                            [ 74%]
kadi/commands/tests/test_validate.py ......................                                          [ 84%]
kadi/tests/test_events.py ..........                                                                 [ 89%]
kadi/tests/test_occweb.py .......................                                                    [100%]

========================== 217 passed, 1 skipped, 1 xfailed in 120.37s (0:02:00) ===========================

With no internet

(ska3-flight-2026.1rc5) ➜  kadi git:(no-internet-requires-flight-scenario)  pytest
=========================================== test session starts ============================================
platform darwin -- Python 3.13.11, pytest-9.0.2, pluggy-1.6.0
rootdir: /Users/aldcroft/git
configfile: pytest.ini
plugins: anyio-4.12.1, timeout-2.4.0
collected 219 items                                                                                        

kadi/commands/tests/test_commands.py .......sssssssssss..ss..............................s...s.s.... [ 28%]
..........ssss..s.......s                                                                            [ 40%]
kadi/commands/tests/test_filter_events.py ss                                                         [ 41%]
kadi/commands/tests/test_states.py sssssssssssssssssssssssssss...s................x................. [ 70%]
.........                                                                                            [ 74%]
kadi/commands/tests/test_validate.py ssssssssssssssssssssss                                          [ 84%]
kadi/tests/test_events.py ..........                                                                 [ 89%]
kadi/tests/test_occweb.py sssssssssssssssssssssss                                                    [100%]

=============================== 121 passed, 97 skipped, 1 xfailed in 17.74s ================================

Independent check of unit tests by [REVIEWER NAME]

  • [PLATFORM]:

Functional tests

No functional testing.

Copy link
Collaborator

@jzuhone jzuhone left a comment

Choose a reason for hiding this comment

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

Looks good except the minor nit about the commented-out lines, and this behavior is OK for ACIS Ops.

pytest.skip("No backstop file found")

# read_backstop(add_observations=True) requires internet because it calls
# kcs.get_continuity().
Copy link
Collaborator

Choose a reason for hiding this comment

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

Will you remove the commented-out lines or will they be needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a code comment justifying the pytest skipif above, not a commented-out line.

@taldcroft taldcroft force-pushed the no-internet-requires-flight-scenario branch from 3b929d6 to e348949 Compare January 30, 2026 10:59
@taldcroft taldcroft requested a review from jeanconn January 30, 2026 11:38
@taldcroft
Copy link
Member Author

@jeanconn - this is ready for review again, with an additional change to remove the HAS_INTERNET global entirely from kadi commands.

Note that HAS_INTERNET is used in all of the testing, but this is set locally in each test module.

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.

3 participants