feat(analysis): consume the current public Analysis v3 contract

- add the process boundary for the core CLI: explicit MARQDO_BIN/--marqdo-bin
  only (never PATH), argv-only invocation of check ENTRY --emit, bounded
  timeout, private temp artifact, exit checks and absolute-path sanitisation
- deserialize every Analysis record with closed serde shapes and validate
  semantic invariants that JSON Schema cannot express: identities, source
  digests, UTF-8 spans, unit tree/order/mode ancestry, anchors, functions and
  signatures, references states, calls, resources, diagnostics and budgets
- validate statement/expression trees structurally with depth and span checks
- convert accepted modules into DocumentFacts, preserving honest upstream
  reference states and one node per Exec unit/function
- merge modules across entry contexts only when identity and source agree,
  otherwise report knowledge.analysis_context_conflict
- add the real rc.4 Analysis positive fixture (with provenance and regeneration
  script), tamper negative tests and optional real-binary integration tests
This commit is contained in:
marqdo-knowledge committed 2026-11-26 00:29:19 +08:00
1 parent 682717a610
commit 59d5afe10b
14 files changed
+3474 -57

No files matched your search

+7 -5
View File
@@ -7,6 +7,7 @@
pub mod analysis;
pub mod ast;
pub mod core_cli;
pub mod discovery;
pub mod markdown;
pub mod okf;
@@ -530,11 +531,12 @@ impl DocumentFacts {
let mut best = 0usize;
let mut best_level = 0u8;
for (index, unit) in self.units.iter().enumerate() {
if unit.span.contains(span) && (index == 0 || unit.level >= best_level) {
if index == 0 || unit.level >= best_level {
best = index;
best_level = unit.level;
}
if index == 0 {
continue;
}
if unit.span.contains(span) && unit.level >= best_level {
best = index;
best_level = unit.level;
}
}
best