[Feat] Serve the knowledge base in Open Knowledge Format (OKF)#1617
Conversation
|
@CREDO23 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Makes the knowledge base natively serve Google's Open Knowledge Format (OKF v0.1), while keeping storage and the search index unchanged.
Documentserializes to a concept (YAML frontmatter derived from its columns, never stored); folders getindex.md, exports getlog.md, so the ZIP export is a full OKF bundle.GET /documents/{id}returns the OKF concept forAccept: text/markdown, JSON otherwise. One endpoint, no separate path. MCPget_documentconsumes it.app/services/okf/package (serializer, type mapping, validator); storage stays the source of truth, chunks/embeddings remain a derived, rebuildable index.Test plan
get_documentforwardsAccept: text/markdownHigh-level PR Summary
This PR makes the knowledge base natively serve Google's Open Knowledge Format (OKF v0.1) by implementing a pure serialization layer that converts documents to OKF concepts on-the-fly. The implementation adds content negotiation to the
GET /documents/{id}endpoint (returning OKF concepts forAccept: text/markdown, JSON otherwise), builds OKF-compliant ZIP exports withindex.mdandlog.mdfiles, and ensures path identity for concept resolution. Storage remains unchanged as frontmatter is derived from document columns rather than stored, keeping OKF as a read-time view layer while the database stays the source of truth.⏱️ Estimated Review Time: 30-90 minutes
💡 Review Order Suggestion
surfsense_backend/app/services/okf/__init__.pysurfsense_backend/app/services/okf/type_mapping.pysurfsense_backend/app/services/okf/serializer.pysurfsense_backend/app/services/okf/validator.pysurfsense_backend/tests/unit/services/okf/test_conformance.pysurfsense_backend/tests/unit/services/okf/test_serializer.pysurfsense_backend/tests/unit/services/okf/test_ingestion.pysurfsense_backend/tests/unit/services/okf/test_audit.pysurfsense_backend/app/services/export_service.pysurfsense_backend/app/routes/documents_routes.pysurfsense_backend/tests/integration/test_okf_export_bundle.pysurfsense_backend/tests/integration/document_upload/test_okf_read.pysurfsense_backend/tests/integration/test_okf_path_identity.pysurfsense_backend/tests/unit/agents/new_chat/test_path_resolver.pysurfsense_mcp/mcp_server/core/client.pysurfsense_mcp/mcp_server/features/knowledge_base/search_tools.pysurfsense_mcp/tests/test_get_document_okf.py