test(grpc-data-rig): #1115 scale profile (seed --scale N) and the #1026 scale gate

- device: read-only scale block (holding registers 1000..5095) + scale_set control action
- seed: GRPC_DATA_SCALE=N adds SOURCE driver modscale/dev with N UInt16 tags in TagGroups
  small (first 160) / large (rest), one RawTagGroup export + CONSUMER mapping each
  (map-scale-small|large); fixture.json records the counts
- rig.py: seed --scale N; deploy trigger gets a 60 s socket timeout (the AdminUI's
  StartDeployment ask waits up to 45 s; a 2048-tag snapshot read took ~25 s, so the
  general 15 s cap aborted the POST)
- scale_gate.py: opens a >128 and a >1024-item mapping via Client CLI recursive
  subscribes on CONSUMER, requires all Good, churns the block, restarts the SOURCE pair,
  requires all Good with a post-restart value, checks the consumer ResetHistory counter
  and the container logs for 'history expired'; PASS/FAIL + evidence/S1026-results.json

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Joseph Doherty
2026-12-05 03:34:02 -05:00
parent 961ca2897c
commit 8ddae2f43d
7 changed files with 570 additions and 9 deletions
@@ -680,3 +680,37 @@ class PinnedSourceRevisionTests(unittest.TestCase):
instance.compose.side_effect = stamp
with patch.object(rig, "pinned_tree_hash", return_value="edited-export"), self.assertRaises(rig.RigError):
instance.verify_candidate()
class ScaleSeedTests(unittest.TestCase):
"""#1115: `seed --scale N` reaches only the seeder, bounded by the device fixture's scale block."""
def instance(self):
instance = object.__new__(rig.LocalRig)
instance.load = Mock(return_value={})
instance.compose = Mock(side_effect=StopIteration("seeder invoked"))
return instance
def test_out_of_range_or_non_integer_scale_is_refused_before_the_seeder_runs(self):
for scale in (0, -1, rig.SCALE_MAX_TAGS + 1, 2.5, "2048", True):
instance = self.instance()
with self.subTest(scale=scale), self.assertRaisesRegex(rig.RigError, "--scale"):
instance.seed(scale=scale)
instance.compose.assert_not_called()
def test_scale_is_passed_to_the_seeder_as_its_environment(self):
instance = self.instance()
with self.assertRaises(StopIteration):
instance.seed(scale=2048)
arguments = instance.compose.call_args.args
self.assertEqual(arguments[:7], ("run", "--rm", "--no-deps", "--env", "GRPC_DATA_SCALE=2048", "seeder", "seed"))
def test_scale_flag_is_seed_only(self):
with patch.object(rig, "LocalRig") as local, patch("sys.stderr"):
self.assertEqual(rig.main(["up", "--run-id", RUN, "--scale", "10"]), 2)
local.return_value.up.assert_not_called()
def test_device_scale_block_covers_the_seed_bound(self):
sys.path.insert(0, str(Path(rig.__file__).resolve().parent / "device"))
import server
self.assertEqual(server.SCALE_COUNT, rig.SCALE_MAX_TAGS)