Anchor each level of L, E and I with shipped items, and have score-outcomes list them for a scorer to compare against
This commit is contained in:
@@ -23,12 +23,17 @@ its table also had A, G and Goals. The chunk measures:
|
||||
|
||||
A project that merges without merge commits, by fast-forward or squash, has no chunk to measure.
|
||||
|
||||
Given L, E and I, on the levels ~/.claude/rules/todo-items.md anchors, and S, it works out R from
|
||||
Given L, E and I, on the levels ~/.claude/rules/todo-items.md defines, and S, it works out R from
|
||||
L, E and I, as rank_todo.py does, and lists the 5 finished items whose guesses sit closest, closest
|
||||
first: the least mean squared difference over the scores both hold, so R and S alone for an item
|
||||
scored before L, E and I, the newest first among equals. Each line gives what the item's chunk
|
||||
measured, which items shipped with it, and its tagline.
|
||||
|
||||
Then the project's anchors, the shipped items its docs/score-anchors.md names for each level of L,
|
||||
E and I, read from the checkout's working tree, each line as above, or that no merge shipped it. Exit 1
|
||||
on a row that names no level on its scale, a level named twice, or an Items cell that is not a list
|
||||
of IDs.
|
||||
|
||||
Then the median of the outcome R and S each predict at each value they were guessed at: R against
|
||||
🔴 findings, S against lines changed. And how well L, E and I each order chunks by review rounds
|
||||
past each pass's first and by 🔴 findings: Spearman's rank correlation, from -1 to +1, where +1
|
||||
@@ -39,10 +44,12 @@ hold it and its outcomes.
|
||||
Exit 1, saying why, on bad arguments, when git cannot start, finds no checkout or reads a shallow
|
||||
clone, or the default branch cannot be read.
|
||||
"""
|
||||
import pathlib
|
||||
import re
|
||||
import sys
|
||||
|
||||
from git_repo import default_branch, file_at, full_history, git
|
||||
from score_outcomes.anchors import anchor_lines, ANCHORS, anchors
|
||||
from git_repo import default_branch, file_at, full_history, git, top
|
||||
from failure import Failure
|
||||
from todo_table import LEVELS, risk, TOP_SCORE
|
||||
from markdown_text import listed
|
||||
@@ -70,12 +77,18 @@ def main(argv: list[str]) -> int:
|
||||
outcomes = read_outcomes(default)
|
||||
if isinstance(outcomes, Failure):
|
||||
return failed(outcomes)
|
||||
anchored = read_anchors()
|
||||
if isinstance(anchored, Failure):
|
||||
return failed(anchored)
|
||||
if argv:
|
||||
given = dict(zip(GIVEN, map(int, argv)))
|
||||
given["R"] = risk(given["L"], given["E"], given["I"])
|
||||
print(f"Finished items nearest L {given['L']}, E {given['E']}, I {given['I']}, so R {given['R']}, and S {given['S']}, closest first:\n")
|
||||
print("\n".join(render(outcome) for outcome in nearest(outcomes, given)) or "- None: no merge commit on the default branch shipped an item from todo.md. A project that merges by squash or fast-forward has none.")
|
||||
print()
|
||||
print(f"Anchors in {ANCHORS}, each level's shipped items:\n")
|
||||
print("\n".join(anchor_lines(anchored, outcomes)) or f"- None: the project's {ANCHORS} names no level; ~/.claude/rules/todo-items.md says how to choose them.")
|
||||
print()
|
||||
print("Median outcome at each guessed score, among chunks that shipped one item:\n")
|
||||
print("\n".join(report(outcomes)))
|
||||
return 0
|
||||
@@ -86,6 +99,19 @@ def failed(failure: Failure) -> int:
|
||||
return 1
|
||||
|
||||
|
||||
def read_anchors() -> list[tuple[str, tuple[int, ...]]] | Failure:
|
||||
"""The checkout's anchors as its working tree holds them, so a branch that edits them shows its edit; none where it has no such file."""
|
||||
root = top()
|
||||
if isinstance(root, Failure):
|
||||
return root
|
||||
try:
|
||||
return anchors((pathlib.Path(root) / ANCHORS).read_text())
|
||||
except FileNotFoundError:
|
||||
return []
|
||||
except (OSError, UnicodeDecodeError) as failure:
|
||||
return Failure(f"cannot read {ANCHORS}: {failure}")
|
||||
|
||||
|
||||
def read_outcomes(default: str) -> list[Outcome] | Failure:
|
||||
if partial := full_history():
|
||||
return partial
|
||||
|
||||
Reference in New Issue
Block a user