From 45568e928c09f1ac13e159c4c9e519f4d2b9f957 Mon Sep 17 00:00:00 2001 From: sknampally Date: Fri, 27 Nov 2026 20:27:33 -0700 Subject: [PATCH 1/3] Plan: Q1-06, types in every module Prepared with AI assistance. --- docs/plan.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/plan.md b/docs/plan.md index d062175..5d0dd1a 100644 --- a/docs/plan.md +++ b/docs/plan.md @@ -210,6 +210,7 @@ The owner's direction (26 November 2026): make Reframe credible to someone readi | Q1-03 | Types in CI | [CONTRIBUTING](../CONTRIBUTING.md) | #452 · Done 26 November 2026 (#455): `mypy` passes in CI. The modules with type errors still to fix are listed in `pyproject.toml`, and the list only shrinks: 25 of 85 modules at the start, after 13 were fixed | | Q1-04 | Tests of the drivers, and a coverage floor | [CONTRIBUTING](../CONTRIBUTING.md) | #453 · Done 26 November 2026 (#455): The Claude assessment's driver, the AWS Transform assessment's driver and the command handlers are tested stage by stage with fakes, and CI fails below 80% line coverage. At the start: 81% overall; the drivers went from 44%, 38% and 46% to 95%, 93% and 71% | | Q1-05 | Split `core/commands.py` | – | #454 · **Next:** unblocked now that v1.0.0 is tagged (27 November 2026). The 900-line module becomes one module per command group, with the Q1-04 tests passing unchanged | +| Q1-06 | Types in every module | [CONTRIBUTING](../CONTRIBUTING.md) | #483 · `mypy` passes in CI with every module checked except `reframe.core.commands`, which comes off the list once Q1-05 has split it. The 24 other modules on the list (108 errors at the start) are fixed without changing what the code does, and the offline tests pass unchanged; any real fault the types turn up is fixed with a test and listed in the PR | ## Release 1.1: any legacy codebase From 72608f500dc1dc078130d2150dbe8fa884256adf Mon Sep 17 00:00:00 2001 From: sknampally Date: Fri, 27 Nov 2026 20:36:35 -0700 Subject: [PATCH 2/3] Q1-06: types in every module mypy now checks every module except reframe.core.commands, which comes off the list once Q1-05 has split it. The 108 errors in the 24 other modules are fixed with annotations, None checks and renamed reused names; what the code does is unchanged. Two real faults the types turned up, each with a test: - preflight accepted an AWS sign-in that named no account, and the graph check then used "None" as the account - the reports store returned no bucket if its Terraform root did not report one, and uploads went to s3://None; it now stops Prepared with AI assistance. --- pyproject.toml | 31 +++------------------------ src/reframe/claude/graph.py | 5 +++-- src/reframe/claude/load.py | 1 + src/reframe/claude/runner.py | 2 +- src/reframe/claude/steps.py | 7 +++++- src/reframe/core/pipeline.py | 1 + src/reframe/core/preflight.py | 2 ++ src/reframe/core/teardown.py | 4 +++- src/reframe/design/flow.py | 30 ++++++++++++++++---------- src/reframe/design/inventory.py | 2 +- src/reframe/design/journeys.py | 5 +++-- src/reframe/design/package.py | 2 +- src/reframe/infrastructure/network.py | 5 +++-- src/reframe/reconcile/audit.py | 10 ++++----- src/reframe/reconcile/decide.py | 5 +++-- src/reframe/reconcile/inputs.py | 5 +++-- src/reframe/reconcile/questions.py | 19 ++++++++-------- src/reframe/reconcile/requirements.py | 21 ++++++++++-------- src/reframe/report/build.py | 14 +++++++----- src/reframe/report/compare.py | 8 +++---- src/reframe/report/store.py | 9 ++++++-- src/reframe/source/s3.py | 6 ++++-- src/reframe/transform/answers.py | 8 +++---- src/reframe/transform/api.py | 14 ++++++------ src/reframe/transform/documents.py | 11 +++++++--- src/reframe/transform/retrieve.py | 4 ++-- tests/core/test_preflight.py | 6 ++++++ tests/report/test_store.py | 9 ++++++++ 28 files changed, 140 insertions(+), 106 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 01d3e7f..8fbfde6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,33 +74,8 @@ ignore_missing_imports = true warn_unused_ignores = true warn_redundant_casts = true -# Modules with type errors still to fix (Q1-03). The list only shrinks: take a module off once it is clean. +# Modules with type errors still to fix (Q1-03, Q1-06). The list only shrinks: take a module off once it is clean. +# `reframe.core.commands` comes off once Q1-05 has split it. [[tool.mypy.overrides]] -module = [ - "reframe.claude.graph", - "reframe.claude.load", - "reframe.claude.runner", - "reframe.claude.steps", - "reframe.core.commands", - "reframe.core.pipeline", - "reframe.core.teardown", - "reframe.design.flow", - "reframe.design.inventory", - "reframe.design.journeys", - "reframe.design.package", - "reframe.infrastructure.network", - "reframe.reconcile.audit", - "reframe.reconcile.decide", - "reframe.reconcile.inputs", - "reframe.reconcile.questions", - "reframe.reconcile.requirements", - "reframe.report.build", - "reframe.report.compare", - "reframe.report.store", - "reframe.source.s3", - "reframe.transform.answers", - "reframe.transform.api", - "reframe.transform.documents", - "reframe.transform.retrieve", -] +module = ["reframe.core.commands"] ignore_errors = true diff --git a/src/reframe/claude/graph.py b/src/reframe/claude/graph.py index eb7c75e..1ff1509 100644 --- a/src/reframe/claude/graph.py +++ b/src/reframe/claude/graph.py @@ -45,12 +45,13 @@ def _literal(value: Any) -> str: class Quads: def __init__(self, run: str) -> None: - self.run, self.graph, self.lines = run, graph_iri(run), [] + self.run, self.graph = run, graph_iri(run) + self.lines: list[str] = [] def iri(self, kind: str, ident: str) -> str: return f"urn:reframe:claude:{self.run}:{kind}:{_local(ident)}" - def add(self, subject: str, predicate: str, obj: str, literal: bool = True) -> None: + def add(self, subject: str, predicate: str, obj: Any, literal: bool = True) -> None: if obj is None or obj == "": return o = _literal(obj) if literal else f"<{obj}>" diff --git a/src/reframe/claude/load.py b/src/reframe/claude/load.py index 4bcd6c9..6d5ee10 100644 --- a/src/reframe/claude/load.py +++ b/src/reframe/claude/load.py @@ -79,6 +79,7 @@ def graph(ctx: Context, model: dict[str, Any], generated: dict[str, Any]) -> dic return update(ctx, graph={"skipped": iso(), "reason": reason, "file": "outputs/claude/graph.nq"})["graph"] digest = hashlib.sha256(path.read_bytes()).hexdigest() fn = loader(ctx, create=True) + assert fn is not None # with create, loader returns the loader or stops outputs = ctx.changes.receipt("terraform-project-apply-graph-loader")["outputs"] bucket, key = outputs["bucket"], KEY.format(run=run) diff --git a/src/reframe/claude/runner.py b/src/reframe/claude/runner.py index 55f115e..c66361d 100644 --- a/src/reframe/claude/runner.py +++ b/src/reframe/claude/runner.py @@ -76,7 +76,7 @@ def summarize(name: str, lines: list[dict[str, Any]], seconds: float, returncode results = [line for line in lines if line.get("type") == "result"] if not results: tail = " ".join(str(line)[:200] for line in lines[-3:]) - problem = "signin" if any(w in tail.casefold() for w in SIGNIN_WORDS) else "limit" if any(w in tail.casefold() for w in LIMIT_WORDS) else "failed" + problem: str | None = "signin" if any(w in tail.casefold() for w in SIGNIN_WORDS) else "limit" if any(w in tail.casefold() for w in LIMIT_WORDS) else "failed" return StepResult(name, False, text=f"no result (exit {returncode}) {tail}", session_id=session, seconds=seconds, problem=problem) # Claude Code can end with an empty "success" result for a background task's notice, after the step's real result # (found on the second test codebase, 26 November 2026: the real one was the usage limit). That notice is not the step's answer. diff --git a/src/reframe/claude/steps.py b/src/reframe/claude/steps.py index 42a66a6..562a251 100644 --- a/src/reframe/claude/steps.py +++ b/src/reframe/claude/steps.py @@ -101,7 +101,12 @@ def run_step(folder: RunFolder, claude: ClaudeCode, analysis: Path, step: str, p folder.event("claude_step", step=step, attempt=attempt, resume=bool(resume), follow_up=follow_up) _save(folder, step, {"ok": False, "attempt": attempt, "started_at": iso(), "session_id": (done or {}).get("session_id"), "follow_ups": (done or {}).get("follow_ups", 0) + (1 if follow_up else 0)}) - text = follow_up_prompt(system) if follow_up else resume_prompt if resume else prompt + if follow_up and system: # follow_up needs system + text = follow_up_prompt(system) + elif resume and resume_prompt: # resume needs resume_prompt + text = resume_prompt + else: + text = prompt result = claude.run(f"{step}-{attempt}", text, timeout=STEP_HOURS.get(step, 2) * 3600, resume=None if follow_up else resume) expected = analysis / EXPECTED[step] if result.ok and not expected.exists(): diff --git a/src/reframe/core/pipeline.py b/src/reframe/core/pipeline.py index 26d8f2c..282821c 100644 --- a/src/reframe/core/pipeline.py +++ b/src/reframe/core/pipeline.py @@ -83,6 +83,7 @@ def prepare(ctx: Context, prompt: Callable[[str], str] | None, say: Callable[[st transform_ready=lambda: client.call("list_resources", {"resource": "workspaces"})) ctx.folder.save("preflight.json", report.as_json()) preflight.require(report) + assert report.account # preflight.require refuses a sign-in that names no account ctx.folder.update(account=report.account, terraform_version=report.terraform) if ctx.state.get("graph") is None: names = ctx.names() diff --git a/src/reframe/core/preflight.py b/src/reframe/core/preflight.py index ac2d3d1..38c6e34 100644 --- a/src/reframe/core/preflight.py +++ b/src/reframe/core/preflight.py @@ -53,6 +53,8 @@ def check(*, aws: Aws, terraform: str, source: str, ref: str | None, transform_r report.problems.append(f"{tool} is not on PATH: {fix}") try: report.account = aws.identity().get("Account") + if not report.account: + report.problems.append(f"the AWS sign-in did not say which account it is in: run {login}") except SigninExpired: report.signin_expired = True report.problems.append(f"the AWS sign-in has expired or is missing: run {login}") diff --git a/src/reframe/core/teardown.py b/src/reframe/core/teardown.py index 25545d1..e63e67d 100644 --- a/src/reframe/core/teardown.py +++ b/src/reframe/core/teardown.py @@ -131,7 +131,8 @@ def delete(ctx: Context, consented: list[dict[str, Any]], say: Callable[[str], N from reframe.transform import teardown as transform_teardown if digest(inventory(ctx)) != digest(consented): raise Stop(Outcome.REFUSED, "the list of resources changed after consent; run reframe teardown again to see the new list") - state, transform, result = ctx.state, transform_ids(ctx), {"at": iso(), "steps": []} + state, transform = ctx.state, transform_ids(ctx) + result: dict[str, Any] = {"at": iso(), "steps": []} def step(name: str, outcome: str) -> None: say(f" {name}: {outcome}\n") @@ -177,6 +178,7 @@ def step(name: str, outcome: str) -> None: if any(i["from"].startswith("Terraform bootstrap") for i in consented): deleted = tf.destroy("bootstrap", ctx.changes)["deleted"] step("state bucket (Terraform)", f"destroyed {len(deleted)}") + left: dict[str, Any] try: left = network.leftovers(ctx.aws, ctx.folder.root.name, state["project"]) except NotSent as error: diff --git a/src/reframe/design/flow.py b/src/reframe/design/flow.py index e67500a..b9e577d 100644 --- a/src/reframe/design/flow.py +++ b/src/reframe/design/flow.py @@ -83,10 +83,10 @@ def data_items(text: str, file: str) -> list[Item]: val = value.group(1) if value else None if val and val[0] in "'\"": val = val[1:-1].replace("''", "'") - items.append(Item(int(m.group(1)), (m.group(2) or "FILLER").upper(), (re.search(r"\bPIC(?:TURE)?\s+(?:IS\s+)?(\S+)", rest, re.I) or [None, ""])[1], - val, ((re.search(rf"\bREDEFINES\s+({NAME})", rest, re.I) or [None, ""])[1]).upper(), - int((re.search(r"\bOCCURS\s+(\d+)", rest, re.I) or [None, 0])[1]), line, file, - ((re.search(r"\b(COMP(?:UTATIONAL)?(?:-[1-5])?|BINARY|PACKED-DECIMAL|DISPLAY)\b", rest, re.I) or [None, ""])[1]).upper())) + items.append(Item(int(m.group(1)), (m.group(2) or "FILLER").upper(), _first(r"\bPIC(?:TURE)?\s+(?:IS\s+)?(\S+)", rest), + val, _first(rf"\bREDEFINES\s+({NAME})", rest).upper(), + int(_first(r"\bOCCURS\s+(\d+)", rest, "0")), line, file, + _first(r"\b(COMP(?:UTATIONAL)?(?:-[1-5])?|BINARY|PACKED-DECIMAL|DISPLAY)\b", rest).upper())) return items @@ -129,6 +129,12 @@ class Program: paragraphs: dict[str, tuple[int, int]] # name -> (first line, last line) +def _first(pattern: str, text: str, default: str = "") -> str: + """Group 1 of the pattern's first match in the text, ignoring case, or the default when it does not match.""" + m = re.search(pattern, text, re.I) + return m.group(1) if m else default + + def _copybooks(legacy: Path) -> dict[str, Path]: return {p.stem.upper(): p for p in legacy.rglob("*") if p.is_file() and p.suffix.lower() in (".cpy", "") and p.parent.name.lower().startswith("cpy")} @@ -144,7 +150,8 @@ def read_program(path: Path, legacy: Path, copybooks: dict[str, Path]) -> Progra items += data_items(book.read_text(errors="replace"), book.relative_to(legacy).as_posix()) constants = {x.name: (str(x.value), x.file, x.line) for x in items if x.value is not None and x.name != "FILLER"} body = lines_of(text) - paragraphs, start, name = {}, None, None + paragraphs: dict[str, tuple[int, int]] = {} + start, name = 0, None # start is set with name procedure = next((i for i, b in enumerate(body) if re.search(r"\bPROCEDURE\s+DIVISION\b", b, re.I)), len(body)) for i in range(procedure + 1, len(body)): m = re.match(rf"^({NAME})\.\s*$", body[i][:4].strip() and body[i] or "", re.I) # a paragraph name, starting in area A @@ -208,9 +215,9 @@ def resolve(program: Program, expr: str, depth: int = 0) -> list[dict[str, Any]] return [{"value": value.strip(), "how": "constant", "lines": [f"{file}:{line}"]}] if value.strip() else [] for source, line in moves_into(program, name): values = resolve(program, source, depth + 1) - if depth == 0 and REF.match(source) and values and all(v["value"].upper() == program.name for v in values): + if depth == 0 and (ref := REF.match(source)) and values and all(v["value"].upper() == program.name for v in values): # a variable the program only ever sets to itself, before transferring away: whoever comes next sends it back - found.append({"value": program.name, "how": "caller", "lines": [f"{program.file}:{line}"], "via": REF.match(source).group(1).upper()}) + found.append({"value": program.name, "how": "caller", "lines": [f"{program.file}:{line}"], "via": ref.group(1).upper()}) continue for v in values: found.append({**v, "how": v["how"] if v["how"] != "literal" else "moved", "lines": v["lines"] + [f"{program.file}:{line}"]}) @@ -247,7 +254,7 @@ def _branch(program: Program, line: int) -> tuple[int, int]: end, depth, started = line, 0, False for i in range(line, min(len(program.lines), line + 80)): body = program.lines[i].strip() - word = (re.match(r"^([A-Z-]+)", body, re.I) or [None, ""])[1].upper() + word = _first(r"^([A-Z-]+)", body).upper() if not started and depth == 0 and (word in ("WHEN", "AND", "OR", "") or body.startswith("(")): end = i + 1 # more of the condition, or a WHEN stacked on this one: they share the statements that follow continue @@ -268,7 +275,7 @@ def flow(legacy: Path, screens: dict[str, Any]) -> dict[str, Any]: copybooks = _copybooks(legacy) programs = {p.stem.upper(): read_program(p, legacy, copybooks) for p in sorted(legacy.rglob("*")) if p.is_file() and p.suffix.lower() in (".cbl", ".cob")} - by_tran = {} + by_tran: dict[str, dict[str, Any]] = {} trans = transactions(legacy) for t in trans: by_tran.setdefault(t["transaction"], t) @@ -308,9 +315,10 @@ def add(kind: str, source: str, target: str, lines: list[str], **extra: Any) -> keys = [] for s in screens.get("screens") or []: for k in s["keys"]["handled"]: - prog = programs.get(k["program"]) - if not prog: + handler = programs.get(k["program"]) + if not handler: continue + prog = handler first, last = _branch(prog, k["line"]) targets = [] for var in transfer_vars.get(prog.name, set()): diff --git a/src/reframe/design/inventory.py b/src/reframe/design/inventory.py index a772aad..6e517a7 100644 --- a/src/reframe/design/inventory.py +++ b/src/reframe/design/inventory.py @@ -331,7 +331,7 @@ def inventory(legacy: Path) -> dict[str, Any]: for p in _files(legacy, COBOL_SUFFIXES): text = p.read_text(errors="replace") programs[p.stem.upper()] = {"file": rel(p), "copies": _copies(text), "text": text} - screens = [] + screens: list[dict[str, Any]] = [] for p in _files(legacy, BMS_SUFFIXES): for m in read_bms(p.read_text(errors="replace"), rel(p)): copybook = symbolic.get(m.mapset.upper()) diff --git a/src/reframe/design/journeys.py b/src/reframe/design/journeys.py index 02adc97..ccbddc2 100644 --- a/src/reframe/design/journeys.py +++ b/src/reframe/design/journeys.py @@ -74,7 +74,7 @@ def domains_of_screens(screens: dict[str, Any], rules: list[dict[str, Any]], req by_program[str(r.get("program", "")).upper()][r.get("function", "")] += 1 found: dict[str, list[str]] = defaultdict(list) for s in screens["screens"]: - counts = Counter() + counts: Counter[str] = Counter() for p in s["programs"]: counts.update(by_program.get(p["name"].upper(), Counter())) function = counts.most_common(1)[0][0] if counts else None @@ -201,7 +201,8 @@ def run(folder, claude, context: Path | None = None, more=None, plan_only: bool log = saved.get("log") or [] folder_in = places["analysis"] / "reframe" / "design" folder_in.mkdir(parents=True, exist_ok=True) - lock, stopped = threading.Lock(), [] + lock = threading.Lock() + stopped: list[Any] = [] todo, why = [], [] for key, mine in sorted(by_domain.items()): data = domain_input(domains.get(key) or {"name": key, "functions": []}, screens, mine, flow, requirements, personas) diff --git a/src/reframe/design/package.py b/src/reframe/design/package.py index 2f009dd..f90ac53 100644 --- a/src/reframe/design/package.py +++ b/src/reframe/design/package.py @@ -665,7 +665,7 @@ def run(folder, context: Path | None = None, notes: str = "") -> dict[str, Any]: problems = check(root, specs, ts) made = manifest(specs, ts, stack) same = latest is not None and (latest / "manifest.json").is_file() and json.loads((latest / "manifest.json").read_text()).get("digest") == digest(root) - if same: + if same and latest is not None: # same already needs latest version, target = have[-1], latest else: version = (have[-1] + 1) if have else 1 diff --git a/src/reframe/infrastructure/network.py b/src/reframe/infrastructure/network.py index 8571f96..a253ea0 100644 --- a/src/reframe/infrastructure/network.py +++ b/src/reframe/infrastructure/network.py @@ -11,6 +11,7 @@ from __future__ import annotations +import functools import time from typing import Any @@ -31,7 +32,7 @@ def delete_interfaces(aws: Aws, changes: Changes, vpc_id: str) -> list[str]: deleted = [] for interface in transform_interfaces(aws, vpc_id): changes.apply(f"teardown-eni-{interface['id']}", "ec2 delete-network-interface", {"interface": interface["id"], "vpc": vpc_id}, - lambda i=interface: aws.write("ec2", "delete-network-interface", "--network-interface-id", i["id"])) + functools.partial(aws.write, "ec2", "delete-network-interface", "--network-interface-id", interface["id"])) deleted.append(interface["id"]) return deleted @@ -117,7 +118,7 @@ def still_exists(aws: Aws, arn: str) -> bool | None: def leftovers(aws: Aws, run: str, project: str) -> dict[str, list[str]]: - found = {"exists": [], "stale_index": [], "unchecked": []} + found: dict[str, list[str]] = {"exists": [], "stale_index": [], "unchecked": []} for arn in tagged(aws, run, project): state = still_exists(aws, arn) found["exists" if state else "stale_index" if state is False else "unchecked"].append(arn) diff --git a/src/reframe/reconcile/audit.py b/src/reframe/reconcile/audit.py index b3d921f..3973c38 100644 --- a/src/reframe/reconcile/audit.py +++ b/src/reframe/reconcile/audit.py @@ -38,7 +38,7 @@ VERDICTS = ("correct", "minor", "wrong", "unsure") DEFECTS = ("real", "not_a_defect", "unsure") -SCHEMA = {"type": "object", "required": ["judgments"], "properties": {"judgments": {"type": "array", "items": { +SCHEMA: dict[str, Any] = {"type": "object", "required": ["judgments"], "properties": {"judgments": {"type": "array", "items": { "type": "object", "required": ["item", "verdict", "evidence", "lost", "defect", "reason", "read"], "properties": { "item": {"type": "string"}, @@ -296,13 +296,13 @@ def read_settled(folder: RunFolder) -> dict[str, dict[str, str]]: return {row["id"]: row for row in csv.DictReader(io.StringIO(path.read_text()))} -def final(item: dict[str, Any], judged: dict[str, dict[str, Any]], settled: dict[str, dict[str, str]], with_note: bool = False) -> dict[str, str]: +def final(item: dict[str, Any], judged: dict[str, dict[str, Any]], settled: dict[str, dict[str, str]], with_note: bool = False) -> dict[str, Any]: """The item's verdict and defect answer: the judges' shared answer, else the owner's, else "unsettled".""" answers = [judged[lab]["answers"].get(item["id"]) or {} for lab in sorted(judged)] owner = settled.get(item["id"]) or {} verdicts = {a.get("verdict") for a in answers} verdict = verdicts.pop() if len(verdicts) == 1 else (owner.get("owner_verdict") or "").strip() or "unsettled" - defect = "" + defect: Any = "" # a judge may leave the defect answer out if with_note: defects = {a.get("defect") for a in answers} defect = defects.pop() if len(defects) == 1 else (owner.get("owner_defect") or "").strip() or "unsettled" @@ -318,7 +318,7 @@ def tally(group: list[dict[str, Any]]) -> dict[str, Any]: n = len(group) counts = Counter(finals[i["id"]]["verdict"] for i in group) agreed = sum(len({(judged[lab]["answers"].get(i["id"]) or {}).get("verdict") for lab in labels}) == 1 for i in group) - out = {"items": n, **{v: counts.get(v, 0) for v in (*VERDICTS, "unsettled")}, "judges_agreed": agreed} + out: dict[str, Any] = {"items": n, **{v: counts.get(v, 0) for v in (*VERDICTS, "unsettled")}, "judges_agreed": agreed} if n: out["correct_share"] = round(counts.get("correct", 0) / n, 2) out["correct_or_minor_share"] = round((counts.get("correct", 0) + counts.get("minor", 0)) / n, 2) @@ -333,7 +333,7 @@ def tally(group: list[dict[str, Any]]) -> dict[str, Any]: # A note's call (P3-13): "unintended" should be judged real, "deliberate" not a defect. called = [i for i in notes if i.get("defect_call") and finals[i["id"]]["defect"] in ("real", "not_a_defect")] calls_agreed = sum((i["defect_call"] == "unintended") == (finals[i["id"]]["defect"] == "real") for i in called) - confidence = defaultdict(Counter) + confidence: defaultdict[str, Counter[str]] = defaultdict(Counter) for i in recommended: confidence[i["confidence"] or "none"][finals[i["id"]]["verdict"]] += 1 evidence = {lab: dict(Counter((judged[lab]["answers"].get(i["id"]) or {}).get("evidence") for i in recommended)) for lab in labels} diff --git a/src/reframe/reconcile/decide.py b/src/reframe/reconcile/decide.py index db6fe17..0b34786 100644 --- a/src/reframe/reconcile/decide.py +++ b/src/reframe/reconcile/decide.py @@ -90,7 +90,7 @@ def missing_evidence(evidence: list[str], legacy: Path) -> list[str]: for cite in evidence: m = CITE.match(str(cite).strip()) target = (legacy / m["path"]).resolve() if m else None - if not m or not target.is_relative_to(root) or not target.is_file(): + if not m or target is None or not target.is_relative_to(root) or not target.is_file(): bad.append(cite) continue count = len(target.read_text(errors="replace").splitlines()) @@ -131,7 +131,8 @@ def problems(unit: dict[str, Any], answer: dict[str, Any] | None, legacy: Path) bad = missing_evidence(evidence, legacy) if bad: found.append(f"evidence that does not exist in the snapshot: {', '.join(map(str, bad))}") - defect = answer.get("defect") if isinstance(answer.get("defect"), dict) else {"text": str(answer.get("defect") or "")} + raw_defect = answer.get("defect") + defect: dict[str, Any] = raw_defect if isinstance(raw_defect, dict) else {"text": str(raw_defect or "")} if str(defect.get("text") or "").strip(): if defect.get("call") not in CALLS: found.append(f'a possible defect needs its call: {" or ".join(CALLS)}') diff --git a/src/reframe/reconcile/inputs.py b/src/reframe/reconcile/inputs.py index 2fbd90e..702290e 100644 --- a/src/reframe/reconcile/inputs.py +++ b/src/reframe/reconcile/inputs.py @@ -78,7 +78,8 @@ def aws_citations(folder: RunFolder) -> dict[str, list[tuple[str | None, list[in found: dict[str, list[tuple[str | None, list[int]]]] = {} for path in sorted(folder.path("outputs/requirements").rglob("traceability.yaml")): for rule in (yaml.safe_load(path.read_text()) or {}).get("rules") or []: - own, other = [], [] + own: list[int] = [] + other: list[tuple[str | None, list[int]]] = [] for entry in rule.get("traceability_lines") or []: if isinstance(entry, dict): other.append((str(entry.get("file")), [int(n) for n in entry.get("lines") or [] if str(n).isdigit()])) @@ -178,7 +179,7 @@ def review_file(path: Path, name: str) -> dict[str, Any] | None: return None rows = [{(k or "").strip().lower(): (v or "").strip() for k, v in row.items()} for row in reader] first = lambda column: next((r[column] for r in rows if r.get(column)), "") # noqa: E731 - found = {"file": name, "format": "csv", "reviewer": first("reviewer"), "tool": first("tool"), "sha256": first("source_sha256"), "marks": [], "signoffs": []} + found: dict[str, Any] = {"file": name, "format": "csv", "reviewer": first("reviewer"), "tool": first("tool"), "sha256": first("source_sha256"), "marks": [], "signoffs": []} if "key" not in columns: return {**found, "unusable": NO_KEY} found["marks"] = [{"key": r["key"], "status": MARKS.get(r.get("status", "")), "comment": r.get("comment", ""), "at": r.get("marked_at", "")} diff --git a/src/reframe/reconcile/questions.py b/src/reframe/reconcile/questions.py index 03a4f80..469c978 100644 --- a/src/reframe/reconcile/questions.py +++ b/src/reframe/reconcile/questions.py @@ -114,7 +114,7 @@ def problems(ids: list[str], merged: list[dict[str, Any]], sources: set[str]) -> missing = [k for k in ids if k not in seen] if missing: found.append(f"ids in no question: {', '.join(missing)}") - wrong = sorted({q.get("settled_by") for q in merged if q.get("settled_by") and q["settled_by"] not in sources}) + wrong = sorted({q["settled_by"] for q in merged if q.get("settled_by") and q["settled_by"] not in sources}) if wrong: found.append(f"settled_by names that are not a document or answer you were given: {', '.join(wrong)}") return found @@ -161,7 +161,7 @@ def merge_batch(folder: RunFolder, claude, places: dict[str, Any], name: str, ba ids = [q["id"] for q in data["questions"]] back = {f"Q{n}": q["key"] for n, q in enumerate(batch, 1)} texts = {q["id"]: q for q in data["questions"]} - sources = {d["file"] for d in documents} | {a.get("id") for a in answers if a.get("id")} + sources = {d["file"] for d in documents} | {a["id"] for a in answers if a.get("id")} context = "" if documents or answers: data["answered"] = [{"id": a.get("id", ""), "question": a.get("question", ""), "answer": a.get("answer", "")} for a in answers] @@ -225,7 +225,8 @@ def build(folder: RunFolder, claude, gathered: dict[str, Any], found: list[dict[ known = set(rules) cache = folder.load("reconcile/sme-merges.json", {}) or {} log = folder.load("reconcile/sme-steps.json", []) or [] - lock, stopped = threading.Lock(), [] + lock = threading.Lock() + stopped: list[Any] = [] planned = [] for n, batch in enumerate(batches(asked), 1): members = {k for q in batch for k in q["rules"]} @@ -256,17 +257,17 @@ def one(item) -> None: listed = [] for _, _, _, digest in planned: for q in cache[digest]: - members = [by_key[k] for k in q["members"]] - listed.append({"kind": "question", "question": q["text"], "owner": q.get("owner") or members[0]["owner"], - "rules": sorted({k for m in members for k in m["rules"]}), "originals": [m["key"] for m in members], - "from": [f"{TOOLS[m['tool']]} {m['code']}".strip() for m in members], "evidence": [], - "settled_by": q.get("settled_by") or "", "settled_answer": q.get("settled_answer") or "", "program": members[0]["program"]}) + group = [by_key[k] for k in q["members"]] + listed.append({"kind": "question", "question": q["text"], "owner": q.get("owner") or group[0]["owner"], + "rules": sorted({k for m in group for k in m["rules"]}), "originals": [m["key"] for m in group], + "from": [f"{TOOLS[m['tool']]} {m['code']}".strip() for m in group], "evidence": [], + "settled_by": q.get("settled_by") or "", "settled_answer": q.get("settled_answer") or "", "program": group[0]["program"]}) for d in defects: ask = "Confirm this is deliberate:" if d["call"] == "deliberate" else "Is this intended?" listed.append({"kind": "defect", "question": f"{ask} {d['text']}", "owner": "Subject-matter expert", "rules": d["rules"], "call": d["call"], "originals": [d["key"]], "from": [f"Reframe's decision on {d['unit']}"], "evidence": d["evidence"], "settled_by": "", "settled_answer": "", "program": d["program"]}) - numbers = Counter() + numbers: Counter[str] = Counter() answers = ctx.get("answers") or [] for q in listed: numbers[q["kind"]] += 1 diff --git a/src/reframe/reconcile/requirements.py b/src/reframe/reconcile/requirements.py index 97c5493..53cc1dd 100644 --- a/src/reframe/reconcile/requirements.py +++ b/src/reframe/reconcile/requirements.py @@ -255,16 +255,16 @@ def place_kept(caps: list[dict[str, Any]], kept_reqs: list[dict[str, Any]]) -> l home = homes.setdefault(x["title"], {"title": x["title"], "story": x["story"], "requirements": [], "questions": [], "tables": list(x.get("tables") or []), "touches": list(x.get("touches") or [])}) home["requirements"].append(x["requirement"]) - rest = [] + rest: list[dict[str, Any]] = [] for cap in caps: - home = homes.get(cap["title"]) - if home is None: + target = homes.get(cap["title"]) + if target is None: rest.append(cap) continue - home["requirements"] += cap["requirements"] - home["questions"] += cap["questions"] - home["tables"] = home["tables"] or cap.get("tables") or [] - home["touches"] = sorted(set(home["touches"]) | set(cap.get("touches") or [])) + target["requirements"] += cap["requirements"] + target["questions"] += cap["questions"] + target["tables"] = target["tables"] or cap.get("tables") or [] + target["touches"] = sorted(set(target["touches"]) | set(cap.get("touches") or [])) return list(homes.values()) + rest @@ -345,7 +345,9 @@ def build(folder: RunFolder, claude, gathered: dict[str, Any], found: list[dict[ saved = previous_doc.get("functions") or {} marks = (gathered.get("context") or {}).get("marks") or {} log = folder.load("reconcile/requirements-steps.json", []) or [] - lock, stopped, written = threading.Lock(), [], {} + lock = threading.Lock() + stopped: list[Any] = [] + written: dict[str, Any] = {} todo = [] for fid in sorted(set(by_function) | set(open_by_function)): members = sorted(by_function.get(fid, []), key=lambda r: (r["program"], r["key"])) @@ -376,6 +378,7 @@ def one(item) -> None: if stop is not None: stopped.append(stop) return + assert value is not None # a step that did not stop has a value written[fid] = {"hash": digest, "dropped": value["dropped"], "raw": value["capabilities"], "reviewed": [{k: m[k] for k in ("key", "mark", "comment")} for m in marked]} folder.save("outputs/reconcile/requirements.json", {"label": label(folder), "complete": False, "functions": {**saved, **written}}) @@ -390,7 +393,7 @@ def one(item) -> None: open_of = {w["unit"]: w for w in waiting} functions = {} for fid in sorted(written, key=lambda f: (f == "", f)): - counters = Counter() + counters: Counter[str] = Counter() kept_codes = {r["code"] for c in written[fid]["raw"] for r in c["requirements"] if r.get("code")} caps = [] for c_index, cap in enumerate(written[fid]["raw"], 1): diff --git a/src/reframe/report/build.py b/src/reframe/report/build.py index cf80efa..9e105e8 100644 --- a/src/reframe/report/build.py +++ b/src/reframe/report/build.py @@ -44,7 +44,8 @@ def _json(path: Path) -> Any: def _rules(trace: dict[str, Any], fid: str) -> tuple[list[dict[str, Any]], dict[str, list[str]]]: """The function's rules, and for each requirement code the keys of the rules that back it.""" - rules, backing = [], {} + rules: list[dict[str, Any]] = [] + backing: dict[str, list[str]] = {} for item in trace.get("requirements") or []: if isinstance(item, dict) and item.get("req_id"): backing.setdefault(str(item["req_id"]), []).extend(f"{fid}/{r}" for r in item.get("rule_ids") or []) @@ -81,7 +82,7 @@ def collect(folder: RunFolder) -> dict[str, Any]: parsed = documents.parse(document.read_text(errors="replace")) listed = catalog["functions"].get(documents.squeeze(parts[-1])) if len(parts) == 1: - domain = dict(UNASSIGNED) + domain: dict[str, Any] = dict(UNASSIGNED) else: known = catalog["domains"].get(documents.squeeze(parts[0])) or ( catalog["domains"].get(documents.squeeze(listed["domain"])) if listed else None) @@ -97,7 +98,7 @@ def collect(folder: RunFolder) -> dict[str, Any]: rules += function_rules rule_programs = {r["key"]: r["program"] for r in function_rules} used: set[str] = set() - function = {"id": fid, "domain": domain["key"], "name": listed["name"] if listed else (parsed["title"] or documents.spaced(parts[-1])), + function: dict[str, Any] = {"id": fid, "domain": domain["key"], "name": listed["name"] if listed else (parsed["title"] or documents.spaced(parts[-1])), "description": listed["description"] if listed else "", "capabilities": [], "notes": [{"heading": n["heading"], "html": render_markdown(n["markdown"]), "technical": n["technical"]} for n in parsed["notes"]], "summary": trace.get("summary") or {}} @@ -183,7 +184,10 @@ def _inline(text: str) -> str: def render_markdown(text: str) -> str: - out, paragraph, listing, table = [], [], None, [] + out: list[str] = [] + paragraph: list[str] = [] + listing: tuple[str, list[str]] | None = None + table: list[str] = [] def flush(): nonlocal paragraph, listing, table @@ -258,7 +262,7 @@ def build(folder: RunFolder) -> Path: # ---- pipeline 2: Claude's results in the same review -------------------------------------------------------- -CLAUDE = {"key": "claude", "name": "Claude (code-modernization plugin)", "short": "Claude", "generated": True, +CLAUDE: dict[str, Any] = {"key": "claude", "name": "Claude (code-modernization plugin)", "short": "Claude", "generated": True, "generated_note": "The business functions, capabilities and requirements on this page were generated by Reframe from Claude's " "results, outside the plugin. The rule cards and the open questions are as the plugin wrote them."} EARS = {"ubiquitous": "Ubiquitous", "event-driven": "Event-driven", "state-driven": "State-driven", "unwanted behaviour": "Unwanted", diff --git a/src/reframe/report/compare.py b/src/reframe/report/compare.py index 94ebe01..0d66e82 100644 --- a/src/reframe/report/compare.py +++ b/src/reframe/report/compare.py @@ -37,7 +37,7 @@ def _links(data: dict[str, Any], base: str) -> dict[str, Any]: """Hash links into a review page for each rule key, requirement key and function id.""" cap_index = {c["id"]: i for i, c in enumerate(data["capabilities"])} fn_index = {f["id"]: i for i, f in enumerate(data["functions"])} - rule_cap = {} + rule_cap: dict[str, Any] = {} for r in data["requirements"]: for k in r.get("rules") or []: rule_cap.setdefault(k, r["capability"]) @@ -112,9 +112,9 @@ def model(folder: RunFolder) -> dict[str, Any]: for p in progs: claude_dom_of[p].append(cid) fn_name = {f["id"]: f["name"] for f in aws["functions"]} - programs = [] + program_rows = [] for p in sorted((aws_programs | claude_programs | set(aws_by_program) | set(claude_by_program)) - {""}): - programs.append({"program": p, "aws_functions": [{"name": fn_name.get(f, f), "link": aws_links.get(f)} for f in sorted(aws_fn_of.get(p, []))], + program_rows.append({"program": p, "aws_functions": [{"name": fn_name.get(f, f), "link": aws_links.get(f)} for f in sorted(aws_fn_of.get(p, []))], "claude_domains": [plugin_domains[c]["name"] for c in sorted(claude_dom_of.get(p, [])) if c in plugin_domains], "aws_rules": len(aws_by_program.get(p, [])), "claude_rules": len(claude_by_program.get(p, [])), "in_aws": p in aws_programs or p in aws_by_program, "in_claude": p in claude_programs or p in claude_by_program}) @@ -155,7 +155,7 @@ def brief(r: dict[str, Any], links: dict[str, str]) -> dict[str, Any]: "sha256": snapshot.get("sha256"), "files": snapshot.get("files")}, "aws_at": folder.state.get("retrieved_at"), "claude_at": claude_state.get("finished_at") or claude_state.get("updated_at"), "plugin": claude_state.get("plugin") or {}, "numbers": numbers, "aws_domains": aws_domains, "claude_domains": claude_domains, - "programs": programs, "pairs_by_program": pairs_by_program, + "programs": program_rows, "pairs_by_program": pairs_by_program, "ai": {"ran": bool(ai), "note": ai.get("note", ""), "pairs": ai_pairs, "at": ai.get("at")}, "only": {"aws_programs": sorted((aws_programs | set(aws_by_program)) - (claude_programs | set(claude_by_program))), "claude_programs": sorted((claude_programs | set(claude_by_program)) - (aws_programs | set(aws_by_program))), diff --git a/src/reframe/report/store.py b/src/reframe/report/store.py index 070e7f3..6319f65 100644 --- a/src/reframe/report/store.py +++ b/src/reframe/report/store.py @@ -53,6 +53,7 @@ def __init__(self, aws: Aws, folder: RunFolder | None = None, terraform: str | N self.aws, self.folder = aws, folder or store_folder() self.changes = Changes(self.folder, f"{getpass.getuser()} (reframe)") self.binary = terraform_binary(terraform) + self._found: str | None = None # the bucket found by its tags, once looked up def terraform(self): from reframe.infrastructure.terraform_runner import Terraform @@ -69,7 +70,7 @@ def reading_bucket(self) -> str: by the records alone.""" if self.bucket: return self.bucket - if getattr(self, "_found", None): + if self._found: return self._found found = self.discover() if not found: @@ -133,8 +134,11 @@ def ensure(self) -> str: tf.install() tf.variables(ROOT, {"region": self.aws.region, "bucket_name": name}) tf.apply(ROOT, self.changes) + bucket = self.bucket + if not bucket: + raise Stop(Outcome.FAILED, "the reports store's Terraform root did not report its bucket") self.folder.event("reports_store_ready") - return self.bucket + return bucket def upload(self, copy: Path, project: str, run: str, folder: RunFolder | None = None) -> str: """The cleaned copy to //reports/, and, given the run folder, its source and the tools' results.""" @@ -151,6 +155,7 @@ def send() -> dict[str, Any]: with tempfile.TemporaryDirectory() as scratch: for key, source in pieces: cp(source, prefix + key, *(("--recursive",) if source.is_dir() else ())) + assert folder is not None # pieces come from the run folder sent[key] = source.resolve().relative_to(folder.root.resolve()).as_posix() if folder and folder.exists("snapshot.json"): note = Path(scratch) / "source.json" diff --git a/src/reframe/source/s3.py b/src/reframe/source/s3.py index 4d8f0dd..d0707e7 100644 --- a/src/reframe/source/s3.py +++ b/src/reframe/source/s3.py @@ -43,8 +43,10 @@ def upload(aws: Aws, folder: RunFolder, changes: Changes, bucket: Bucket, data: key = f"source/{digest_hex[:16]}.zip" def matches(found: dict[str, Any] | None) -> bool: - return bool(found) and (found.get("ChecksumSHA256") == _b64(digest_hex) - or (found.get("Metadata") or {}).get("reframe-sha256") == digest_hex) + if not found: + return False + return (found.get("ChecksumSHA256") == _b64(digest_hex) + or (found.get("Metadata") or {}).get("reframe-sha256") == digest_hex) def settle(): found = head(aws, bucket, key) diff --git a/src/reframe/transform/answers.py b/src/reframe/transform/answers.py index 98564ba..6193813 100644 --- a/src/reframe/transform/answers.py +++ b/src/reframe/transform/answers.py @@ -212,10 +212,10 @@ def chat_question(message: dict[str, Any], awaiting: bool = False) -> Question | clashes = name_clashes(text) if clashes: bare = BARE_WORD.search(plain(text)) and len(clashes) == 1 - replies = ("domain", "function") if bare else tuple(", ".join(f"{reading} {name}" for name in clashes) for reading in ("domain", "function")) + choices = ("domain", "function") if bare else tuple(", ".join(f"{reading} {name}" for name in clashes) for reading in ("domain", "function")) listed = ", ".join(f'"{name}"' for name in clashes) return Question(message_id, "clash", text, (f"The business domain {listed}: every business function in it", - f"The business function {listed} only"), replies) + f"The business function {listed} only"), choices) if closing in PLAN_MENU: numbered = menu_options(text) return Question(message_id, "plan", text, tuple(label for _, label in numbered), @@ -335,8 +335,8 @@ def catalog_form_content(task: dict[str, Any], source_uri: str | None) -> dict[s return dict(template) -def fits_schema(schema: dict[str, Any], value: Any) -> bool: - types = {"string": str, "boolean": bool, "array": list, "object": dict, "integer": int, "number": (int, float)} +def fits_schema(schema: Any, value: Any) -> bool: + types: dict[str, type | tuple[type, ...]] = {"string": str, "boolean": bool, "array": list, "object": dict, "integer": int, "number": (int, float)} if not isinstance(schema, dict): return True if "enum" in schema and value not in schema["enum"]: diff --git a/src/reframe/transform/api.py b/src/reframe/transform/api.py index 93cf5aa..bfcebda 100644 --- a/src/reframe/transform/api.py +++ b/src/reframe/transform/api.py @@ -48,14 +48,14 @@ def _call(self, request: dict[str, Any], changes: bool) -> Any: reply = json.loads(lines[-1]) if reply.get("ok"): return reply.get("value") - error = str(reply.get("error") or "") - if signin_expired(error): - raise SigninExpired(error[:300]) - if REFUSED.search(error) or (isinstance(reply.get("status"), int) and 400 <= reply["status"] < 500): - raise Rejected(request["op"], error[:500]) + message = str(reply.get("error") or "") + if signin_expired(message): + raise SigninExpired(message[:300]) + if REFUSED.search(message) or (isinstance(reply.get("status"), int) and 400 <= reply["status"] < 500): + raise Rejected(request["op"], message[:500]) if changes: - raise Uncertain(f"{request['op']}: {error[:300]}") - raise NotSent(f"{request['op']}: {error[:300]}") + raise Uncertain(f"{request['op']}: {message[:300]}") + raise NotSent(f"{request['op']}: {message[:300]}") def messages(self, workspace_id: str, job_id: str) -> list[dict[str, Any]]: return self._call({"op": "messages", "workspace_id": workspace_id, "job_id": job_id}, changes=False) or [] diff --git a/src/reframe/transform/documents.py b/src/reframe/transform/documents.py index b875ebd..10096e7 100644 --- a/src/reframe/transform/documents.py +++ b/src/reframe/transform/documents.py @@ -113,7 +113,9 @@ def new_capability(number: str, title: str) -> dict[str, Any]: document["capabilities"].append(capability) else: capability = None - heading = NOTE_SECTION.match(line).group(1) + section = NOTE_SECTION.match(line) + assert section is not None # the line starts with "## ", which NOTE_SECTION always matches + heading = section.group(1) note = {"heading": heading, "markdown": [], "technical": heading.casefold() in TECHNICAL_NOTES} document["notes"].append(note) continue @@ -144,8 +146,11 @@ def new_capability(number: str, title: str) -> dict[str, Any]: question = QUESTION.match(line) bullet = BULLET.match(line) if "question" in part else None if question or bullet: - body = question.group(2) if question else bullet.group(1) - code = question.group(1) if question else f"Q-{len(capability['questions']) + 1:03d}" + if question: + body, code = question.group(2), question.group(1) + else: + assert bullet is not None + body, code = bullet.group(1), f"Q-{len(capability['questions']) + 1:03d}" item = {"code": code, "text": body.strip(), "owner": "", "unverified": False} capability["questions"].append(item) continue diff --git a/src/reframe/transform/retrieve.py b/src/reframe/transform/retrieve.py index 254bc80..9d3409c 100644 --- a/src/reframe/transform/retrieve.py +++ b/src/reframe/transform/retrieve.py @@ -91,7 +91,7 @@ def retrieve(aws: Aws, folder: RunFolder, bucket: Bucket, job_id: str) -> dict[s def summarize(requirements: Path) -> dict[str, Any]: """Per function: its domain, requirement counts by type, open questions, and AWS's own rule counts.""" spec = requirements / "spec" if (requirements / "spec").is_dir() else requirements - functions = [] + functions: list[dict[str, Any]] = [] for document in sorted(spec.rglob("requirements.md")): relative = document.parent.relative_to(spec).parts text = document.read_text(errors="replace") @@ -103,7 +103,7 @@ def summarize(requirements: Path) -> dict[str, Any]: functions.append({"domain": relative[0] if len(relative) > 1 else "", "function": relative[-1] if relative else "", "path": "/".join(relative), "requirements": counts, "open_questions": count_questions(text), "rules": rules}) - totals = {"requirements": sum(sum(f["requirements"].values()) for f in functions), + totals: dict[str, Any] = {"requirements": sum(sum(f["requirements"].values()) for f in functions), "by_type": {}, "rules": sum(int(f["rules"].get("total_rules", 0) or 0) for f in functions), "captured_rules": sum(int(f["rules"].get("captured", 0) or 0) for f in functions), "open_questions": sum(f["open_questions"] for f in functions)} diff --git a/tests/core/test_preflight.py b/tests/core/test_preflight.py index c0a7b8c..4e183ae 100644 --- a/tests/core/test_preflight.py +++ b/tests/core/test_preflight.py @@ -49,6 +49,12 @@ def test_old_terraform_and_missing_pieces_listed_together(self): preflight.require(report) self.assertEqual(stop.exception.outcome, Outcome.REFUSED) + def test_a_signin_that_names_no_account_is_refused(self): + report = run(runner(sts=(0, {}, ""))) + self.assertTrue(any("did not say which account" in p for p in report.problems), report.problems) + with self.assertRaises(Stop): + preflight.require(report) + def test_transform_not_ready(self): def ready(): raise RuntimeError("No Transform profile found for this account") diff --git a/tests/report/test_store.py b/tests/report/test_store.py index 83ba004..2ac504c 100644 --- a/tests/report/test_store.py +++ b/tests/report/test_store.py @@ -237,6 +237,15 @@ def test_a_run_is_published_with_its_source_results_and_reports(self): self.store.upload(copy, "demo", "abc123", run) self.assertEqual([c for c in self.aws.calls if c[:2] == ("s3", "cp")], before) + def test_a_store_whose_terraform_reports_no_bucket_stops(self): + class NoBucket(FakeTerraform): + def apply(self, root, changes, backend=None): + return changes.apply("terraform-reports-apply", "terraform apply", {}, lambda: {"created": [], "outputs": {}}) + self.store.terraform = lambda: NoBucket(self.store) + with self.assertRaises(Stop) as stop: + self.store.ensure() + self.assertIn("did not report its bucket", stop.exception.message) + def test_reports_published_before_the_three_folders_still_open(self): self.store.ensure() self.aws.objects.update({"demo/old111/index.html": b"

old

", "demo/old111/report.zip": b"zip", From 13104b1aa45b0a7de8b97b6f607b983823cd418c Mon Sep 17 00:00:00 2001 From: sknampally Date: Fri, 27 Nov 2026 20:37:05 -0700 Subject: [PATCH 3/3] Plan: Q1-06 delivered in #484 Prepared with AI assistance. --- docs/plan.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/plan.md b/docs/plan.md index 5d0dd1a..6276778 100644 --- a/docs/plan.md +++ b/docs/plan.md @@ -210,7 +210,7 @@ The owner's direction (26 November 2026): make Reframe credible to someone readi | Q1-03 | Types in CI | [CONTRIBUTING](../CONTRIBUTING.md) | #452 · Done 26 November 2026 (#455): `mypy` passes in CI. The modules with type errors still to fix are listed in `pyproject.toml`, and the list only shrinks: 25 of 85 modules at the start, after 13 were fixed | | Q1-04 | Tests of the drivers, and a coverage floor | [CONTRIBUTING](../CONTRIBUTING.md) | #453 · Done 26 November 2026 (#455): The Claude assessment's driver, the AWS Transform assessment's driver and the command handlers are tested stage by stage with fakes, and CI fails below 80% line coverage. At the start: 81% overall; the drivers went from 44%, 38% and 46% to 95%, 93% and 71% | | Q1-05 | Split `core/commands.py` | – | #454 · **Next:** unblocked now that v1.0.0 is tagged (27 November 2026). The 900-line module becomes one module per command group, with the Q1-04 tests passing unchanged | -| Q1-06 | Types in every module | [CONTRIBUTING](../CONTRIBUTING.md) | #483 · `mypy` passes in CI with every module checked except `reframe.core.commands`, which comes off the list once Q1-05 has split it. The 24 other modules on the list (108 errors at the start) are fixed without changing what the code does, and the offline tests pass unchanged; any real fault the types turn up is fixed with a test and listed in the PR | +| Q1-06 | Types in every module | [CONTRIBUTING](../CONTRIBUTING.md) | #483 · Done 27 November 2026 (#484): `mypy` passes in CI with every module checked except `reframe.core.commands`, which comes off the list once Q1-05 has split it. The 24 other modules on the list (108 errors at the start) are fixed without changing what the code does, and the offline tests pass unchanged; any real fault the types turn up is fixed with a test and listed in the PR. Two were: preflight accepted a sign-in that named no account, and the reports store could return no bucket | ## Release 1.1: any legacy codebase