Repository navigation
fix(test): the mesh replay builds optimized and reports a strand once #9236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1edb022
17a932a
68bf33b
a9c3178
d87c341
705d853
2c39807
b8eaedc
d837d42
3eee470
024742e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -669,6 +669,8 @@ def __init__(self, args, mesh: Mesh, script: Script) -> None: | |
| self.auth = Auth(self.auth_port, self.dir / "auth.jsonl") | ||
| self.events: list[dict] = [] | ||
| self.violations: list[dict] = [] | ||
| # Each reader path left unfed, by the event that left it so and its last read then. | ||
| self.strands: dict[tuple[str, str], dict] = {} | ||
| self.stop = threading.Event() | ||
| self.lock = threading.Lock() | ||
| self.poller = threading.Thread(target=self.poll, daemon=True) | ||
|
|
@@ -926,32 +928,53 @@ def check(self, report: dict, unfed: list[dict], unrouted: list[dict]) -> None: | |
| # A baseline with a reader left unrouted tests nothing behind it. | ||
| if self.baseline(report["kind"]): | ||
| self.violation(report, "unrouted", unrouted) | ||
| for kind in ("stuck", "starved"): | ||
| items = [item for item in unfed if item["kind"] == kind] | ||
| if items: | ||
| self.violation(report, "unfed", items, kind) | ||
|
|
||
| # A reader still unfed from an earlier event, having read nothing since, is that event's | ||
| # strand: it keeps that event's known entry rather than failing every later event again. | ||
| # A strand ends only with a read, so one whose source stopped meanwhile is kept for later. | ||
| def last(reader: str, path: str) -> float | None: | ||
| follow = self.relays[reader].readout.paths.get(path) | ||
| return follow.last if follow else None | ||
|
|
||
| strands = {key: began for key, began in self.strands.items() if began["last"] == last(*key)} | ||
| groups = {} | ||
| for item in unfed: | ||
| key = (item["reader"], item["path"]) | ||
| began = strands.get(key) or {"name": report["name"], "kind": report["kind"], "last": last(*key)} | ||
| strands[key] = began | ||
| groups.setdefault((began["name"], item["kind"]), (began, []))[1].append(item) | ||
| self.strands = strands | ||
| for (name, kind), (began, items) in groups.items(): | ||
| self.violation(report, "unfed", items, kind, None if name == report["name"] else began) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Register each strand only once in the run-level failures. With no matching known entry, an unchanged strand reaches Keep carried details in each event report if needed. Add a run-level failure only when the strand begins. After the reader reads again, allow a new strand to register another failure.
|
||
| if shown: | ||
| self.violation(report, "shown", shown) | ||
| died = [proc.name for proc in self.procs() if proc.died] | ||
| if died: | ||
| self.violation(report, "died", died) | ||
|
|
||
| def violation(self, report: dict, check: str, items: list, kind: str | None = None) -> None: | ||
| def violation( | ||
| self, report: dict, check: str, items: list, kind: str | None = None, began: dict | None = None | ||
| ) -> None: | ||
| """Record a violation of `report`'s event, or one carried from the earlier event `began`, | ||
| which names the event whose known entries it is matched against.""" | ||
| event = (began or report)["kind"] | ||
| # The start is the baseline before any fault, so no known flaw excuses it. | ||
| known = next( | ||
| ( | ||
| k | ||
| for k in self.script.known | ||
| if report["kind"] != "start" | ||
| if event != "start" | ||
| and k["check"] == check | ||
| and k.get("kind", kind) == kind | ||
| and k.get("event", report["kind"]) == report["kind"] | ||
| and k.get("event", event) == event | ||
| ), | ||
| None, | ||
| ) | ||
| entry = {"event": report["name"], "check": check, "count": len(items), "items": items[:20]} | ||
| if kind: | ||
| entry["kind"] = kind | ||
| if began: | ||
| entry["began"] = began["name"] | ||
| if known: | ||
| entry["known"] = known["quest"] | ||
| report.setdefault("violations", []).append(entry) | ||
|
|
@@ -1275,6 +1298,7 @@ def markdown(report: dict) -> str: | |
| for entry in report["violations"] + report["known"]: | ||
| tag = f" (known: {entry['known']})" if "known" in entry else "" | ||
| check = entry["check"] + (f" ({entry['kind']})" if entry.get("kind") else "") | ||
| check += f" since {entry['began']}" if "began" in entry else "" | ||
| lines.append(f"- {entry['event']}: {check} x{entry['count']}{tag}: `{json.dumps(entry['items'][:3])}`") | ||
| lines += ["", NOTE, ""] | ||
| return "\n".join(lines) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capture
lastwith theunfedobservation.measurecallsself.readers()aftersettlereturns itsunfedlist. If that update reports a recovery read, Line 943 stores the newer timestamp against the older unfed observation. A later stall with that timestamp then retains the previous origin. For example, a new roll strand can inherit a known kill exemption and incorrectly pass. (raw.githubusercontent.com)Include the observed
lastin eachhungryresult and use that value for strand creation. A subsequent read must invalidate that strand; no intervening read must preserve it.