Apply lilleman's answers: maintain-restoring items are defects ranked after security, the most specific goal only, the reshape as the only work, bar 0.1
This commit is contained in:
+9
-5
@@ -5,7 +5,7 @@ usage: rank_todo.py [--check] [todo.md]
|
||||
|
||||
Reads todo.md (default: ./todo.md), the README.md beside it, and docs/decisions.md when there is
|
||||
one. Rewrites each item's Score from the formula and sorts the items by release; within a release,
|
||||
security rows come first, then the rest by score from highest, then by ID. Then it moves each blocker,
|
||||
security rows come first, then defect rows, then the rest, each group by score from highest, then by ID. Then it moves each blocker,
|
||||
an item another's Blocked by cell names, that ranks below an item it blocks to just above the first
|
||||
such item. Orders the details to match. Adds the Blocked by column to a table
|
||||
without it. --check writes nothing and fails when the file is not ranked as it would be.
|
||||
@@ -44,7 +44,9 @@ A valid todo.md; ## Details and each item's detail are optional:
|
||||
- An item's R, S and C are whole numbers from 1 to 10. C, how hard the change is to get right, stays
|
||||
out of the formula.
|
||||
- An item's Moves cell is empty, or names each achieve goal it moves and how far, a whole number
|
||||
from 1 to 10, such as `1.1 by 8, 1.2 by 5`. An item that moves no achieve goal scores V 0.
|
||||
from 1 to 10, such as `1.1 by 8, 1.2 by 5`: the most specific goal, and a parent only for a move
|
||||
none of its sub-goals covers, so never a goal beside its own sub-goal. An item that moves no
|
||||
achieve goal scores V 0.
|
||||
- An item's Exempt cell is empty, or names why the bar does not apply: decision, defect, owner,
|
||||
principle, question or security. An item docs/decisions.md cites as "`todo.md` item N" must be
|
||||
exempt, and a row marked decision must be cited there.
|
||||
@@ -81,9 +83,11 @@ LARGEST_FORMULA = 200
|
||||
LONGEST_FORMULA = 4 * LARGEST_FORMULA
|
||||
OPERATORS = (ast.Add, ast.BinOp, ast.Div, ast.Expression, ast.Load, ast.Mult, ast.Pow, ast.Sub, ast.UAdd, ast.UnaryOp, ast.USub)
|
||||
WEIGHTS_HEADER = "| Goal | W |"
|
||||
# The Exempt reasons that rank an item ahead of the rest of its release, in order: a security finding, then a defect, which a 🔴 or a broken maintain goal is.
|
||||
FIRST = {"security": 0, "defect": 1}
|
||||
# How README.md marks a goal; None where it marks it neither way.
|
||||
Mark = typing.Literal["Maintain", "Achieve"] | None
|
||||
RESHAPE = f"the items table scores A and G against goal weights todo.md states, the shape before {MOVES}; reshaping it to the shape rank_todo.py --help shows, after marking README.md's goals **Maintain:** or **Achieve:** and setting the bar on the new scale under every item to keep, is a chunk of its own"
|
||||
RESHAPE = f"the items table scores A and G against goal weights todo.md states, the shape before {MOVES}. Until it has the shape rank_todo.py --help shows, reshaping it is the project's only work, as ~/.claude/CLAUDE.md → 'Working loop' says: mark README.md's goals **Maintain:** or **Achieve:**, name each item's {MOVES}, and set the bar on the new scale under every item to keep"
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
@@ -233,14 +237,14 @@ def blocked_through(id_: int, items: list[Item]) -> set[int]:
|
||||
|
||||
|
||||
def ordered(items: list[Item], scoring: Scoring) -> list[tuple[Item, float]] | Failure:
|
||||
"""Each item with its score, by release, then security first, then by score from highest, then by ID; then each blocker above every item it blocks."""
|
||||
"""Each item with its score, by release, then security first and defect next, then by score from highest, then by ID; then each blocker above every item it blocks."""
|
||||
by_score = []
|
||||
for item in items:
|
||||
value = score(scoring.formula, item, scoring)
|
||||
if isinstance(value, Failure):
|
||||
return value
|
||||
by_score.append((item, value))
|
||||
by_score.sort(key=lambda pair: (pair[0].release, pair[0].exempt != "security", -pair[1], pair[0].id))
|
||||
by_score.sort(key=lambda pair: (pair[0].release, FIRST.get(pair[0].exempt, len(FIRST)), -pair[1], pair[0].id))
|
||||
return blockers_first(by_score)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user