Answer stability round 1: 1 🔴, 1 🟡; restore the import order, and decide ships-alone from L, E and I so an unranked row counts
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
"""The lines the preflight prints, stated from what it gathered."""
|
"""The lines the preflight prints, stated from what it gathered."""
|
||||||
from todo_table import BUNDLE_MAX_R, bundle_candidates, Item, ships_alone, version
|
from todo_table import bundle_candidates, BUNDLE_MAX_R, Item, ships_alone, version
|
||||||
from failure import Failure
|
from failure import Failure
|
||||||
from chunk_preflight.gathered import Forge, Gathered, ItemFacts, NamedPath, NoItem, Plan, Ran
|
from chunk_preflight.gathered import Forge, Gathered, ItemFacts, NamedPath, NoItem, Plan, Ran
|
||||||
from chunk_pick import LastCut, unreleased_entries
|
from chunk_pick import LastCut, unreleased_entries
|
||||||
|
|||||||
@@ -483,6 +483,9 @@ class Blockers(unittest.TestCase):
|
|||||||
# At R 6, item 3 ships alone too.
|
# At R 6, item 3 ships alone too.
|
||||||
riskier = todo_table.items(TODO.replace("| 2 | 1 | 2 | 3 | 7 |", "| 3 | 2 | 3 | 6 | 7 |"))
|
riskier = todo_table.items(TODO.replace("| 2 | 1 | 2 | 3 | 7 |", "| 3 | 2 | 3 | 6 | 7 |"))
|
||||||
self.assertNotIn(3, [item.id for item in todo_table.bundle_candidates(riskier, todo_table.next_item(riskier))])
|
self.assertNotIn(3, [item.id for item in todo_table.bundle_candidates(riskier, todo_table.next_item(riskier))])
|
||||||
|
# Before rank_todo.py fills its R cell, item 3's L 3, E 2 and I 3 still make R 6.
|
||||||
|
unranked = todo_table.items(TODO.replace("| 2 | 1 | 2 | 3 | 7 |", "| 3 | 2 | 3 | | 7 |"))
|
||||||
|
self.assertNotIn(3, [item.id for item in todo_table.bundle_candidates(unranked, todo_table.next_item(unranked))])
|
||||||
|
|
||||||
def test_drops_a_blocker_the_table_no_longer_holds_as_finished(self):
|
def test_drops_a_blocker_the_table_no_longer_holds_as_finished(self):
|
||||||
finished = TODO.replace("| 4 | 0.1.0 | | security | **Rotate the leaked key.** | 3 | 3 | 5 | 9 | 2 | 2.1 by 1 | 0 |\n", "").replace("| 2 | 0.1.0 | |", "| 2 | 0.1.0 | 4 |")
|
finished = TODO.replace("| 4 | 0.1.0 | | security | **Rotate the leaked key.** | 3 | 3 | 5 | 9 | 2 | 2.1 by 1 | 0 |\n", "").replace("| 2 | 0.1.0 | |", "| 2 | 0.1.0 | 4 |")
|
||||||
|
|||||||
+3
-2
@@ -203,8 +203,9 @@ def renames(todo: str) -> set[tuple[int, int, int]] | Failure:
|
|||||||
|
|
||||||
|
|
||||||
def ships_alone(item: Item) -> bool:
|
def ships_alone(item: Item) -> bool:
|
||||||
"""An item above BUNDLE_MAX_R joins no chunk, and none joins it."""
|
"""An item above BUNDLE_MAX_R joins no chunk, and none joins it. R comes from L, E and I, so an R cell rank_todo.py has yet to fill counts too; a table without them, in the old shape, ships nothing alone."""
|
||||||
return item.scores.get("R", 0) > BUNDLE_MAX_R
|
scores = item.scores
|
||||||
|
return all(level in scores for level in ("L", "E", "I")) and risk(scores["L"], scores["E"], scores["I"]) > BUNDLE_MAX_R
|
||||||
|
|
||||||
|
|
||||||
def bundle_candidates(found: list[Item], first: Item) -> list[Item]:
|
def bundle_candidates(found: list[Item], first: Item) -> list[Item]:
|
||||||
|
|||||||
Reference in New Issue
Block a user