feat(compiler): end-to-end compile and check orchestration

- resolve scope, discover exact snapshot, project plain Markdown, run real
  Analysis for .mq.md entries, cross-check module source bytes, merge contexts
  and reject uncovered/invalid Marqdo documents
- collect referenced local assets and known-missing paths before linking so a
  missing file is distinguished from an unindexed/excluded one
- incremental plan by content-digest change set: unchanged documents reuse
  digest-guarded facts; any .mq.md/manifest/lock/core-identity change triggers
  the conservative full re-analysis; plain-only edits never invoke Analysis
- no-op compiles preserve the stored snapshot and generation; rebuilds
  increment the generation and atomically replace the artifact
- recheck every source digest immediately before publishing, never mixing
  snapshots, and refuse to publish graphs with blocking diagnostics
- check validates sources, references, Analysis coverage, database structure
  and currentness, writes nothing and exits 1 for definite broken links
- add end-to-end tests for plain-only compile without a core binary, mixed
  real-Analysis compile, incremental/rebuild/no-op, stale database and broken
  links
This commit is contained in:
marqdo-knowledge committed 2026-11-26 01:21:29 +08:00
1 parent cca8fbdab1
commit 66f3e168c4
5 files changed
+1106 -14

No files matched your search

+12 -3
View File
@@ -355,16 +355,17 @@ impl ReadStore {
let mut statement = self
.conn
.prepare(
"SELECT a.context_id, n.id, n.canonical_key, n.kind, n.doc_id, n.parent_id,
"SELECT n.id, n.canonical_key, n.kind, n.doc_id, n.parent_id,
n.span_start, n.span_end, n.title, n.title_norm, n.symbol_norm,
n.content_digest, n.semantic_digest, n.searchable, n.metadata_json
n.content_digest, n.semantic_digest, n.searchable, n.metadata_json,
a.context_id
FROM aliases a JOIN nodes n ON n.id = a.node_id
WHERE a.alias = ?1 ORDER BY a.context_id",
)
.map_err(db)?;
let rows = statement
.query_map([alias], |row| {
Ok((row.get::<_, String>(0)?, map_node(row)?))
Ok((row.get::<_, String>(14)?, map_node(row)?))
})
.map_err(db)?;
let mut out = Vec::new();
@@ -735,6 +736,14 @@ impl ReadStore {
}
}
pub fn search_unit_count(&self) -> Result<u64, KnowledgeError> {
let count: i64 = self
.conn
.query_row("SELECT count(*) FROM search_units", [], |row| row.get(0))
.map_err(db)?;
Ok(count as u64)
}
pub fn counts(&self) -> Result<(u64, u64, u64), KnowledgeError> {
let documents: i64 = self
.conn