Skip to content

fix: log inactivity with fixed texts and no configured value (BootUI 2.6.0) - #374

Draft
ffroliva wants to merge 7 commits into
mainfrom
fix/0.11.0-s11-inactivity-log
Draft

ffroliva wants to merge 7 commits into
mainfrom
fix/0.11.0-s11-inactivity-log

Conversation

@ffroliva

@ffroliva ffroliva commented Dec 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

Task 1.4 of the 0.11.0 plan (#367), row S11 of the BootUI 2.6.0 delta: when sharpit is inactive, its startup log uses
fixed texts and BootUI's levels, and never a configured value.

  • src/sharpit/engine/activation.py: ActivationStatus.inactivity (auto, off, disabled-profile, invalid, or
    None when enabled), set by decide, not part of to_dto() (the overview contract is unchanged);
    inactivity_message() returns the level and fixed text, ported from BootUI 2.6.0
    BootUiShellGuardAutoConfiguration.bootUiInactiveStartupDiagnostic:
    • AUTO, INFO: sharpit is inactive in AUTO mode: no enabled profile is active and no reloading development server was detected. For local development, activate a SHARPIT_ENABLED_PROFILES profile or set SHARPIT_ENABLED=ON.
    • OFF, DEBUG: sharpit is inactive: SHARPIT_ENABLED=OFF.
    • disabled profile, DEBUG: sharpit is inactive: an active profile matches SHARPIT_DISABLED_PROFILES.
    • invalid SHARPIT_ENABLED, WARNING: sharpit is inactive: invalid SHARPIT_ENABLED configuration (fail-closed). Use AUTO, ON, or OFF.
  • src/sharpit/fastapi/install.py: the inactive branch logs that text instead of sharpit inactive: <reason> (the
    reason can name a profile or echo a raw invalid value). Settings warnings are logged only while sharpit is active;
    while inactive, one WARNING gives their number, leaving out the invalid SHARPIT_ENABLED warning that the fixed text
    already reports. The repeated-install warning no longer quotes the earlier install's reason. The WARNING
    escalation for "requested but inactive" is removed: the levels are BootUI's.
  • docs/reference/matrix-updates/0.11.0-activation.tsv: two adapted rows (the renamed texts; the warning count).

Behaviour change for users: an explicit OFF or a disabled profile now logs at DEBUG (previously INFO or WARNING), as
BootUI does.

Red evidence

All new tests were run against a commit with the tests and stub interfaces only (inactivity field and
inactivity_message returning None), so each red is an assertion, not an import error.

Defect Test Red
the inactive log echoes an invalid SHARPIT_ENABLED value tests/fastapi/test_install.py::test_inactivity_log_carries_no_invalid_enabled_value RED (assertion under tests/)
the inactive log names the disabled profile tests/fastapi/test_install.py::test_inactivity_log_carries_no_profile_name RED (assertion under tests/)
a crafted value can forge a log line tests/fastapi/test_install.py::test_invalid_enabled_value_cannot_forge_a_log_line RED (assertion under tests/)
custom profiles or path echoed in AUTO tests/fastapi/test_install.py::test_auto_inactivity_does_not_echo_custom_profiles_or_path RED (assertion under tests/)
OFF logs above DEBUG tests/fastapi/test_install.py::test_explicit_off_only_logs_at_debug RED (assertion under tests/)
a disabled profile logs above DEBUG tests/fastapi/test_install.py::test_disabled_profile_only_logs_at_debug RED (assertion under tests/)
other settings warnings printed while inactive tests/fastapi/test_install.py::test_inactive_install_logs_warning_count_not_values RED (assertion under tests/)
the repeated-install warning quotes a configured value tests/fastapi/test_install.py::test_repeated_install_log_carries_no_configured_value RED (assertion under tests/)
fixed text missing tests/fastapi/test_install.py::test_inactive_logs_a_fixed_text RED (assertion under tests/)
no inactivity category per branch tests/engine/test_activation.py::test_inactivity_category_per_branch RED (assertion under tests/)
no level and text per category tests/engine/test_activation.py::test_inactivity_message_levels_and_texts RED (assertion under tests/)

Review findings

Finding Test Red before the fix
an invalid SHARPIT_ENABLED logged two WARNINGs (the fixed text and a count of 1 for the same cause); BootUI logs one tests/fastapi/test_install.py::test_invalid_enabled_value_cannot_forge_a_log_line (now asserts exactly one record) RED (assertion under tests/)
the count must still cover other invalid settings tests/fastapi/test_install.py::test_invalid_enabled_value_still_counts_other_warnings RED (assertion under tests/)
deliberateDisablementIsSilentAtInfo not ported tests/fastapi/test_install.py::test_deliberate_disablement_is_silent_at_info passes (behaviour already held); a temporary INFO level for OFF turns it red
the AUTO no-echo test lacked an active custom profile same test, now with private-active-profile n/a (strengthened)
a # ported: citation named BootUI's private helper assertSingleDiagnostic, not a test tests/test_ported_citations.py::test_ported_citations_resolve_in_bootui_test_inventory new unresolved citation: BootUiInactiveStartupDiagnosticTests.assertSingleDiagnostic

Other review items: # ported: citations added, the expected texts kept in one test helper, one Inactivity type
alias, and the nothing-configured test clears the whole activation environment.

Follow-up outside this change: settings warnings echo raw invalid values while sharpit is active (tracked separately).

Verification

uv run ruff check, uv run ruff format --check, uv run pyright (0 errors);
uv run pytest -q -n 4 tests/engine/test_activation.py tests/fastapi/test_install.py tests/test_settings.py tests/test_settings_05.py tests/engine/config/test_settings_source.py tests/test_code_shape.py (515 passed).

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Record the two deviations of the inactivity log from BootUI 2.6.0 in a matrix fragment, update the MVP plan text that still described the old log line, extract the inactivity logging of install() into a helper to keep its complexity at the pinned count, and wrap one over-long test assertion.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
An invalid SHARPIT_ENABLED must log exactly one record, the fixed warning, as BootUI does. The count of the remaining configuration warnings stays.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
An invalid SHARPIT_ENABLED is already reported by the fixed inactive warning. Counting its settings warning as well produced a second WARNING record, where BootUI logs one.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
…tests

Port BootUiInactiveStartupDiagnosticTests.deliberateDisablementIsSilentAtInfo, cite the BootUI tests the other inactivity tests port, and keep the expected log texts in one test module. A single Inactivity alias types the inactivity category. The matrix row for the warning count records that it leaves out the invalid SHARPIT_ENABLED warning.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>

This branch has not been deployed

No deployments
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.

1 participant