mirror of
https://github.com/MacosPorters/betterxen.git
synced 2026-11-27 04:35:27 +00:00
Overhaul repo into clean 6-track hybrid M0 workspace and retire legacy native files
Rebases onto origin/main and retires the paused in-tree native-first workspace, legacy scripts, legacy CI, and native-only docs per ADR 0006 (preserving full history permanently at Git tag native-first-final). Addresses all maintainer review findings on PR #406: - Isolate CrossOver/Wine child process environment in bx-cli (env_clear + minimal allowlist + opt-in --inherit-env, with unit tests) - Replace naive objdump grep in scripts/build-shims.sh with strict PE Export Directory verification (exact names, ordinals, forwarders, 0 extra exports, 0 forbidden MinGW imports across all 16 DLLs / 102 exports) - Restore global * @MacosPorters/maintainers fallback in .github/CODEOWNERS alongside per-track rules - Restore independent-verification, claims/evidence-class, provenance-first, and contributor clean-room protections in AGENTS.md - Unify docs/roadmap.md, CONTRIBUTING.md, README.md, docs/README.md, THIRD_PARTY_NOTICES.md, and CHANGELOG.md around Milestones M0-M6 and ADR 0006 Signed-off-by: ates <ahmetrizaates@hotmail.com>
This commit is contained in:
1 parent
d9333d272f
commit
30e551a161
683 files changed
+3422
-192724
No files matched your search
@@ -1,143 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Parse issue-form bodies into tasks and validate dependencies. Text is data only."""
|
||||
import hashlib
|
||||
import re
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from . import config as cfgmod
|
||||
|
||||
SECTION = re.compile(r"^###\s+(.+?)\s*$", re.M)
|
||||
|
||||
|
||||
def sections(body):
|
||||
body = (body or "").replace("\r\n", "\n")
|
||||
marks = list(SECTION.finditer(body))
|
||||
out = {}
|
||||
for i, m in enumerate(marks):
|
||||
end = marks[i + 1].start() if i + 1 < len(marks) else len(body)
|
||||
text = body[m.end():end].strip()
|
||||
out[m.group(1).strip().lower()] = "" if text == "_No response_" else text
|
||||
return out
|
||||
|
||||
|
||||
def _lines(text):
|
||||
res = []
|
||||
for line in text.splitlines():
|
||||
line = line.strip()
|
||||
if line.startswith("```"):
|
||||
continue # issue forms wrap `render:` fields in a code fence
|
||||
if line.startswith(("- ", "* ")):
|
||||
line = line[2:].strip()
|
||||
line = line.strip("`").strip()
|
||||
if line:
|
||||
res.append(line)
|
||||
return res
|
||||
|
||||
|
||||
def normalise_acceptance(text):
|
||||
lines = [l.strip() for l in (text or "").replace("\r\n", "\n").split("\n")]
|
||||
while lines and lines[0].startswith("```"):
|
||||
lines.pop(0)
|
||||
while lines and lines[-1].startswith("```"):
|
||||
lines.pop()
|
||||
lines = [" ".join(l.split()) for l in lines if l]
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
def acceptance_hash(text):
|
||||
return hashlib.sha256(normalise_acceptance(text).encode("utf-8")).hexdigest()
|
||||
|
||||
|
||||
def label_names(issue):
|
||||
out = []
|
||||
for l in issue.get("labels") or []:
|
||||
out.append(l["name"] if isinstance(l, dict) else str(l))
|
||||
return out
|
||||
|
||||
|
||||
def holder_of(labels):
|
||||
for l in labels:
|
||||
if l.startswith("claimed-by:"):
|
||||
return l[len("claimed-by:"):]
|
||||
return ""
|
||||
|
||||
|
||||
def label_value(labels, prefix):
|
||||
for l in labels:
|
||||
if l.startswith(prefix):
|
||||
return l[len(prefix):]
|
||||
return ""
|
||||
|
||||
|
||||
def parse_task(issue):
|
||||
"""Build a plain dict task from a gh issue dict {number,title,body,state,labels}."""
|
||||
sec = sections(issue.get("body"))
|
||||
labels = label_names(issue)
|
||||
area = sec.get("area", "").strip().lower() or label_value(labels, "area:")
|
||||
prio = sec.get("priority", "").strip().lower() or label_value(labels, "priority:")
|
||||
return {
|
||||
"number": int(issue["number"]),
|
||||
"title": issue.get("title", ""),
|
||||
"state": str(issue.get("state", "OPEN")).upper(),
|
||||
"labels": labels,
|
||||
"area": area if area in cfgmod.AREAS else "",
|
||||
"priority": prio if prio in cfgmod.PRIORITIES else "medium",
|
||||
"files": _lines(sec.get("files", "")),
|
||||
"depends": sorted({int(n) for n in re.findall(r"#(\d+)", sec.get("depends on", ""))}),
|
||||
"acceptance": sec.get("acceptance command", ""),
|
||||
"interface": sec.get("interface", ""),
|
||||
"holder": holder_of(labels),
|
||||
}
|
||||
|
||||
|
||||
def task_state(t):
|
||||
if t["state"] != "OPEN":
|
||||
return "closed"
|
||||
for name in ("invalid", "conflict", "blocked", "claimed", "ready"):
|
||||
if "agent:" + name in t["labels"]:
|
||||
return name
|
||||
return "untracked"
|
||||
|
||||
|
||||
def parse_time(s):
|
||||
return datetime.strptime(s, "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=timezone.utc)
|
||||
|
||||
|
||||
def find_cycles(tasks):
|
||||
"""Cycles among open tasks. tasks: {number: task}. Returns list of number lists."""
|
||||
openset = {n for n, t in tasks.items() if t["state"] == "OPEN"}
|
||||
color, stack, cycles = {}, [], []
|
||||
|
||||
def visit(n):
|
||||
color[n] = 1
|
||||
stack.append(n)
|
||||
for d in tasks[n]["depends"]:
|
||||
if d not in openset:
|
||||
continue
|
||||
if color.get(d) == 1:
|
||||
cycles.append(stack[stack.index(d):] + [d])
|
||||
elif d not in color:
|
||||
visit(d)
|
||||
stack.pop()
|
||||
color[n] = 2
|
||||
|
||||
for n in sorted(openset):
|
||||
if n not in color:
|
||||
visit(n)
|
||||
return cycles
|
||||
|
||||
|
||||
def dep_problems(task, tasks):
|
||||
"""Dependency problems for one task: missing, open and cyclic dependencies."""
|
||||
res = {"missing": [], "open": [], "cycle": []}
|
||||
for d in task["depends"]:
|
||||
dep = tasks.get(d)
|
||||
if dep is None or dep["state"] == "MISSING":
|
||||
res["missing"].append(d)
|
||||
elif dep["state"] == "OPEN":
|
||||
res["open"].append(d)
|
||||
for cyc in find_cycles(tasks):
|
||||
if task["number"] in cyc:
|
||||
res["cycle"] = cyc
|
||||
break
|
||||
return res
|
||||
Reference in new issue
Block a user