inventoryStore: invert writeability terms to readonly

This commit is contained in:
Johannes Kirschbauer
2025-10-16 12:57:02 +02:00
parent 5eb6b703f0
commit 892cb1baae
3 changed files with 5 additions and 5 deletions

View File

@@ -12,9 +12,9 @@ from clan_lib.persist.path_utils import (
from clan_lib.persist.validate import (
validate_list_uniqueness,
validate_no_static_deletion,
validate_not_readonly,
validate_patch_conflicts,
validate_type_compatibility,
validate_writeability,
)
from clan_lib.persist.write_rules import AttributeMap, PersistenceAttribute
@@ -131,7 +131,7 @@ Please report this issue at https://git.clan.lol/clan/clan-core/issues
continue
# Validate the change is allowed
validate_writeability(path, attribute_props)
validate_not_readonly(path, attribute_props)
validate_type_compatibility(path, old_value, new_value)
validate_list_uniqueness(path, new_value)

View File

@@ -69,7 +69,7 @@ def test_update_add_empty_dict() -> None:
data_disk: dict = {}
writeables = compute_attribute_persistence(prios, data_eval, data_disk)
attribute_props = compute_attribute_persistence(prios, data_eval, data_disk)
update = deepcopy(data_eval)
@@ -79,7 +79,7 @@ def test_update_add_empty_dict() -> None:
data_disk,
update,
all_values=data_eval,
attribute_props=writeables,
attribute_props=attribute_props,
)
assert patchset == {("foo", "mimi"): {}} # this is what gets persisted

View File

@@ -20,7 +20,7 @@ def validate_no_static_deletion(
raise ClanError(msg)
def validate_writeability(path: PathTuple, writeables: AttributeMap) -> None:
def validate_not_readonly(path: PathTuple, writeables: AttributeMap) -> None:
"""Validate that a path is writeable."""
if not is_writeable_path(path, writeables):
msg = f"Path '{path_to_string(path)}' is readonly. - It seems its value is statically defined in nix."