refactor(core): eliminate three circular import edges (DIP violations) (#1937)#2013
Open
mvillmow wants to merge 2 commits into
Open
refactor(core): eliminate three circular import edges (DIP violations) (#1937)#2013mvillmow wants to merge 2 commits into
mvillmow wants to merge 2 commits into
Conversation
c7681bd to
27ca9c6
Compare
#1937) - Promote TokenStats from scylla.e2e.models_internals to scylla.core.token_stats - Promote progress types from scylla.cli.progress to scylla.core.progress - Repoint scylla.e2e.progress to scylla.core.progress (breaks cli↔e2e cycle) - Repoint scylla.adapters.base to scylla.core.token_stats (breaks adapters↔e2e cycle) - Retarget analysis/loader_internals TokenStats imports to scylla.core.token_stats - Add back-compat re-export shims in cli/progress.py and e2e/models_internals/token_stats.py - Retarget test mock patch sites to scylla.core.progress.datetime - Add import-linter contracts (3 forbidden) in pyproject.toml with pixi lint feature - Add pixi lint-imports task and CI step in _required.yml - Add tests/test_import_layering.py pytest wrapper for import-linter contracts Edge 1 (config↔metrics): not a live cycle; locked by import-linter contracts only. Edge 2 (cli↔e2e): eliminated — e2e.progress no longer imports from scylla.cli. Edge 3 (adapters↔e2e): eliminated — adapters.base no longer imports from scylla.e2e. Note: adapters.claude_code→e2e.rate_limit pre-existing dep narrowed in contract. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: mvillmow <4211002+mvillmow@users.noreply.github.com>
- pixi.lock was v7 (incompatible with CI pixi v0.67.2, max v6); regenerated from main + pixi.toml import-linter dep using pixi 0.67.2 -> v6 - Fix I001 import ordering in cli/progress.py Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: mvillmow <4211002+mvillmow@users.noreply.github.com>
27ca9c6 to
e2a4536
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
Eliminates the two live circular import cycles identified in #1937 and adds import-linter enforcement to prevent regression.
RunStatus,RunProgress,TierProgress,EvalProgress,ProgressDisplay,format_duration,format_progress_bar) fromscylla.cli.progressto newscylla.core.progress. Repointedscylla.e2e.progressto import fromscylla.core.progress(atomic commit — no intermediate state with the violation).scylla.cli.progressis now a back-compat re-export shim.TokenStatsfromscylla.e2e.models_internals.token_statsto newscylla.core.token_stats. Repointed all consumers:adapters/base.py,analysis/loader_internals/models.py,analysis/loader_internals/run_loader.py,e2e/models.py,e2e/models_internals/results.py. The original file becomes a one-line back-compat shim.config/models.pyalready imports fromscylla.core.thresholds. No code move required; regression locked by import-linter contracts.forbiddencontracts inpyproject.toml:e2e must not import cli,adapters must not import e2e,core has no scylla layer dependencies. Addedlint-importstask to pixi and CI step in_required.yml. Addedtests/test_import_layering.pypytest wrapper.tests/unit/cli/test_progress.pyandtests/unit/e2e/test_progress.pymock patch retargeted toscylla.core.progress.datetime.Divergence from plan
cli/progress.pyre-exports consolidated into a single import block (plan had separate blocks per symbol — functionally identical, cleaner style).adapters.claude_code → e2e.rate_limitis a pre-existing intentional dependency narrowed viaignore_importsin theadapters must not import e2econtract, documented inline. Tracked as a follow-up refactor.Verification
grep -rn "from scylla.cli" src/scylla/e2e/→ 0 matchesgrep -rn "from scylla.e2e.*TokenStats" src/scylla/adapters/ src/scylla/executor/ src/scylla/metrics/→ 0 matchespixi run --environment default lint-imports→ Contracts: 3 kept, 0 brokenpixi run --environment lint mypy src/scylla/→ Success: no issues found in 180 source filespixi run lint→ All checks passedCloses #1937
🤖 Generated with Claude Code