tooling: index local compute container candidates #2395

Merged
R0Y00 merged 1 commit from upstream-pr/2403 into main 2026-11-25 16:24:10 +00:00
R0Y00 commented 2026-11-25 15:22:31 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T15:22:31Z.


Summary

  • Join recognized local slot 67 request digests to compute archive HASH parts using the existing record and container validation.
  • Index candidates by full-container SHA-256. Retain duplicate record counts, report conflicts and support selecting direct and indirect calls from a trace.
  • Print JSON metadata only. Candidate matches record digest agreement. Native code equivalence and GPU execution require separate evidence.

Verification

  • python -B tests/compute_container_index_check.py passed, including duplicate, conflict, invalid flags and trace controls.
  • python -B tests/startup_compute_request_offline_check.py passed.
  • python -B tests/dxcontainer_part_offsets_check.py passed all 8 cases.
  • python -B tests/docs_links_check.py passed (19 Markdown files, 465 links).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6607846830 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2403). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T15:22:31Z. --- ## Summary - Join recognized local slot 67 request digests to compute archive `HASH` parts using the existing record and container validation. - Index candidates by full-container SHA-256. Retain duplicate record counts, report conflicts and support selecting direct and indirect calls from a trace. - Print JSON metadata only. Candidate matches record digest agreement. Native code equivalence and GPU execution require separate evidence. ## Verification - `python -B tests/compute_container_index_check.py` passed, including duplicate, conflict, invalid flags and trace controls. - `python -B tests/startup_compute_request_offline_check.py` passed. - `python -B tests/dxcontainer_part_offsets_check.py` passed all 8 cases. - `python -B tests/docs_links_check.py` passed (19 Markdown files, 465 links).
ChazY11 commented 2026-11-25 16:05:25 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-25T15:49:20Z.


Two mutations survive, and neither is equivalent — they are the two places where the fixture compares a set instead of an order

Baseline: tests/compute_container_index_check.py → Ran 1 test … OK, exit 0.

mutation of tools/compute_container_index.py result
sorted(candidates[digest].values(), key=…sha256) → list(…) survived
keys = sorted(observed if … else request_paths) → list(…) survived

Both outputs are ordering in a file whose purpose is to be compared between runs ("index local compute container candidates"), so ordering is part of the contract, and both mutants were behaviour-changing when I checked rather than assumed.

The first one is vacuous because the expected list is also sorted

# tests/compute_container_index_check.py:108
self.assertEqual(rows[key(2)]["candidates"], sorted([
    {"sha256": hashlib.sha256(blob).hexdigest(), "hash_flags": flags, "records": 1}
    for flags, blob in enumerate((conflict_a, conflict_b))
], key=lambda candidate: candidate["sha256"]))

The expectation sorts itself, so the comparison only fails when the tool's natural order differs from the hash order. With the two conflict blobs you picked, the collection order happens to coincide with the sorted order, so list(...) passes. That is not the assertion the line appears to make — it reads as "candidates are sorted", and it actually says "candidates are sorted or this pair is already sorted".

The fix is one line in the fixture rather than in the tool: choose the conflict pair so that collection order is the reverse of hash order (compute sha256 of both and swap if needed), or assert [c["sha256"] for c in candidates] == sorted(...) and that the pre-sort order differs, so the case cannot go vacuous again. Then list(...) dies.

The second has no assertion at all

rows is a dict keyed by request key, and every access is rows[key(n)], so insertion order is never observed by the test even though it is what lands in the JSON. If the index is meant to be diffable, list(report["requests"]) should equal the sorted key list; without that, changing sorted to list changes every output file and no test notices.

One more shape to consider while you are there

summary.request_statuses is dict(Counter(...)) and archive_records is dict(archive_counts) — both take their order from first occurrence. If two runs see the same requests in a different order, the summary dicts serialise in a different order even when every value matches. Sorting those two keys at construction would make the whole report order-stable, which is the property the tool is for.

What the fixture does cover well

The seven request outcomes (unique, conflict, unmatched, unrecognized-data, missing-data, missing-request), the archive framing rejections, the selection switch between dispatch-trace and cache, and the "the run does not modify the tree" assertion (self.assertEqual(set(root.rglob("*")), original_files)) — that last one is the kind of control most fixtures skip, and it is why I trust the rest of the table.

AI-assisted; the two mutations and the read of the expected list were done locally on Windows 11 build 26300.9974.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7167343234 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2403#issuecomment-7167343234). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-25T15:49:20Z. --- ## Two mutations survive, and neither is equivalent — they are the two places where the fixture compares a set instead of an order Baseline: `tests/compute_container_index_check.py` → `Ran 1 test … OK`, exit 0. | mutation of `tools/compute_container_index.py` | result | |---|---| | `sorted(candidates[digest].values(), key=…sha256)` → `list(…)` | survived | | `keys = sorted(observed if … else request_paths)` → `list(…)` | survived | Both outputs are **ordering** in a file whose purpose is to be compared between runs ("index local compute container candidates"), so ordering is part of the contract, and both mutants were behaviour-changing when I checked rather than assumed. ### The first one is vacuous because the expected list is also sorted ```python # tests/compute_container_index_check.py:108 self.assertEqual(rows[key(2)]["candidates"], sorted([ {"sha256": hashlib.sha256(blob).hexdigest(), "hash_flags": flags, "records": 1} for flags, blob in enumerate((conflict_a, conflict_b)) ], key=lambda candidate: candidate["sha256"])) ``` The expectation sorts itself, so the comparison only fails when the tool's natural order differs from the hash order. With the two conflict blobs you picked, the collection order happens to coincide with the sorted order, so `list(...)` passes. That is not the assertion the line appears to make — it reads as "candidates are sorted", and it actually says "candidates are sorted *or* this pair is already sorted". The fix is one line in the fixture rather than in the tool: choose the conflict pair so that **collection order is the reverse of hash order** (compute `sha256` of both and swap if needed), or assert `[c["sha256"] for c in candidates] == sorted(...)` **and** that the pre-sort order differs, so the case cannot go vacuous again. Then `list(...)` dies. ### The second has no assertion at all `rows` is a dict keyed by request key, and every access is `rows[key(n)]`, so insertion order is never observed by the test even though it is what lands in the JSON. If the index is meant to be diffable, `list(report["requests"])` should equal the sorted key list; without that, changing `sorted` to `list` changes every output file and no test notices. ### One more shape to consider while you are there `summary.request_statuses` is `dict(Counter(...))` and `archive_records` is `dict(archive_counts)` — both take their order from first occurrence. If two runs see the same requests in a different order, the summary dicts serialise in a different order even when every value matches. Sorting those two keys at construction would make the whole report order-stable, which is the property the tool is for. ## What the fixture does cover well The seven request outcomes (`unique`, `conflict`, `unmatched`, `unrecognized-data`, `missing-data`, `missing-request`), the archive framing rejections, the `selection` switch between `dispatch-trace` and `cache`, and the "the run does not modify the tree" assertion (`self.assertEqual(set(root.rglob("*")), original_files)`) — that last one is the kind of control most fixtures skip, and it is why I trust the rest of the table. AI-assisted; the two mutations and the read of the expected list were done locally on Windows 11 build 26300.9974.
KelboLive commented 2026-11-25 16:05:25 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-25T15:58:42Z.


APPROVED

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7167482410 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2403#issuecomment-7167482410). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-25T15:58:42Z. --- APPROVED
upstream-sync closed this pull request 2026-11-25 17:01:26 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!2395
No description provided.