Commit 940d5bb
* refactor(phase8-g1): carve export v1 shim to knowledge_base domain (#47)
Per PM scope (msg=7733c905) and Bryce inventory G1: complete the export
carve trail started by #1670 (ExportTask ORM) and #1672 (export_collection_task).
Pure carve / move; URL contract `/api/v1/export*` and `/api/v1/export-tasks*`
unchanged.
Changes:
- aperag/views/export.py → aperag/domains/knowledge_base/api/export_routes.py
(3 routes: create_export_task / get_export_task / download_export;
switched User ORM dep → AuthenticatedUser Protocol, matching the
canonical KB routes pattern)
- aperag/service/export_service.py → aperag/domains/knowledge_base/service/export_service.py
(git mv preserves history; replaced view_models.ExportTaskResponse
references with bare ExportTaskResponse imported from KB schemas)
- ExportTaskResponse schema migrated from aperag/schema/view_models.py
to aperag/domains/knowledge_base/schemas.py (added to __all__);
view_models.py keeps a backward-compat re-export following the same
pattern used for knowledge_graph/retrieval schemas
- aperag/app.py: import switched from aperag.views.export to
aperag.domains.knowledge_base.api.export_routes; mount prefix
remains /api/v1 (D1 hard-cut to /api/v2 deferred to later G3+ batch)
Verification:
- pytest tests/unit_test/test_modularization_boundaries.py -x → 21 passed
(G1-G19 all green; new KB route does not import legacy aggregates)
- pytest tests/unit_test/ → 686 passed, 29 skipped (matches phase8 baseline)
- grep "from aperag.service.export_service|from aperag.views.export"
returns 0 hits in aperag/, tests/, config/
- python -c "from aperag.app import app; ..." confirms 3 export endpoints
remain at /api/v1/collections/{id}/export, /api/v1/export-tasks/{id},
/api/v1/export-tasks/{id}/download
aperag/service/ retains exactly the 3 permanent seam files
(quota_service / prompt_template_service / search_pipeline_service);
no Layer A / Layer B violation.
Ghost-check: none.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* refactor(phase8-g1): D7 v2 hard-cut for export endpoints (#47)
Per @符炫炜 D7 canonical update (msg=30405f5b) + PM msg=3b0c2589:
G1 includes URL prefix migration `/api/v1/export*` → `/api/v2/export*`,
not just file carve.
- aperag/app.py: export_router mount /api/v1 → /api/v2
- aperag/domains/knowledge_base/api/export_routes.py: docstring updated
to reflect D7 v2 hard-cut
- aperag/domains/knowledge_base/service/export_service.py: download_url
template /api/v1/... → /api/v2/...
- web/src/api-v2/schema.d.ts: 3 export route key strings v1 → v2
- web/src/features/collection/client-api.ts: 2 client call paths v1 → v2
- tests/unit_test/test_web_typed_api_contract.py: assertions and comment
updated to expect v2 paths post-D7
Verification:
- pytest tests/unit_test/test_modularization_boundaries.py
tests/unit_test/test_web_typed_api_contract.py -x → 37 passed
- python -c "from aperag.app import app; ..." → 3 export endpoints
now mounted at /api/v2/{collections/{id}/export, export-tasks/{id},
export-tasks/{id}/download}
- grep "/api/v1/export" aperag/ tests/ web/ config/ → 0 hits
(a single unrelated historical comment about KG-eval export remains
in knowledge_graph/api/routes.py:259, untouched)
Ghost-check: none.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 12e5671 commit 940d5bb
8 files changed
Lines changed: 76 additions & 45 deletions
File tree
- aperag
- domains/knowledge_base
- api
- service
- schema
- tests/unit_test
- web/src
- api-v2
- features/collection
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| |||
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
88 | | - | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
| 226 | + | |
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
| |||
Lines changed: 18 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
15 | 25 | | |
16 | 26 | | |
17 | 27 | | |
18 | 28 | | |
19 | | - | |
20 | 29 | | |
21 | | - | |
22 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
23 | 33 | | |
24 | 34 | | |
25 | 35 | | |
| |||
35 | 45 | | |
36 | 46 | | |
37 | 47 | | |
38 | | - | |
39 | | - | |
| 48 | + | |
| 49 | + | |
40 | 50 | | |
41 | 51 | | |
42 | 52 | | |
| |||
49 | 59 | | |
50 | 60 | | |
51 | 61 | | |
52 | | - | |
53 | | - | |
| 62 | + | |
| 63 | + | |
54 | 64 | | |
55 | 65 | | |
56 | 66 | | |
| |||
63 | 73 | | |
64 | 74 | | |
65 | 75 | | |
66 | | - | |
| 76 | + | |
67 | 77 | | |
68 | 78 | | |
69 | 79 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| |||
381 | 382 | | |
382 | 383 | | |
383 | 384 | | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | | - | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
649 | 649 | | |
650 | 650 | | |
651 | 651 | | |
652 | | - | |
653 | | - | |
654 | | - | |
655 | | - | |
656 | | - | |
657 | | - | |
658 | | - | |
659 | | - | |
660 | | - | |
661 | | - | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
667 | | - | |
668 | | - | |
669 | | - | |
670 | | - | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
671 | 659 | | |
672 | 660 | | |
673 | 661 | | |
| |||
684 | 672 | | |
685 | 673 | | |
686 | 674 | | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
687 | 678 | | |
688 | 679 | | |
689 | 680 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
639 | 639 | | |
640 | 640 | | |
641 | 641 | | |
642 | | - | |
643 | | - | |
644 | | - | |
| 642 | + | |
| 643 | + | |
645 | 644 | | |
646 | 645 | | |
647 | 646 | | |
648 | | - | |
649 | | - | |
| 647 | + | |
| 648 | + | |
650 | 649 | | |
651 | 650 | | |
652 | 651 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
549 | 549 | | |
550 | 550 | | |
551 | 551 | | |
552 | | - | |
| 552 | + | |
553 | 553 | | |
554 | 554 | | |
555 | 555 | | |
| |||
569 | 569 | | |
570 | 570 | | |
571 | 571 | | |
572 | | - | |
| 572 | + | |
573 | 573 | | |
574 | 574 | | |
575 | 575 | | |
| |||
589 | 589 | | |
590 | 590 | | |
591 | 591 | | |
592 | | - | |
| 592 | + | |
593 | 593 | | |
594 | 594 | | |
595 | 595 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| |||
0 commit comments