Repository navigation
fix(rag): import Layer B through the real schema boundary - #116
Merged
Merged
Conversation
The merged Layer B importer wrote columns that do not exist in the committed documents/document_chunks schema and used non-UUID chunk ids for UUID primary keys. Its tests passed only because the mock accepted arbitrary columns.\n\nRoute imports through the shipped storeChunks path, derive deterministic UUID ids, keep import provenance in JSONB metadata, and assert the real schema column allowlist. Also stop echoing matched secret/PII material in rejection labels and include the chunk ordinal in chunk ids so repeated paragraphs cannot collide.\n\nRed control on base 78f0b06: 5 failed / 20 passed (25 tests). Corrected tree: 25/25. Full gate: typecheck 0, lint 0 errors, 131 files / 722 tests, boundaries/i18n/raw-hex/governance/imports/AI boundary/secrets/dist guards green, QA all systems verified, web export OK. No document imported; no version/tag/release.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
A newly published advisory (GHSA-ghv9-86vm-4v8m) marks cross-spawn 7.0.0-7.0.6 critical for command injection on Windows. The CI production dependency audit gate began failing on the existing 7.0.6 lock entry. Pin the transitive dependency to 7.1.2 with an npm override and record the remaining audit surface in the changelog. No product source behaviour changed.
This branch was successfully deployed
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.
What this fixes
The merged Layer B importer wrote columns that do not exist in the committed
documents/document_chunksschema (source_status,provenance,chunk_id,chunk_index,size_chars, and others), and wrotechunk-…strings into UUID primary keys. Its tests passed only because the mock accepted arbitrary columns.This change routes imports through the shipped
storeChunksingestion path inlib/knowledge.ts, which already ownsdocuments/document_chunksgovernance. Document and chunk ids are now deterministic UUIDs viastableHashId, and import provenance is stored in the JSONBmetadatacolumn. Tests now assert the real schema column allowlist.Two additional defects found by the red control are fixed:
Proof
Red control on base
78f0b06with the final test file: 5 failed / 20 passed (25 tests) across key/PII echo, duplicate chunk IDs, missing document UUID and missing chunk UUIDs.Corrected tree: targeted suite 25/25; full suite 131 files / 722 tests passing.
Gates: typecheck 0; lint 0 errors; tests 131/722; architecture boundaries, i18n, no-raw-hex, governance audit, declared imports, AI boundary, secret/public-env/dist guards green; QA runner “All systems verified”; web export and perf budget passed.
Scope guard
No document was imported.
docs/rag-sources/remains empty. No version bump, tag or release. Layer B remains blocked on owner-supplied licence-cleared documents, a written licence/rights basis and a named reviewer.Changed-content replacement is explicitly not claimed: stale-chunk cleanup after a changed source is not implemented and must be specified and tested before any real import.