Skip to content

Stop the overalloc oracle test counting Project's UID-0 resource (#518) - #520

Merged
yeroo merged 1 commit into
mainfrom
issue-518-overalloc-oracle-uid0
Sep 28, 2026
Merged

yeroo merged 1 commit into
mainfrom
issue-518-overalloc-oracle-uid0

Conversation

@yeroo

@yeroo yeroo commented Sep 28, 2026

Copy link
Copy Markdown
Owner

Closes #518. Test-only change. The decoder is right; the corpus test was comparing against the wrong thing.

overalloc::tests::project_assignment_and_resource_offsets failed on every snapshot of the real .mpp corpus, not just the one it named. Two problems, the second hidden behind the first.

1. Project's implicit UID-0 resource

Project's XML export always lists an implicit unassigned resource with UID 0, and read_mspdi keeps it. Since #507 the decoder reads the true resource UID (+4, as the module doc says; before, it read the row ID at +0) and skips UID 0. That skip is right: the only caller, the OverAllocated derivation, never looks it up, because unassigned work carries the binary sentinel -65535 and is skipped before any resource lookup.

So the count was off by exactly one on all 47 pairs:

01-empty            decoder=[]            oracle=[0]
34-resource-work    decoder=[1]           oracle=[0, 1]
40-assign-multi     decoder=[1, 2, 3, 4]  oracle=[0, 1, 2, 3, 4]

Every real resource matched. The test now compares only real resources and pins both halves of that design, so neither side can drift unnoticed:

  • the XML still lists UID 0;
  • the decoder still leaves it out.

2. checked >= 50 could never pass on the fetchable corpus

yeroo/mpp-corpus provides only snapshots/, which is 47 eligible pairs. The other folders the test walks (task-fields/, order/, manual/, lag/, progress/) are generated locally with Project and pywin32 (corpus/tools/gen_mpp_task_field_cases.py), and neither the Mac nor the Windows machine has them. The guard now counts snapshot pairs and requires a complete fetch's 47. A partial fetch still fails loudly, and generated folders are checked on top when present.

3. Sorted paths

read_dir order is whatever the filesystem keeps. macOS reached 31-calendar-hours first and Windows another file, so a failure common to every snapshot looked peculiar to 31, and #518 was first filed under that name. The paths are sorted now. No assertion changes.

Proof, on macOS with the fetched corpus (yeroo/mpp-corpus b02a8e0)

Run Before After
cargo test -p mppread --release --lib 1 failed 83 passed
... --no-fail-fast -- --include-ignored 3 failed 2 failed: only the two #517 tests on 44-baseline, unchanged
same, with no corpus present (CI's view) all pass all pass (the test returns early)

The new assertions were checked against their failure modes. Each was broken on purpose and then reverted:

decoder made to return UID 0:
  .../snapshots/01-empty.mpp decoder returned Project's implicit UID-0 resource
guard raised to 48:
  only 47 snapshot pairs checked (47 in all); a complete corpus/tools/fetch-mpp-corpus.* fetch provides 47

cargo fmt --check is clean, and cargo clippy -p mppread --all-targets -- -D warnings exits 0.

One deviation from the agreed plan, worth stating. The plan said to also assert "every eligible pair was checked". Every mismatch in this test panics, and every skip is an explicit continue before a pair is eligible, so that assertion would be vacuous. I left it out, and the snapshot minimum is the guard.

#517 (the 44-baseline baseline-work failure) is deliberately untouched.

🤖 Generated with Claude Code

https://claude.ai/code/session_018qSpykxfaLiQSDxjsqbQUm

`project_assignment_and_resource_offsets` failed on every snapshot of the
real .mpp corpus, not just the one it named. Two problems, the second
hidden behind the first. The decoder is right in both; only the test changes.

1. Project's XML always lists an implicit unassigned resource, UID 0, and
   read_mspdi keeps it. Since #507 the decoder reads the true resource UID
   (+4, as the module doc says; it read the row ID at +0 before) and skips
   UID 0, which nothing looks up: unassigned work carries the binary
   sentinel -65535 and is skipped before any resource lookup. So the count
   was off by exactly one on all 47 pairs — 34-resource-work decodes [1]
   against an oracle of [0, 1]. The test now compares only real resources,
   and pins both halves: the XML still lists UID 0, and the decoder still
   leaves it out. Checked by reintroducing UID 0 in the decoder: the new
   assertion fires on the first snapshot.

2. `checked >= 50` could never pass on the corpus anyone can fetch.
   yeroo/mpp-corpus provides only snapshots/, 47 eligible pairs. The other
   folders the test walks are generated locally with Project and pywin32,
   and neither the Mac nor the Windows machine has them. The guard now
   counts snapshot pairs and requires a complete fetch's 47, so a partial
   fetch still fails loudly while generated folders are checked on top.
   Checked by raising the bound to 48: it fails naming 47.

The paths are now sorted before checking. read_dir order is whatever the
filesystem keeps: macOS reached 31-calendar-hours first, Windows another
file, and a failure common to every snapshot looked peculiar to 31.

Measured on macOS with the fetched corpus (yeroo/mpp-corpus b02a8e0):
`cargo test -p mppread --release --lib` goes from 1 failure to 83 passed.
With `--no-fail-fast -- --include-ignored` the only failures left are the
two #517 tests on 44-baseline, unchanged. With no corpus present, as in
CI, the test still returns early and everything passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018qSpykxfaLiQSDxjsqbQUm
@yeroo

yeroo commented Sep 28, 2026

Copy link
Copy Markdown
Owner Author

Windows (corpus b02a8e0) on a44389d: cargo test --release -p mppread --lib → 83 passed, 0 failed (was 1 failed). Full --no-fail-fast -- --include-ignored → only the two #517 tests on 44-baseline fail (project_2024_oracles, progress_survives_save_as_mspdi_when_present), unchanged. Agree with dropping the always-true "every eligible pair checked" assertion; the 47-snapshot minimum is the real guard. Merging when CI is green.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 0% with 18 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
mppread/src/overalloc.rs 0.00% 18 Missing ⚠️

📢 Thoughts on this report? Let us know!

@yeroo
yeroo merged commit 69acc87 into main Sep 28, 2026
11 checks passed
@yeroo
yeroo deleted the issue-518-overalloc-oracle-uid0 branch September 28, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: mppread overalloc test counts Project's implicit UID-0 resource (and needs corpus folders a fetch doesn't have)

2 participants