Skip to content
Closed
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
11 changes: 11 additions & 0 deletions .github/scripts/msinsight_acceptance/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Optional pinned msinsight consumer acceptance

Draft, not yet validated as a hosted workflow. Keep separate from the core installed-HTML release gate.

The locally verified pieces use msinsight revision 101f65b877a267ffd5f66ea3834706057ba243e5, the candidate installed wheel, and the exact reviewed 581140-byte snapshot_expandable.pkl SHA256 3afc9d1c5ef4ca4b417e58c0830e9eb8a913eb9459f4088b8c66c22325c68c40.

Required runner: Linux, official compiler/build tools, Node, Python, Playwright Chromium and strace; browser and three loopback-only server ports must share one network runtime. No tokens or third-party authentication, public tunnel, deployment, upstream edits, tags or release actions.

Keep all producer raw output, server traces, SQLite databases, source pickle, WebSocket messages and screenshots private. Hosted artifacts must be an explicit allowlist of sanitized numeric gate summaries. A screenshot must first be reviewed to exclude source user paths and callstacks; do not upload a whole working directory on success or failure.

Current local evidence: isolated official dependency install passed, unchanged frozen frontend lockfile passed; original producer, 11 installed API templates and 11 console templates passed. Minimal server compilation is in progress; production frontend builds are not yet run. Cloud-browser/runtime isolation blocks local GUI, and local ptrace is denied. The hosted job requires actual GUI import, window navigation, peak-event label, 167 typed protocol assertions, mandatory process trace and preservation checks. None is claimed passed merely by adding this harness. Twelve fast fail-closed contract tests pass; exact-source hosted execution is the remaining acceptance step.
159 changes: 159 additions & 0 deletions .github/scripts/msinsight_acceptance/evidence_inventory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
#!/usr/bin/env python3
"""New readonly helper; only syntax/synthetic tests performed, not a rerun of acceptance.
Use after writers have stopped; immutable SQLite assumes no pending WAL.
Never prints source call stacks; JSON stores only table hashes/counts, not rows.
"""

import argparse
import hashlib
import json
import sqlite3
from pathlib import Path


def digest(path):
h = hashlib.sha256()
with path.open("rb") as stream:
for b in iter(lambda: stream.read(1024 * 1024), b""):
h.update(b)
return h.hexdigest()


def inventory(root):
result = {}
for p in sorted(root.rglob("*")):
if p.name.endswith(("-wal", "-shm", "-journal")):
raise ValueError("Stop writers and resolve WAL/SHM/journal sidecars before inspection")
if p.is_symlink():
raise ValueError("Refusing symlink in evidence directory")
if p.is_file():
result[str(p.relative_to(root))] = {
"sha256": digest(p),
"bytes": p.stat().st_size,
}
return result


def quote(name):
return '"' + name.replace('"', '""') + '"'


def logical(path):
for ending in ("-wal", "-shm", "-journal"):
if Path(str(path) + ending).exists() or Path(str(path) + ending).is_symlink():
raise ValueError("Stop writers and resolve WAL/journal before immutable inspection")
with sqlite3.connect(path.resolve().as_uri() + "?mode=ro&immutable=1", uri=True) as db:
result = {}
for table, schema in db.execute(
"SELECT name,sql FROM sqlite_master WHERE type='table' ORDER BY name"
):
cols = [r[1] for r in db.execute("PRAGMA table_info(" + quote(table) + ")")]
query = "SELECT * FROM " + quote(table) + " ORDER BY " + ",".join(map(quote, cols))
h = hashlib.sha256()
count = 0
for row in db.execute(query):
# Typed canonical encoding also supports BLOB without exposing its contents.
encoded = [(type(x).__name__, x.hex() if isinstance(x, bytes) else x) for x in row]
h.update(
json.dumps(encoded, ensure_ascii=False, separators=(",", ":")).encode() + b"\n"
)
count += 1
result[table] = {
"schema": schema,
"rows": count,
"logical_sha256": h.hexdigest(),
}
return result


