refactor(phase8 #48 G2): settings shim → KB domain + /api/v2 hard-cut#1678
Merged
Conversation
…/v2 hard-cut Phase 8 second batch G2 — per architect canonical D7-2 (msg=94f663f2 §3.2.2), ``aperag/views/settings.py`` is carved into the knowledge_base domain and the URL prefix is hard-cut from ``/api/v1/settings*`` to ``/api/v2/settings*``. Changes: - Rename ``aperag/views/settings.py`` → ``aperag/domains/knowledge_base/api/settings_routes.py`` - Inline the small ``Settings`` request schema locally so the new domain module does not import ``aperag.schema.view_models`` (G1 ban). Drop the now-orphan ``Settings`` class from ``aperag/schema/view_models.py`` — no other caller imports it (verified by grep). - Switch the ``settings_router`` mount in ``aperag/app.py`` from ``/api/v1`` to ``/api/v2``; sort the import line into the ``aperag.domains.knowledge_base.api.*`` block. - Add a new boundary test ``test_no_module_imports_legacy_views_settings`` — analogous to the existing ``test_aperag_domains_never_import_legacy_auth_view_dependencies`` added by #36. Total boundary tests now 22. - Update ``docs/modularization/cleanup-inventory.md`` §3.2 to mark the row done. FE follow-up: ``web/src/features/admin/{client,server}-api.ts`` (and related typed-client regen) will be picked up by @dongdong in a sibling PR per task thread #模块化重构:e1f4ce71. Gates: 22/22 boundary, 686 pass / 29 skip / 1 deselect / 0 fail unit suite, ruff check + format clean.
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
Phase 8 second batch G2 — per architect canonical D7-2 (msg=94f663f2 §3.2.2),
aperag/views/settings.pyis carved into the knowledge_base domain and the URL prefix is hard-cut from/api/v1/settings*to/api/v2/settings*.Changes
aperag/views/settings.py→aperag/domains/knowledge_base/api/settings_routes.pySettingsrequest schema locally so the new domain module does not importaperag.schema.view_models(G1 ban). Drop the now-orphanSettingsclass fromaperag/schema/view_models.py— no other caller imports it (verified by grep).settings_routermount inaperag/app.pyfrom/api/v1to/api/v2; sort the import line into theaperag.domains.knowledge_base.api.*block.test_no_module_imports_legacy_views_settings— analogous to thetest_aperag_domains_never_import_legacy_auth_view_dependenciesadded by chore: change apecd #36 (PR Phase 8: hard-cut identity auth routes #1671). Total boundary tests now 22.docs/modularization/cleanup-inventory.md§3.2 row marked done.Net: 5 files / +55 / -10 LOC.
FE follow-up
web/src/features/admin/{client,server}-api.ts(and related typed-client regen) will be picked up by @dongdong in a sibling FE PR per task thread #模块化重构:e1f4ce71. The two PRs land independently — backend/api/v2/settings*is mounted now; FE callers can stay on/api/v1/settings*(404 on dev) until the FE PR ships.Wait — the v1 routes are gone now, so FE on v1 will 404 immediately after this PR merges. @dongdong this PR may need to land with the FE swap to avoid temporarily breaking admin UI. Please ack timing in the task thread before merge.
Test plan
uv run python -m pytest tests/unit_test/test_modularization_boundaries.py -x -q→ 22 passed (was 21, +1 new gate)uv run python -m pytest tests/unit_test -q --deselect 'tests/unit_test/test_web_typed_api_contract.py::test_phase1_fe_complete_identity_auth_admin_audit_adapter_boundary'→ 686 passed / 29 skipped / 1 deselected / 0 faileduv run ruff check aperag/ tests/ config/→ cleanuv run ruff format --checkon touched files → clean/api/v1/settings*per inventory)CR ask
@weston blocker-level minimal CR — pure file move + 1 prefix change + 1 boundary gate; should be tight.
@符炫炜 canonical drift quick check — D7-2 alignment.
@dongdong FE timing coordination + sibling PR for
web/src/features/admin/*v1→v2 swap.🤖 Generated with Claude Code