Item 2: sisi route and delegation honour learned routing adjustments. done 2 / next 3 (failed-check evidence)
This commit is contained in:
1 parent
c8aef3dc23
commit
23a7cc7aec
2 files changed
+45
-2
No files matched your search
@@ -542,6 +542,34 @@ class Mechanisms(Base):
|
||||
self.assertEqual(len(cycle.routing_adjustments(self.proj)), 1)
|
||||
self.assertEqual(cycle.routing_adjustments(self.other_project()), [])
|
||||
|
||||
def test_a_promoted_routing_adjustment_changes_sisi_route_for_its_project_only(self):
|
||||
"""R-11.1-7, R-7.1-1: the reader of routing-adjustments.json is `sisi route`: a cycle's avoid entry
|
||||
moves the choice in its own project, names its learning in --explain, and leaves another project alone."""
|
||||
bindir = os.path.join(self.tmp, "bin")
|
||||
os.makedirs(bindir)
|
||||
tool = os.path.join(bindir, "muse")
|
||||
with open(tool, "w") as f:
|
||||
f.write('#!/bin/sh\nif [ "$1 $2" = "exec --list-models" ]; then echo beta-1; echo beta-2; fi\nexit 0\n')
|
||||
os.chmod(tool, 0o755)
|
||||
env = {"PATH": bindir}
|
||||
for m, price in (("beta-1", "1"), ("beta-2", "2")):
|
||||
r = self.sisi("workers", "fact", "muse/" + m, "--price", price, "--source", "fixture", env=env)
|
||||
self.assertEqual(r.returncode, 0, r.stderr)
|
||||
other = self.other_project()
|
||||
route = ("route", "--kind", "impl", "--difficulty", "2", "--explain")
|
||||
before, before_other = self.sisi(*route, env=env), self.sisi(*route, cwd=other, env=env)
|
||||
self.assertEqual(before.stdout.splitlines()[0], "muse/beta-1", before.stdout)
|
||||
self.assertEqual(before_other.stdout, before.stdout)
|
||||
self.propose()
|
||||
self.assertEqual(self.apply([{"action": "promote", "learning": "L-0001", "mechanism_kind": "routing",
|
||||
"kind": "impl", "avoid": "beta-1"}]).returncode, 0)
|
||||
after, after_other = self.sisi(*route, env=env), self.sisi(*route, cwd=other, env=env)
|
||||
self.assertEqual(after.stdout.splitlines()[0], "muse/beta-2", after.stdout)
|
||||
self.assertIn("learning L-0001", after.stdout)
|
||||
self.assertEqual(after_other.stdout, before_other.stdout)
|
||||
unrelated = self.sisi("route", "--kind", "review", "--difficulty", "2", env=env)
|
||||
self.assertEqual(unrelated.stdout.splitlines()[0], "muse/beta-1")
|
||||
|
||||
def test_earned_scope_widens_what_a_cycle_may_apply(self):
|
||||
"""R-11.6-2: once a learning has earned scope (two units, two projects) its risk adjustment
|
||||
reaches both projects and a rule it motivates needs no approval for reach alone."""
|
||||
|
||||
Reference in new issue
Block a user