rfc/spec/layer-yaml-freeze.md

11 KiB

Layer YAML v1 schema freeze review

Status: Frozen by explicit user approval, 2026-11-04. Implements RFC-0008/D-066. The normative structural schema is ../schemas/layer-v1.schema.json; semantic requirements below remain mandatory even where JSON Schema cannot express them.

Agreed: envelope and package requirements

The user explicitly approved this block on 2026-11-04:

  • One kind: Layer, apiVersion: archipelago/v1 for Core and Purpose.
  • Required metadata.name (stable logical ID), metadata.version (SemVer), spec.type and one spec.architecture per manifest.
  • spec.type is core or purpose for this review; the accepted overlay type remains part of RFC-0008 and is not removed by this scoped agreement.
  • Purpose requires spec.purpose: {role, variant}; Core forbids it. Roles: desktop, server, iot; variants include gnome and kde.
  • compatibility.core constrains permitted Core logical IDs; omission imposes no additional Core-ID restriction.
  • packages.runtime and packages.build contain requirement objects with name and optional constraint: one native libalpm comparison. Purpose declares its own requirements; shared dependencies do not create duplicate payload ownership.
  • Groups are expanded to explicit package names before use as manifest requirements. Exact versions, providers, checksums and dependency closures belong in LayerLock.
  • Snapshot selection occurs during resolve; mirror URLs and lower-layer commits are not fields in this manifest block.
  • Reject unknown fields, duplicate keys, anchors/aliases and implicit type coercion.

Illustrative package lists do not approve complete Core/KDE/GNOME package sets.

Agreed: runtime declarations

The user explicitly approved this block on 2026-11-04:

  • runtime.sysusers, tmpfiles and presets are optional lists of packaged absolute /usr paths, defaulting to empty. Native systemd mechanisms run in the target lifecycle; preserve existing identities and persistent data. Secrets and machine account databases do not belong in manifests.
  • runtime.units is an optional list of {name, activation}. enable requests initial enablement, socket requests initial enablement of the named .socket, and manual requests no automatic enablement. These are initial defaults; administrator enablement survives updates. Conflicting presets/unit declarations are validation errors.
  • No separate display_manager field. Purpose declares the DM unit; its activation adapter handles display-manager.service. DM changes require an explicit plan accounting for the administrator's existing selection.
  • Optional runtime.provisioner names a versioned adapter. Core supplies terminal firstboot on tty1/ttyS0. A Purpose declaration replaces Core's provisioner; omission inherits Core's. Onboarding finishes before subsequent normal deployments and does not restart on updates. Example adapter names do not prove implementation.
  • Optional boot_checks and functional_checks are action-ID lists, defaulting to empty. Boot checks run with timeouts in the installed target's boot lifecycle. Functional checks run only in isolated acceptance environments, not on every user boot. Purpose inherits all Core checks and may add its own.
  • Official validation profiles enforce completeness of mandatory declarations even though these lists are syntactically optional.

Agreed: actions

The user explicitly approved this block on 2026-11-04:

  • Required fields: locally unique id, phase, versioned adapter, positive integer timeout_seconds, explicit network (none or allowed).
  • Phases: build-local, finalize, deploy, runtime. Finalization requires network: none. Exact adapter identities are locked.
  • argv, inputs, outputs, after default to empty lists; required defaults to true. No implicit shell interpolation. Adapters validate resource types, allowed values and sufficient inputs.
  • Phase selects execution context, not an automatic invocation. Workflows or runtime references select invocation points. Functional checks can exercise runtime behavior inside acceptance VMs without becoming boot checks.
  • after references local action IDs. Composed identity is the pair of layer ID and action ID. Cross-layer system ordering belongs to the finalizer adapter DAG, including depmod before mkinitcpio.
  • Cycles, missing references, incompatible phases and undeclared conflicting outputs are errors. Required failures block the operation; boot failures report diagnostics without automatic rollback/reboot. Official validation profiles cannot have essential checks downgraded to optional.
  • Package hooks/scriptlets are inventoried through PackageActionPolicy rather than requiring every action to be manually repeated in the Layer manifest.

Final validation agreement

The user approved the final block and froze Layer v1 on 2026-11-04:

  • One UTF-8 YAML document, no unknown fields, duplicate keys, anchors/aliases, merge keys, custom tags, interpolation or implicit type coercion. Null does not substitute for omission. Optional lists/maps use agreed empty defaults.
  • Action IDs and Purpose variants match [a-z0-9][a-z0-9._-]*, at most 128 characters.
  • Reject duplicate package requirements, action IDs, unit names and normalized file paths. Resolve all action/source/adapter references; unknown adapters are unsupported capabilities, not no-ops.
  • Validate separately: structural schema; resolve/build dependencies, identities, ownership and actions; complete composition conflicts, replacements, effective package DB, kernel/ABI and finalization. Syntax validity is not readiness.
  • Changes to fields or semantics require separate approval and schema versioning. Exact desktop sets and adapter implementations remain separate work.