def main():
a = argparse.ArgumentParser(description=__doc__)
a.add_argument("--artifact", type=Path, required=True)
a.add_argument("--compare", type=Path)
a.add_argument(
"--mode",
choices=("exact", "logical"),
help="Required with --compare: exact byte-for-byte copy gate; logical post-GUI cache gate",
)
a.add_argument("--output", type=Path, required=True)
args = a.parse_args()
if bool(args.compare) != bool(args.mode):
a.error("--compare and --mode must be supplied together")
if args.output.exists() or args.output.is_symlink():
a.error("Select a fresh output filename")
roots = [args.artifact] + ([args.compare] if args.compare else [])
for root in roots:
if not root.is_dir() or root.is_symlink():
a.error("Artifact must be an existing nonsymlink directory")
if args.output.resolve().is_relative_to(root.resolve()):
a.error("Write the report outside the artifact")
result = {
"helper_schema_version": 2,
"mode": args.mode or "inventory",
"inventory": inventory(args.artifact),
}
if args.compare:
before = result["inventory"]
after = inventory(args.compare)
result["comparison_inventory"] = after
result["identical_file_set"] = set(before) == set(after)
result["changed_files"] = sorted(
k for k in set(before) & set(after) if before[k] != after[k]
)
result["missing_files"] = sorted(set(before) - set(after))
result["added_files"] = sorted(set(after) - set(before))
result["exact_copy"] = before == after
if args.mode == "exact":
result["passed"] = result["exact_copy"]
else:
# Only shard DB bytes may change. Manifest and all other files must stay exact.
db_members = {
str(x.relative_to(args.artifact)) for x in args.artifact.glob("device_*/*.db")
}
result["unchanged_non_database_files"] = all(
before[k] == after.get(k) for k in before if k not in db_members
)
result["manifest_unchanged"] = "manifest.json" in before and before[
"manifest.json"
] == after.get("manifest.json")
result["members"] = []
allowed_added_tables = {"memory_allocation_cache_v1_0"}
for member in sorted(db_members):
if member not in after:
continue
db, other = args.artifact / member, args.compare / member
old, new = logical(db), logical(other)
added = {k: v for k, v in new.items() if k not in old}
result["members"].append(
{
"member": member,
"base_tables_unchanged": all(new.get(k) == v for k, v in old.items()),
"added_tables": added,
"only_known_derived_tables_added": set(added) <= allowed_added_tables,
"bytes_changed": digest(db) != digest(other),
}
)
result["all_base_tables_unchanged"] = (
bool(db_members)
and len(result["members"]) == len(db_members)
and all(m["base_tables_unchanged"] for m in result["members"])
)
result["only_known_derived_tables_added"] = all(
m["only_known_derived_tables_added"] for m in result["members"]
)
result["passed"] = (
result["identical_file_set"]
and result["unchanged_non_database_files"]
and result["manifest_unchanged"]
and result["all_base_tables_unchanged"]
and result["only_known_derived_tables_added"]
)
with args.output.open("x") as out:
json.dump(result, out, indent=2, ensure_ascii=False)
out.write("\n")
if args.compare and not result["passed"]:
raise SystemExit("Comparison failed in " + args.mode + " mode; report saved")


if __name__ == "__main__":
main()
131 changes: 131 additions & 0 deletions .github/scripts/msinsight_acceptance/gui_navigation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
"""Draft real UI navigation; numerical lifecycle assertions are a separate protocol gate.
Never uploads screenshots, logs, DOM or fixture bytes. No security flags or UI overrides.
"""

import argparse
import json
import re
from pathlib import Path

GUI_PHASES = (
"browser_launch",
"page_open",
"import_open",
"fixture_input",
"import_search",
"confirm_ready",
"import_confirm",
"overview_visible",
"window_count",
"window_click",
"window_selected",
"window_ready",
"peak_visible",
"peak_event",
"browser_close",
"page_errors",
"complete",
)
GUI_ERRORS = ("none", "timeout", "assertion", "runtime", "other")


