feat(nickel): emit_host scaffold — ProbedState → Nickel host config text#60
Merged
Conversation
Opens M4 W1 reconcile direction (Plan §7.5): the inverse of load_host. Where load_host shells out to nickel-export and parses TOML into a DeclaredState, emit_host renders a ProbedState as Nickel host-config text intended to land at <config_dir>/hosts/<host>.imported.ncl as the operator's reconcile review starting point. This first chunk emits only the always-present blocks: meta and kernel. Unprobed meta fields (timezone, arch_level, locale, keymap) get conservative placeholders that the operator hand-edits; in follow-up chunks reconcile probes /etc/timezone, /etc/locale.conf, /proc/cpuinfo etc. to populate them automatically. Subsequent chunks add the packages, services, users, and config-file blocks. The pure-function/no-I/O design keeps emit testable without the nickel binary; round-trip via nickel-export will be exercised once the engine method that wraps probe + emit ships. - New `pearlite-nickel::emit` module + `emit_host(probed) -> String`. - Conservative defaults documented in the rustdoc. - Backslash and double-quote escaping for Nickel string literals. - Five unit tests: basic emit, two escape paths, top-level brace shape, meta-before-kernel ordering. - time crate added to dev-dependencies for fixture construction. Tests: 321 passing (+5). Clippy clean. fmt clean. audit clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Opens M4 W1 reconcile direction (Plan §7.5) — the inverse of
load_host. Whereload_hostshells out tonickel exportand parses TOML into aDeclaredState,emit_hostrenders aProbedStateas Nickel host-config text intended to land at<config_dir>/hosts/<host>.imported.nclas the starting point for an operator's reconcile review.This first chunk emits only the always-present blocks:
metaandkernel. Unprobedmetafields (timezone,arch_level,locale,keymap) get conservative placeholders that the operator hand-edits. Subsequent chunks (a) probe/etc/timezone,/etc/locale.conf,/proc/cpuinfoto populate them automatically and (b) add thepackages,services,users, and config-file blocks.The pure-function / no-I/O design keeps
emittestable without thenickelbinary; full round-trip vianickel exportwill be exercised once the engine method that wraps probe + emit ships.pearlite-nickel::emitmodule +emit_host(probed: &ProbedState) -> String.timecrate added to dev-dependencies for fixture construction.Test plan
cargo test --workspace --all-features— 321 passing (+5 new)cargo clippy --workspace --all-targets --all-features -- -D warnings— cleancargo fmt --all -- --check— cleanscripts/ci/check-spdx.sh— cleanpearlite-audit check .— 1 check, 0 violations🤖 Generated with Claude Code