Skip to content

Port config validation and the writable allowlist to a Rust library #714

Open

Description

@pithead-developer

What's the problem

Config parsing and validation and the control-writable allowlist live in Bash and lean on jq (about 200 mentions in rigforge.sh): parse_config, _validate_host_port, _validate_pool_url. The Rust servers, the tick and the CLI all need this logic, and jq stays a runtime dependency until it is replaced. Most helpers have no dispatcher verb, so without a hidden subcommand the unchanged oracle cannot reach a Rust port and it would be dead code.

What it impacts

Every later slice, plus rig correctness: validation errors and the allowlist.

How I found it

Function map of rigforge.sh at ea41133 and tests that pin the behavior (tests/test-config-ownership.sh, the allowlist-subset guard in tests/run.sh). Unknown: whether jq-free parsing changes any error text asserted by tests/run.sh.

How important is it

Medium; shared base for the high-value slices.

Acceptance criteria

  • A library exposes config load and validation and the writable allowlist.
  • A hidden helper subcommand is called by the Bash functions when RIGFORGE_IMPL=rust (hybrid, listed in the ledger), so both sourced-function and black-box tests reach the Rust code.
  • With RIGFORGE_IMPL=rust, tests/test-config-ownership.sh and the allowlist guard pass with no edits.
  • Native unit tests cover each validator with accepted and rejected inputs lifted from the Bash tests; error messages that tests assert are byte-identical.
  • The allowlist is generated from or checked against the same source as the tests/run.sh guard so the sets cannot diverge.
  • PARITY.md lists each helper native, hybrid or Bash fallback. make check passes.

Possible solutions

  • Port parse_config and validators one function per PR.
  • JSON via serde_json or a smaller crate; decided by dependency audit.
  • Keep jq for anything not yet ported; the ledger tracks it.

Release: issue rigforge#856 closed
Who: operator

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4-code-healthenhancementoperator-holdrefactorsize:M

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions