Skip to content

Validate storage-root and scan-probe-host settings at boot - #700

Merged
xmap merged 1 commit into
mainfrom
config-boot-validation
Aug 21, 2026
Merged

Validate storage-root and scan-probe-host settings at boot#700
xmap merged 1 commit into
mainfrom
config-boot-validation

Conversation

@xmap

@xmap xmap commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add field validators on posix_checksum_roots and scan_probe_allowed_roots: every entry must be an absolute path and must not normalize to the empty string (catches a relative path or a bare "/" at boot instead of at the first write, where the run_capture_path vault's CHECK constraint would otherwise reject it).
  • Add a field validator rejecting an empty or whitespace-only scan_probe_remote_host, closing a silent-skip path: "" is falsy so the existing paired-setting check (scan_probe_remote_host and not value) never fired, and active_scan_transport's is not None guard then treated "" as a configured remote host, failing the vault's CHECK constraint on the first upsert.

Test plan

  • tests/unit/test_settings.py (57 passed) — new cases: trailing-slash accepted, relative path rejected, bare / rejected for both root settings; empty/whitespace host rejected; pre-existing host/python pairing check still fires
  • Consumer tests unaffected: test_checksum_verifier_wiring.py, test_wire_scan_ingest_pair.py, test_capture_path_locator.py, test_capture_scan_ingestor.py, test_run_witness.py (153 passed)
  • Full unit suite: 13941 passed
  • tests/architecture: 31288 passed
  • ruff, ruff format, pyright, tach all clean

🤖 Generated with Claude Code

posix_checksum_roots and scan_probe_allowed_roots had no field
validators, so a relative path or a bare "/" passed Settings() and
only failed later: "/" normalizes to the empty string
(normalize_storage_root), and the run_capture_path vault's CHECK
constraint forbids an empty root, so the failure landed on the first
write instead of at startup. Both now require every entry to be
absolute and to normalize to a non-empty string; a trailing slash is
still accepted since normalization already handles it.

scan_probe_remote_host="" also passed validation silently: the paired
_validate_scan_probe_remote_python check tests
"if scan_probe_remote_host and not value", which treats "" as falsy
and skips the check, and active_scan_transport's guard is
"if host is not None", so "" was accepted as a configured remote host
with nothing to connect to and failed the vault's CHECK constraint
(host length 1-255) on upsert. Reject empty/whitespace-only host
instead of coercing it to None, so the misconfiguration surfaces at
boot rather than being silently papered over.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  apps/api/src/cora/infrastructure
  config.py
Project Total  

This report was generated by python-coverage-comment-action

@xmap
xmap merged commit dfb44a9 into main Aug 21, 2026
19 checks passed
@xmap
xmap deleted the config-boot-validation branch August 21, 2026 03:54
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