3.9 KiB
Indexing Requirements and Projections
Status: Draft Scope: Define indexing contract, authority boundaries, and projection invariants for derived search/index systems (e.g., Elasticsearch).
API Usage Rule (Normative)
- Elasticsearch returns candidate References only.
- Authoritative confirmation MUST occur via ASL/1-STORE and/or TGK/STORE/1.
- Any ordering visible to clients MUST be computed using the canonical
(hash_id, digest)ordering defined in TGK/STORE/1. - Elasticsearch MUST NOT be treated as a source of semantic truth.
1. Decision Checklist (Must Resolve Before Implementation)
- Which artifact types are searchable.
- Which fields are eligible for text extraction.
- Whether
created_atis intrinsic or ingestion-derived. - Checkpoint source of truth (ASL log position required).
- Verification policy (which APIs require authoritative confirmation).
- Edge indexing included in Phase A or deferred.
- Redaction policy per TypeTag.
- Projection schema versioning strategy.
No indexing implementation proceeds without resolving these.
2. Authority Boundary
2.1 Authoritative Sources
- Artifact identity and content: ASL/1-STORE.
- Graph semantics and ordering: TGK/STORE/1.
- Canonical encoding: ENC/ASL1-CORE.
- Identity derivation: ASL/1-CORE and HASH/ASL1.
Elasticsearch is a derived projection only.
2.2 No Semantic Drift Rule
- No backend-specific interpretation of artifacts.
- No inferred edges.
- No implicit ordering.
- No hidden type coercion.
- All optimizations must be observationally equivalent to authoritative results.
3. Reference Encoding Rule
All reference fields indexed in ES MUST use canonical ReferenceBytes hex encoding as defined by ENC/ASL1-CORE.
This guarantees:
- Unambiguous equality.
- Stable identity across backends.
- No ambiguity between
(hash_id, digest)representations.
No alternative encodings are permitted.
4. Ordering Rule
Elasticsearch ordering MUST NOT be treated as authoritative.
Any client-visible ordering MUST be computed via the canonical (hash_id, digest) ordering defined in TGK/STORE/1.
If ES provides candidate edges, authoritative logic must re-order them.
5. Projection Contract
5.1 Replayability
Index state MUST be fully replayable from ASL log/index state, EdgeArtifacts, and deterministic decoding rules.
5.2 Observational Equivalence
Given identical ASL state, ES projection rebuilt from scratch MUST produce identical documents within a schema version.
5.3 Schema Versioning
Each projection index MUST have:
- An explicit schema version, e.g.,
projection_schema_version. - The version recorded in a checkpoint artifact.
- A versioned rebuild strategy.
Schema changes require full replay.
6. Lag Metric Definition
Lag is formally defined as:
Lag = ASL_head_log_position - indexer_checkpoint_log_position
Where:
ASL_head_log_positionis authoritative.indexer_checkpoint_log_positionis recorded in a projection checkpoint artifact.
Lag MUST be observable via metrics.
7. Decoding and Extraction Rules
- Artifact decoding MUST use only the declared encoding profile.
- No heuristic decoding permitted.
- Text extraction MUST be deterministic and versioned.
- Extractor version MUST be stored in index documents.
8. Edge Indexing Guardrail
If edges are indexed:
- Edge documents MUST be derived only from EdgeArtifacts.
- No inferred adjacency allowed.
- Edge semantics MUST respect TGK profile rules.
- Ordering MUST be applied by the authoritative layer.
9. Security and Redaction
- Per-TypeTag redaction policy is mandatory.
- No secrets indexed unless explicitly approved.
- Redaction rules MUST be declared before indexing begins.
10. Conformance Gates
- System must function with ES disabled.
- Full rebuild equivalence test required.
- Ordering correctness test required.
- Cross-backend equivalence test required.