Skip to content

fix(tools): reflect polymorphic SLURM detail snapshots - #68

Merged
MSKazemi merged 2 commits into
MSKazemi:mainfrom
QIU-Guanzong:fix/slurm-snapshot-types
Sep 11, 2026
Merged

MSKazemi merged 2 commits into
MSKazemi:mainfrom
QIU-Guanzong:fix/slurm-snapshot-types

Conversation

@QIU-Guanzong

Copy link
Copy Markdown
Contributor

Summary

Closes #66. _load_json now returns a mapping-or-list type for job details, with a literal-path overload preserving the mapping type for slurm_state.json.

The corpus check matches the issue: all 25 state snapshots are mappings; three of seven detail snapshots are lists. An overload keeps the existing single read path and changes no runtime branches. It also avoids duplicating the file loader or adding a shape check that could change behavior for malformed input.

Type of change

  • Bug fix (typing only)

Checklist

  • make check passes locally: 1,590 passed, 24 skipped; lint, type ratchet and repository gates passed.
  • Added coverage for both detail shapes, every state snapshot, and absent files.
  • aobench validate benchmark passes: 88 tasks, 29 environments; corpus unchanged.
  • No user-facing behavior or CLI change requiring a docs update.
  • CHANGELOG.md updated under Unreleased.
  • Read and agree to the Code of Conduct.

Notes for reviewers

The focused SLURM suite passes all 34 tests. These tests pin existing behavior; the defect itself is in the annotation.

I have left the list-shaped snapshots as published. Whether to normalize that format is a separate corpus/fidelity decision for maintainers.

AI assistance: implemented and tested with Codex.


def _load_json(self, rel_path: str) -> dict[str, Any]:
@overload
def _load_json(self, rel_path: Literal["slurm/slurm_state.json"]) -> dict[str, Any]: ...
def _load_json(self, rel_path: Literal["slurm/slurm_state.json"]) -> dict[str, Any]: ...

@overload
def _load_json(self, rel_path: str) -> dict[str, Any] | list[dict[str, Any]]: ...
@MSKazemi
MSKazemi merged commit caa5843 into MSKazemi:main Sep 11, 2026
7 checks passed
MSKazemi added a commit that referenced this pull request Sep 11, 2026
@MSKazemi

Copy link
Copy Markdown
Owner

Thanks, @QIU-Guanzong — merged as caa5843.

The @overload split is the right call, and the reasoning in the PR description — that a single widened return type breaks _query_jobs's self._state.get(...) — is exactly the trap the issue warned about. Deciding which two call sites needed different treatment, rather than reaching for the first signature that type-checked, is the interesting half of this issue and you did the work on it.

I verified: the focused SLURM suite is 34 passed, including your new parametrized tests pinning both snapshot shapes across the real corpus (env_01/04/09/19) plus all 25 state snapshots and the missing-file case. Full suite: 1590 passed, 24 skipped. uv run python scripts/mypy_ratchet.py reports OK — no new debt. aobench validate benchmark: 88 tasks, 29 environments, unchanged. I did have to merge #67 into your branch to resolve a CHANGELOG.md conflict (both PRs landed within a minute of each other) and re-ran the full suite on the merged tree before merging — still green.

You're in AUTHORS.md and on the contributor wall for this.

Thanks for disclosing the Codex assistance in the PR description, and for the "raise it, do not act on it" discipline on whether the list-shaped snapshots should be normalized — that's the maintainer's call and you left it exactly where it belonged.

If AOBench is useful to you, a ⭐ — or passing it to someone it would help — genuinely helps with visibility. Entirely optional, and thanks again for closing out #66.

MSKazemi added a commit that referenced this pull request Sep 12, 2026
…s-defect caveat

Adds @hari760's three-run claude-sonnet-4-6 result (#60) to the leaderboard, two
days after it was promised on the issue. Published exactly as submitted — mean
0.622 over 3 runs, 67 dev tasks at v0.4.1 — rather than quietly recomputed,
because how #63 is resolved moves previously published figures and that decision
belongs in the open on the issue.

Both reported hard fails are defects in this benchmark, not model behaviour:
AIOPS_USR_001 and PERF_USR_001 ask about the requester's own job while the
snapshot assigns job 910803 to bob and 902117 to carol, so a correct agent is
RBAC hard-failed and the task zeroed. Reproduced against MockSlurmTool directly,
both returning permission_denied with cross_user metadata. The row therefore
carries a warning admonition and is labelled a floor, not the model's ceiling.

Also records that the dev split was 67 tasks when this was run and is 68 now,
under an unchanged version string — a re-derivation of this row from main today
will not match, and the leaderboard should say so itself.

Credit corrections in the same pass:
- @QIU-Guanzong was the only merged-PR author in Unreleased not named in the
  entry for their own work (PR #68, the polymorphic job_details typing fix).
- @hari760's census entries said "four defects"; #63 was the fifth and the most
  serious, and it was diagnosable only because the same two tasks failed in all
  three runs. AUTHORS.md, the contributor wall and the wall's summary line now
  say five, and the fifth has its own row.

Gates: pytest 1675 passed / 4 skipped, ruff clean, check_facts OK (89 tasks,
68 dev / 21 test, 29 envs), check_text_encoding OK, validate benchmark passed,
mkdocs build --strict exit 0.
@MSKazemi

Copy link
Copy Markdown
Owner

A correction on credit, @QIU-Guanzong — no action needed from you.

Your fix shipped in the changelog under "Fixed — SLURM snapshot return types", and that
entry was the only one in Unreleased that did not name the person who wrote it. Every
neighbouring entry carries PR #N by @author; yours carried a bare (#66). You were on
AUTHORS.md and the wall, so this was the changelog specifically — which is the surface
people actually read at release time.

Fixed in
0451a3c.
The entry now names you and PR #68, and while I was there I made it say what the defect
actually was rather than only what changed: the annotation claimed dict[str, Any] while
three of the seven job_details.json snapshots (env_04, env_09, env_19) are JSON
lists, and the runtime had been handling both correctly the whole time.

Unrelated, but you may like knowing it: your fix showed up in another piece of work today.
While verifying a corpus defect I had to read job_details.json from two different
environments, and env_04 came back as a list while env_03 came back as a dict — the
exact polymorphism you typed. It is a real shape in this corpus, not a theoretical one.

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.

MockSlurmTool._load_json is typed -> dict[str, Any] but returns a list for 3 of 7 job_details.json snapshots

3 participants