Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

- **Summary findings normalization**: `scripts/summarize.py` now normalizes issue severities (`"BLOCKER"`, `"Major"`) to lowercase so mixed-case severities are not downgraded or misranked in `SUMMARY.md` and `scripts/notify.py`, and coerces non-string `title`, `screen`, and `issues` fields in `findings.json` without crashing.
- **Android screen element filtering**: `scripts/android/screen.py` now parses signed UIAutomator `bounds` (avoiding phantom on-screen tap targets from negative off-screen coordinates), skips zero-size or off-screen elements, and collapses multiline labels onto one line.
- **NativeScript builds (beta)**: `scripts/build/detect.sh` detects NativeScript apps (`nativescript.config.*` or `@nativescript/core` / `tns-core-modules` in `package.json`), and `scripts/build/android.sh` and `scripts/build/ios.sh` build a debug APK (`ns build android`) and an iOS Simulator `.app` (`ns build ios`), forwarding `build_args` / `BUILD_ARGS`. Beta: the tests use a stand-in for `ns`, no real NativeScript app has been built with it yet.
- **Slow and flaky networks (Android)**: optional `network` field in an Android persona's `device` (`slow` or `flaky`). `scripts/android/run_agent.sh` sets the emulator's network before the app launches, with `adb emu network speed` and `adb emu network delay`: EDGE speed for both, EDGE latency for `slow`, replies 0.5 to 3 s late for `flaky`. The job log shows what the emulator applied, and the agent's prompt names the condition. Kenji uses `flaky`.
Expand Down
20 changes: 16 additions & 4 deletions scripts/summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,30 @@ def number(x):
return x if isinstance(x, (int, float)) and not isinstance(x, bool) else None


def text(x, default=""):
"""Coerce a JSON value from findings.json to a trimmed string."""
if x is None or isinstance(x, bool):
return default
if isinstance(x, list):
s = ", ".join(p for p in (text(item) for item in x) if p)
else:
s = str(x).strip()
return s or default


def load(run_dir):
findings, scores = [], []
for persona, data in per_persona(run_dir):
if number(data.get("score")) is not None:
scores.append(data["score"])
for i in data.get("issues") or []:
issues = data.get("issues")
for i in issues if isinstance(issues, list) else []:
if not isinstance(i, dict):
continue
findings.append({"id": len(findings) + 1, "persona": persona,
"severity": i.get("severity") or "?",
"title": (i.get("title") or "?").strip(),
"screen": (i.get("screen") or "").strip()})
"severity": text(i.get("severity"), "?").lower(),
"title": text(i.get("title"), "?"),
"screen": text(i.get("screen"))})
return findings, scores


Expand Down
56 changes: 56 additions & 0 deletions tests/test_summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,62 @@ def test_credit_line_and_how_to_remove_it(self):
self.assertNotIn("mobile-agent-testers", out)
self.assertTrue(out.endswith("|\n"))

def test_mixed_case_severity_is_normalized_for_summary_and_notify(self):
import notify # local import to avoid circular import with test_notify
with tempfile.TemporaryDirectory() as d:
write_run(d, {
"anna": {"score": 5, "issues": [
{"title": "Crash on Save | Cancel", "severity": " BLOCKER ", "screen": "Editor"},
{"title": "Tiny button", "severity": "Major", "screen": "Settings"},
{"title": "Typo in footer", "severity": "cosmetic", "screen": "Home"}]},
"malik": {"score": 7, "issues": [
{"title": "Crash on Save | Cancel", "severity": "minor", "screen": "Editor"}]},
})
findings, scores = summarize.load(d)
md = summarize.render(findings, scores, summarize.group_by_title(findings), False)
msg = notify.message(findings, scores)
table = [line for line in md.splitlines() if line.startswith("| ") and "Severity" not in line]
self.assertEqual(table, [
"| blocker | Crash on Save \\| Cancel | 2 (anna, malik) | Editor |",
"| major | Tiny button | 1 (anna) | Settings |",
"| cosmetic | Typo in footer | 1 (anna) | Home |",
])
msg_lines = [line for line in msg.splitlines() if line.startswith("- ")]
self.assertEqual(msg_lines, [
"- [blocker] Crash on Save | Cancel (2: anna, malik)",
"- [major] Tiny button (1: anna)",
"- [cosmetic] Typo in footer (1: anna)",
])

def test_non_string_fields_in_findings_do_not_crash(self):
with tempfile.TemporaryDirectory() as d:
write_run(d, {
"anna": {"score": 6, "issues": [
{"title": "Clipped button", "severity": "minor", "screen": ["02", "03"]},
{"title": "Blank page", "severity": "major", "screen": 2},
{"title": "Missing label", "severity": "cosmetic", "screen": None},
{"title": 404, "severity": None, "screen": ["04", None, "", 5]},
{"title": ["Broken", "header"], "severity": " ", "screen": []},
{"title": None, "severity": False, "screen": 0}]},
"malik": {"score": 8, "issues": 123},
})
findings, scores = summarize.load(d)
md = summarize.render(findings, scores, summarize.group_by_title(findings), False)
self.assertEqual([(f["title"], f["severity"], f["screen"]) for f in findings], [
("Clipped button", "minor", "02, 03"),
("Blank page", "major", "2"),
("Missing label", "cosmetic", ""),
("404", "?", "04, 5"),
("Broken, header", "?", ""),
("?", "?", "0"),
])
self.assertIn("| minor | Clipped button | 1 (anna) | 02, 03 |", md)
self.assertIn("| major | Blank page | 1 (anna) | 2 |", md)
self.assertIn("| cosmetic | Missing label | 1 (anna) | |", md)
self.assertIn("| ? | 404 | 1 (anna) | 04, 5 |", md)
self.assertIn("| ? | Broken, header | 1 (anna) | |", md)
self.assertIn("| ? | ? | 1 (anna) | 0 |", md)


class Reproduction(unittest.TestCase):
"""A run with bug_report: each persona answers whether it reproduced the bug."""
Expand Down
Loading