Draft: runtime-validated non-destructive reconstruction workflow for ChromaDB 1.x - #25
Draft
apajon wants to merge 30 commits into
Draft
Draft: runtime-validated non-destructive reconstruction workflow for ChromaDB 1.x#25apajon wants to merge 30 commits into
apajon wants to merge 30 commits into
Conversation
Add a conservative palace detector that classifies a palace as chroma_0_6, chroma_1_x, or unknown using manifest-first evidence and a narrow structural fallback, with unit tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Document the detector decision rules, ambiguity handling, and example outputs, and link the new documentation from the README. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a stable-path palace safety gate that blocks unsafe read, write, create, and repair flows unless the detected palace format is chroma_0_6. Wire it into init, mine, health checks, MCP startup, and verify, with unit coverage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Document the stable safety gate policy, guarded flows, and blocked-versus-allowed behavior, and surface the feature in the README. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move the generated Copilot MCP config to .mcp.json, switch validation to the mcpServers schema, and add legacy .vscode/mcp.json migration handling in update.sh. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update the README, MCP docs, troubleshooting notes, update workflow guide, and example config to reflect Copilot CLI's .mcp.json format and the jq-based migration path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Document the ChromaDB 1.x compatibility exploration and add an exploration-only MCP launcher that bypasses the stable branch guardrails for isolated testing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Document the feasibility, risks, required building blocks, validation checklist, and recommendation for a source-preserving ChromaDB reconstruction migration flow. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Explicitly set README to the final reviewed state from the experimental branch. The README was surgically excluded from all mixed commits during the split; this commit applies the intended final state. Includes all stable content (format detection, safety gate, .mcp.json references) plus the experimental reconstruction section, clearly labeled as not part of the supported bridge path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Centralized palace/runtime version detection and compatibility check. - classify_chromadb_version() detects 0.6.x vs 1.x runtime - probe_palace_format() inspects palace SQLite config_json_str - diagnose() returns structured CompatDiagnostic with actionable message - 19 unit tests covering all version combinations
run_mcp_server.py: replace ad-hoc _check_config_type() with runtime_compat.diagnose() — blocks on mismatch with actionable error. run_mcp_server_exploration.py: add diagnose() call that warns on mismatch but does not block (exploration mode).
- create_rich_palace.py: 45-drawer fixture (5 wings, 16 rooms, Unicode, emoji, near-dupes, varied metadata, long content) - compare_palaces.py: 6-tier migration-grade comparison - mcp_runtime_test.py: MCP stdio JSON-RPC test harness (15 phases) - compare_mcp_results.py: structured comparison of MCP test outputs - create_native_palace.py, runtime_load_test.py: earlier investigation tools
Reports: - runtime_compatibility_matrix.md: 6-case version mismatch study - runtime_targeting_hardening.md: launcher audit and safeguards - migration_grade_validation_plan.md: 10-tier validation plan with honest status classification - mcp_runtime_comparison.md: MCP runtime comparison (verdict: IDENTICAL) - type_failure_trace.md, type_usages_inventory.md: _type root cause Logs: - mcp_test_native_1x.json, mcp_test_reconstructed_1x.json: raw MCP test - mcp_comparison_report.json: structured diff - runtime_case_logs/: 6-case compatibility matrix logs
Add entries for: - .vscode/c_cpp_properties.json (machine-specific C++ config) - entities.json, mempalace.yaml (MemPalace local runtime) - .venv-*/ (extra investigation virtualenvs)
19 adversarial palace generators (adversarial_palaces.py): - Data integrity: duplicate IDs, blank IDs, missing/duplicate documents, duplicate metadata keys, empty metadata - Encoding: emoji, CJK, RTL, zero-width, null bytes, astral plane, 100K chars - Scale: 1MB, 10MB, 10K-line documents - Structural: empty palace, missing/corrupted SQLite, wrong schema - Format: mixed signals, missing/conflicting manifest - Edge: single drawer, metadata type extremes (int 2^62, inf, bool) Robustness harness (robustness_harness.py): - 5-stage pipeline: extract → export → import → validate → integrity crosscheck - Outcome classification: full_success, degraded, partial_failure, hard_failure - Root cause tagging: expected_limitation, fixable_bug, upstream_constraint - Silent corruption detection via source/target document comparison - JSON + markdown report generation
Results from running 19 adversarial palaces through the full pipeline: - 7 full success (unicode, large content, metadata edge types, etc.) - 10 explicit rejections (correct pipeline behavior) - 2 hard failures (fixable: unhandled sqlite3 exceptions) - 0 silent corruption Robustness matrix details boundaries, root causes, and recommendations.
All raw sqlite3.Error exceptions in extract_drawers_from_sqlite() and _source_sqlite_integrity() are now caught and converted to structured ReconstructionCliError with stage, category, file path, and actionable hint. - Corrupted SQLite files → 'source palace database is unreadable' - Wrong schema → 'source palace database query failed' - Both caught at connect and query level Robustness harness updated to classify ReconstructionCliError at extract stage as partial_failure (structured rejection) instead of hard_failure. Result: 19 adversarial cases → 7 success, 12 structured rejections, 0 hard failures, 0 silent corruption. Tests: 4 new tests for corrupted/wrong-schema SQLite, 24/24 passing.
- Add global --debug flag to argparse parser - 3-tier exception handler in main(): ReconstructionCliError (structured), RuntimeError (concise + --debug hint), Exception (catch-all + hint) - Debug mode prints full tracebacks; normal mode prints actionable messages - Propagate --debug through reconstruct.sh via run_step() - Add 3 CLI error UX tests: no-traceback, debug-traceback, runtime-error-hint - Document error model in docs/error_model.md
- docs/support_matrix.md: tested environments, validated input classes, adversarial results (7 success, 12 rejections, 0 corruption) - docs/limitations.md: explicit scope, version, data, and operational constraints with honest 'not tested' section
- docs/cli_usage.md: all subcommands, flags, examples, output modes - README.md: upgrade reconstruction from 'experimental' to 'proven with explicit boundaries'; add evidence section, quick usage, guarantees; link new documentation; preserve honest framing of constraints
56/56 tests pass, 19 adversarial cases (0 silent corruption), structured error UX verified, all documentation delivered. Classification: non-destructive, runtime-valid, explicitly bounded migration path with structured failure modes for the tested scope.
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 draft PR isolates the reconstruction workflow for rebuilding a ChromaDB 0.6.x palace into a separate ChromaDB 1.x target.
This is still not a claim of universal 1.x support.
This is not an in-place migration path.
This is a non-destructive, explicitly validated reconstruction path with bounded guarantees.
The key change from the earlier framing is this:
In other words, this branch is no longer just an exploration lab.
It now demonstrates a controlled reconstruction workflow that can produce runtime-usable 1.x targets, while preserving the source palace and failing explicitly on invalid inputs.
Base / dependency
This branch is currently stacked on top of:
split/mcp-json-migrationThat keeps the reconstruction work aligned with the current stable configuration baseline while remaining isolated from the conservative stable-path contract.
What’s included
.mcp.jsonmigration workWhat this branch now demonstrates
1. Non-destructive reconstruction
2. Runtime-valid reconstructed targets within tested scope
Reconstructed 1.x palaces have been validated against native 1.x palaces at multiple levels:
In the tested scope, reconstructed 1.x targets were indistinguishable from native 1.x targets at real MCP runtime level:
3. Explicit runtime mismatch handling
This branch also formalizes a failure mode that previously produced misleading results:
_type/ masked “No palace found” behavior4. Safe failure model
Adversarial and invalid inputs were exercised to ensure the reconstruction path does not fail ambiguously:
What this branch does not claim
This PR does not claim:
This remains a bounded reconstruction workflow, not a blanket 1.x support declaration.
Stable vs experimental contract
Stable path
The existing stable path remains conservative and 0.6.x-oriented.
Experimental / reconstruction path
This branch adds a separate reconstruction workflow for producing validated 1.x targets, with:
This keeps the stable support contract narrow while allowing the reconstruction path to mature independently.
Validation performed
Test suite
pytest tests/Reconstruction validation
Validated on controlled fixtures with:
MCP runtime validation
Validated through real MemPalace MCP server behavior:
Adversarial robustness
Tested against invalid / hostile cases such as:
Observed result:
Reviewer focus
Please review:
Why this is still a draft
This branch proves much more than the original exploration framing, but it is still draft because the support boundary must remain explicit.
What is proven:
What is not yet claimed:
Expected outcome
This branch should be treated as:
It should not be read as: