taicpp foundation: vault, settings, debug log, sessions keyed by shell/pane, REPL, plexer
Full port of the Store (17 tables, FTS5, per-profile slices, sessions, turn state, bots, settings, MCP registry), DebugLog, SETTINGS_CATALOG and boot_settings, ShellSession (as ShellContext), Conversation persistence, Repl/Boot, and the PlexerController family with FlowValidator/PlexerFlow. Verified by replaying 643 operations through tai.py and the C++ code (results, tables, FTS, schema, files identical) and by restarting the REPL under per-pane shells and checking the vault. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
+18
-20
@@ -1,25 +1,23 @@
|
||||
#include "../src/store/store.h"
|
||||
#include <cassert>
|
||||
// Store smoke test (record CRUD, search, spill). The full parity suite is
|
||||
// tests/foundation_parity.py; this one has no python dependency.
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include "../src/store/spill.h"
|
||||
#include "../src/store/store.h"
|
||||
int main() {
|
||||
using namespace detz::store;
|
||||
Store st(":memory:");
|
||||
assert(st.ok() && st.schema_version() == 1);
|
||||
int64_t id = st.add_record("note", "hello", "the quick brown fox jumps");
|
||||
auto r = st.get_record(id);
|
||||
assert(r && r->title == "hello");
|
||||
assert(st.update_record(id, "hello2", "the quick brown fox jumps high"));
|
||||
auto hits = st.search("fox");
|
||||
assert(!hits.empty());
|
||||
assert(st.delete_record(id));
|
||||
assert(!st.get_record(id));
|
||||
Store st2(":memory:");
|
||||
std::string big(5000, 'x');
|
||||
std::string v = spill_or_truncate(&st2, "note", "big", big);
|
||||
assert(v.find("spilled to") != std::string::npos);
|
||||
assert(truncate_text("abc", 4000) == "abc");
|
||||
DebugLog dl; dl.info("a"); dl.warn("b"); dl.error("c");
|
||||
assert(dl.lines().size() == 3);
|
||||
std::puts("M3 OK");
|
||||
auto st = Store::Open(":memory:");
|
||||
std::string id = st->add_record("note", "hello", "the quick brown fox jumps", {"animals"});
|
||||
auto r = st->get_record(id);
|
||||
if (!r || r->get_string("title") != "hello") { std::puts("get_record failed"); return 1; }
|
||||
if (st->search_records("fox").size() != 1) { std::puts("search_records failed"); return 1; }
|
||||
if (st->fts_search("fox").empty()) { std::puts("fts_search failed"); return 1; }
|
||||
if (!st->delete_record(id) || st->get_record(id)) { std::puts("delete_record failed"); return 1; }
|
||||
std::string big(7000, 'x');
|
||||
std::string view = Spill::spill_or_truncate(st.get(), "note", "big", big);
|
||||
if (view.find("chars spilled to mem:") == std::string::npos) { std::puts("spill failed"); return 1; }
|
||||
if (Spill::truncate("abc") != "abc") { std::puts("truncate failed"); return 1; }
|
||||
std::puts("store OK");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user