next_functions: skip functions already in an open review item (by scope, or the addresses its title names), so agents are not offered work they or others have already done

This commit is contained in:
KeelrLeek committed 2026-10-07 08:47:21 -05:00
1 parent 9b6ea3bc57
commit 3d9ac4ca9a
1 file changed
+19 -2
+19 -2
View File
@@ -17,7 +17,7 @@ import re
from pathlib import Path from pathlib import Path
from .reverse import Reverse from .reverse import Reverse
from .util import HarborError from .util import HarborError, parse_scope
DEFER_REASONS = ("register-args", "needs-type", "callee-unnamed", "inline", "x87", "layout", "too-large", DEFER_REASONS = ("register-args", "needs-type", "callee-unnamed", "inline", "x87", "layout", "too-large",
"engine-template", "data-not-code", "other") "engine-template", "data-not-code", "other")
@@ -91,6 +91,23 @@ class FunctionQueue:
"SELECT lo, hi FROM claims WHERE kind IN ('draft','edit','naming') AND agent<>? AND released_at IS NULL", "SELECT lo, hi FROM claims WHERE kind IN ('draft','edit','naming') AND agent<>? AND released_at IS NULL",
(agent,)) if row["lo"] is not None] (agent,)) if row["lo"] is not None]
def in_review(self):
"""(lo, hi) of every item not yet landed or closed, from any author: work already done on a branch"""
out = []
for row in self.h.conn.execute("SELECT scope, title FROM items WHERE state IN "
"('submitted','in_review','approved','changes_requested','held')"):
lo = None
if row["scope"]:
try:
_, lo, hi = parse_scope(row["scope"])
except HarborError:
lo = None
if lo is not None:
out.append((lo, hi))
else: # no scope given: the addresses its title names
out += [(int(a, 16), int(a, 16)) for a in re.findall(r"\b0x([0-9A-Fa-f]{6})\b", row["title"] or "")]
return out
def _named(self): def _named(self):
names = self.r._csv("names.csv") names = self.r._csv("names.csv")
return {a for a, row in names.items() if len(row) > 1 and row[1] and not re.match(r"(FUN|sub|thunk)_", row[1])} return {a for a, row in names.items() if len(row) > 1 and row[1] and not re.match(r"(FUN|sub|thunk)_", row[1])}
@@ -168,7 +185,7 @@ class FunctionQueue:
bands = self.bands(agent) bands = self.bands(agent)
if not bands: if not bands:
raise HarborError(f"{agent} has no band; ask the coordinator for one") raise HarborError(f"{agent} has no band; ask the coordinator for one")
taken = self.claimed_by_others(agent) taken = self.claimed_by_others(agent) + self.in_review() # claimed elsewhere, or already in an item
statuses, deferred, rejected = self.statuses(), self.deferrals(), self.rejections() statuses, deferred, rejected = self.statuses(), self.deferrals(), self.rejections()
facts, named = self.r._facts(), self._named() facts, named = self.r._facts(), self._named()
library = self._results("library_results") library = self._results("library_results")