feat: contracts for the Windows depth programme, 4.56.0 (NetOrk/netork#2888–#2899) #145

Merged
christianmanivong merged 20 commits from chore/merge-train-windows-depth into main 2026-12-02 21:25:09 +00:00
Owner

Not to be merged before Christian's go. These are the contract additions of the napalm-windows depth programme (NetOrk/netork#2888–#2899).

Everything is additive. Nothing napalm-linux fills was renamed, retyped or removed.

What each stream adds

  • storage: host_storage.py, with HostStorageMixin, DiskSmartDict and HostVolumeDict.
  • basics:
    • clean_system_identity();
    • an optional UserDict.sid;
    • UserDict and ProcessDict move to os_models.py, re-exported from models.
  • logins: optional sid, administrator and remote_desktop on login accounts; LoginGroupDict and LoginGroupMemberDict; records_since on sessions.
  • exposure:
    • HostFirewallDict.windows, with the Windows firewall shapes in host_firewall_models.py;
    • windows_features.py, with WindowsFeaturesMixin.
  • events:
    • host_events.py, with HostEventsMixin;
    • the log-source kind eventlog, with LogSourceDict.channel;
    • optional result, exit_code, trigger_start and account on ServiceDict.
  • repairs: host_repairs.py, with HostRepairMixin, HostRepairResultDict, tool_outcome() and offered_host_repairs().
  • updates: optional title, advisories, cves and vendor_severity on UpdateDict; title on UpdateHistoryPackageDict.
  • posture: optional Windows posture keys on HardeningDict: secure_boot, tpm, disk_encryption, antimalware, firewall_profiles, vbs.

Checked locally

  • Tests: 2345 passed, 3 skipped.
  • ruff clean; mypy strict clean.

Two runs of tests/test_host_status.py::TestThePackageManagerCommandOnARealShell failed locally on unchanged main too; they depend on the machine.

Release

The version is not bumped. At merge this wants a minor release (4.56.0). napalm-windows' dependency floor rises to it, and the napalm-windows train PR's lowest job cannot pass until then.

Found on the way

#144: NotRequired under from __future__ import annotations is required at runtime. The posture stream avoided it in hardening.py.

**Not to be merged before Christian's go.** These are the contract additions of the napalm-windows depth programme (NetOrk/netork#2888–#2899). **Everything is additive.** Nothing napalm-linux fills was renamed, retyped or removed. ## What each stream adds - **storage:** `host_storage.py`, with `HostStorageMixin`, `DiskSmartDict` and `HostVolumeDict`. - **basics:** - `clean_system_identity()`; - an optional `UserDict.sid`; - `UserDict` and `ProcessDict` move to `os_models.py`, re-exported from `models`. - **logins:** optional `sid`, `administrator` and `remote_desktop` on login accounts; `LoginGroupDict` and `LoginGroupMemberDict`; `records_since` on sessions. - **exposure:** - `HostFirewallDict.windows`, with the Windows firewall shapes in `host_firewall_models.py`; - `windows_features.py`, with `WindowsFeaturesMixin`. - **events:** - `host_events.py`, with `HostEventsMixin`; - the log-source kind `eventlog`, with `LogSourceDict.channel`; - optional `result`, `exit_code`, `trigger_start` and `account` on `ServiceDict`. - **repairs:** `host_repairs.py`, with `HostRepairMixin`, `HostRepairResultDict`, `tool_outcome()` and `offered_host_repairs()`. - **updates:** optional `title`, `advisories`, `cves` and `vendor_severity` on `UpdateDict`; `title` on `UpdateHistoryPackageDict`. - **posture:** optional Windows posture keys on `HardeningDict`: `secure_boot`, `tpm`, `disk_encryption`, `antimalware`, `firewall_profiles`, `vbs`. ## Checked locally - **Tests:** 2345 passed, 3 skipped. - **ruff** clean; **mypy strict** clean. Two runs of `tests/test_host_status.py::TestThePackageManagerCommandOnARealShell` failed locally on unchanged `main` too; they depend on the machine. ## Release **The version is not bumped.** At merge this wants a minor release (4.56.0). napalm-windows' dependency floor rises to it, and the napalm-windows train PR's `lowest` job cannot pass until then. ## Found on the way #144: `NotRequired` under `from __future__ import annotations` is required at runtime. The posture stream avoided it in `hardening.py`.
christianmanivong added 18 commits 2026-12-01 12:29:17 +00:00
HostRepairMixin declares one method per run -- verify_system_files,
repair_system_files, check_component_store, repair_component_store,
update_antimalware_signatures and scan_antimalware -- so the method list is the
guard, and a repair is never offered with its check. Each streams the tool's
lines to log and returns a HostRepairResultDict; tool_outcome builds it from the
lines and the exit code, failing a non-zero code with the tool's last lines.
offered_host_repairs lists the runs a driver defines.
clean_system_identity applies parse_system_identity's placeholder rules to values a
host reads through an interface of its own (Windows' CIM classes,
NetOrk/netork#2888); parse_system_identity now uses it. UserDict gains an optional
sid beside the int uid (NetOrk/netork#2889).
LoginAccountDict may carry sid, administrator and remote_desktop; uid
stays an int and is the RID where a SID is given. LoginAccountsDict may
carry groups (LoginGroupDict, LoginGroupMemberDict, LOGIN_GRANTS): the
groups that grant administering the host or a remote desktop login,
with every member. LoginSessionsDict may carry records_since, the oldest
entry the record still holds. All optional: the Linux reading and every
driver that builds one are unchanged.
UpdateDict takes optional title, advisories, cves and vendor_severity, for a
source that says more of an update than a package name: Windows Update's
title, KBArticleIDs, CveIDs and MsrcSeverity. UpdateHistoryPackageDict takes
an optional title. Additive: every reader that leaves them out conforms.
HostStorageMixin declares get_disks, get_disk_pools and get_volumes in
StorageDriver's shapes, and get_disk_smart, drive health per disk, with
no role: a Windows or Linux host reports its storage and stays a host.

DiskSmartDict names the keys Proxmox's get_disk_smart already fills and
adds the highest temperature and the uncorrected read and write errors.
HostVolumeDict adds a volume's file system and health to
LogicalVolumeDict. A disk that does not say reads temperature -1 and
health "unknown", never a zero or a "healthy" nobody measured.

Additive: nothing changes for StorageDriver or its drivers.
Secure Boot, the TPM, disk encryption per volume, the antimalware product,
the firewall's profiles and virtualization-based security, in terms no OS
owns, so a Windows host's protection fits the reading Linux fills. The new
keys are NotRequired; every key Linux fills stays required and unchanged.
- HostEventsMixin.get_host_events(since=None), declared: the events of a fixed
  set of kinds a host's own log recorded (unexpected shutdowns, system crashes,
  hardware errors, disk errors, programs and services that crashed), with
  HostEventDict, HostEventsDict and host_event().
- LogSourceDict: kind "eventlog" for a Windows event channel, named by the new
  optional channel field (eventlog_source, LOG_SOURCE_KINDS).
- ServiceDict: optional result, exit_code, trigger_start and account; exported.
get_host_firewall gains an optional windows key: a Windows host's
profiles, enabled rules with their filters, and the profile of each
connected interface, beside the netfilter chains rather than in them.
WindowsFeaturesMixin declares get_windows_features: every optional
feature of the host's image and its state.

The netfilter shapes move to host_firewall_models; models re-exports
them.
An application whose worker gives a run less time than the driver's bound
passes limit (seconds), so the run fails with what it printed instead of
being cut off by the worker.
models.py stays within its line baseline; the baseline drops to what is left.
# Conflicts:
#	CHANGELOG.md
# Conflicts:
#	CHANGELOG.md
# Conflicts:
#	CHANGELOG.md
#	napalm_device_types/models.py
# Conflicts:
#	CHANGELOG.md
# Conflicts:
#	CHANGELOG.md
#	napalm_device_types/__init__.py
# Conflicts:
#	CHANGELOG.md
Merge remote-tracking branch 'origin/feature/windows-posture-2893' into chore/merge-train-windows-depth
driver / lint (pull_request) Successful in 17s
driver / standard (pull_request) Failing after 19s
driver / lowest (pull_request) Successful in 48s
driver / types (pull_request) Successful in 1m14s
driver / test (3.12) (pull_request) Successful in 1m33s
driver / build (pull_request) Successful in 28s
driver / test (3.13) (pull_request) Successful in 1m26s
driver / security (pull_request) Successful in 56s
CI / driver (pull_request) Failing after 2m3s
driver / publish (pull_request) Skipped
47ad8c55bf
# Conflicts:
#	CHANGELOG.md
christianmanivong added 1 commit 2026-12-01 22:20:16 +00:00
chore(quality): lower the models.py line baseline after the merged moves
driver / lint (pull_request) Successful in 24s
driver / standard (pull_request) Successful in 27s
driver / lowest (pull_request) Successful in 54s
driver / types (pull_request) Successful in 1m30s
driver / test (3.12) (pull_request) Successful in 1m50s
driver / test (3.13) (pull_request) Successful in 1m39s
driver / build (pull_request) Successful in 33s
driver / security (pull_request) Successful in 1m26s
CI / driver (pull_request) Successful in 2m47s
driver / publish (pull_request) Skipped
a3d957500f
christianmanivong added 1 commit 2026-12-02 21:21:31 +00:00
chore(release): 4.56.0
driver / lint (pull_request) Successful in 14s
driver / standard (pull_request) Successful in 19s
driver / types (pull_request) Successful in 1m1s
driver / lowest (pull_request) Successful in 44s
driver / test (3.12) (pull_request) Successful in 1m20s
driver / test (3.13) (pull_request) Successful in 1m17s
driver / build (pull_request) Successful in 35s
driver / security (pull_request) Successful in 1m22s
CI / driver (pull_request) Successful in 2m25s
driver / publish (pull_request) Skipped
fda74048f3
christianmanivong changed title from WIP: feat: contracts for the Windows depth programme (NetOrk/netork#2888–#2899) to feat: contracts for the Windows depth programme, 4.56.0 (NetOrk/netork#2888–#2899) 2026-12-02 21:25:08 +00:00
christianmanivong merged commit 6eec94830a into main 2026-12-02 21:25:09 +00:00
christianmanivong deleted branch chore/merge-train-windows-depth 2026-12-02 21:25:09 +00:00
Sign in to join this conversation.