def error_kind(exc):
# Never serialize exception messages, custom class names, paths or DOM text.
if isinstance(exc, AssertionError):
return "assertion"
if isinstance(exc, TimeoutError):
return "timeout"
if type(exc).__module__ == "playwright._impl._errors" and type(exc).__name__ == "TimeoutError":
return "timeout"
if isinstance(exc, RuntimeError):
return "runtime"
return "other"


def record_navigation(output, action):
state = {"phase": "browser_launch", "error_kind": "none", "transition": 0}
checks, page_errors = [], []
try:
action(state, checks, page_errors)
state["phase"] = "complete"
except Exception as exc:
state["error_kind"] = error_kind(exc)
raise
finally:
state["completed_windows"] = [c["window"] for c in checks if "window" in c]
state["page_error_count"] = len(page_errors)
output.write_text(json.dumps(state, indent=2))


def navigate(fixture, state, checks, page_errors):
from playwright.sync_api import expect, sync_playwright

state["phase"] = "browser_launch"
with sync_playwright() as pw:
browser = pw.chromium.launch(headless=True)
context = browser.new_context(locale="en-US", viewport={"width": 1600, "height": 1000})
page = context.new_page()
page.on("pageerror", lambda error: page_errors.append(type(error).__name__))
state["phase"] = "page_open"
page.goto("http://127.0.0.1:5174/", wait_until="domcontentloaded")
state["phase"] = "import_open"
page.locator(".btn-import").click()
field = page.get_by_test_id("filePathInput")
state["phase"] = "fixture_input"
field.fill(str(fixture))
state["phase"] = "import_search"
field.press("Enter")
confirm = page.get_by_role("button", name="Confirm", exact=True)
state["phase"] = "confirm_ready"
expect(confirm).to_be_enabled(timeout=30000)
state["phase"] = "import_confirm"
confirm.click()
frame = page.frame_locator('iframe[src*="plugins/Leaks"]')
overview = frame.get_by_test_id("snapshotSliceOverview")
state["phase"] = "overview_visible"
expect(overview).to_be_visible(timeout=180000)
windows = overview.locator('[role="button"]')
state["phase"] = "window_count"
expect(windows).to_have_count(5)
for index in (0, 1, 0, 3):
state["transition"] = len(checks)
state["phase"] = "window_click"
button = windows.nth(index)
if index != 0 or len(checks):
button.click()
state["phase"] = "window_selected"
expect(button).to_have_attribute("aria-pressed", "true", timeout=30000)
state["phase"] = "window_ready"
expect(button).to_have_attribute("data-ready", "true")
checks.append({"window": index + 1, "selected": True, "ready": True})
peak = windows.nth(3).get_by_test_id("globalPeakMarker")
state["phase"] = "peak_visible"
expect(peak.first).to_be_visible()
state["phase"] = "peak_event"
expect(peak.first).to_have_attribute("aria-label", re.compile(r"\b7430\b"))
checks.append({"window_4_global_peak_marker": True, "event_id": 7430})
# Close the sole GUI WebSocket before the separate protocol client starts.
state["phase"] = "browser_close"
context.close()
browser.close()
state["phase"] = "page_errors"
if page_errors:
raise RuntimeError("GUI page errors observed; inspect private diagnostics")


def main():
p = argparse.ArgumentParser()
p.add_argument("--fixture", type=Path, required=True)
p.add_argument("--output", type=Path, required=True)
args = p.parse_args()
if args.output.exists():
raise ValueError("Use a fresh output path")
assert args.fixture.is_absolute() and args.fixture.is_file()
record_navigation(
args.output,
lambda state, checks, errors: navigate(args.fixture, state, checks, errors),
)


if __name__ == "__main__":
main()
Loading
Loading