Skip to content

Read ORACLE_FLOOR_RATES and PARAM_SCALES from omx-contract (#75) - #86

Merged
linuxnow merged 1 commit into
mainfrom
fix/75-contract-derived
Oct 18, 2026
Merged

linuxnow merged 1 commit into
mainfrom
fix/75-contract-derived

Conversation

@linuxnow

Copy link
Copy Markdown
Contributor

Fixes #75.

  • Probe runner rates. The default --rates used to be typed by hand, in the option default and in the usage text. Both now come from OMX_ORACLE_FLOOR_RATES_INIT. The man page now names the contract list instead of copying its values.
  • Parameter scales. The scales stay in include/plugin-hostd/protocol.h, because the installed header a consumer compiles against must not need omx-contract. tools/protocol-gen.c now holds them to omx-contract's PARAM_SCALES in three ways: a _Static_assert for each id's position, one for the count, and a check at run time that each word is the contract's id in lower case. A drifted generator neither builds nor writes the JSON or the README.
  • Packaging. omx-contract-devel >= 2.16.0 and libomx-contract-dev (>= 2.16.0~) are now build dependencies, floors only. The FreeMixer channel carries both. Nothing is linked. BUILDING.md describes the dependency.

How it is tested: tests/contract_derived.py (make test-contract, part of make test) fails on main. Its checks:

  • the protocol's scales equal the installed contract's data;
  • the runner's child gets ORACLE_FLOOR_RATES when it is given no rates, and the usage text names the same list;
  • a runner built against a scratch header with other rates hands those rates to its child;
  • the generator does not build against a header with the scales swapped;
  • built against a protocol.h with a renamed word, the generator writes nothing.

Each guard has a sabotage arm (a new contract kind in tests/sabotage.py), and all three go red.

Local checks in the Fedora worker image: test-pin, test-format, test-daemon, check-generated, check-schema, test-probe-schema, test-probe, test-contract, test-consumer, test-perturbation, check-readme, check-own-host-page, check-no-pins, test-mod-host-json, and the three sabotage arms.

The probe runner's default rates, "44100,48000,96000,192000", were typed by hand in two places (the option
default and the usage text). They are omx-contract's ORACLE_FLOOR_RATES. The runner now builds both from
OMX_ORACLE_FLOOR_RATES_INIT in <omxcontract/omx_contract_limits.h>, and the man page names the contract
list instead of repeating its values.

The protocol's parameter scales (linear, log, stepped) are omx-contract's PARAM_SCALES, whose data says the
words are for this protocol. They stay in protocol.h, because an installed header a consumer compiles
against must not need omx-contract. protocol-gen, which writes them into the JSON and the README, now refuses
to build when an id is not where the contract's enum has it or when the count differs. It also refuses to run
when a word is not the contract's id in lower case.

omx-contract-devel / libomx-contract-dev >= 2.16.0 is a build dependency (a floor only). Nothing is linked:
the header holds values only.

tests/contract_derived.py (make test-contract, part of make test) checks the scales against the installed
contract's data. It checks the runner's default rates by what its child is given and by its usage text. It
also builds against a copy of the header with other rates (the runner follows) and with the scales swapped
(the generator does not build), and against a protocol.h with a renamed word (the generator writes nothing).
Each of the three guards has a sabotage arm.

Closes #75
@linuxnow

Copy link
Copy Markdown
Contributor Author

Rebased onto main 1ce8398: resolved Makefile and tests/sabotage.py: main added the relay test (test-relay, relay_test, 'relay' jack arm, three SABOTAGE entries, #85's pin entry) where this PR added test-contract (contract_test runner, 'contract' arm, three entries); kept both sides in the test: line, the arm lists, the usage comment, the entries and the runners. No logic chosen.

@linuxnow
linuxnow force-pushed the fix/75-contract-derived branch from 08b68c8 to 2d11975 Compare October 18, 2026 21:27
@linuxnow linuxnow mentioned this pull request Oct 18, 2026
@linuxnow
linuxnow merged commit b39203d into main Oct 18, 2026
26 checks passed
@linuxnow
linuxnow deleted the fix/75-contract-derived branch October 18, 2026 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PARAM_SCALES and ORACLE_FLOOR_RATES typed by hand; the package does not depend on omx-contract

1 participant