Agreed: file contributions

The user explicitly approved this block on 2026-11-04:

  • spec.files defaults to an empty list. Each entry has type (file by default, directory or symlink) and required path, mode, owner, group.
  • Files require source and forbid target; symlinks require literal target and forbid source; directories have neither. Directory entries never imply recursive copying: every contributed object is explicit.
  • source is relative to the locked source tree. Parent traversal and escape through symlinks are forbidden.
  • mode is an octal string. Symlink mode is "0777" under Linux semantics; applying it never changes target permissions.
  • Owners/groups are root or declared system identities; numeric resolution is locked and unresolved immutable-payload ownership blocks the build.
  • /etc contributions become /usr/etc vendor defaults with native installed OSTree merge. Persistent-state contributions need explicit adapters; tmpfiles normally creates target directories. /boot and ESP use the boot adapter.
  • Symlinks are objects and are not followed when applying files or overrides. A file declaration does not grant overwrite permission: conflicts require explicit bounded overrides with expected ownership and reason.

Agreed: overrides

The user explicitly approved this block on 2026-11-04:

  • spec.overrides defaults to empty and uses the same format for Purpose and Managed Overlays. Each entry requires operation, a nonempty finite paths list, expected_owner.layer and a nonempty reason. No glob or implicit recursion.
  • Operations: replace-file, replace-symlink, set-metadata, change-type, delete-path. Replacement/type-change paths require matching new files objects. Deletion has no replacement; metadata changes affect only declared fields.
  • expected_owner.package is required for package objects and absent for layer-authored objects. Check ownership against the composition index immediately before the operation; a mismatch is an error.
  • set-metadata requires a nonempty metadata map containing only mode, owner, group. xattrs/ACL/capability editing needs a separate schema extension.
  • Directory deletion enumerates affected children explicitly. Bulk file deletion cannot substitute for package removal. Overrides affect the new image, never delete persistent state and never bypass /etc, boot or ESP contracts.
  • Preserve changes in diff/provenance and effective package records.
  • Optional expected_sha256 maps affected paths to sha256:<64 lowercase hex> digests of ordinary-file bytes. Keys must belong to paths. Reject this check for symlinks and directories until their identity semantics are separately defined.

Agreed: compatibility and package replacements

The user explicitly approved this block on 2026-11-04:

  • compatibility.core is allowed for Purpose/Overlay; purpose for Overlay only; requires/conflicts for Purpose/Overlay; before/after for Overlay only. Reject these fields on other layer types. Lists default to empty; duplicates are forbidden. A nonempty Purpose allowlist requires a matching present Purpose.
  • requires/conflicts reference Overlay IDs. Required overlays must already be present, never auto-added. before/after constrain present overlays; require presence separately through requires. Missing dependencies, conflicts and cycles fail; composition order is never automatically repaired.
  • Core/Purpose versions are not pinned here: CompositionLock records exact commits, while package/ABI compatibility is checked separately. Concrete compatibility.kernel structure remains pending.
  • packages.replacements defaults to empty and is allowed for Purpose/Overlay, forbidden for Core. Each entry requires target, replacement, expected_owner (effective owning layer ID), and reason.
  • Replacement must also be an explicit runtime requirement. Target absence or owner mismatch fails. Replace the whole package and validate dependencies, file conflicts and ABI of the complete result. Native pacman replaces does not authorize this operation. Package replacement and file overrides are distinct.

Agreed: kernel binding

The user explicitly approved this block on 2026-11-04:

compatibility:
  kernel:
    package:
      name: linux
      version: "<exact Arch version>"
      architecture: x86_64
      archive_sha256: "sha256:<64 lowercase hex>"
    release: "<exact uname -r>"
    abi:
      adapter: linux-module-abi/v1
      digest: "sha256:<64 lowercase hex>"
  • Optional kernel permits one binding per layer. If present, every shown field is required. Package identity is exact; release identifies /usr/lib/modules/.
  • A versioned adapter defines ABI inputs and computes the digest; its exact code identity is locked. Validate all declared values against pinned artifacts. Package/architecture/release/ABI mismatch blocks composition.
  • Absence means no declared kernel-bound payload, not compatibility with every kernel. Detected modules without binding are errors. Ordinary Purpose layers need no binding. Core supplying the kernel is not a dependency on a lower kernel.
  • DKMS sources are distinct from prebuilt modules: finalization binds their build to the selected kernel and validates the resulting modules.
  • The ABI-reference structure is agreed; the concrete linux-module-abi/v1 algorithm still requires specification and validation before use. The example adapter name does not establish implementation.