feat: implement MoloApp plans 01-15 with integration
Full C++23 framework tree: runtime, observability, security, data, app, realtime, supervisor, clients, CLI, example plus enterprise tenancy, audit, operability, governance, supplychain. Postgres via docker compose for tests.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
// pii_boot: registry builds when every field is marked, boot-fails naming
|
||||
// the unmarked fields otherwise.
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "audit/pii/registry.h"
|
||||
|
||||
#define CHECK(c, msg) \
|
||||
if (!(c)) { \
|
||||
std::cerr << "FAIL pii_boot: " << msg << "\n"; \
|
||||
return 1; \
|
||||
}
|
||||
|
||||
int main() {
|
||||
using namespace molo::audit::pii;
|
||||
std::map<std::string, std::vector<std::string>> schema = {
|
||||
{"users", {"id", "email", "name"}}, {"orders", {"id", "user_id", "total"}}};
|
||||
std::map<std::string, FieldMark> marks = {
|
||||
{"users.id", {PiiClass::kNone, true, ErasureRule::kKeep, "pk"}},
|
||||
{"users.email", {PiiClass::kEmail, true, ErasureRule::kDelete, "consent"}},
|
||||
{"users.name", {PiiClass::kName, true, ErasureRule::kDelete, "consent"}},
|
||||
{"orders.id", {PiiClass::kNone, true, ErasureRule::kKeep, "pk"}},
|
||||
{"orders.user_id", {PiiClass::kNationalId, false, ErasureRule::kMask, "contract"}},
|
||||
{"orders.total", {PiiClass::kFinancial, true, ErasureRule::kDelete, "contract"}},
|
||||
};
|
||||
Registry r = Registry::Build(schema, marks);
|
||||
CHECK(r.size() == 6, "registry size");
|
||||
CHECK(r.Lookup("users", "email").cls == PiiClass::kEmail, "lookup class");
|
||||
CHECK(!r.Lookup("orders", "user_id").exportable, "lookup exportable");
|
||||
CHECK(r.Lookup("nope", "nope").cls == PiiClass::kNone, "lookup default none");
|
||||
|
||||
marks.erase("orders.total");
|
||||
bool threw = false;
|
||||
try {
|
||||
Registry::Build(schema, marks);
|
||||
} catch (const std::runtime_error& e) {
|
||||
threw = true;
|
||||
CHECK(std::string(e.what()).find("orders.total") != std::string::npos,
|
||||
"names missing field");
|
||||
}
|
||||
CHECK(threw, "unmarked field must boot-fail");
|
||||
std::cout << "PASS pii_boot\n";
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user