feat(wiki): convert existing source to wiki + human page edit endpoint

Unit 5 of F-Wiki (D20-D23). convert_source_to_wiki task reuses reingest's storage file-load + parser to materialize files->wiki_pages (one page/file), skips/reports non-text, re-embeds per page, and flips kind=wiki + exposure=agentic_tool only when pages were created. POST /wiki/convert (explicit, write-authz; blank source enables inline, fileful enqueues the task; rejects mid-ingest). PUT /wiki/page for human edits (write-authz, optimistic version -> 409, re-embed). PATCH /config preserves kind (kind changes only via convert).
This commit is contained in:
Alex committed 2026-06-22 20:16:18 +01:00
1 parent 5110189143
commit 0c9e0313bd
8 files changed
+1133 -25

No files matched your search

+16
View File
@@ -86,6 +86,20 @@ class TestReingestSourceTask:
assert result == {"status": "ok"}
class TestConvertSourceToWikiTask:
@pytest.mark.unit
@patch("application.worker.convert_source_to_wiki_worker")
def test_calls_convert_worker(self, mock_worker):
from application.api.user.tasks import convert_source_to_wiki
mock_worker.return_value = {"status": "converted"}
result = convert_source_to_wiki("source123", "user1")
mock_worker.assert_called_once_with(ANY, "source123", "user1")
assert result == {"status": "converted"}
class TestScheduleSyncsTask:
@pytest.mark.unit
@patch("application.api.user.tasks.sync_worker")
@@ -286,6 +300,8 @@ class TestDurableTaskRetryPolicy:
"store_attachment",
"process_agent_webhook",
"ingest_connector_task",
"reembed_wiki_page",
"convert_source_to_wiki",
],
)
def test_task_has_retry_config(self, task_name):