From 391fbee9d4c0251142002c88e368ef57043320ad Mon Sep 17 00:00:00 2001 From: sknampally Date: Sat, 28 Nov 2026 22:03:55 -0700 Subject: [PATCH 1/2] L1-09: live acceptance on two codebases JPetStore 6 and eShopModernizing ran from `reframe run --tools claude` to `reframe export`, locally and with nothing committed, with no stop that needed a code fix. Each was then built in another language from the Claude Code package alone. The results are in docs/any-legacy.md, section 7. Fixed with tests, from what the runs and the builds showed: - the stack profile leaves out vendored scripts and build wrappers; - link patterns: a view returned through a constant from a long method, the Web Forms route table and routes by name, `~`, Razor's Url.Action; - included parts (JSP includes, Razor partials and layouts, _ViewStart, master pages, user controls, PHP includes) fold into the pages that include them, and a layout, partial, master page or control is never a screen; - the proof slice is named by its journey, and falls back to the journey's capabilities when no rule's program is behind the first screen; - the Claude Code form has the role files its tasks name; - data contracts: keys shown, files that hold SQL and the files a rule cites name the tables they use, SQL integers typed by width, the entity classes a data context names are read, and a decimal with no declared precision is not given one; - a value with a space at either end is quoted in a criterion; - golden/compare.py matches a quoted message with a value in it; - the prototype keeps its review marks per project, run and source; - the start message fits any codebase. Prepared with AI assistance. --- docs/any-legacy.md | 52 ++++++++ docs/plan.md | 2 +- src/reframe/core/commands/starting.py | 5 +- src/reframe/design/contracts.py | 11 +- src/reframe/design/general.py | 166 +++++++++++++++++++++++--- src/reframe/design/golden.py | 2 +- src/reframe/design/golden_compare.py | 11 +- src/reframe/design/handover.py | 18 ++- src/reframe/design/package.py | 12 ++ src/reframe/design/prototype.html | 14 ++- src/reframe/design/schema.py | 35 +++++- src/reframe/design/specs.py | 11 +- src/reframe/source/profile.py | 16 ++- tests/design/test_general.py | 123 ++++++++++++++++++- tests/design/test_golden.py | 7 ++ tests/design/test_package.py | 15 +++ tests/design/test_prototype.py | 7 ++ tests/design/test_schema.py | 45 +++++++ tests/design/test_specs.py | 5 + tests/source/test_profile.py | 15 +++ 20 files changed, 535 insertions(+), 37 deletions(-) diff --git a/docs/any-legacy.md b/docs/any-legacy.md index 54a22bd5..dc6d5185 100644 --- a/docs/any-legacy.md +++ b/docs/any-legacy.md @@ -128,6 +128,58 @@ The profile is shown by `reframe status`, carried into the reports' About sectio - the package's checks pass. - **Recorded in this document:** the time, agents and cost of each run, and what was found and fixed. +### Results (L1-09, 28 and 29 November 2026) + +Both codebases ran from the CLI on the owner's yes, Claude only, on the subscription, from the workspace's `.reframe/`, with nothing committed. Costs are the list-price equivalents Claude Code reports. eShopModernizing's input was its two legacy applications only (the MVC and Web Forms solutions' `src`, 316 files), not the repository's modernized versions. + +| Stage | JPetStore 6 (Java, JSP) | eShopModernizing (.NET Framework MVC and Web Forms) | +|---|---|---| +| Profile | `java`: Java 46 files, JSP 20, SQL 3; 20 views, 6 route files, 14 data files | `dotnet`: C# and Razor; 307 vendored script files left out | +| `reframe run --tools claude` | 40 minutes, $22.08: 13 shards (estimate 15 to 40 agents, "tiny estate"); 11 functions, 29 rules, 112 requirements | about 50 minutes of work, $21.62, with a stop at the usage limit during extract-rules and `reframe resume` after the reset; 12 shards (estimate 120 to 180 agents); 23 functions, 46 rules, 198 requirements | +| Agents | the logs show 3 subagents in assess and 40 in map | the same: 3 and 40 | +| `reframe reconcile` | 4 minutes, $6.29: 29 rules decided against the code; 72 recommended rules, all cited by 78 requirements; 21 possible defects; 7 SME questions from 9 | 5 minutes, $9.04: 46 rules decided; 79 recommended rules, all cited by 117 requirements; 14 possible defects; 16 SME questions from 20 | +| Screens and flow | 20 views; 86 links by pattern, 2 by model, none unresolved | 15 views in round 1; 13 screens in round 2, with 6 parts folded or left out (two layouts, two master pages, a partial, a user control); 48 links by pattern, none by model, 1 unresolved (a link built at run time, `<%: SwitchUrl %>`) | +| Data contracts | 8 tables from the SQL DDL, with their keys; the inventory table, read only in a mapper, was missing until the fix below | 6, from the entity classes of both applications, by a checked step | +| `reframe design` | 14 minutes, $10.72: 13 journeys, 15 modern screens, 24 capabilities (all draft), 123 golden cases | two rounds, 23 minutes, $15.94: 7 journeys, 8 modern screens, 37 capabilities (all draft) | +| `--package` and `--check` | 64 files in the Claude Code form; ready once the engineer's placeholders are filled | 86 files; ready once filled | +| `reframe export` | Jira and Azure DevOps: 10 epics, 24 stories, 78 requirements, 87 acceptance criteria | Jira and Azure DevOps: 19 epics, 37 stories, 117 requirements, 126 acceptance criteria | + +No stage stopped for a fault in the code. + +**Built in another language from the package alone.** To test the package as a build would use it, Claude Code (headless, on the subscription) built each application in a new language from the Claude Code form alone, with no access to the legacy source. The engineer's placeholders were filled for a local test build, and the owner confirmed the draft capabilities for this test only. + +| | JPetStore 6 → React with TypeScript, NestJS, PostgreSQL | eShopModernizing → React with TypeScript, Python 3.12 with FastAPI, PostgreSQL | +|---|---|---| +| The proof slice | 4 capabilities, 22 minutes, $7.32: 11 of 11 criteria pass; 37 package gaps recorded | 4 capabilities, 15 of 15 criteria, before the rest | +| The whole build | 24 capabilities; the rest in 58 minutes, $27.58; 87 of 87 criteria pass; 117 back-end and 111 front-end tests | 37 capabilities in one run of 72 minutes, $19.49; 125 of 126 criteria pass; 241 back-end tests against PostgreSQL and 41 screen tests | +| End to end | a script through browse, search, cart, sign on, checkout and orders: 17 of 17 steps | a script through browse, view, add, edit and delete: 21 of 21 steps | +| Golden datasets | 123 cases: 45 match, 4 formatting, 2 business (both from the datasets: a template literal and a title the case says must not appear), 72 for the tests to assert | 105 cases: 21 match, none differ, 84 for the tests to assert | +| Package gaps | 37 | 23 | +| For the owner | the reconciled rules let a crafted request change any account, password included, as the legacy does; a repeated confirmation places a second order; three rules contradict their screen's text | the one criterion not met asks for the legacy binary brand file, which its own design note says not to copy; a brand "delete" that deletes nothing and an unprinted correlation ID are carried as historical artifacts; anyone can change the catalog, as in the legacy | + +**Found and fixed in Reframe:** +- *A web application profiled by its vendored scripts.* eShopModernizing's unminified jQuery, Bootstrap and ASP.NET scripts outweighed its C#: library files and folders are now left out, and build wrappers (`mvnw.cmd`, `build.cmd`) are no longer jobs. +- *Links the patterns missed.* A view returned through a constant from a long method (JPetStore), the Web Forms route table and routes by name, `~` as the application root, and Razor's `Url.Action` in any case (eShopModernizing). +- *Included parts read as screens.* JPetStore's `IncludeTop.jsp` started 7 of its 13 journeys and became part of a modern screen. Includes, Razor partials and layouts, `_ViewStart`, master pages, user controls and PHP includes are now folded into the pages that include them, and a layout, partial, master page or control is never a screen, even when nothing names it. +- *The proof slice.* It was always titled "Sign in", and on eShopModernizing it listed no capability, because the controller reaches its service through an interface. It is now named by the journey that starts it, and falls back to that journey's capabilities. +- *What the build found missing in the package:* + - the Claude Code form had no role files, though every task names a role; + - a table read only in a MyBatis mapper was missing from the contracts (files that hold SQL, and the files a rule cites, now count); + - the contracts showed no keys and used mainframe words (`PIC`, "working storage of") for tables and entities; + - an SQL `INT` was typed as a `BIGINT`; + - a leading space in an example's value was lost; + - a quoted message with a value in it (`' in stock.'`) could never match; + - the golden README said `python`. +- *What the Python build found missing in the entity contracts:* eShopModernizing's entities were read from its Entity Framework context, which configures only some properties, so the stock fields and the description were missing; the classes a context names in `DbSet<...>` are now read too. A C# `decimal` with no declared precision was given 18 digits and no decimals, which would have dropped the cents; it now says its precision is not declared, for the team to decide. +- *The prototype's review marks* were kept under one fixed key in the browser, so two prototypes opened from files could mix them. They are now kept per project, run and source, as the review pages keep theirs. +- *The start message* gave CardDemo's two hours for every codebase. + +**Seen, not a fault in Reframe:** +- On eShopModernizing, Claude's plugin names its functions after the code's layers (`bootstrap`, `mvc-host`, `wf-host`), not business functions. +- Two pairs of capabilities on JPetStore restate the same rule (search, and placing an order); the build implemented each once with both IDs. +- The MVC and Web Forms applications share route paths (`/Catalog/Create`), and in one codebase the first one found wins. +- Rule programs are kept in upper case, as the reconciliation matches them, so a web file's path shows in capitals in `traceability.md`. + ## 8. Not in 1.1 - **AWS Transform for other stacks.** It transforms code rather than documenting it, so there is nothing to reconcile yet. Revisit if AWS adds requirements for them. Whether its code analyses could give a second opinion on debt and security is looked at in [aws-transform-other-stacks.md](aws-transform-other-stacks.md). diff --git a/docs/plan.md b/docs/plan.md index 2e96677f..31ebd2fc 100644 --- a/docs/plan.md +++ b/docs/plan.md @@ -226,7 +226,7 @@ The owner's direction (27 November 2026): Reframe takes any legacy codebase Clau | L1-06 | Data contracts from any stack | [§5.4](any-legacy.md) | #478 · SQL DDL is read with no model; entity classes by a checked model step; the target stack's types apply as today. Reworked 28 November 2026 after the review (#478): tables and entities are stored records in the package | | L1-07 | "Runs as" for any stack | [§5.4](any-legacy.md) | #479 · Online, scheduled job, service or library from screens, routes and job definitions, for each fixture | | L1-08 | Words, README and docs | [§5.5, 6](any-legacy.md) | #480 · The tagline, the README's table by family, the guide and every stage's words follow section 6 | -| L1-09 | Live acceptance on two codebases | [§7](any-legacy.md) | #481 · Section 7's *done when* on eShopModernizing and JPetStore 6, run locally, nothing committed, the results recorded here | +| L1-09 | Live acceptance on two codebases | [§7](any-legacy.md) | #481 · Done 29 November 2026 ([results](any-legacy.md)): JPetStore 6 and eShopModernizing from `reframe run --tools claude` to `reframe export`, run locally with nothing committed, no stop that needed a code fix. Each was then built in another language from the Claude Code package alone (TypeScript with NestJS; Python with FastAPI): 87 of 87 and 125 of 126 criteria. The defects the runs and builds showed are fixed with tests | ## Mainframe source packages and a second public codebase diff --git a/src/reframe/core/commands/starting.py b/src/reframe/core/commands/starting.py index 64232c0d..0f4e0c16 100644 --- a/src/reframe/core/commands/starting.py +++ b/src/reframe/core/commands/starting.py @@ -107,8 +107,9 @@ def start_claude_only(*, source: str, ref: str | None, mode: str, project: str | pid = commands._start_worker(folder, "claude") folder.event("claude_worker_started", pid=pid) ui.console.print() - ui.panel(f"The Claude assessment runs in the background (process {pid}); on CardDemo it takes about two hours. It uses no AWS, so " - "there is nothing to tear down.\n" + ui.panel(f"The Claude assessment runs in the background (process {pid}): about two hours on CardDemo, about 40 minutes on a small web " + "application; reframe status shows this run's estimate once Claude has mapped the code.\n" + "It uses no AWS, so there is nothing to tear down.\n" "Follow it: reframe status · reframe events --follow\n" + ("Answer Claude: reframe answer\n" if mode == "interactive" else "") + "When it is done: reframe report --open · then reframe reconcile", "Started", "green") diff --git a/src/reframe/design/contracts.py b/src/reframe/design/contracts.py index 5a114dc9..8cd1ca31 100644 --- a/src/reframe/design/contracts.py +++ b/src/reframe/design/contracts.py @@ -190,7 +190,16 @@ def on_stack(t: dict[str, Any], types: dict[str, Any]) -> dict[str, str]: if kind in ("text", "formatted"): slot, n = "text", t.get("length", 0) elif kind == "integer": - slot, n = ("int" if t["digits"] <= 9 else "long" if t["digits"] <= 18 else "big"), 0 + bits = t.get("bits") # an SQL integer: its width, not its digits (an INT is 32 bits, a BIGINT 64) + slot = ("int" if bits <= 32 else "long") if bits else ("int" if t["digits"] <= 9 else "long" if t["digits"] <= 18 else "big") + n = 0 + elif kind == "decimal" and t.get("declared") is False: # no precision to carry: the column type without one + found = {} + for side in ("code", "column"): + table = types.get(side) + if table: + found[side] = re.sub(r"\(\{p\},\{s\}\)", "", table["decimal"]) + (" (precision to decide)" if side == "column" else "") + return found elif kind == "decimal": slot, n = "decimal", 0 elif kind == "float": diff --git a/src/reframe/design/general.py b/src/reframe/design/general.py index 5709a1d3..c7ddda73 100644 --- a/src/reframe/design/general.py +++ b/src/reframe/design/general.py @@ -13,6 +13,9 @@ renders `Views//`, `return "orders/list"` renders that view), and a script page's own path. A link no pattern settles goes to one Claude step, checked the same way: its target must be a screen, a route or a file that exists, and its lines must exist. What fails twice stays unresolved. +- **Fragments:** a view another view includes (a JSP include, a Razor partial or layout, a Web Forms master page or user + control, a PHP include), found by pattern, is folded into the screens that include it: they get its fields, actions + and links, and it is no longer a screen of its own, so no journey starts on a shared header. Every link and field cites `:` in the snapshot. Nothing here changes the source. """ @@ -76,12 +79,16 @@ def screen_id(rel: str, taken: set[str]) -> str: p = PurePosixPath(rel) parts = [x for x in p.with_suffix("").parts if x.lower() not in {"src", "main", "webapp", "web-inf", "jsp", "views", "templates", "pages", "resources", "public", "app", "web"}] or [p.stem] - base = re.sub(r"[^A-Z0-9]+", "-", "-".join(parts[-3:]).upper()).strip("-") or "SCREEN" - name, n = base, 2 - while name in taken: - name, n = f"{base}-{n}", n + 1 - taken.add(name) - return name + for depth in (2, 3, len(parts)): # the last two names, and more only where two screens would share them + name = re.sub(r"[^A-Z0-9]+", "-", "-".join(parts[-depth:]).upper()).strip("-") or "SCREEN" + if name not in taken: + taken.add(name) + return name + base, n = name, 2 + while f"{base}-{n}" in taken: + n += 1 + taken.add(f"{base}-{n}") + return f"{base}-{n}" def batches(views: list[str], legacy: Path) -> list[list[str]]: @@ -207,6 +214,11 @@ def as_screen(rel: str, answer: dict[str, Any], sid: str, problems: list[str]) - JAVA_CLASS_ROUTE = re.compile(r"@(?:RequestMapping|Path|UrlBinding)\(\s*(?:value\s*=\s*|path\s*=\s*)?\"([^\"]*)\"") JAVA_METHOD_ROUTE = re.compile(r"@(?:GetMapping|PostMapping|PutMapping|DeleteMapping|PatchMapping|RequestMapping|Path)(?:\(\s*(?:value\s*=\s*|path\s*=\s*)?\"([^\"]*)\")?") RETURN_VIEW = re.compile(r"return\s+\"([^\":]+)\"\s*;") +RETURN_NAME = re.compile(r"return\s+([A-Z][A-Z0-9_]*)\s*;") # return LIST_ORDERS_VIEW; with the constant in the class (JPetStore) +CONSTANT = re.compile(r"\bstatic\s+final\s+String\s+(\w+)\s*=\s*\"([^\"]*)\"|\bfinal\s+static\s+String\s+(\w+)\s*=\s*\"([^\"]*)\"") +PAGE_ROUTE = re.compile(r"MapPageRoute\(\s*\"([^\"]*)\"\s*,\s*\"([^\"]*)\"\s*,\s*\"~?/?([^\"]+)\"") # ASP.NET Web Forms' route table +ROUTE_NAME = re.compile(r"<%\$\s*RouteUrl\s*:\s*RouteName\s*=\s*(\w+)|GetRouteUrl\(\s*\"(\w+)\"") +URL_ACTION = re.compile(r"Url\.Action\(\s*\"(\w+)\"(?:\s*,\s*\"(\w+)\")?") REDIRECT = re.compile(r"\"redirect:([^\"?]+)|RedirectToAction\(\s*\"(\w+)\"(?:\s*,\s*\"(\w+)\")?|header\(\s*'Location:\s*([^'?]+)|Location:\s*([^\"'?\s]+)") HREF = re.compile(r"\b(href|action)\s*=\s*[\"']([^\"'#]+)") ACTION_LINK = re.compile(r"Html\.ActionLink\(\s*\"[^\"]*\"\s*,\s*\"(\w+)\"(?:\s*,\s*\"(\w+)\")?") # (text, action[, controller]) @@ -214,7 +226,95 @@ def as_screen(rel: str, answer: dict[str, Any], sid: str, problems: list[str]) - CS_ACTION = re.compile(r"public\s+(?:async\s+)?(?:ActionResult|IActionResult|Task<\w+>|ViewResult)\s+(\w+)\s*\(") +# A view that other views include is a part of theirs, not a screen: a JSP include, a Razor partial or layout, a Web Forms +# master page or user control, a PHP include. Found with no model (L1-09: JPetStore's IncludeTop.jsp was read as a screen). +INCLUDE = re.compile(r"<%@\s*include\s+file\s*=\s*\"([^\"]+)\"|]*\bSrc\s*=\s*\"([^\"]+)\"" + r"|\b(?:include|require)(?:_once)?\s*\(?\s*['\"]([^'\"]+\.(?:php|inc|phtml))['\"]", re.I) + + +# Parts by their kind, by ASP.NET's own conventions: a Razor view named with a leading underscore (_Layout, _ViewStart, a +# partial), a master page and a user control are never pages (L1-09: eShop's _ViewStart and Site.Mobile.Master). +PART_BY_KIND = re.compile(r"(^|/)_[^/]*\.(cshtml|vbhtml)$|\.(master|ascx)$", re.I) + + +def _included(raw: str, where: str, files: list[str]) -> str | None: + """An include as written -> the view file it names: relative to the including file, from the root (`/`, `~/`), or by + its name (a Razor partial or layout named without its folder).""" + raw = raw.strip() + if not raw or "$" in raw or "<%" in raw: + return None + by_root = raw.lstrip("~").lstrip("/") + candidates = [(PurePosixPath(where).parent / raw).as_posix(), by_root] + for c in candidates: + parts: list[str] = [] + for p in c.split("/"): + if p == "..": + parts = parts[:-1] + elif p not in ("", "."): + parts.append(p) + joined = "/".join(parts).lower() + hit = next((f for f in files if f.lower() == joined or f.lower().endswith("/" + joined)), None) + if hit: + return hit + name = PurePosixPath(by_root).name.lower() + stem = PurePosixPath(name).stem if "." in name else name + named = [f for f in files if PurePosixPath(f).stem.lower() == stem and f != where] + return named[0] if len(named) == 1 else next((f for f in named if "/shared/" in f.lower()), None) + + +def includes(legacy: Path, files: list[str]) -> dict[str, list[str]]: + """Each view file -> the view files it includes, and a Razor `_ViewStart` layout for every view under its folder.""" + found: dict[str, list[str]] = defaultdict(list) + starts = {} + for rel in files: + for line in _lines(legacy, rel): + for m in INCLUDE.finditer(line): + to = _included(next(g for g in m.groups() if g), rel, files) + if to and to != rel and to not in found[rel]: + found[rel].append(to) + if PurePosixPath(rel).stem.lower() == "_viewstart": + starts[str(PurePosixPath(rel).parent)] = found.pop(rel, []) + for folder, layouts in starts.items(): + for rel in files: + if (folder == "." or rel.startswith(folder + "/")) and PurePosixPath(rel).stem.lower() != "_viewstart": + found[rel] += [x for x in layouts if x != rel and x not in found[rel]] + return {k: v for k, v in found.items() if v} + + +def fold_fragments(screens: list[dict[str, Any]], included: dict[str, list[str]], rendered: set[str]) -> dict[str, list[str]]: + """Fold each fragment (a view another view includes and no route renders) into the screens that include it: they get + its fields and actions, each marked with the fragment's file, and it is no longer a screen. Returns each fragment's + file and the screens it is part of. `screens` is changed in place.""" + by_file = {s["file"]: s for s in screens} + fragments = {f for parts in included.values() for f in parts if f in by_file and f not in rendered} + fragments |= {f for f in by_file if PART_BY_KIND.search(f) and f not in rendered} # a layout, partial or control even if nothing names it + def parts_of(rel: str, seen: frozenset[str] = frozenset()) -> list[str]: + out = [] + for f in included.get(rel, []): + if f in fragments and f not in seen: + out += [f] + parts_of(f, seen | {f}) + return list(dict.fromkeys(out)) + part_of: dict[str, list[str]] = defaultdict(list) + for s in screens: + if s["file"] in fragments: + continue + for f in parts_of(s["file"]): + part = by_file[f] + part_of[f].append(s["map"]) + s["fields"] += [{**x, "from": f} for x in part["fields"]] + have = {k["key"] for k in s["keys"]["shown"]} + s["keys"]["shown"] += [{**k, "from": f} for k in part["keys"]["shown"] if k["key"] not in have] + s["problems"] += [p for p in part["problems"] if p not in s["problems"]] + s["counts"] = {k: sum(1 for x in s["fields"] if x["kind"] == k) for k in ("input", "output", "label", "stopper")} + screens[:] = [s for s in screens if s["file"] not in fragments] + return {f: sorted(set(part_of.get(f, []))) for f in sorted(fragments)} + + def _clean(url: str) -> str: + if url.strip() in ("~", "~/"): # ASP.NET's application root + return "/" url = re.sub(r"\$\{[^}]*\}|<%=?[^%]*%>|@\{[^}]*\}|~", "", url.strip()) url = re.sub(r"/+", "/", url.split("?")[0].split("#")[0].strip()) return "/" + url.strip("/") if url else "" @@ -226,22 +326,33 @@ def routes(legacy: Path, files: list[str]) -> dict[str, dict[str, Any]]: for rel in files: lines = _lines(legacy, rel) suffix = PurePosixPath(rel).suffix.lower() + if suffix in (".cs", ".vb"): + for pr in PAGE_ROUTE.finditer("\n".join(lines)): # routes.MapPageRoute("Name", "Catalog/Edit/{id}", "~/Catalog/Edit.aspx") + project = PurePosixPath(rel).parent.parent if PurePosixPath(rel).parent.name == "App_Start" else PurePosixPath(rel).parent + page = next((f for f in files if f == (project / pr.group(3)).as_posix() or f.endswith("/" + pr.group(3))), pr.group(3)) + at = "\n".join(lines)[:pr.start()].count("\n") + 1 + found.setdefault("/" + pr.group(2).strip("/"), {"handler": page, "line": 1, "renders": [page], "redirects": [], "name": pr.group(1), + "declared": f"{rel}:{at}"}) if suffix in (".java", ".kt", ".groovy"): text = "\n".join(lines) + constants = {a or c: b if a else d for a, b, c, d in CONSTANT.findall(text)} base = "" cls = re.search(r"^\s*(?:public\s+)?(?:final\s+)?class\s", text, re.M) head = text[:cls.start()] if cls else "" - m = JAVA_CLASS_ROUTE.search(head) - if m: - base = _clean(m.group(1)) + top = JAVA_CLASS_ROUTE.search(head) + if top: + base = _clean(top.group(1)) for n, line in enumerate(lines, 1): mm = JAVA_METHOD_ROUTE.search(line) if mm and (not cls or n > text[:cls.start()].count("\n") + 1): route = _clean(base + "/" + (mm.group(1) or "")) or base or "/" - body = "\n".join(lines[n:n + 40]) - body = body.split("@GetMapping")[0].split("@PostMapping")[0].split("@RequestMapping")[0] + body = "\n".join(lines[n:n + 400]) # the method, up to the next mapping + body = re.split(r"@(?:Get|Post|Put|Delete|Patch|Request)Mapping\b|@Path\b", body)[0] found.setdefault(route, {"handler": rel, "line": n, "renders": [], "redirects": []}) - found[route]["renders"] += [v for v in RETURN_VIEW.findall(body)] + named = RETURN_NAME.findall(body) + found[route]["renders"] += [v for v in RETURN_VIEW.findall(body)] + [ + constants[k] for k in named if k in constants and not constants[k].startswith("redirect:")] + found[route]["redirects"] += [_clean(constants[k][len("redirect:"):]) for k in named if constants.get(k, "").startswith("redirect:")] found[route]["redirects"] += [_clean(r[0]) for r in REDIRECT.findall(body) if r[0]] elif suffix in (".cs", ".vb") and re.search(r"Controller\.(cs|vb)$", rel): controller = re.sub(r"Controller\.(cs|vb)$", "", PurePosixPath(rel).name) @@ -262,9 +373,11 @@ def routes(legacy: Path, files: list[str]) -> dict[str, dict[str, Any]]: found[route]["redirects"] += redirects if action == "Index": found.setdefault(f"/{controller}", found[route]) - elif suffix in (".php", ".asp", ".pl", ".cgi", ".rb", ".py") or (suffix in (".jsp", ".html", ".htm") and "WEB-INF/" not in rel): # a page at its own path + elif suffix in (".php", ".asp", ".pl", ".cgi", ".rb", ".py", ".aspx") or (suffix in (".jsp", ".html", ".htm") and "WEB-INF/" not in rel): # a page at its own path redirects = [_clean(r[3] or r[4]) for r in REDIRECT.findall("\n".join(lines)) if (r[3] or r[4])] found.setdefault("/" + rel, {"handler": rel, "line": 1, "renders": [rel] if suffix != ".py" else [], "redirects": redirects}) + if PurePosixPath(rel).name.lower() == "default.aspx": # ~ is the application's root, and Default.aspx its default page + found.setdefault("/", found["/" + rel]) return found @@ -306,9 +419,14 @@ def read_flow(folder, claude, legacy: Path, screens: dict[str, Any], stack: dict unsettled: list[dict[str, Any]] = [] keys: list[dict[str, Any]] = [] + lower = {k.lower(): k for k in table} # ASP.NET matches routes in any case + named = {v["name"]: k for k, v in table.items() if v.get("name")} + def target_of(raw: str, where: str) -> str | None: """A link as written -> a route Reframe knows, or a view file.""" url = _clean(raw) + if url.lower() in lower: + return lower[url.lower()] relative = "/" + (PurePosixPath(where).parent / raw.split("?")[0]).as_posix().lstrip("/") if raw and not raw.startswith("/") else url for candidate in (url, relative): if candidate in table: @@ -335,8 +453,15 @@ def target_of(raw: str, where: str) -> str | None: rel = s["file"] targets: dict[str, list[str]] = defaultdict(list) for n, line in enumerate(_lines(legacy, rel), 1): + helpers = [(m.group(1), m.group(2)) for m in URL_ACTION.finditer(line)] + [(m.group(1) or m.group(2), None) for m in ROUTE_NAME.finditer(line)] found = [("form" if kind == "action" else "href", raw) for kind, raw in HREF.findall(line) - if not raw.startswith(("http:", "https:", "mailto:", "javascript:")) and not re.search(r"\.(css|js|png|jpe?g|gif|svg|ico)$", raw)] + if not raw.startswith(("http:", "https:", "mailto:", "javascript:")) and not re.search(r"\.(css|js|png|jpe?g|gif|svg|ico)$", raw) + and not (helpers and raw.lstrip().startswith(("@", "<%")))] # a helper's link is read from the helper, below + for m in URL_ACTION.finditer(line): + found.append(("href", f"/{m.group(2) or PurePosixPath(rel).parent.name}/{m.group(1)}")) + for m in ROUTE_NAME.finditer(line): + if (m.group(1) or m.group(2)) in named: + found.append(("href", named[m.group(1) or m.group(2)])) for kind, pattern in (("href", ACTION_LINK), ("form", BEGIN_FORM)): for m in pattern.finditer(line): found.append((kind, f"/{m.group(2) or PurePosixPath(rel).parent.name}/{m.group(1)}")) @@ -354,6 +479,17 @@ def target_of(raw: str, where: str) -> str | None: keys.append({"screen": s["map"], "key": k["key"], "to": sorted(set(leads))}) resolved, unresolved = settle(folder, claude, legacy, unsettled, views, table, stack, plan_only) links += resolved + rendered = {x["to"] for x in links if x["kind"] == "renders"} + fragments = fold_fragments(screens["screens"], includes(legacy, sorted(views)), rendered) + screens["fragments"] = fragments + for rel, parents in fragments.items(): # a fragment's links and actions are those of every screen it is part of + sid = views[rel] + screens_of[rel] = set(parents) + for other in screens_of.values(): + if sid in other: + other.discard(sid) + other |= set(parents) + keys = [k for k in keys if k["screen"] != sid] + [{**k, "screen": p, "from": rel} for k in keys if k["screen"] == sid for p in parents] for s in screens["screens"]: # the code behind a screen: the handlers that render it and what they use handlers = sorted({table[x["from"]]["handler"] for x in links if x["kind"] == "renders" and x["to"] == s["file"] and x["from"] in table} | {table[x["to"]]["handler"] for x in links if x["kind"] == "form" and x["from"] == s["file"] and x["to"] in table}) @@ -363,7 +499,7 @@ def target_of(raw: str, where: str) -> str | None: entries = {sid for r in ("/", "/index.php", "/index.html", "/index.jsp") for sid in screens_of.get(r, set())} reach = [{"screen": s["map"], "reached": "navigated" if s["map"] in reached else "entry" if s["map"] in entries else "unreached"} for s in screens["screens"]] - return {"reader": "general", "links": links, "keys": keys, "reach": reach, "unresolved": unresolved, "transactions": [], + return {"reader": "general", "links": links, "keys": keys, "reach": reach, "unresolved": unresolved, "transactions": [], "fragments": fragments, "routes": {k: {"handler": v["handler"], "line": v["line"]} for k, v in sorted(table.items())}, "screens_of_programs": {k: sorted(v) for k, v in screens_of.items() if v}, "counts": {"by_pattern": sum(1 for x in links if x.get("how") == "pattern"), "by_model": sum(1 for x in links if x.get("how") == "model"), diff --git a/src/reframe/design/golden.py b/src/reframe/design/golden.py index ac3f0a01..a7553f11 100644 --- a/src/reframe/design/golden.py +++ b/src/reframe/design/golden.py @@ -162,7 +162,7 @@ def readme(datasets: list[dict[str, Any]]) -> str: "`uncovered` lists the input combinations a decision table leaves to no rule: each is a question for the owner, not a case.", "", "## Running them", "", "Run each case's input through the target on your stack, record what the system answered by case ID, then compare:", "", - "```bash", "python golden/compare.py golden/.json actual.json --report report.json", "```", "", + "```bash", "python3 golden/compare.py golden/.json actual.json --report report.json", "```", "", "`actual.json` maps each case ID to `{\"text\": \"\", \"values\": {\"\": \"\"}}`. " "A quoted message must appear word for word, and money, dates, status codes, IDs and counts must have the same value. " "A difference only in how something is written (padding, case, spacing, an amount's or a date's layout) is reported as *formatting*, " diff --git a/src/reframe/design/golden_compare.py b/src/reframe/design/golden_compare.py index 762c0186..e4a20c42 100644 --- a/src/reframe/design/golden_compare.py +++ b/src/reframe/design/golden_compare.py @@ -3,7 +3,7 @@ This file is copied as it is into the package (golden/compare.py), so it uses the Python standard library only and imports nothing from Reframe. Run it on the stack you build with, or port it. - python compare.py golden/.json actual.json [--report report.json] + python3 compare.py golden/.json actual.json [--report report.json] actual.json holds what the new system answered for each case, by case ID: @@ -90,12 +90,21 @@ def compare_value(expected: Any, actual: Any, kind: str) -> str: return FORMATTING if _plain(e) == _plain(a) else BUSINESS +PLACEHOLDER = re.compile(r"(<[A-Za-z][\w ]{0,30}>)") + + def compare_literal(literal: str, text: str | None) -> str: """A message or code the rule quotes, looked for in what the system showed.""" if text is None: return MISSING if literal in text: return MATCH + if PLACEHOLDER.search(literal): # 'Added to your cart.': the rule quotes a message with a value in it + pattern = "".join(".+?" if PLACEHOLDER.fullmatch(part) else re.escape(part) for part in PLACEHOLDER.split(literal)) + if re.search(pattern, text, re.S): + return MATCH + plain = "".join(".+?" if PLACEHOLDER.fullmatch(part) else re.escape(_plain(part)) for part in PLACEHOLDER.split(literal)) + return FORMATTING if re.search(plain, _plain(text), re.S) else BUSINESS return FORMATTING if _plain(literal) in _plain(text) else BUSINESS diff --git a/src/reframe/design/handover.py b/src/reframe/design/handover.py index 2e026f21..a098da3d 100644 --- a/src/reframe/design/handover.py +++ b/src/reframe/design/handover.py @@ -10,7 +10,8 @@ START-HERE.md, in the package and in each form, takes the engineer through it: copy the package, give the stack, fill the placeholders, settle what is still open (draft capabilities, SME questions, decision table gaps, historical -artifacts), check what is left (`--check`), prove it by building *Sign in*, then build final capabilities first. +artifacts), check what is left (`--check`), prove it by building the slice behind the screen most journeys start on (on +CardDemo, *Sign in*), then build final capabilities first. """ from __future__ import annotations @@ -91,7 +92,7 @@ def role_fill(role: str) -> list[str]: SKILLS = { "build-capability": ("Build one capability of the modernized application from its specification and tasks, keeping every ID.", [ "1. Read the capability's specification ({specs}) and its tasks ({tasks}). Check its status: a draft is confirmed with the owner first.", - "2. Do the tasks in order, each by its role (the role files are in .claude/agents/ in the Spec Kit form; the guardrails are in the conventions).", + "2. Do the tasks in order, each by its role (the role files are in .claude/agents/; the guardrails are in the conventions).", "3. Name each requirement and rule ID where it is implemented, and each acceptance criterion's ID in its test.", "4. Build: `{build}`. Run the tests: `{test}`.", "5. Report the IDs implemented, the criteria that pass, and anything that could not be done and why."]), @@ -129,14 +130,18 @@ def facts(specs: list[dict[str, Any]], journeys: list[dict[str, Any]], programs: screen most journeys start on (the sign-on). `programs` is each legacy screen's programs, from the inventory.""" starts = Counter(j["steps"][0]["screen"] for j in journeys if j.get("steps")) first = starts.most_common(1)[0][0] if starts else "" + journey = next((str(j.get("name") or "") for j in journeys if j.get("steps") and j["steps"][0]["screen"] == first), "") behind = {p.upper() for p in programs.get(first) or []} proof = [s for s in specs if behind & {str(r.get("program", "")).upper() for r in s["rules"]}] + if not proof and first: # no rule's program is behind the screen (a service reached through an interface, L1-09): + starting = {j.get("id") for j in journeys if j.get("steps") and j["steps"][0]["screen"] == first} # the capabilities of its journeys + proof = [s for s in specs if starting & set(s.get("journeys") or [])] drafts = Counter(s["function_name"] for s in specs if s["status"] == "draft") return {"drafts": dict(drafts), "draft_count": sum(drafts.values()), "final_count": sum(1 for s in specs if s["status"] == "final"), "questions": len({q["id"] or q["question"] for s in specs for q in s["questions"]}), "gaps": sum(len(t.get("gaps") or []) for s in specs for t in s["tables"]), "artifacts": sorted({s["rule_ids"][r["key"]] for s in specs for r in s["rules"] if r["class"] == "historical artifact"}), - "first_screen": first, "proof": [{"id": s["id"], "title": s["title"], "criteria": len(s["acceptance"]), "folder": s["folder"], "status": s["status"]} for s in proof]} + "first_screen": first, "first_journey": journey, "proof": [{"id": s["id"], "title": s["title"], "criteria": len(s["acceptance"]), "folder": s["folder"], "status": s["status"]} for s in proof]} WHERE = { @@ -150,7 +155,7 @@ def facts(specs: list[dict[str, Any]], journeys: list[dict[str, Any]], programs: def start_here(f: dict[str, Any], project: str, stack: dict[str, Any] | None, form: str | None, legacy: str = "") -> str: where = WHERE[form] if form else "\n\n".join(f"**{k}**\n\n{v}" for k, v in WHERE.items()) + "\n" drafts = "\n".join(f" - {name}: {n} draft" for name, n in sorted(f["drafts"].items())) or " - None." - proof = "\n".join(f" - {p['id']} {p['title']} ({p['criteria']} acceptance criteria; {p['status']}" + proof = "\n".join(f" - {p['id']} {p['title']} ({p['criteria']} acceptance criteri{'on' if p['criteria'] == 1 else 'a'}; {p['status']}" + (": confirm it with the owner first, or sign off its function" if p["status"] == "draft" else "") + ")" for p in f["proof"]) or " - The capabilities of your first journey." artifacts = ", ".join(f["artifacts"]) or "none" return f"""# Start here @@ -198,9 +203,10 @@ def start_here(f: dict[str, Any], project: str, stack: dict[str, Any] | None, fo `python -m reframe.design.package --check ` lists every `[FILL IN: ...]` still there and the draft capabilities. It is ready when no placeholder is left and the capabilities you are building are final. -## 6. Prove it: build Sign in +## 6. Prove it: build {f.get("first_journey") or "the first slice"} -In a scratch repository, with the Claude Code form and the stack filled in, ask Claude Code to build the sign-in slice: +In a scratch repository, with the Claude Code form and the stack filled in, ask Claude Code to build the slice behind the screen most journeys +start on{" (" + f["first_screen"] + ")" if f.get("first_screen") else ""}: {proof} Use the `build-capability` and `write-acceptance-tests` skills. Record whether it builds and which acceptance criteria pass, by ID, then run diff --git a/src/reframe/design/package.py b/src/reframe/design/package.py index cb5a6989..9d181ff6 100644 --- a/src/reframe/design/package.py +++ b/src/reframe/design/package.py @@ -285,6 +285,17 @@ def contracts_md(s: dict[str, Any], books: dict[str, Any]) -> str: def contract_md(c: dict[str, Any], note: str = "") -> str: out = [f"#### {c['copybook']}\n\n{note} Source: `{c['file']}`.\n" if note else f"#### {c['copybook']}\n\nSource: `{c['file']}`.\n"] + if c.get("kind") in ("table", "entity"): # any stack but the mainframe: the declared type and the keys, not a PIC + for r in c["records"]: + out.append(f"{'Table' if c['kind'] == 'table' else 'Entity'} `{r['name']}`:\n\n| {'Column' if c['kind'] == 'table' else 'Field'} | Key | " + f"Declared as | Type | Code type | Column type | Values |\n|---|---|---|---|---|---|---|") + for f in r["fields"]: + declared = f["pic"] + (" " + f["usage"] if f.get("usage") else "") + values = "; ".join(f"{x['name']} = {x['value']}" for x in f.get("conditions") or []) + out.append(f"| {f['name']} | {md(f.get('key', ''))} | {md(declared)} | {md(f['says'])} | " + f"{md((f.get('stack') or {}).get('code', ''))} | {md((f.get('stack') or {}).get('column', ''))} | {md(values)} |") + out.append("") + return "\n".join(out) for r in c["records"]: out.append(f"Record `{r['name']}`:\n\n| Field | In | PIC | Type | Code type | Column type | Values |\n|---|---|---|---|---|---|---|") for f in r["fields"]: @@ -575,6 +586,7 @@ def write(root: Path, specs: list[dict[str, Any]], books: dict[str, Any], stack: "## House conventions", "", handover.house(context.get("style", "")), "", "## Conventions", ""] + conventions()) + "\n" for role in ROLES: files[f"spec-kit/.claude/agents/{role}.md"] = role_md(role) + files[f"claude-code/.claude/agents/{role}.md"] = role_md(role) for n, s in enumerate(specs, 1): base = f"spec-kit/specs/{n:03d}-{s['folder']}" files[f"{base}/spec.md"] = speckit_spec(s) diff --git a/src/reframe/design/prototype.html b/src/reframe/design/prototype.html index a243bf7f..b2942c64 100644 --- a/src/reframe/design/prototype.html +++ b/src/reframe/design/prototype.html @@ -51,8 +51,18 @@ const esc = s => String(s == null ? '' : s).replace(/[&<>"']/g, c => ({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c])); const byId = Object.fromEntries(D.screens.map(s => [s.id, s])); let marks = {}, signoffs = {}, reviewer = ''; -try { marks = JSON.parse(localStorage.getItem('reframe-design-marks') || '{}'); signoffs = JSON.parse(localStorage.getItem('reframe-design-signoffs') || '{}'); reviewer = localStorage.getItem('reframe-reviewer') || ''; } catch (e) {} -const save = () => { try { localStorage.setItem('reframe-design-marks', JSON.stringify(marks)); localStorage.setItem('reframe-design-signoffs', JSON.stringify(signoffs)); } catch (e) {} }; +// Marks are kept in this browser per project, run and source, as the review pages keep theirs: two prototypes opened from +// files share the browser's storage, so a fixed key mixed their marks (L1-09). Marks under the old fixed key are kept only +// when every one names a screen of this prototype. +const STORE = 'reframe-design:' + (D.project || '') + ':' + (D.run || '') + ':' + String((D.source || {}).sha256 || '').slice(0, 16); +const ours = m => Object.keys(m).every(k => byId[k.split('/')[1]]); +try { + marks = JSON.parse(localStorage.getItem(STORE + ':marks') || 'null'); signoffs = JSON.parse(localStorage.getItem(STORE + ':signoffs') || 'null'); + if (marks === null) { const old = JSON.parse(localStorage.getItem('reframe-design-marks') || '{}'); marks = ours(old) ? old : {}; } + if (signoffs === null) { const old = JSON.parse(localStorage.getItem('reframe-design-signoffs') || '{}'); signoffs = ours(marks) && Object.keys(marks).length ? old : {}; } + reviewer = localStorage.getItem('reframe-reviewer') || ''; +} catch (e) { marks = marks || {}; signoffs = signoffs || {}; } +const save = () => { try { localStorage.setItem(STORE + ':marks', JSON.stringify(marks)); localStorage.setItem(STORE + ':signoffs', JSON.stringify(signoffs)); } catch (e) {} }; const STATUS = {agree: 'Agree', change: 'Needs change', question: 'Question'}; $('app').textContent = D.app; diff --git a/src/reframe/design/schema.py b/src/reframe/design/schema.py index 3a4a54e6..a5a7cd35 100644 --- a/src/reframe/design/schema.py +++ b/src/reframe/design/schema.py @@ -65,7 +65,8 @@ def sql_type(written: str) -> dict[str, Any]: return {"type": "text", "length": a, "storage": "characters", "bytes": a} if name in ("SMALLINT", "INT", "INTEGER", "BIGINT", "TINYINT", "MEDIUMINT", "SERIAL", "BIGSERIAL"): digits = {"TINYINT": 3, "SMALLINT": 5, "MEDIUMINT": 7, "BIGINT": 19, "BIGSERIAL": 19}.get(name, 10) - return {"type": "integer", "digits": digits, "scale": 0, "signed": True, "storage": "binary", "bytes": 8 if digits > 10 else 4} + bits = {"TINYINT": 8, "SMALLINT": 16, "MEDIUMINT": 24, "BIGINT": 64, "BIGSERIAL": 64}.get(name, 32) + return {"type": "integer", "digits": digits, "scale": 0, "signed": True, "storage": "binary", "bytes": bits // 8 if bits > 8 else 1, "bits": bits} if name in ("DECIMAL", "NUMERIC", "DEC", "NUMBER", "MONEY"): return {"type": "decimal" if b else "integer", "digits": a or 18, "scale": b, "signed": True, "storage": "decimal", "bytes": 0} if name in ("FLOAT", "REAL", "DOUBLE", "DOUBLE PRECISION"): @@ -87,6 +88,8 @@ def from_answer(f: dict[str, Any]) -> dict[str, Any]: kind = f.get("neutral") or "unknown" if kind == "text": return {"type": "text", "length": int(f.get("length") or 0), "storage": "characters", "bytes": int(f.get("length") or 0)} + if kind == "decimal" and not f.get("digits") and f.get("scale") in (None, ""): # a C# decimal, a BigDecimal: no precision declared + return {"type": "decimal", "digits": 0, "scale": 0, "signed": True, "storage": "decimal", "bytes": 0, "declared": False} if kind in ("integer", "decimal"): return {"type": kind, "digits": int(f.get("digits") or (18 if kind == "decimal" else 10)), "scale": int(f.get("scale") or 0), "signed": True, "storage": "decimal" if kind == "decimal" else "binary", "bytes": 0} @@ -100,6 +103,8 @@ def says(t: dict[str, Any]) -> str: kind = t.get("type") if kind == "text": return f"text, {t['length']} characters" if t.get("length") else "text" + if kind == "decimal" and t.get("declared") is False: + return "decimal, its precision and scale not declared in the code" if kind in ("integer", "decimal") and t.get("storage") in ("binary", "decimal"): return (f"integer, {t['digits']} digits" if kind == "integer" else f"decimal, {t['digits'] - t['scale']} integer and {t['scale']} fraction digits") return {"date": "date", "timestamp": "date and time", "time": "time of day", "boolean": "true or false", "binary": "binary data", @@ -283,6 +288,20 @@ def entities(folder, claude, legacy: Path, files: list[str], words: str, types: # ---- all of it --------------------------------------------------------------------------------------------------------- +DBSET = re.compile(r"\b(?:I?DbSet|DbSet\(Of)\s*?\)?") + + +def named_entities(legacy: Path, code: list[str]) -> list[str]: + """The entity classes a data context names (Entity Framework's `DbSet`), in the codebase's own files: a + context configures only some of their properties, and the class declares them all.""" + from reframe.source import profile + names = {n for rel in code for n in DBSET.findall("\n".join(_lines(legacy, rel)))} + if not names: + return [] + return sorted(p.relative_to(legacy).as_posix() for p in legacy.rglob("*") if p.is_file() and p.suffix.lower() in CODE and p.stem in names + and p.relative_to(legacy).as_posix() not in code and not profile.is_library(p.relative_to(legacy).as_posix())) + + def read(folder, claude, legacy: Path, stack: dict[str, Any], types: dict[str, Any]) -> dict[str, Any]: """Every contract of a codebase that is not a mainframe: its tables, with no model, and its entities, by a checked step.""" from reframe.source import profile @@ -293,13 +312,20 @@ def read(folder, claude, legacy: Path, stack: dict[str, Any], types: dict[str, A for c in tables((legacy / rel).read_text(errors="replace"), rel, types): found.setdefault(c["copybook"], c) code = [rel for rel in data_files if PurePosixPath(rel).suffix.lower() in CODE] + code += named_entities(legacy, code) made, left = entities(folder, claude, legacy, code, stack["words"]["languages"], types) for c in made: - name = c["copybook"] if c["copybook"] not in found else f"{c['copybook']}-ENTITY" + name, n = c["copybook"], 1 + while name in found: # the same name in two applications or files: each is kept + n += 1 + name = f"{c['copybook']}-ENTITY" + (f"-{n - 1}" if n > 2 else "") found[name] = {**c, "copybook": name} return {"contracts": found, "problems": left} +SQL_USE = re.compile(r"\b(?:SELECT\b[\s\S]{0,400}?\bFROM|INSERT\s+INTO|UPDATE\s+\w+\s+SET|DELETE\s+FROM)\b", re.I) + + def uses(legacy: Path, contracts: dict[str, dict[str, Any]]) -> dict[str, dict[str, str]]: """For each source file (the program, L1-02), the contracts its code names: a table by its name, an entity by its class.""" from reframe.source import kinds, profile @@ -309,9 +335,12 @@ def uses(legacy: Path, contracts: dict[str, dict[str, Any]]) -> dict[str, dict[s if not p.is_file(): continue rel = p.relative_to(legacy).as_posix() - if profile.is_library(rel) or profile.language(rel, kinds.read_head(p)) in (None, "SQL"): + language = profile.language(rel, kinds.read_head(p)) + if profile.is_library(rel) or language == "SQL": continue text = p.read_text(errors="replace") + if language is None and not SQL_USE.search(text): # a mapper's XML, a query file: they name the tables they use + continue mine = {name: ("table" if c["kind"] == "table" else "entity") for name, c in contracts.items() if c["file"] != rel and any(re.search(rf"\b{re.escape(w)}\b", text, re.I if c["kind"] == "table" else 0) for w in words[name])} mine.update({name: "entity" for name, c in contracts.items() if c["file"] == rel}) diff --git a/src/reframe/design/specs.py b/src/reframe/design/specs.py index db6207dc..d27c6a9e 100644 --- a/src/reframe/design/specs.py +++ b/src/reframe/design/specs.py @@ -165,7 +165,10 @@ def event_of(rule: dict[str, Any]) -> str: def given_of(example: dict[str, Any]) -> str: - given = [f"{g.get('field', '')}: {g.get('value', '')}" for g in example.get("given") or []] + def value(v: Any) -> str: + v = str(v if v is not None else "") + return f'"{v}"' if v != v.strip() or not v else v + given = [f"{g.get('field', '')}: {value(g.get('value', ''))}" for g in example.get("given") or []] return "; ".join(given) if given else "no particular input" @@ -294,11 +297,13 @@ def assemble(folder, legacy: Path | None, signoffs: list[dict[str, Any]] | None {str(t.get("program", "")).upper() for t in flow.get("transactions") or []} jobs: set[str] | None = None routes: set[str] | None = None + written: dict[str, str] = {} if contracts is not None: # any stack but the mainframe (L1-06): the tables and entities each source file names from reframe.design import schema uses = schema.uses(legacy, contracts) if legacy and legacy.is_dir() else {} if legacy and legacy.is_dir(): jobs, routes = what_runs(legacy) + written = {p.relative_to(legacy).as_posix().upper(): p.relative_to(legacy).as_posix() for p in legacy.rglob("*") if p.is_file()} else: uses = data_contracts.uses(legacy) if legacy and legacy.is_dir() else {} domain_of = {f: d for d in requirements.get("domains") or [] for f in d.get("functions") or []} @@ -320,11 +325,13 @@ def assemble(folder, legacy: Path | None, signoffs: list[dict[str, Any]] | None # split into specified and context screens, so a saved answer still fits titles = [x.get("title", "") for x in modern.get("screens") or [] if x["id"] in shown] programs = sorted({str(r.get("program", "")).upper() for r in mine if r.get("program")}) + if contracts is not None: # the files the rules cite: a mapper's SQL names the tables a controller's rule reads (L1-09) + programs += sorted({str(e).split(":")[0].upper() for r in mine for e in r.get("evidence") or []} - set(programs)) books: dict[str, dict[str, Any]] = {} for p in programs: for b, role in (uses.get(p) or {}).items(): entry = books.setdefault(b, {"copybook": b, "role": role, "programs": []}) - entry["programs"].append(p) + entry["programs"].append(written.get(p, p)) if role in PERSISTENT: entry["role"] = role criteria = example_criteria(reqs, rules) diff --git a/src/reframe/source/profile.py b/src/reframe/source/profile.py index 78d06b2a..f88bdf7d 100644 --- a/src/reframe/source/profile.py +++ b/src/reframe/source/profile.py @@ -55,7 +55,16 @@ SHARED = {".inc", ".h", ".prc"} # extensions more than one stack uses: classed by content SKIPPED_FOLDERS = {"node_modules", "bower_components", "vendor", "packages", "third_party", "thirdparty", ".git", ".svn", ".idea", - ".vscode", "target", "bin", "obj", "dist", "build", ".gradle", "__pycache__"} + ".vscode", "target", "bin", "obj", "dist", "build", ".gradle", "__pycache__", "umd", "esm"} +# Libraries a web application keeps beside its own scripts, by name (found on eShopModernizing, L1-09): jQuery and its plugins, +# Bootstrap, Modernizr, Popper, Respond and the like, their Visual Studio IntelliSense files and type definitions, ASP.NET's +# own WebForms scripts, and the `lib` folder of wwwroot. +LIBRARY_FILES = re.compile(r"^(jquery|bootstrap|modernizr|popper|respond|knockout|angular|react|react-dom|vue|lodash|underscore|moment|" + r"require|backbone|handlebars|mustache|toastr|select2|signalr|_references)([.\-_].*)?\.(js|ts|css)$" + r"|(-vsdoc|\.intellisense)\.js$|\.d\.ts$", re.I) +LIBRARY_PATHS = re.compile(r"(^|/)(Scripts/WebForms|wwwroot/lib)/", re.I) +BUILD_WRAPPERS = re.compile(r"(^|/)(mvnw|gradlew|build|restore|setup|install|clean|publish)\.(cmd|bat)$", re.I) +"""Batch files that build or install the code, not jobs of the system.""" LANGUAGE_FAMILY = {lang: family for lang, family in OTHER.values()} | {lang: "mainframe" for lang in MAINFRAME_LANGUAGES.values()} \ | {"Natural": "4gl", "PHP": "web-script", "C": "native", "C++": "native", "JCL": "mainframe", "SQL": "data"} @@ -86,7 +95,8 @@ def is_library(name: str) -> bool: parts = PurePosixPath(name).parts - return any(p in SKIPPED_FOLDERS for p in parts[:-1]) or bool(re.search(r"\.min\.(js|css)$", name)) or parts[-1].startswith(".") + return (any(p in SKIPPED_FOLDERS for p in parts[:-1]) or bool(re.search(r"\.min\.(js|css)$", name)) or parts[-1].startswith(".") + or bool(LIBRARY_FILES.search(parts[-1])) or bool(LIBRARY_PATHS.search(name))) def language(name: str, head: bytes) -> str | None: @@ -127,6 +137,8 @@ def family_of(lines: dict[str, int]) -> str: def _matches(rules: list[tuple[str, str | None]], name: str, text: str) -> bool: + if rules is JOBS and BUILD_WRAPPERS.search(name): + return False for path_pattern, content_pattern in rules: if re.search(path_pattern, name, re.I) and (content_pattern is None or re.search(content_pattern, text)): return True diff --git a/tests/design/test_general.py b/tests/design/test_general.py index 740ac1dd..907f1a37 100644 --- a/tests/design/test_general.py +++ b/tests/design/test_general.py @@ -134,7 +134,7 @@ def test_java_links_by_pattern_with_no_model(self): def test_dotnet_by_its_conventions(self): found, linked = self.run_for("dotnet") - self.assertEqual(sorted(s["map"] for s in found["screens"]), ["SHOP-ORDERS-CREATE", "SHOP-ORDERS-INDEX"]) + self.assertEqual(sorted(s["map"] for s in found["screens"]), ["ORDERS-CREATE", "ORDERS-INDEX"]) links = {(x["kind"], x["from"], x["to"]) for x in linked["links"]} self.assertIn(("renders", "/Orders/Index", "Shop/Views/Orders/Index.cshtml"), links) # View() renders Views/Orders/Index self.assertIn(("href", "Shop/Views/Orders/Index.cshtml", "/Orders/Create"), links) # Html.ActionLink("New order", "Create") @@ -181,6 +181,118 @@ def reader(data): self.assertEqual(linked["counts"]["by_model"], 1) +class PatternsFoundLiveTest(unittest.TestCase): + """Link patterns found on JPetStore 6 and eShopModernizing (L1-09), each settled with no model.""" + + def flow(self, files): + root = stacks.write(Path(tempfile.mkdtemp()), files) + self.addCleanup(lambda: __import__("shutil").rmtree(root, ignore_errors=True)) + stack = profile.profile_folder(root) + taken = set() + views = profile.files_with(root, "ui") + screens = {"screens": [general.as_screen(v, {"title": v, "fields": [], "actions": []}, general.screen_id(v, taken), []) for v in views]} + return general.read_flow(None, None, root, screens, stack, plan_only=True), root + + def test_a_view_returned_through_a_constant_from_a_long_method(self): + filler = "\n".join(f" int step{n} = {n};" for n in range(60)) + found, root = self.flow({ + "src/main/java/demo/web/OrderController.java": "package demo.web;\n@Controller\n@RequestMapping(\"/order\")\npublic class OrderController {\n" + " private static final String CONFIRM_VIEW = \"order/ConfirmOrder\";\n @PostMapping(\"/new\")\n public String create() {\n" + + filler + "\n return CONFIRM_VIEW;\n }\n}\n", + "src/main/webapp/WEB-INF/jsp/order/ConfirmOrder.jsp": "
\n"}) + self.assertIn(("renders", "/order/new", "src/main/webapp/WEB-INF/jsp/order/ConfirmOrder.jsp"), + {(x["kind"], x["from"], x["to"]) for x in found["links"]}) + + def test_web_forms_routes_by_name_the_application_root_and_url_action(self): + found, root = self.flow({ + "Shop/App_Start/RouteConfig.cs": "public class RouteConfig {\n public static void Register(RouteCollection routes) {\n" + " routes.MapPageRoute(\"EditProductRoute\", \"Catalog/Edit/{id}\", \"~/Catalog/Edit.aspx\");\n }\n}\n", + "Shop/Default.aspx": "
Edit
\n", + "Shop/Catalog/Edit.aspx": "
Back
\n", + "Mvc/Controllers/CatalogController.cs": "public class CatalogController : Controller {\n public ActionResult Index() {\n return View();\n }\n}\n", + "Mvc/Views/Catalog/Index.cshtml": "Home\n
\n"}) + links = {(x["kind"], x["from"], x["to"]) for x in found["links"]} + self.assertIn(("href", "Shop/Default.aspx", "/Catalog/Edit/{id}"), links) # GetRouteUrl by the route's name + self.assertIn(("renders", "/Catalog/Edit/{id}", "Shop/Catalog/Edit.aspx"), links) + self.assertIn(("href", "Shop/Catalog/Edit.aspx", "/"), links) # ~ is the application's root, Default.aspx + self.assertIn(("href", "Mvc/Views/Catalog/Index.cshtml", "/Catalog/Index"), links) # Url.Action, matched in any case + self.assertEqual(found["unresolved"], []) + self.assertEqual(general.check(found, root), []) + + def test_an_included_header_is_part_of_each_page_not_a_screen(self): + jsp = "src/main/webapp/WEB-INF/jsp/" + files = { + "src/main/java/demo/web/CatalogController.java": "package demo.web;\n@Controller\n@RequestMapping(\"/catalog\")\npublic class CatalogController {\n" + " @GetMapping(\"\")\n public String home() {\n return \"catalog/Main\";\n }\n}\n", + "src/main/java/demo/web/AccountController.java": "package demo.web;\n@Controller\n@RequestMapping(\"/account\")\npublic class AccountController {\n" + " @GetMapping(\"/new\")\n public String form() {\n return \"account/NewAccountForm\";\n }\n}\n", + jsp + "common/IncludeTop.jsp": "\n", + jsp + "catalog/Main.jsp": "<%@ include file=\"../common/IncludeTop.jsp\"%>\n

Pick a category

\n", + jsp + "account/IncludeAccountFields.jsp": "\n", + jsp + "account/NewAccountForm.jsp": "<%@ include file=\"../common/IncludeTop.jsp\"%>\n
\n" + "<%@ include file=\"IncludeAccountFields.jsp\"%>\n
\n"} + root = stacks.write(Path(tempfile.mkdtemp()), files) + self.addCleanup(lambda: __import__("shutil").rmtree(root, ignore_errors=True)) + views = profile.files_with(root, "ui") + self.assertEqual(general.includes(root, views), {jsp + "catalog/Main.jsp": [jsp + "common/IncludeTop.jsp"], + jsp + "account/NewAccountForm.jsp": [jsp + "common/IncludeTop.jsp", jsp + "account/IncludeAccountFields.jsp"]}) + taken: set[str] = set() + answers = {jsp + "common/IncludeTop.jsp": {"title": "Header", "fields": [], "actions": [{"label": "Register", "kind": "link", "target": "/account/new", "line": 3}]}, + jsp + "account/IncludeAccountFields.jsp": {"title": "Fields", "fields": [{"name": "firstName", "kind": "input", "line": 1}], "actions": []}} + screens = {"screens": [general.as_screen(v, answers.get(v, {"title": v, "fields": [], "actions": []}), general.screen_id(v, taken), []) for v in views]} + found = general.read_flow(None, None, root, screens, profile.profile_folder(root), plan_only=True) + self.assertEqual(sorted(s["map"] for s in screens["screens"]), ["ACCOUNT-NEWACCOUNTFORM", "CATALOG"]) # no screen for a fragment + self.assertEqual(found["fragments"], {jsp + "account/IncludeAccountFields.jsp": ["ACCOUNT-NEWACCOUNTFORM"], + jsp + "common/IncludeTop.jsp": ["ACCOUNT-NEWACCOUNTFORM", "CATALOG"]}) + form = next(s for s in screens["screens"] if s["map"] == "ACCOUNT-NEWACCOUNTFORM") + self.assertEqual([(f["name"], f["from"]) for f in form["fields"]], [("firstName", jsp + "account/IncludeAccountFields.jsp")]) + self.assertEqual(found["screens_of_programs"][jsp + "common/IncludeTop.jsp"], ["ACCOUNT-NEWACCOUNTFORM", "CATALOG"]) # its links leave every page + self.assertEqual({(k["screen"], k["key"]): k["to"] for k in found["keys"]}[("CATALOG", "Register")], ["/account/new"]) + self.assertEqual({r["screen"] for r in found["reach"]}, {"ACCOUNT-NEWACCOUNTFORM", "CATALOG"}) + self.assertEqual(general.check(found, root), []) + + def test_layouts_partials_master_pages_user_controls_and_php_includes(self): + files = { + "Mvc/Views/_ViewStart.cshtml": "@{\n Layout = \"~/Views/Shared/_Layout.cshtml\";\n}\n", + "Mvc/Views/Shared/_Layout.cshtml": "@RenderBody()\n", + "Mvc/Views/Shared/_pagination.cshtml": "Next\n", + "Mvc/Views/Catalog/Index.cshtml": "@Html.Partial(\"_pagination\")\n
\n", + "Shop/Site.Master": "\n", + "Shop/Default.aspx": "<%@ Page MasterPageFile=\"~/Site.Master\" %>\n<%@ Register Src=\"~/Pager.ascx\" TagPrefix=\"uc\" TagName=\"Pager\" %>\n
\n", + "Shop/Pager.ascx": "First\n", + "site/index.php": "\n
\n", + "site/header.php": "Home\n"} + root = stacks.write(Path(tempfile.mkdtemp()), files) + self.addCleanup(lambda: __import__("shutil").rmtree(root, ignore_errors=True)) + found = general.includes(root, sorted(files)) + self.assertEqual(found["Mvc/Views/Catalog/Index.cshtml"], ["Mvc/Views/Shared/_pagination.cshtml", "Mvc/Views/Shared/_Layout.cshtml"]) + self.assertEqual(found["Shop/Default.aspx"], ["Shop/Site.Master", "Shop/Pager.ascx"]) + self.assertEqual(found["site/index.php"], ["site/header.php"]) + self.assertNotIn("Mvc/Views/_ViewStart.cshtml", found) # its layout goes to the views under it + + def test_layouts_partials_master_pages_and_controls_are_never_screens(self): # L1-09: eShop's _ViewStart and Site.Mobile.Master + files = {"Mvc/Views/_ViewStart.cshtml": "@{\n Layout = \"~/Views/Shared/_Layout.cshtml\";\n}\n", + "Mvc/Views/Shared/_Layout.cshtml": "Home@RenderBody()\n", + "Mvc/Views/Catalog/Index.cshtml": "

Catalog

\n", + "Shop/Site.Mobile.Master": "\n", + "Shop/Default.aspx": "
\n"} + root = stacks.write(Path(tempfile.mkdtemp()), files) + self.addCleanup(lambda: __import__("shutil").rmtree(root, ignore_errors=True)) + taken: set[str] = set() + screens = {"screens": [general.as_screen(v, {"title": v, "fields": [], "actions": []}, general.screen_id(v, taken), []) for v in sorted(files)]} + found = general.read_flow(None, None, root, screens, profile.profile_folder(root), plan_only=True) + self.assertEqual(sorted(s["file"] for s in screens["screens"]), ["Mvc/Views/Catalog/Index.cshtml", "Shop/Default.aspx"]) + self.assertEqual(found["fragments"]["Shop/Site.Mobile.Master"], []) # a part of no page: switched in at run time + self.assertEqual(found["fragments"]["Mvc/Views/Shared/_Layout.cshtml"], ["CATALOG-INDEX"]) + + def test_short_screen_ids_longer_only_where_two_share_a_name(self): + taken = set() + self.assertEqual(general.screen_id("eShopLegacyMVCSolution/src/eShopLegacyMVC/Views/Shared/_Layout.cshtml", taken), "SHARED-LAYOUT") + self.assertEqual(general.screen_id("eShopLegacyMVCSolution/src/eShopLegacyMVC/Views/Catalog/Create.cshtml", taken), "CATALOG-CREATE") + self.assertEqual(general.screen_id("eShopLegacyWebFormsSolution/src/eShopLegacyWebForms/Catalog/Create.aspx", taken), + "ESHOPLEGACYWEBFORMS-CATALOG-CREATE") + + class WordsTest(unittest.TestCase): def test_the_designs_prompts_in_the_stacks_words(self): from reframe.design import journeys, screens, specs @@ -226,6 +338,15 @@ def test_a_design_round_on_java(self): self.assertIn("general reader", page) self.assertIn("the tables read from the SQL DDL with no model", page) # L1-06: the service behind the rule names the Order entity self.assertIn('id="contract-ORDER"', page) + package = self.folder.path("outputs/design/package/v1/claude-code") # L1-09: what the build of JPetStore's slice found missing + self.assertTrue((package / ".claude/agents/data.md").is_file()) # the roles the tasks name, in the Claude Code form too + contracts = (package / "data-contracts.md").read_text() + self.assertIn("Entity `Order`:\n\n| Field | Key | Declared as |", contracts) + self.assertIn("| id | primary | Long |", contracts) + self.assertNotIn("| PIC |", contracts) + spec = next(p for p in (package / "specs").glob("*.md")).read_text() + self.assertIn("Entity of src/main/java/org/demo/shop/service/OrderService.java.", spec) # the path as written, not upper case + self.assertIn("| Field | Key | Declared as |", spec) if __name__ == "__main__": diff --git a/tests/design/test_golden.py b/tests/design/test_golden.py index 5c8fc018..cacdccc5 100644 --- a/tests/design/test_golden.py +++ b/tests/design/test_golden.py @@ -105,6 +105,13 @@ def test_a_quoted_message_must_be_there_word_for_word(self): self.assertEqual(golden_compare.compare_literal("Credit Limit is not valid", "credit limit is not valid"), "formatting") self.assertEqual(golden_compare.compare_literal("Credit Limit is not valid", "Saved"), "business") + def test_a_message_with_a_value_in_it_matches_any_value_in_its_place(self): # L1-09: ' in stock.' + self.assertEqual(golden_compare.compare_literal(" in stock.", "10 in stock."), "match") + self.assertEqual(golden_compare.compare_literal("Added to your cart.", "Added EST-1 to your cart."), "match") + self.assertEqual(golden_compare.compare_literal(" in stock.", "10 IN STOCK."), "formatting") + self.assertEqual(golden_compare.compare_literal(" in stock.", "Back ordered."), "business") + self.assertEqual(golden_compare.compare_literal(" in stock.", None), "missing") + def test_a_dataset_is_equivalent_when_no_case_differs_in_business_or_is_unanswered(self): d = golden.dataset(SPEC) actual = {"OATM-C16-GD-01": {"text": "CREDIT LIMIT IS NOT VALID"}, "OATM-C16-GD-03": {"text": "Changes committed to database"}, diff --git a/tests/design/test_package.py b/tests/design/test_package.py index 7a1059f5..eff4f046 100644 --- a/tests/design/test_package.py +++ b/tests/design/test_package.py @@ -91,6 +91,17 @@ def test_a_missing_id_is_found_and_the_copy_is_cleaned(self): self.assertNotIn(str(Path.home()), (Path(out) / "kiro/traceability.md").read_text()) + def test_the_proof_slice_falls_back_to_the_journeys_that_start_there(self): # L1-09: eShop's service is behind an interface + from reframe.design import handover + journeys = [{"id": "J01", "name": "Find and view a product", "steps": [{"screen": "CATALOG-INDEX"}]}, {"id": "J02", "steps": [{"screen": "OTHER"}]}] + specs = [{"id": "CB-C01", "title": "Browse", "acceptance": [1, 2], "folder": "cb-01", "status": "draft", "rules": [{"program": "SVC.CS", "class": "business rule", "key": "r1"}], + "journeys": ["J01"], "function_name": "f", "questions": [], "tables": [], "rule_ids": {}}, + {"id": "CB-C02", "title": "Other", "acceptance": [1], "folder": "cb-02", "status": "draft", "rules": [], "journeys": ["J02"], + "function_name": "f", "questions": [], "tables": [], "rule_ids": {}}] + found = handover.facts(specs, journeys, {"CATALOG-INDEX": ["Views/Catalog/Index.cshtml", "Controllers/CatalogController.cs"]}) + self.assertEqual([p["id"] for p in found["proof"]], ["CB-C01"]) + self.assertEqual(found["first_journey"], "Find and view a product") + def test_placeholders_skills_and_the_guide_until_ready(self): value = package.run(self.folder) root = Path(value["path"]) @@ -99,6 +110,10 @@ def test_placeholders_skills_and_the_guide_until_ready(self): "**Decision table gaps:** 1", "SIG-C01 Sign on", "python -m reframe.design.package --check "): self.assertIn(expected, guide) self.assertNotIn("VA-C01 View an account (", guide) # the proof slice is the sign-on's programs only + start = next(line for line in guide.splitlines() if line.startswith("## 6. Prove it: build ")) # named by the journey that starts there + journeys = (self.folder.load("design/journeys.json") or {}).get("journeys") or [] + self.assertEqual(start, "## 6. Prove it: build " + next(j["name"] for j in journeys if j["steps"] and j["steps"][0]["screen"] == "SIGN0A")) + self.assertRegex(guide, r"\(1 acceptance criterion;|\([02-9]\d* acceptance criteria;") for form in package.FORMS: self.assertTrue((root / form / "START-HERE.md").is_file(), form) for name in handover.SKILLS: diff --git a/tests/design/test_prototype.py b/tests/design/test_prototype.py index 98535373..6b557f8f 100644 --- a/tests/design/test_prototype.py +++ b/tests/design/test_prototype.py @@ -79,6 +79,13 @@ def test_every_route_renders_and_acts_without_a_script_error(self): self.assertTrue(set(re.findall(r'href="#/([^"]+)"', v.get("html", ""))) <= known, v["route"]) self.assertNotIn("http", page.read_text().replace("http-equiv", "")) # nothing loaded from outside + def test_marks_are_kept_per_project_run_and_source(self): # L1-09: two prototypes opened from files shared one key + page = prototype.draw(self.folder, self.build()).read_text() + self.assertIn("const STORE = 'reframe-design:' + (D.project || '') + ':' + (D.run || '')", page) + self.assertNotIn("setItem('reframe-design-marks'", page) # the old fixed key is only read, once, for this prototype's own screens + done = subprocess.run([NODE, str(RENDER), str(prototype.draw(self.folder, self.build()))], capture_output=True, text=True, timeout=60) + self.assertNotIn('"ok": false', done.stdout.replace('"ok":false', '"ok": false')) + if __name__ == "__main__": unittest.main() diff --git a/tests/design/test_schema.py b/tests/design/test_schema.py index 57b576ac..98a9491d 100644 --- a/tests/design/test_schema.py +++ b/tests/design/test_schema.py @@ -89,6 +89,51 @@ def test_the_target_stacks_types_apply_as_today(self): self.assertEqual(customer["CREDIT"]["stack"], {"code": "BigDecimal", "column": "NUMERIC(9,2)"}) self.assertNotIn("stack", customer["JOINED"]) # no type table names a date: the neutral type stands + def test_an_sql_integer_by_its_width_not_its_digits(self): # L1-09: JPetStore's qty int had become a BIGINT + types = contracts.stack_types(contracts.parse_stack("React; Node.js with NestJS (TypeScript); PostgreSQL")) + ddl = "CREATE TABLE INVENTORY (\n ITEMID VARCHAR(10) NOT NULL,\n QTY INT NOT NULL,\n SEEN BIGINT,\n RANK SMALLINT\n);\n" + fields = {f["name"]: f for f in schema.tables(ddl, "db/schema.sql", types)[0]["records"][0]["fields"]} + self.assertEqual(fields["QTY"]["stack"], {"code": "number", "column": "INTEGER"}) + self.assertEqual(fields["SEEN"]["stack"], {"code": "number", "column": "BIGINT"}) + self.assertEqual(fields["RANK"]["stack"]["column"], "INTEGER") + java = contracts.stack_types(contracts.parse_stack("React; Java 21 with Spring Boot; PostgreSQL")) + fields = {f["name"]: f for f in schema.tables(ddl, "db/schema.sql", java)[0]["records"][0]["fields"]} + self.assertEqual((fields["QTY"]["stack"]["code"], fields["SEEN"]["stack"]["code"]), ("int", "long")) + + def test_a_mapper_that_holds_sql_uses_the_tables_it_names(self): # L1-09: JPetStore's inventory is read in ItemMapper.xml + with tempfile.TemporaryDirectory() as tmp: + root = stacks.write(__import__("pathlib").Path(tmp), { + "src/main/resources/db/schema.sql": "CREATE TABLE INVENTORY (\n ITEMID VARCHAR(10) NOT NULL,\n QTY INT NOT NULL\n);\n", + "src/main/resources/demo/ItemMapper.xml": "\n \n\n", + "src/main/resources/demo/log4j2.xml": "\n"}) + found = {c["copybook"]: c for c in schema.tables((root / "src/main/resources/db/schema.sql").read_text(), "src/main/resources/db/schema.sql", + contracts.stack_types(None))} + used = schema.uses(root, found) + self.assertEqual(used, {"SRC/MAIN/RESOURCES/DEMO/ITEMMAPPER.XML": {"INVENTORY": "table"}}) # a file with no SQL in it names no table + + +class EntityGapsTest(unittest.TestCase): + """L1-09: what eShopModernizing's Python build found missing in the entity contracts.""" + + def test_the_classes_a_data_context_names_are_read_too(self): + with tempfile.TemporaryDirectory() as tmp: + root = stacks.write(__import__("pathlib").Path(tmp), { + "App/Models/CatalogDBContext.cs": "public class CatalogDBContext : DbContext {\n public DbSet CatalogItems { get; set; }\n" + " public IDbSet CatalogBrands { get; set; }\n}\n", + "App/Models/CatalogItem.cs": "public class CatalogItem {\n public int Id { get; set; }\n public int AvailableStock { get; set; }\n}\n", + "App/Models/CatalogBrand.cs": "public class CatalogBrand {\n public int Id { get; set; }\n}\n", + "App/Models/Unrelated.cs": "public class Unrelated { }\n"}) + self.assertEqual(schema.named_entities(root, ["App/Models/CatalogDBContext.cs"]), ["App/Models/CatalogBrand.cs", "App/Models/CatalogItem.cs"]) + + def test_a_decimal_with_no_declared_precision_is_not_given_one(self): # a C# decimal: 18,0 had dropped the cents + t = schema.from_answer({"neutral": "decimal"}) + self.assertEqual(schema.says(t), "decimal, its precision and scale not declared in the code") + types = contracts.stack_types(contracts.parse_stack("React; Python 3.12 with FastAPI; PostgreSQL")) + self.assertEqual(contracts.on_stack(t, types), {"code": "Decimal", "column": "NUMERIC (precision to decide)"}) + declared = schema.from_answer({"neutral": "decimal", "digits": 9, "scale": 2}) + self.assertEqual(contracts.on_stack(declared, types)["column"], "NUMERIC(9,2)") + class EntitiesTest(unittest.TestCase): def setUp(self): diff --git a/tests/design/test_specs.py b/tests/design/test_specs.py index 7a9ce23b..43836bdc 100644 --- a/tests/design/test_specs.py +++ b/tests/design/test_specs.py @@ -182,6 +182,11 @@ def test_copybooks_beside_the_programs_and_no_screen_copybooks(self): self.assertIn("LGCMAREA", found) self.assertNotIn("SIGN00", found) + def test_a_value_with_a_space_at_either_end_or_none_is_quoted(self): # L1-09: JPetStore's keyword ' Dog' lost its space + from reframe.design import specs as built + self.assertEqual(built.given_of({"given": [{"field": "keyword", "value": " Dog"}, {"field": "note", "value": ""}, {"field": "id", "value": "EST-1"}]}), + 'keyword: " Dog"; note: ""; id: EST-1') + def test_the_checks_on_an_answer(self): data = {"capabilities": [{"key": "K#1", "requirements": [{"code": "R1", "rules": ["a"]}, {"code": "R2", "rules": ["b"]}], "needs_criteria": ["R2"], "technical_rules": ["b"]}]} diff --git a/tests/source/test_profile.py b/tests/source/test_profile.py index 29183ccb..957c2772 100644 --- a/tests/source/test_profile.py +++ b/tests/source/test_profile.py @@ -50,6 +50,21 @@ def test_libraries_in_the_tree_are_not_counted(self): self.assertNotIn("JavaScript", java["languages"]) self.assertEqual(java["languages"]["Java"]["files"], 4) + def test_a_web_applications_libraries_and_build_wrappers(self): + """Found on eShopModernizing (L1-09): unminified jQuery, Bootstrap and the like in Scripts/, ASP.NET's WebForms scripts and + Popper's umd/ build outweighed the C#, so the profile said front-end; and mvnw.cmd and build.cmd were taken for jobs.""" + library = "!function(){" + "var a=1;\n" * 3000 + "}();\n" + files = {**stacks.DOTNET, "Shop/Scripts/jquery-3.3.1.js": library, "Shop/Scripts/bootstrap.bundle.js": library, + "Shop/Scripts/modernizr-2.8.3.js": library, "Shop/Scripts/jquery.validate-vsdoc.js": library, + "Shop/Scripts/WebForms/WebForms.js": library, "Shop/Scripts/umd/popper.js": library, "Shop/Scripts/index.d.ts": library, + "Shop/Scripts/app.js": "function start() {\n return 1;\n}\n", "build.cmd": "msbuild Shop.sln\n", "mvnw.cmd": "@echo off\n", + "jobs/nightly.bat": "Shop.exe --report\n"} + found = profile.profile_folder(stacks.write(Path(self.tmp.name) / "eshop", files)) + self.assertEqual(found["family"], "dotnet") + self.assertEqual(found["skipped"], 8) # the seven libraries and the Shop's own minified jQuery + self.assertEqual(found["languages"]["JavaScript"], {"files": 1, "lines": 3, "family": "front-end"}) # the application's own script stays + self.assertEqual(found["has"]["jobs"]["files"], ["jobs/nightly.bat"]) # a batch file that runs the system is still a job + def test_words_for_the_prompts(self): self.assertEqual(self.of("mainframe")["words"], {"languages": "COBOL", "follow": "a PERFORM, CALL or copybook", "program": "program"}) self.assertEqual(self.of("java")["words"]["languages"], "Java and JSP") From 744ad81c83a4a27ef4c1ce401e7a01fc4887c4d0 Mon Sep 17 00:00:00 2001 From: sknampally Date: Sat, 28 Nov 2026 22:05:21 -0700 Subject: [PATCH 2/2] REL-1.1: prepare release v1.1.0 - The version is 1.1.0, and the install lines name v1.1.0. - CHANGELOG.md has the 1.1.0 section, with the forward-engineering review's fixes folded in; its date is set at the release. - The README says what 1.1 is proven on: live on JPetStore 6 and eShopModernizing, Claude only, with PHP offline; it links to the new docs/how-it-works.md. - docs/how-it-works.md explains Reframe in two pages: the four pipelines, traceability from a line of legacy code to a test, and where reviewers' marks live and how they come back. - The plan marks P4-12, P4-13, Q1-05 and MP-01 to MP-04 done, with their pull requests, and adds REL-1.1. The merge into main, the tag and the GitHub release wait for the owner. Prepared with AI assistance. --- CHANGELOG.md | 32 ++++++++++++++- README.md | 17 ++++---- docs/how-it-works.md | 86 +++++++++++++++++++++++++++++++++++++++++ docs/how-to-run.md | 2 +- docs/plan.md | 15 +++---- pyproject.toml | 2 +- src/reframe/__init__.py | 2 +- 7 files changed, 138 insertions(+), 18 deletions(-) create mode 100644 docs/how-it-works.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 512d3514..fc6d5be5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,43 @@ What changed in each release. Releases are tagged on `main`; the stories behind each are in [docs/plan.md](docs/plan.md). -## Unreleased +## 1.1.0 (unreleased) + +Any legacy codebase Claude's code-modernization plugin reads, not only mainframes: Java, .NET and PHP join mainframe COBOL, CICS and JCL. Outside the mainframe a run is Claude only, since AWS Transform writes requirements and business rules only for mainframe code. + +**The stack profile** +- `stack-profile.json` names a codebase's languages, family, screens, routes, jobs and data, with the files that show them; vendored libraries and build wrappers are left out. `--legacy` overrides it; `reframe status` and the reports show it. +- AWS Transform is offered only for a mainframe codebase, and refused before anything is made otherwise. + +**The reconciliation and the design, in the stack's words** +- The prompts, source files and evidence checks follow the profile: programs are a web application's files, not COBOL members. +- The general reader: each view's fields and actions by a checked Claude step; the routes and links between screens by pattern with no model (Spring and JAX-RS annotations, Stripes, MVC conventions, Razor helpers, the Web Forms route table, redirects, forms), and a checked step for the rest. Included parts (JSP includes, Razor partials and layouts, master pages, user controls, PHP includes) are folded into the pages that include them. +- A codebase without screens (batch jobs, services, libraries) gets its specifications, golden datasets, package and backlog, with the screens left out and the page saying why. +- Data contracts from SQL DDL with no model, and from entity classes by a checked step, with their keys; a file that holds SQL (a mapper, a query file) names the tables it uses. The target stack's types apply, SQL integers by their width. +- "Runs as": online, a scheduled job, a service or a library, from the screens, routes and job definitions. +- The order of replacement (P4-12): read-only capabilities first, then updates, then money, security and audit, shared data and screens kept together, with the reason for each, on the design page and in the package. + +**The AI-DLC package** +- The Claude Code form has the role files the tasks name, in `.claude/agents/`. +- The proof slice is named by the journey it starts; a value with a space at either end is quoted in the criteria; a message with a value in it (`' in stock.'`) matches any value in its place in `golden/compare.py`. **After the forward-engineering review (28 November 2026)** - Specifications: rules only about the old screen's mechanics are *legacy interaction*, with no acceptance criterion; an example's criterion states its event, not the rule's condition; a journey's screen with nothing of the capability is named as context, not given an empty table (#393). - The package: every capability has its service or job task; SQL tables and ORM entities are stored records, rendered with their columns; the copy for the team keeps the application's own e-mail addresses and IDs (#394, #478). - Golden datasets: values an outcome states are compared by value; an unchecked case is never a pass, and `compare.py` exits 2 until the team asserts it (#421). +**Mainframe source packages** +- One table of source kinds, from AWS Transform's list: upper-case extensions, `.cobol`, `.pl1`, and members with no extension or `.txt` classed by their content. +- CICS transactions from DFHCSDUP's DEFINE statements (with `$`, `#` and `@` in names) and from IBM's CICS resource-builder YAML. +- A package check after the snapshot, before any upload: files AWS Transform's table does not name, content and extension that disagree, files that are not text or not in one encoding, and which system extracts are present. +- The guide says how to bring source from a mainframe. + +**Code quality** +- `reframe.core.commands` is one module per command group, and every module is type-checked. + +**Proven on** +- Live, Claude only: JPetStore 6 (Java) and eShopModernizing (.NET Framework), from `reframe run` to `reframe export`, run locally; nothing from them is committed. Results in [docs/any-legacy.md](docs/any-legacy.md), section 7. + ## 1.0.0 (27 November 2026) The first release for anyone to try: with Claude only, or with Claude and AWS Transform. Tested end to end on mainframe code; open source under the MIT License, at github.com/CodeStrata/reframe. diff --git a/README.md b/README.md index a15998a6..32fe4bc5 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@

From legacy source to reviewed requirements, business rules and a design to build from.
- Tested end to end on mainframe COBOL and CICS. Java, .NET and PHP are tested offline, with live runs to come. + Tested end to end on mainframe COBOL and CICS, and live on Java and .NET web applications with Claude only. PHP is tested offline.

@@ -48,12 +48,12 @@ Reframe works out what the codebase is first, its *stack profile*, and picks its | Family | Tools | How the design reads screens, flow and data | Proven | |---|---|---|---| | **Mainframe:** COBOL, PL/I, JCL, CICS, BMS, IMS | Claude's assessment and AWS Transform's, reconciled | Exact readers with no model: BMS maps, CICS transfers and definitions (CSD or resource-builder YAML), copybooks | **End to end** on AWS's CardDemo | -| **Java:** Java, JSP, JSF, Groovy, Kotlin | Claude only: AWS Transform writes requirements only for the mainframe | The general reader: views, fields and actions by a checked Claude step; links from routes and patterns; SQL DDL with no model, entities by a checked step | Offline, on small fixtures | -| **.NET:** C#, VB.NET, ASP.NET, Razor | Claude only | The general reader, with the MVC conventions | Offline, on small fixtures | +| **Java:** Java, JSP, JSF, Groovy, Kotlin | Claude only: AWS Transform writes requirements only for the mainframe | The general reader: views, fields and actions by a checked Claude step; links from routes and patterns; SQL DDL with no model, entities by a checked step | **Live** on JPetStore 6, Claude only ([results](docs/any-legacy.md)) | +| **.NET:** C#, VB.NET, ASP.NET, Razor | Claude only | The general reader, with the MVC and Web Forms conventions | **Live** on eShopModernizing, Claude only ([results](docs/any-legacy.md)) | | **Web scripts:** PHP, Perl, Ruby, Python, classic ASP | Claude only | The general reader | Offline, on small fixtures | | **Front end, native, 4GL, mixed** | Claude only | The general reader | **Not yet:** they run, unproven | -A codebase with no screens (a batch system, a service or a library) gets its specifications, golden datasets, package and backlog without journeys, screens or a prototype. Live runs on two codebases beyond the mainframe come next ([the 1.1 specification](docs/any-legacy.md)). +A codebase with no screens (a batch system, a service or a library) gets its specifications, golden datasets, package and backlog without journeys, screens or a prototype. Both live codebases were also built in another language from the package alone, as a test of the package ([the results](docs/any-legacy.md)). It is for modernization teams, architects and the business people who have to say "yes, that is what the system does" before anything is rebuilt. @@ -121,6 +121,8 @@ Both tools assess the same snapshot. The comparison shows where they agree and w ## How it works +[How Reframe works](docs/how-it-works.md) explains it in two pages: the four pipelines, traceability from a line of legacy code to a test, and where reviewers' marks live and how they come back. + ![How a Reframe run works: the snapshot, the two assessments side by side, the reports, the reconciliation against the source code, the design, sharing and teardown](docs/images/reframe.svg) | Step | Command | What happens | @@ -137,7 +139,7 @@ Every step is recorded before it starts and confirmed after it ends, so a run th You need macOS or Linux (on Windows, WSL2), Python 3.10 or later and [uv](https://docs.astral.sh/uv/). ```bash -uv tool install "git+https://github.com/CodeStrata/reframe@v1.0.0" +uv tool install "git+https://github.com/CodeStrata/reframe@v1.1.0" ``` ### With Claude only @@ -233,9 +235,10 @@ The figures are from live runs and are recorded in [docs/acceptance.md](docs/acc ## Roadmap -- **Beyond the mainframe (1.1):** built and tested offline: the stack profile, Claude-only runs by family, the reconciliation in the stack's words, and screens, flows, data contracts and "runs as" read for each stack. Live acceptance on two codebases comes next ([the specification](docs/any-legacy.md)). +- **Beyond the mainframe (1.1):** done: the stack profile, Claude-only runs by family, the reconciliation in the stack's words, and screens, flows, data contracts and "runs as" read for each stack, live on JPetStore 6 and eShopModernizing ([the results](docs/any-legacy.md)). +- **A second public mainframe codebase:** IBM's Bank-of-Z end to end, with both tools. - **Proof at scale:** a codebase several times CardDemo's size, and a mainframe expert's own check of the audit. -- **Later:** a replacement order from the specifications, real legacy outputs under GnuCOBOL, and Claude on Amazon Bedrock, live ([docs/plan.md](docs/plan.md)). +- **Later:** real legacy outputs in the golden datasets (the GnuCOBOL spike is done), and Claude on Amazon Bedrock, live ([docs/plan.md](docs/plan.md)). ## Contributing diff --git a/docs/how-it-works.md b/docs/how-it-works.md new file mode 100644 index 00000000..1bd899ac --- /dev/null +++ b/docs/how-it-works.md @@ -0,0 +1,86 @@ +# Reframe: how it works + +Reframe turns a legacy codebase into reviewed requirements, business rules and a design to build from. It is open source (MIT), runs on your machine as one command line, `reframe`, and leaves the legacy source as it found it. Version 1.1 takes any codebase Claude's code-modernization plugin reads: mainframe COBOL, CICS and JCL as before, and now Java, .NET and PHP. + +## The idea + +Two machines reading the same code disagree, and both can be wrong. Reframe does not pick one: it checks each business rule against the code itself, with evidence it can verify, and shows a person only what needs a person. Everything it says cites `file:line`, and Reframe checks that the line exists and says what is claimed before it keeps the claim. What it cannot settle it says, as a question or an open item, never a guess. + +## The four pipelines + +**1. AWS Transform (mainframe only).** For mainframe code, Reframe can run AWS Transform's assess-and-reimagine job beside Claude. It sets up what the job needs with Terraform, answers the job's questions by rule, downloads its business rules and requirements, and removes every resource it made, by the IDs it recorded, with `reframe teardown`. Outside the mainframe a run is Claude only, since AWS Transform writes requirements only for mainframe code. + +**2. The Claude assessment.** Claude Code with Anthropic's code-modernization plugin assesses a snapshot of the source: preflight, an inventory and risk assessment, a dependency map, and business rules as Given/When/Then cards with citations. Reframe drives it in steps, estimates time and cost first, stops cleanly at a usage limit, and resumes without repeating finished work. The result is a business review page. + +**3. The reconciliation.** Every rule the two assessments do not agree on (with Claude alone, every rule) is decided against the source code, in batches, by a checked Claude step. The answer must cite real lines; one that fails is asked again with the reasons, then kept open. The outcome is a set of recommended rules and requirements, possible defects (where the code does not do what a rule says), one list of questions for a subject-matter expert, and a reconciliation page where reviewers sign off each business function. Their review downloads, answered questions and documents go back in with `--context`, and the next round redoes only what they change. An accuracy audit samples rules for a second judge, and an expert's blind review can be read back in. + +**4. The design.** From the reconciled results, Reframe designs the modern application: + +- **Screens and flow:** read from the code with no model wherever a pattern settles it (BMS maps and CICS transfers on a mainframe; views, routes, links, forms, redirects, includes and layouts on Java, .NET and PHP), with a checked Claude step for the rest. A codebase without screens (batch jobs, services, libraries) gets its specifications without them. +- **Journeys, modern screens and a clickable prototype**, with every legacy screen, field and action mapped to what replaces it, and why. +- **A specification per capability:** requirements, rules, acceptance criteria, decision tables with their gaps, data contracts (from copybooks, SQL DDL or entity classes), and how it runs: online, a scheduled job, a service or a library. A capability is *final* when its function is signed off, *draft* until then. +- **Golden datasets:** the cases the new system must answer as the legacy one does, with `compare.py`, which tells a business difference from a formatting one. +- **An order of replacement:** read-only capabilities first, then updates, then money, security and audit, with the reason for each. +- **The AI-DLC package**, in Kiro, Claude Code and Spec Kit forms: every ID traced back to the legacy source, `[FILL IN: ...]` where only your team can decide (versions, hosting, house conventions), and `START-HERE.md` to take an engineer from copy to build. The target stack is yours: `reframe design --stack "; ; "` adds its code and column types, and Reframe never chooses one for you. + +## Traceability: from a line of legacy code to a test + +Every item carries an ID, and every ID leads back to the code: + +| Item | ID | Leads back to | +|---|---|---| +| Business function | `CB` (a short code per function) | its domain and the reconciled function | +| Business rule | `CB-BR-004` | the files and lines it was checked against (`ItemMapper.xml:47-74`), and the reconciliation's decision | +| Requirement | `CB-REQ-F-003` | the rules it rests on | +| Capability | `CB-C03` | its requirements, rules, screens and data contracts | +| Acceptance criterion | `CB-C03-AC-02` | its requirement and rule | +| Task | `CB-C03-T2` | the requirement, rule and criterion IDs it implements, and its role | +| Golden case | `CB-C03-GD-05` | its rule, the worked example or table row, and the legacy lines | +| Modern screen | `S-CART` | the legacy screens it replaces, field by field | + +- `traceability.md` in every form of the package lists each ID with its run key (the reconciliation's own key), its rules, criteria and tasks, and each rule's evidence lines. +- The IDs are kept from one design round to the next (`design/package-ids.json`), so a new round never renumbers what a team is already building. +- The package's conventions ask the build to name each requirement and rule ID where it is implemented, and each criterion's ID in its test. A test result or a golden-case difference therefore leads back, through the IDs, to the legacy line it came from. +- `CHANGES.md` says, by ID, what a new version of the package changed. + +## Reviews: where a reviewer's marks live, and how they come back + +The review pages are single HTML files that need no server: the business reviews, the reconciliation page, the comparison and the clickable prototype. + +1. **Marking.** On each requirement, rule, open question or screen, a reviewer marks *Agree*, *Needs change* or *Question*, with a comment. On the reconciliation page they can also sign off a whole business function. +2. **Kept in the browser.** Marks are saved as the reviewer goes, in that browser's own storage. They are kept apart for each project, run and source snapshot, so two pages never mix. Close the file and open it again in the same browser, and the marks are still there. Another browser or computer starts empty, and so does a browser whose site data was cleared. The browser is a convenience, not the record. +3. **The record is the download.** *Your review* downloads the marks as JSON (format `reframe-review/1`: reviewer, run, source, and every mark with its key, status, comment and time) or as CSV. The SME list downloads as a CSV for answers. +4. **Back into Reframe.** Put the downloads, answered questions and any documents in a context folder: + - `reframe review --context ` shows each reviewer's coverage and sign-offs, and where two reviewers disagree. It runs nothing. + - `reframe reconcile --context ` reads them all. *Needs change* and *Question* outrank *Agree*, and every comment keeps its reviewer's name. A rule someone agreed is kept, with who agreed. A signed-off function's capabilities become *final* in the next design. Only what the context touches is redone. + - `reframe design --context ` does the same with the prototype's marks, and with personas, decisions and a design system. +5. **What the next page shows.** The regenerated page shows the last round's decisions from the run's own files, not from the browser: who agreed, what was signed off, and what is still open. + +Downloads made from a published copy name items by cleaned keys; Reframe reads them back with the run's own keys. + +## Sharing the results + +`reframe export` writes the reconciled results as one Excel workbook, or the design's backlog as a Jira or Azure DevOps import file with acceptance criteria. `reframe publish` makes a cleaned copy of the reports, with account details and keys removed, to send or to publish on GitHub Pages after a typed yes. + +## How a run goes + +``` +reframe run --tools claude --source # or a guided run with no options +reframe reconcile +reframe design --stack "React; Java 21 with Spring Boot; PostgreSQL" +reframe export --to jira +``` + +`reframe status` says where a run is and what to do next. Runs live in `.reframe///` of the folder you run from. Claude signs in with your subscription, an Anthropic API key, or Amazon Bedrock. + +## What it is careful about + +- An estimate before every paid step, and a stop at a limit you set. +- The source is read-only; Claude works on a snapshot. +- No secrets are written; a published copy is cleaned and checked first. +- AWS resources are made only for a mainframe run with both tools, and removed by their recorded IDs, never by name. +- Nothing is guessed: what is not settled is shown as a question, a draft or an open item. + +## How far it is proven + +Mainframe: end to end on AWS CardDemo with both tools, with an audited accuracy of 91% of sampled rules, and a public example of its output. Java, .NET and PHP: offline on test fixtures; Java and .NET live, Claude only, on JPetStore 6 and eShopModernizing (the 1.1 acceptance runs). diff --git a/docs/how-to-run.md b/docs/how-to-run.md index ee54405f..cde86d4d 100644 --- a/docs/how-to-run.md +++ b/docs/how-to-run.md @@ -7,7 +7,7 @@ One page, start to finish. The detail of each step is in [the guide](guide.md); ## 0. Install, once ```bash -uv tool install "git+https://github.com/CodeStrata/reframe@v1.0.0" +uv tool install "git+https://github.com/CodeStrata/reframe@v1.1.0" ``` Then choose what this computer will run: diff --git a/docs/plan.md b/docs/plan.md index 31ebd2fc..e0860b44 100644 --- a/docs/plan.md +++ b/docs/plan.md @@ -176,8 +176,8 @@ Agreed by the owner on 24 November 2026. From the reconciled and reviewed result | P4-09 | Rounds with more context | [§4 D9](pipeline-4.md) | Done 26 November 2026 (`python -m reframe.design.pipeline`, with `--plan`): added context redoes only the parts it touches; each round versions the package and writes what changed since the last | | P4-10 | Live acceptance and README | [§8](pipeline-4.md) | Done 26 November 2026 ([results](pipeline-4.md)): rounds 1 and 2 on CardDemo from the CLI; round 2's persona, design system and *Needs change* redid only what they reach, and a kept part now records its pieces so a later round can say why. On CardDemo, from the CLI: the prototype covers every screen, a second round with added context changes only what it should, and the README and `docs/cli.md` describe pipeline 4 from the tested commands | | P4-11 | Golden datasets and equivalence tests | [§4 D10](pipeline-4.md) | #421 · Done 26 November 2026 (#456; the owner moved it forward from Later, the same day), with no model: per capability, a golden dataset from the worked examples and decision tables in each form of the package, with `golden/compare.py` setting formatting apart from business differences, and the test-generation task naming every case. On CardDemo: 1,595 cases for 139 capabilities, 746 edge cases and 82 combinations left for the owner. Expected outputs come from the rules until P4-13. Reworked 28 November 2026 after the review (#421): values an outcome states are compared by value, and an unchecked case is never a pass (`compare.py` exits 2) | -| P4-12 | Risk and replacement order | [§4 D11](pipeline-4.md) | **Later** (the owner, 26 November 2026). Capabilities are ordered for replacement from their risk and what they touch, low-risk and read-only first and money, security and adjudication last, shared data and screens kept together; the order and its reasons are on the design page and in the package's constitution and tasks | -| P4-13 | Spike: real legacy outputs under GnuCOBOL (low priority) | [§4 D12](pipeline-4.md) | #423 · Spike written 28 November 2026 ([spikes/p4-13-gnucobol.md](spikes/p4-13-gnucobol.md)), for the owner: 10 of CardDemo's 12 batch programs compile under GnuCOBOL 3.1.2 in a container and 8 run to a normal end on CardDemo's own data. The reconciled rules for posting and interest agree with the real outputs (300 of 300 reject decisions, 50 of 50 interest amounts), but only when amounts are truncated to the cent, which the interest rule does not say. The real run also shows that one recommended rule is wrong: the interest batch never posts the last account's interest, a CardDemo defect. Proposed: a story for an optional legacy run in the golden datasets | +| P4-12 | Risk and replacement order | [§4 D11](pipeline-4.md) | #422 · Done 28 November 2026 (#496): capabilities ordered for replacement from their risk and what they touch, read-only first and money, security and audit last, shared data and screens kept together, with the reason for each on the design page and in the package | +| P4-13 | Spike: real legacy outputs under GnuCOBOL (low priority) | [§4 D12](pipeline-4.md) | #423 · Done 28 November 2026 ([note](spikes/p4-13-gnucobol.md), #497): 10 of CardDemo's 12 batch programs compile under GnuCOBOL and 8 run; the posting and interest rules agree with the programs' outputs, once interest truncates to the cent, and one rule is shown wrong | ## Release 1.0: anyone can try it @@ -209,7 +209,7 @@ The owner's direction (26 November 2026): make Reframe credible to someone readi | Q1-02 | Lint in CI | [CONTRIBUTING](../CONTRIBUTING.md) | #451 · Done 26 November 2026 (#455): `ruff check src tests` passes in CI with pyflakes, syntax and bugbear rules. The 51 findings of the first check are fixed: unused imports and names, two dead loads in the design round, loop variables never read, and a test that accepted any exception | | 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-05 | Split `core/commands.py` | – | #454 · Done 28 November 2026 (#493): `reframe.core.commands` is one module per command group, the Q1-04 tests pass unchanged, and it is type-checked like every other module | | 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 @@ -227,6 +227,7 @@ The owner's direction (27 November 2026): Reframe takes any legacy codebase Clau | L1-07 | "Runs as" for any stack | [§5.4](any-legacy.md) | #479 · Online, scheduled job, service or library from screens, routes and job definitions, for each fixture | | L1-08 | Words, README and docs | [§5.5, 6](any-legacy.md) | #480 · The tagline, the README's table by family, the guide and every stage's words follow section 6 | | L1-09 | Live acceptance on two codebases | [§7](any-legacy.md) | #481 · Done 29 November 2026 ([results](any-legacy.md)): JPetStore 6 and eShopModernizing from `reframe run --tools claude` to `reframe export`, run locally with nothing committed, no stop that needed a code fix. Each was then built in another language from the Claude Code package alone (TypeScript with NestJS; Python with FastAPI): 87 of 87 and 125 of 126 criteria. The defects the runs and builds showed are fixed with tests | +| REL-1.1 | Release v1.1.0 | – | #500 · The version is 1.1.0, CHANGELOG.md has its section, the README and the guide say what 1.1 is proven on, and docs/how-it-works.md explains how Reframe works; then, after the owner's go-ahead, develop is merged into main, v1.1.0 is tagged and the GitHub release has the CHANGELOG's notes | ## Mainframe source packages and a second public codebase @@ -236,10 +237,10 @@ IBM's Bank-of-Z (Apache-2.0) is the second public codebase, run end to end after | Story | Title | Specification | Done when | |---|---|---|---| -| MP-01 | One table of source kinds | – | #486 · Reframe has one table of source kinds, taken from AWS Transform's list of source file types, and the reconciliation's source files and the design's readers use it. Upper-case extensions, `.cobol`, `.pl1` and members with no extension or `.txt` are classed by their content (COBOL divisions, JCL statements, BMS and IMS macros). On a test package laid out as AWS Transform documents it, the design and the reconciliation find the same programs, copybooks, maps and transactions as with the usual extensions | -| MP-02 | CICS definitions in either form | – | #487 · Transactions are read from DFHCSDUP's DEFINE statements, names with `$`, `#` and `@` included, and from IBM's CICS resource-builder YAML (`resourceDefinitions` with `transaction` entries naming their `program`), each citing its line. On a fixture of each form every transaction reaches its program | -| MP-03 | A package check before the upload | – | #488 · After the snapshot and before anything is uploaded, `package-check.json` lists the files AWS Transform's table does not name, the files whose content and extension disagree (with what AWS Transform will take them as, for example IMS DBD and PSB macros kept as `.asm`), files that are not text or not in one encoding, and which system extracts are present (catalog listing, CSD extract, IMS Stage 1, CA-7 reports). `reframe status` and the reports' About section show it. Nothing in the source is changed | -| MP-04 | Bringing source from a mainframe | [guide](guide.md) | #489 · The guide says how to give Reframe a mainframe's source: AWS Transform's package (folders by type, its extensions, one encoding), the optional system extracts with links to AWS's page, that SMF data goes in its own folder and Reframe does not run AWS's activity analysis, and what the package check reports | +| MP-01 | One table of source kinds | – | #486 · Done 28 November 2026 (#494) · Reframe has one table of source kinds, taken from AWS Transform's list of source file types, and the reconciliation's source files and the design's readers use it. Upper-case extensions, `.cobol`, `.pl1` and members with no extension or `.txt` are classed by their content (COBOL divisions, JCL statements, BMS and IMS macros). On a test package laid out as AWS Transform documents it, the design and the reconciliation find the same programs, copybooks, maps and transactions as with the usual extensions | +| MP-02 | CICS definitions in either form | – | #487 · Done 28 November 2026 (#494) · Transactions are read from DFHCSDUP's DEFINE statements, names with `$`, `#` and `@` included, and from IBM's CICS resource-builder YAML (`resourceDefinitions` with `transaction` entries naming their `program`), each citing its line. On a fixture of each form every transaction reaches its program | +| MP-03 | A package check before the upload | – | #488 · Done 28 November 2026 (#494) · After the snapshot and before anything is uploaded, `package-check.json` lists the files AWS Transform's table does not name, the files whose content and extension disagree (with what AWS Transform will take them as, for example IMS DBD and PSB macros kept as `.asm`), files that are not text or not in one encoding, and which system extracts are present (catalog listing, CSD extract, IMS Stage 1, CA-7 reports). `reframe status` and the reports' About section show it. Nothing in the source is changed | +| MP-04 | Bringing source from a mainframe | [guide](guide.md) | #489 · Done 28 November 2026 (#494) · The guide says how to give Reframe a mainframe's source: AWS Transform's package (folders by type, its extensions, one encoding), the optional system extracts with links to AWS's page, that SMF data goes in its own folder and Reframe does not run AWS's activity analysis, and what the package check reports | | MP-05 | Bank-of-Z end to end | results to be written | #490 · After MP-01 to MP-04 and the rest of the backlog: every pipeline runs from the CLI on IBM's Bank-of-Z as far as it goes, with an estimate and the owner's yes before each live run. The time, cost and every failure are written up in the docs with no account or resource identifiers; the run's outputs stay out of the repository; any Reframe defect it shows is fixed with a test | ## Proving it at scale diff --git a/pyproject.toml b/pyproject.toml index 339aba2b..bf973ce7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "reframe" -version = "1.0.0" +version = "1.1.0" description = "From legacy source to reviewed requirements, business rules and a design to build from, with Claude, or Claude and AWS Transform; tested on mainframe code" readme = "README.md" requires-python = ">=3.10" diff --git a/src/reframe/__init__.py b/src/reframe/__init__.py index 6c0fc9b8..e88f9af6 100644 --- a/src/reframe/__init__.py +++ b/src/reframe/__init__.py @@ -1,3 +1,3 @@ """Reframe: an AWS Transform mainframe assessment, end to end, from one command (docs/specification.md).""" -__version__ = "1.0.0" +__version__ = "1.1.0"