fix: two-round code review fixes for parser, MCP framing, v0.2 serialization - #7
Merged
Merged
Conversation
…ization - fix(parser): correct frontmatter boundary detection and support EOF closing marker - fix(okf): make title optional per v0.2 spec, derive from filename when missing - fix(api): skip reserved filenames before concept parsing to avoid misleading errors - fix(git): serialize all v0.2 fields when saving knowledge base to prevent data loss - fix(git): handle both v0.1 bool and v0.2 struct formats for generated metadata - fix(mcp): implement standard Content-Length framing for JSON-RPC stdio transport - fix(mcp): flush stdout after writing messages to prevent buffering delays - fix(import): make archive extension checks consistently case-insensitive - test: update test cases to match fixed behavior
superops-team
force-pushed
the
fix/two-round-code-review-fixes
branch
from
August 27, 2026 13:44
f97152f to
2b56bc9
Compare
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
This PR applies fixes identified during a two-round code review of the recent PR #5 (v0.2 upgrade) and PR #6 (MCP server) merges.
Fixes
Parser (boundary bug):
findFrontmatterEndhad an off-by-one loop bound (i < len(data)-3→i <= len(data)-3) and did not accept closing---at EOF without trailing newline, causing valid markdown files without trailing newlines to fail frontmatter parsing.v0.2 spec conformance:
ValidateConceptstill enforced title as required, contradicting v0.2 spec §4.1 where title is optional. Fixed to derive title from filename when missing (matching parser behavior).API error handling:
LoadBundlenow explicitly skips reserved filenames (index.md,log.md) before callingParseConcept, making the skip logic explicit rather than relying on parse errors.Data loss in SaveKnowledgeBase (critical):
SaveKnowledgeBaseonly serialized v0.1 fields when writing concepts to disk, dropping all v0.2 fields (sources, generated, verified, status, stale_after, runtime, parameters, computation, executor, attester, filePath). Fixed to serialize the full v0.2 concept structure.MCP stdio transport protocol (critical):
Content-Length:header framing. Standard MCP clients (Claude Desktop, etc.) could not communicate with the server. Fixed to implement proper Content-Length framing for both reading and writing, with newline-delimited fallback for reading.Incremental update / delete (v0.2 compatibility):
removeKnowledgeFilefailed to recognize auto-generated concepts becausehasTrustedGeneratedMetadataonly checked the legacygenerated: trueboolean in CustomFields, but v0.2 concepts store generated info in theGeneratedstruct. Fixed to accept both formats.Archive detection consistency:
IsArchivewas case-sensitive for simple extensions (.zip,.tar) but case-insensitive for compound extensions (.tar.gz), whileExtractArchiveinternally used case-insensitive checks. Unified to fully case-insensitive detection..gzsuffix check inextractTarGzto also be case-insensitive.Tests:
TestValidateConcept_MissingTitleto verify filename-derived title instead of expecting error.TestIsArchive/uppercase_ZIPto expecttruefor case-insensitive detection.test_mcp.pyto use Content-Length framing matching the fixed MCP server.Verification
go build ./...passesgo vet ./...passesgo test ./...all packages pass