strawberry/tests/trace_check.cpp
trvon 3fd5d23b77
threat traces checker + fleet gate in the dockerized Salt test
- scripts/threat_traces.py: enforces the mechanical rules of the 2026-10-28
  threat-trace pre-registration: required # meta keys; eval families first
  reported 2025-07-01..2026-10-28 with a new-family/new-variant bucket and
  write-up sources only; training families before the cutoff with every
  fifth family (first-report order) in dev; no family in both files;
  RFC 5737 addresses and .example domains only; size caps; and that every
  file compiles with replay's parser. --sha256 prints the freeze digest.
- tests/trace_check.cpp: strawberry-trace-check dev tool (replay's parser).
- strawberry.gate: optional gate.warmup_hours (unset = the pre-registered
  12 h; TEST pillars only).
- deploy/salt/test/fleet_run.sh: gate phase - tops sensor history past the
  10 min injection floor, runs orch.strawberry_gate, asserts 3 gate models
  were published, 9 pooled cells over 3 sensors with positives, sensors keep
  their reports, and still no promoted model anywhere.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 09:36:24 -07:00

36 lines
1.2 KiB
C++

// strawberry-trace-check: dev tool (build-only, not installed). Compiles trace files with the same
// parser replay uses and prints "<file>: N traces" or the parse error. Exit 0 only if all compile.
#include "strawberry/learn/trace.hpp"
#include <fstream>
#include <iostream>
#include <iterator>
#include <string>
#include <vector>
int main(int argc, char** argv) {
if (argc < 2) {
std::cerr << "usage: strawberry-trace-check FILE...\n";
return 2;
}
int rc = 0;
for (int i = 1; i < argc; ++i) {
std::ifstream in(argv[i], std::ios::binary);
if (!in) {
std::cerr << argv[i] << ": cannot read\n";
rc = 1;
continue;
}
const std::string text((std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>());
std::vector<strawberry::learn::Trace> traces;
std::string error;
if (!strawberry::learn::compile_traces(text, traces, error)) {
std::cerr << argv[i] << ": " << error << "\n";
rc = 1;
continue;
}
std::cout << argv[i] << ": " << traces.size() << " traces\n";
for (const auto& t : traces) std::cout << " " << t.name << " (" << t.steps.size() << " steps)\n";
}
return rc;
}