Skip to content

refactor(phase8 #48 G2): settings shim → KB domain + /api/v2 hard-cut#1678

Merged
earayu merged 1 commit into
mainfrom
bryce/phase8-task48-g2-settings-carve
Apr 25, 2026
Merged

refactor(phase8 #48 G2): settings shim → KB domain + /api/v2 hard-cut#1678
earayu merged 1 commit into
mainfrom
bryce/phase8-task48-g2-settings-carve

Conversation

@earayu
Copy link
Copy Markdown
Collaborator

@earayu earayu commented Apr 25, 2026

Summary

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.pyaperag/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).
  • Hard-cut 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.
  • New boundary test test_no_module_imports_legacy_views_settings — analogous to the test_aperag_domains_never_import_legacy_auth_view_dependencies added by chore: change apecd #36 (PR Phase 8: hard-cut identity auth routes #1671). Total boundary tests now 22.
  • Doc update 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 -q22 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 failed
  • uv run ruff check aperag/ tests/ config/ → clean
  • uv run ruff format --check on touched files → clean
  • e2e-http-smoke / hurl — runs in CI; settings hurl coverage will need FE-side rebase (no hurl currently hits /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

…/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.
@earayu earayu merged commit 14c6935 into main Apr 25, 2026
0 of 2 checks passed
@earayu earayu deleted the bryce/phase8-task48-g2-settings-carve branch April 25, 2026 09:05
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.

1 participant