IF Commons GitHub

Linux observation: the platform of a machine

0004Active

0004-linux-observe-platform · owner if · domain commons

Requirements

FR-001checkpassing

The library MUST name the families of Linux it tells apart by how packages are managed (debian, rhel, suse, arch) and the architectures (x86_64, aarch64); whether a machine is a server or a workstation is the kind of its asset and is not said here, and MUST give the family of a distribution from the ID of its os-release and, where that is not known, from its ID_LIKE; a distribution of no known family MUST be named and never guessed.

Enforced (check): .github: cd commons/linux-observe && bun run verify — suite/platform.test.ts

Proved by: linux-observe/suite/platform.test.ts

Written in: linux-observe/src/governance/platform.ts

Tests: passed: suite/platform.test.ts each distribution is of its family from its ID, one that derives from another is found by

FR-002checkpassing

The platform MUST be read from the text of os-release (values in single or double quotes) and from the output of uname -m (amd64 and arm64 read as x86_64 and aarch64), giving the family, the ID (the distribution), the VERSION_ID (the release, empty on a rolling release) and the architecture where it is known.

Enforced (check): .github: cd commons/linux-observe && bun run verify — suite/platform.test.ts

Proved by: linux-observe/suite/platform.test.ts

Written in: linux-observe/src/governance/platform.ts, linux-observe/src/logical/platform.ts

Tests: passed: suite/platform.test.ts each distribution is of its family from its ID, one that derives from another is found by

FR-003checkpassing

A platform a model declares MUST be parsed with every reason it is refused, and a distribution declared in a family it is not of MUST be refused; platformDrift MUST say, one sentence each, where the machine differs from the declaration (family, distribution, release where one is declared, architecture).

Enforced (check): .github: cd commons/linux-observe && bun run verify — suite/platform.test.ts

Proved by: linux-observe/suite/platform.test.ts

Written in: linux-observe/src/logical/platform.ts

Tests: passed: suite/platform.test.ts a declaration is refused with every reason, one in a family its distribution is not of is

FR-004checkpassing

observePlatform MUST read the platform through the way of running programs it is given, by cat of /etc/os-release (or /usr/lib/os-release) and uname -m and by no program that changes anything, and MUST give the reason where the machine has no os-release.

Enforced (check): .github: cd commons/linux-observe && bun run verify — suite/platform.test.ts

Proved by: linux-observe/suite/platform.test.ts

Tests: passed: suite/platform.test.ts the platform is read by cat and uname only, from /usr/lib/os-release where /etc has none,

Acceptance scenarios

  1. Given the os-release of Ubuntu, Debian, Rocky, Fedora, openSUSE and Arch, When each is read, Then the family is debian, debian, rhel, rhel, suse and arch, per FR-001 and FR-002.
  2. Given a distribution that derives from Arch and says so in ID_LIKE, When it is read, Then its family is arch, per FR-001.
  3. Given a model that declares Rocky as debian, When it is parsed, Then it is refused, per FR-003.

Out of scope

  • What each family's dialect does with a package, and what the boot of each distribution is: other specifications.

Edge cases

  • An os-release with no ID, or one of a family that is not known: the reason is given, per FR-002.
  • A rolling release with no VERSION_ID: the release is empty and a declaration of an empty release is not compared, per FR-003.

Assumptions

  • The machine has /etc/os-release or /usr/lib/os-release, as every systemd distribution does.

Open questions

  • None.

Key entities

  • Family, Platform.

Success criteria

SC-001success criterion

Every machine that Archon converges has a platform that is read or declared, and a dialect never carries a package by a program of a family the machine is not.

Review & acceptance checklist

  • [x] Every requirement is testable (MUST / MUST NOT), not aspirational
  • [x] No company fact is asserted here
  • [x] Every open item is marked, not silently decided

Cited by

Converge plugin: the commands, Ansible dialect: the families of Linux, Linux observation: observing a machine

Titles, headings, exports, tables, columns and requirements. Esc closes.