fix(lib): give local dry-run services an id so rendering works - #528
Open
cswaney wants to merge 2 commits into
Open
fix(lib): give local dry-run services an id so rendering works#528cswaney wants to merge 2 commits into
cswaney wants to merge 2 commits into
Conversation
`blackfish run --dry-run` crashed with `AttributeError: 'NoneType' object has no attribute 'hex'` for local profiles: the local branch built its service without an `id`, unlike the Slurm branch, and `render_job_script` reads `self.id.hex`. Since a dry-run service is never flushed to the database, nothing else assigns one. Add `id=uuid4()` to the local constructors in both `text_generation` and `speech_recognition`, matching the Slurm branch. The dry-run tests missed this because they patched the service class, so the real renderer never ran. Drop those patches and assert on the script body rather than only the metadata echoed above it. `mock_config` now carries a real `CONTAINER_PROVIDER`, since the local templates branch on `provider == "docker"` and would otherwise render an empty script. Closes #494
The dry-run tests now exercise the real job-script renderer and templates instead of a mocked service, which covers a few more lines. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011Aj5BVf85qjSaKT9kJxap8
ReviewSolid, well-scoped bug fix. I traced the root cause and confirmed it in Code quality
Test coverage — this is the best part of the PR
Other
Nice, tight fix with a good "test the real path, not the mock" instinct. LGTM. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
blackfish run --dry-runcrashed withAttributeError: 'NoneType' object has no attribute 'hex'for local profiles. The local branch constructed its service without anid, unlike the Slurm branch, andrender_job_scriptreadsself.id.hex. A dry-run service is never flushed to the database, so nothing else assigns one. Fixed by addingid=uuid4()to the local constructors in bothtext_generation.pyandspeech_recognition.py.mock_configleftCONTAINER_PROVIDERas a bareMagicMock, so the local templates — which branch onprovider == "docker"— rendered an empty script. The fixture now setsContainerProvider.Docker.Test plan
mainviaCliRunner(exit 1,AttributeError); the same invocation now exits 0 and prints a fulldocker runscript.cd lib && uv run pytest tests/cli→ 142 passed.cd lib && uv run just lint→ all hooks pass (ruff, ruff format, mypy, codespell).Closes #530
Generated by Claude Code