[P0] ZARA-004 — Make Prolog user configuration load into the correct modules and actually override defaults #5

Closed
opened 2026-07-18 19:18:28 +00:00 by lost-rob0t · 0 comments
lost-rob0t commented 2026-07-18 19:18:28 +00:00 (Migrated from github.com)

Problem

modules/config_loader.pl historically made ~/.config/zarathushtra/config.pl the single user Prolog configuration authority. Module qualification/precedence/reload correctness was repaired, but the Home Manager migration exposed a durability regression: when a declarative manager owns config.pl as an immutable Nix-store-backed file/symlink, Zara has no separate mutable/private Prolog layer for runtime/operator edits. A rebuild can therefore replace the effective user configuration even though Zara itself never overwrites an existing file.

Required fix

  • Preserve config.pl as a supported provisioned/base user configuration layer for compatibility.
  • Add a distinct mutable local Prolog configuration layer, stored outside the Nix store and loaded after the provisioned layer so local facts win deterministically.
  • Never rewrite an existing provisioned config.pl; never copy secrets/private mutable state into repository or generated Nix/store content.
  • Define and document ownership: Home Manager/Nix may provision directories/templates/base config, while the mutable local layer remains user-owned.
  • Load each supported override into its intended module; keep validation/fail-closed behavior and explicit server/device scope.
  • Reload atomically without accumulating stale/duplicate clauses from either layer.
  • Reject unknown/unsafe declarations with clear diagnostics.
  • Keep Python TOML and Prolog configuration responsibilities documented; do not merge the systems.

Required tests

  • Existing temporary HOME/XDG coverage for app mapping, direct app, search engine, dictation command, LLM provider/model/endpoint, and custom intent overrides remains green.
  • RED regression: provisioned config.pl can be read-only/symlink-like while a separate mutable local layer overrides it without modifying the provisioned file.
  • Local layer wins over provisioned layer deterministically.
  • Reload removes old local values and does not duplicate provisioned/local facts.
  • Server scope reads only allowed semantic facts from both layers and still rejects device-only facts.
  • Missing local layer is safe and does not get silently populated with private defaults.
  • scripts/test-prolog-config.sh remains the non-interactive authority and is extended for ownership/durability.

Acceptance

  • A declaratively provisioned config.pl can coexist with a user-owned mutable Prolog file.
  • Home Manager rebuilds of the provisioned layer cannot silently erase the separate mutable layer.
  • Local overrides beat provisioned values deterministically.
  • Reload does not duplicate facts.
  • No secrets/private mutable state is generated into Git/Nix-store-owned config.
  • Tests run without modifying the real home directory.

Branch

rage/zara-004-config-durability

Dependencies

ZARA-003.

## Problem `modules/config_loader.pl` historically made `~/.config/zarathushtra/config.pl` the single user Prolog configuration authority. Module qualification/precedence/reload correctness was repaired, but the Home Manager migration exposed a durability regression: when a declarative manager owns `config.pl` as an immutable Nix-store-backed file/symlink, Zara has no separate mutable/private Prolog layer for runtime/operator edits. A rebuild can therefore replace the effective user configuration even though Zara itself never overwrites an existing file. ## Required fix - Preserve `config.pl` as a supported provisioned/base user configuration layer for compatibility. - Add a distinct mutable local Prolog configuration layer, stored outside the Nix store and loaded after the provisioned layer so local facts win deterministically. - Never rewrite an existing provisioned `config.pl`; never copy secrets/private mutable state into repository or generated Nix/store content. - Define and document ownership: Home Manager/Nix may provision directories/templates/base config, while the mutable local layer remains user-owned. - Load each supported override into its intended module; keep validation/fail-closed behavior and explicit server/device scope. - Reload atomically without accumulating stale/duplicate clauses from either layer. - Reject unknown/unsafe declarations with clear diagnostics. - Keep Python TOML and Prolog configuration responsibilities documented; do not merge the systems. ## Required tests - Existing temporary HOME/XDG coverage for app mapping, direct app, search engine, dictation command, LLM provider/model/endpoint, and custom intent overrides remains green. - RED regression: provisioned `config.pl` can be read-only/symlink-like while a separate mutable local layer overrides it without modifying the provisioned file. - Local layer wins over provisioned layer deterministically. - Reload removes old local values and does not duplicate provisioned/local facts. - Server scope reads only allowed semantic facts from both layers and still rejects device-only facts. - Missing local layer is safe and does not get silently populated with private defaults. - `scripts/test-prolog-config.sh` remains the non-interactive authority and is extended for ownership/durability. ## Acceptance - A declaratively provisioned `config.pl` can coexist with a user-owned mutable Prolog file. - Home Manager rebuilds of the provisioned layer cannot silently erase the separate mutable layer. - Local overrides beat provisioned values deterministically. - Reload does not duplicate facts. - No secrets/private mutable state is generated into Git/Nix-store-owned config. - Tests run without modifying the real home directory. ## Branch `rage/zara-004-config-durability` ## Dependencies ZARA-003.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nsaspy/zara#5
No description provided.