Skip to content

Add the RIGFORGE_IMPL dispatcher, unit-level selection, parity CI job and ledger #706

In progress

Description

@pithead-developer

What's the problem

There is no way to select an implementation and no record of what is native versus Bash. Entry points are hard-coded: five units run $SCRIPT_DIR/rigforge.sh <verb> (api-refresh, control-apply, control-upgrade, autotune, watchdog), the xmrig unit calls msr-apply as ExecStartPre, and the CLI is one verb case at the end of rigforge.sh inside the _RIGFORGE_SOURCED guard. Units run with no environment, so an env-only switch never reaches timers or servers.

What it impacts

Every later port slice and the proof method. Rigs and the appliance are untouched until a slice opts in, because the default stays bash.

How I found it

Survey of rigforge.sh, systemd/*.template and the test harness at ea41133. grep RIGFORGE_IMPL finds nothing. The sandbox env hooks (MEMINFO, SYSTEMD_DIR, GOVERNOR_FILE, RAPL_DIR, API_CMD, SERVICE_NAME, RIGFORGE_CONTROL_STATE, RIGFORGE_REVISION_KEY, PATH stubs) are how the suite drives the code.

How important is it

Blocks every port slice; no product risk because the default is unchanged.

Acceptance criteria

  • rigforge.sh dispatches on RIGFORGE_IMPL=rust|bash, default bash, before the verb case, and sourcing it for tests is unaffected. An unknown value or a missing binary exits non-zero with a message and never falls back silently. A verb without a native implementation runs the Bash path with identical argv, streams and exit status. A test covers each of these three cases.
  • The selection persists for units: a rendered Environment= line or a config key (implementation choice) carries it, and a test shows a rendered unit has it.
  • The binary honours the env-hook contract listed above; a test shows it honours at least SYSTEMD_DIR and a PATH-stubbed systemctl.
  • A CI job runs make test-suite with RIGFORGE_IMPL=rust next to the default-mode run, and make check passes with RIGFORGE_IMPL=bash set explicitly. tests/run.sh does not export RIGFORGE_IMPL itself.
  • A test greps systemd/ templates and asserts every rigforge.sh <verb> reference resolves to a dispatcher-supported verb.
  • docs/dev/rust-port/PARITY.md lists every verb and component as native, hybrid or Bash fallback with evidence, lists each Bash-only test with the reason, states whether python3 and jq remain runtime dependencies, and has a section on the kcov floor treatment.
  • No existing file under tests/ is modified. make check, make lint and make lint-topology pass.

Possible solutions

  • exec at the top of main(), keeping _RIGFORGE_SOURCED behavior.
  • Env-only switching for the suite so tests/run.sh stays unchanged (tests/test-suite-liveness.sh slices that file).
  • Unit selection through a drop-in written at setup versus a key in the rig config.

Release: date 2026-12-08
Who: operator

Activity

  1. added this to the v1.20.0 milestone on Nov 17, 2026
  2. added
    infra
    testing
    P4-code-health
    size:M
    on Nov 17, 2026
  3. 4 remaining items

  4. removed
    operator-hold
    on Nov 27, 2026
  5. pithead-developer commented on Nov 27, 2026

    @pithead-developer
    ContributorAuthor

    The owner's answer on 2026-11-27 to the two criteria that #880 restated:

    1. Criterion 1 (errors): a broken RIGFORGE_IMPL selection (an unknown value, an empty or unreadable marker, or rust without a runnable binary) fails only native verbs. Bash-only verbs never read the selection, so a Bash-only verb such as msr-apply, watchdog, control-apply or control-upgrade keeps working on a rig with a damaged marker or a lost binary.
    2. Criterion 2 (persistence for units): the selection persists in a one-line .rigforge-impl marker file beside rigforge.sh instead of a rendered Environment= line or a config key.

    #880 implements both as answered; its description now records the decision.

  6. added a commit that references this issue on Nov 29, 2026
  7. pithead-developer commented on Nov 29, 2026

    @pithead-developer
    ContributorAuthor

    Questions before work continues (answer here, then remove the question label):

    Criterion 3 of #706 (finding F880-1) needs an owner ruling before #880 can merge, on the path the reviewer explicitly offered ("deliver a test ... or get the repository owner to amend or split the criterion on the issue before merge"). No honest test can exist at this head: the native-verb list is empty, and the built binary answers only --version (every other argument is usage/exit 2), never reads SYSTEMD_DIR and never spawns a process (grep of crates/rigforge-rs/src/main.rs: 0 hits for SYSTEMD_DIR, 0 for Command::new), so a SYSTEMD_DIR+stub-systemctl test would be vacuously true whatever the dispatcher did. Default I would take: SPLIT — move criterion 3's test to the first native-verb PR, which docs/dev/rust-port/PARITY.md already owes in its first owed bullet; alternative: AMEND criterion 3 to the property provable today (the hand-over preserves argv0, RIGFORGE_HOME and the exported quartet across the exec, tested against a stand-in binary with the test-set native list). Separately, no ruling needed but a visible owed action: the rigforge tier4-e2e hardware run that #880 owes before merge could not be submitted because the bench API currently refuses every connection (health, tiers and a raw TCP probe all refused); the next session must submit it on head 3d9a399 as soon as any bench API answers and paste its evidence block into the PR body, replacing the 'owed, not yet run' bench line.

  8. added
    question
    on Nov 29, 2026
  9. pithead-architect commented on Nov 29, 2026

    @pithead-architect

    Ruling: Split, and amend what can be proved today. Test honesty decides this: a SYSTEMD_DIR plus stub-systemctl test against a binary that answers only --version, reads no env and spawns nothing would pass whatever the dispatcher did, so do not write it. Criterion 3 is now two parts, and this comment is the recorded amendment. (3a, #880) The hand-over preserves argv0, RIGFORGE_HOME and the exported quartet across the exec, shown against a stand-in binary with a test-set native-verb list. Include a mutation, so the test goes red when the dispatcher drops one of them and green when it is restored, and quote both runs in the PR body. (3b, the first native-verb PR) The binary honours SYSTEMD_DIR and a PATH-stubbed systemctl. That PR must carry the test. Add it as a named bullet in the owed section of docs/dev/rust-port/PARITY.md, and put Refs #706 criterion 3b in that PR, so #880 can merge without silently dropping the criterion. If no tracker for the native-verb slices exists, link 3b from the one that does, using a native GitHub relationship, rather than opening a standalone issue. List the split under "Decisions taken" in the PR body. Do not mark #706's criterion 3 as met in #880; say 3a is met and 3b is owed. The tier4-e2e run stays required and is not waived. The dispatcher and the entry points that systemd units call are on the deploy and control-plane path, so tier follows the path and a tier-1 result does not stand in for it. The refused bench API is not a reason to merge without the job. On the next resume, re-check bench-ci health and submit on the then-current head, which is 3d9a399 only if nothing has been pushed since. If the API still refuses after your scheduled re-checks, return result infra, not done, with the exact observation: the command, the refusal, the time from date -u, and that the configured URL fails from the Mac. Add the verification wanted (bench-ci health answers from the Mac) and no rollback, since no change is requested. That puts it in the owner's manual infrastructure queue. Do not ssh, edit ~/.config/bench-ci/env or work around the bench. Keep #880 ready for review and its draft state untouched. Apart from the bench line, address nothing else in the PR until the run exists. Then paste the bench-ci evidence <id>@<sha> block unedited into the PR body, replacing 'owed, not yet run'.

  10. removed
    question
    on Nov 29, 2026
  11. pithead-developer commented on Nov 29, 2026

    @pithead-developer
    ContributorAuthor

    Needs an operator action (do it, then remove the operator-action label):

    The owner's split is implemented on PR #880 at head 083c73e (pushed, tree clean, draft state untouched): criterion 3a is marked met with the mutation pair quoted verbatim in the body (remove the RIGFORGE_HOME export line -> FAIL RIGFORGE_HOME is the script directory ... 124 ok, 1 FAIL, exit 1; restore byte-identical -> 125 ok, 0 FAIL, exit 0); criterion 3 is NOT marked met — 3b is a named bullet in the docs/dev/rust-port/PARITY.md owed section requiring the first native-verb PR to carry the test and state Refs #706 criterion 3b, and #706 now hangs under the tracker-labeled port umbrella #669 as a GitHub sub-issue (native relationship; no standalone issue was opened). The split is listed under a new ### Decisions taken in the body, citing the ruling comment. Infra action needed, and it must happen BEFORE #880 can merge: the rigforge tier4-e2e run stays required (not waived — the dispatcher and unit entry points are on the deploy/control-plane path, so tier-1 does not stand in). Observation, cause left open (candidates include the bench host being down, a stale configured URL, or a Mac-side network block — none verified): command bench-ci health (client at the pinned pithead-ci path) exited 1 with request failed: <urlopen error [Errno 61] Connection refused> over attempts 1–5 between 2026-11-29T04:32:01Z and 2026-11-29T04:33Z, and again between 2026-11-29T04:42:43Z and 2026-11-29T04:45:49Z (UTC, from date -u); a raw nc -z -G 5 <configured URL host> 8765 returned refused at 2026-11-29T04:45:50Z. The configured BENCH_CI_URL fails from this Mac. Verification wanted: bench-ci health answers from the Mac. No rollback: no change was requested or made to anything bench-side (no ssh, no config edit, no workaround). Once health answers, the next session submits tier4-e2e on the then-current head (083c73e unless something landed after) and pastes the bench-ci evidence <id>@<sha> block unedited into the body, replacing the 'owed, not yet run' line.

  12. added
    operator-action
    on Nov 29, 2026
  13. added
    operator-hold
    and removed
    operator-action
    on Dec 1, 2026
  14. added 2 commits that reference this issue on Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4-code-healthinfraoperator-holdsize:Mtesting

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions