WIP Phase 4 ingestion: platform guides, exclusion gate, gitea/vault/graph harvest, payload provenance

This commit is contained in:
Paperclip Builder
2026-10-26 22:26:45 +11:00
parent 5c0622c1b1
commit 1e46ec009a
19 changed files with 2952 additions and 70 deletions

View File

@@ -13,7 +13,7 @@ from dataclasses import dataclass
# Bumped whenever chunk boundaries or payload shape change. A stored corpus
# carrying a different version is stale by definition and gets rebuilt.
CHUNKER_VERSION = "blocks-v1"
CHUNKER_VERSION = "blocks-v2-code-v1"
# Provider defaults. `local-hashing` is a deterministic, offline provider used
# by the tests, by `make corpus-test`, and by any rebuild on a host with no
@@ -29,6 +29,14 @@ DEFAULT_QDRANT_URL = "http://127.0.0.1:6333"
DEFAULT_COLLECTION = "resume_corpus"
DEFAULT_PROVIDER = "local-hashing"
DEFAULT_OMNIROUTE_URL = "https://omniroute.lab.audasmedia.com.au"
DEFAULT_GITEA_URL = "https://gitea.lab.audasmedia.com.au"
DEFAULT_PLATFORMS = ("gitea", "obsidian", "graphify")
DEFAULT_GRAPH_COLLECTION = "resume_graph"
# A source that has not changed in this window is reported by the audit. The
# estate is active; silence is evidence that ingestion stopped, not that the
# work stopped.
DEFAULT_SOURCE_SILENCE_DAYS = 30
# Freshness horizon: a document whose `last_verified` is older than this is
# reported stale by the nightly audit. docs/phase-4-notes.md section 5.
@@ -60,6 +68,13 @@ class Config:
max_age_days: int
warn_days: int
apprise_url: str
gitea_url: str = DEFAULT_GITEA_URL
gitea_token: str = ""
platforms: tuple = DEFAULT_PLATFORMS
offline: bool = False
graph_path: str = ""
graph_collection: str = DEFAULT_GRAPH_COLLECTION
source_silence_days: int = DEFAULT_SOURCE_SILENCE_DAYS
vectors_on_disk: bool = False
# -- construction -----------------------------------------------------
@@ -102,6 +117,19 @@ class Config:
),
warn_days=int(os.environ.get("RESUME_WARN_DAYS") or DEFAULT_WARN_DAYS),
apprise_url=os.environ.get("RESUME_APPRISE_URL") or "",
gitea_url=(os.environ.get("GITEA_URL") or os.environ.get("RESUME_GITEA_URL") or DEFAULT_GITEA_URL).rstrip("/"),
gitea_token=os.environ.get("GITEA_TOKEN") or "",
platforms=tuple(
part.strip()
for part in (os.environ.get("RESUME_PLATFORMS") or ",".join(DEFAULT_PLATFORMS)).split(",")
if part.strip()
),
offline=(os.environ.get("RESUME_OFFLINE") or "").lower() in ("1", "true", "yes"),
graph_path=os.environ.get("RESUME_GRAPH_PATH") or "",
graph_collection=os.environ.get("RESUME_GRAPH_COLLECTION") or DEFAULT_GRAPH_COLLECTION,
source_silence_days=int(
os.environ.get("RESUME_SOURCE_SILENCE_DAYS") or DEFAULT_SOURCE_SILENCE_DAYS
),
vectors_on_disk=(os.environ.get("RESUME_QDRANT_VECTORS_ON_DISK") or "").lower()
in ("1", "true", "yes"),
)
@@ -124,6 +152,21 @@ class Config:
)
if not os.path.isdir(self.content_dir):
raise ConfigError(f"content directory not found: {self.content_dir}")
unknown = [name for name in self.platforms if name not in ("gitea", "obsidian", "graphify")]
if unknown:
raise ConfigError(
f"RESUME_PLATFORMS contains unknown platform(s) {unknown}; "
"expected gitea, obsidian, graphify"
)
if not self.offline and self.gitea_token == "":
# Only a hard error when a platform that needs Gitea is selected; the
# token itself is never printed or stored.
if set(self.platforms) & {"gitea", "obsidian", "graphify"}:
raise ConfigError(
"GITEA_TOKEN is not set. Harvesting needs read access to Gitea "
"(~/.config/environment.d/10-secrets.conf), or set RESUME_OFFLINE=1 "
"to rebuild only the curated tier."
)
# -- presentation -----------------------------------------------------
@@ -140,7 +183,10 @@ class Config:
f"batch={self.batch_size}\n"
f"api_url={self.api_url} api_key={key}\n"
f"freshness=max_age_days:{self.max_age_days} warn_days:{self.warn_days}\n"
f"qdrant vectors_on_disk={self.vectors_on_disk}\n"
f"estate=platforms:{','.join(self.platforms)} offline:{self.offline} "
f"gitea:{self.gitea_url} token:{'set' if self.gitea_token else 'unset'} "
f"graph_path:{self.graph_path or 'from gitea'} silence_days:{self.source_silence_days}\n"
f"qdrant vectors_on_disk={self.vectors_on_disk} graph_collection={self.graph_collection}\n"
f"chunker={CHUNKER_VERSION}"
)