Conversation
…nstructor Closes the gap the previous phase named rather than implied away (bd 6ns.1). 39df523 typed the layout, the repository field, the readers and the argparse boundaries, but NetworkModelRepository.from_parquet still accepted any path-like, so `from_parquet(script.root)` type-checked -- at the entry point most callers use, and exactly the swap bd 7rt made. Narrowing it needed the three workflow signatures first, which is why it waited: generate_ev_scenarios, generate_flexibility_provider_artifacts and generate_semantic_graph declared base_dir: Path and passed it straight in, so narrowing alone raised the gridalyn ratchet 116 -> 119 when measured last time. - The three signatures take BaseArtifactDir. generate_semantic_graph re-wraps after base_dir.resolve(), which returns a plain Path. - from_parquet's annotation is BaseArtifactDir. Its body still passes the value through Path(), so a caller holding a str or a Path keeps working at run time; what changes is that mypy now rejects the wrong root there. - All three functions gained the docstring they never had, each documenting every parameter, base_dir included -- the condition agreed with the twin's owner for anything this work annotates. Measured, not assumed. Simulated first on a throwaway worktree of main: 0 new errors in gridalyn, projects and gridalyn/twin, and a positive control confirmed a plain Path into from_parquet is now rejected. On this branch: pinned black/isort/flake8 clean, the touched modules import at run time, the three ratchets read 116 / 846 / 12 (identical to main), 57 targeted tests pass, and the full suite is 2260 passed / 0 failed. What remains untyped is stated rather than implied: argparse hands the scripts an Any, so the boundary is held by the type= converters added in 39df523, and tests pass bare Paths, which no ratchet type-checks and run time still accepts. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
nilsonfh
force-pushed
the
fix/type-the-workflow-base-dirs
branch
from
September 16, 2026 17:07
8c50282 to
77e3d7f
Compare
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
The next phase of bd 6ns.1:
NetworkModelRepository.from_parquetnow requiresBaseArtifactDir.#54 typed the producer (
ArtifactLayout.base), the repository field, the readers and the argparse boundaries, but its own commit message said plainly what it did not cover:from_parquetstill accepted any path-like, sofrom_parquet(script.root)type-checked — at the constructor most callers use, and exactly the swap bd 7rt made. This closes it.Why it waited
Narrowing alone raised the gridalyn ratchet 116 → 119 when measured during #54, because three workflow functions declared
base_dir: Pathand passed it straight in. So they come first:generate_ev_scenarios,generate_flexibility_provider_artifacts,generate_semantic_graphnow takeBaseArtifactDir.generate_semantic_graphre-wraps afterbase_dir.resolve(), which returns a plainPath.from_parquet's body still passes the value throughPath(), so a caller holding astror aPathkeeps working at run time; only what mypy accepts changes.base_dirincluded — the condition agreed with the twin's owner for anything this work annotates.Verification
Pathintofrom_parquetis now rejected, so mypy was reading the patched tree.What is still untyped, stated rather than implied
Any, so the boundary is held by thetype=converters added in feat(foundation): type the canonical base-artifact directory of an instance #54, not by these signatures. Measured on this branch, the value still arrives atfrom_parquetunchecked atgenerate_digital_twin_dashboard_catalog.py:104(args.base_dir) and attools/r7_twin_consumer_identity.py:167(tools/carries no ratchet).Paths at 46 call sites (counted, not estimated). No ratchet type-checks tests, and run time still accepts them, because the body converts.🤖 Generated with Claude Code