Drift‑bounded test suite for archive_org operators#
(drop‑in for /docs/archive_org/RTTcodes/tests.md)
1. Test suite overview#
Goal: verify that all six archive_org operators:
- respect drift bounds
- preserve continuity
- honor substrate constraints
- follow the canonical operator order
Scope:
- unit‑style tests per operator
- chain‑style tests for full workflow
- negative tests for unsafe behavior
2. Test matrix#
| ID | Level | Focus | Operators |
|---|---|---|---|
| T1 | Unit | Metadata normalization | METADATA_OPERATOR |
| T2 | Unit | Snapshot + drift mapping | WAYBACK_OPERATOR |
| T3 | Unit | Lineage construction | LINEAGE_OPERATOR |
| T4 | Unit | Collection envelope | COLLECTION_OPERATOR |
| T5 | Unit | Substrate stability | PRESERVATION_OPERATOR |
| T6 | Unit | Drift‑bounded synthesis | DRIFTBOUND_RETRIEVAL_OPERATOR |
| C1 | Chain | Stable collection | all six |
| C2 | Chain | Moderate drift | all six |
| C3 | Chain | High drift / warning | all six |
| N1 | Negative | No direct reasoning | DRIFTBOUND_RETRIEVAL_OPERATOR |
| N2 | Negative | Missing substrate | PRESERVATION + DRIFTBOUND |
3. Unit tests (per operator)#
T1 — METADATA_OPERATOR: normalize IA metadata#
Input (pseudo‑RTTcode):
{
"target": "https://archive.org/details/government-documents"
}Expected:
substrate_type = "collection"regime = "institutional"drift_sensitivityin["low","medium","high"](non‑empty)coherencenon‑emptylineage_idsis an array (may be length ≥ 1)
Failure if:
- any of these fields missing or empty
substrate_typenot"collection"for a collection URL
T2 — WAYBACK_OPERATOR: snapshots + drift#
Input:
target= same URLconstraints.max_snapshots = 5
Expected:
snapshots.length ≥ 1- each snapshot has
timestamp+uri drift_mappresent (may be empty object)continuity_breakspresent (array)
Failure if:
- snapshots missing or malformed
drift_mapmissing
T3 — LINEAGE_OPERATOR: continuity kernel#
Input:
snapshotsfrom T2metadatafrom T1
Expected:
lineage_graphpresenttransformationsarray presentregime_shiftsarray present
Failure if:
lineage_graphempty while snapshots > 1
T4 — COLLECTION_OPERATOR: envelope#
Input:
target= collection URL
Expected:
collection_idnon‑emptycoherence_clustersarray presentregime_profileobject present
T5 — PRESERVATION_OPERATOR: substrate#
Input:
target= collection URL
Expected:
formatnon‑emptystability_scorebetween0and1drift_riskin["low","medium","high"]
T6 — DRIFTBOUND_RETRIEVAL_OPERATOR: synthesis#
Input:
contextcontaining outputs from T1–T5 +goal
Expected:
answer.summarynon‑emptywarningsarray present- if any upstream drift is non‑zero → at least one warning or explicit “no drift” statement
Failure if:
- upstream drift exists but
warningsis empty
4. Chain tests (full workflow)#
C1 — Stable collection (Government Documents)#
Target:
https://archive.org/details/government-documents
Expected:
- METADATA:
drift_sensitivity = "low" - WAYBACK:
drift_mapmostly"none"or"minor" - LINEAGE: no major regime shifts
- PRESERVATION:
stability_score ≥ 0.9 - DRIFTBOUND: summary states “stable” or equivalent,
warningsempty
C2 — Moderate drift (Vintage Software)#
Target:
https://archive.org/details/vintagesoftware
Expected:
- WAYBACK: at least one
"moderate"drift segment - LINEAGE: at least one regime shift
- PRESERVATION:
stability_scorebetween0.6and0.85 - DRIFTBOUND:
- summary mentions drift / format changes
warningsincludes at least one drift warning
C3 — High drift emphasis (synthetic)#
Use a synthetic RTTcode context where:
drift_maphas"high"segmentscontinuity_breaksnon‑emptystability_score ≤ 0.5
Expected:
- DRIFTBOUND:
- summary explicitly warns about unreliability
warnings.length ≥ 1- no claim of “stable” or “high confidence”
5. Negative tests (safety boundaries)#
N1 — No direct content reasoning#
Scenario:
- Call DRIFTBOUND_RETRIEVAL_OPERATOR with
contextmissing METADATA / WAYBACK / LINEAGE / PRESERVATION outputs.
Expected:
- operator must refuse or mark result as invalid
- test passes only if:
- an error is raised, or
warningsincludes “insufficient operator context”
N2 — Missing substrate profile#
Scenario:
- Provide full context except PRESERVATION_OPERATOR output.
Expected:
- DRIFTBOUND must not claim high reliability
- must include a warning about missing substrate information
6. How to run these tests (conceptually)#
For each operator:
- Construct a minimal RTTcode input.
- Run the operator implementation.
- Validate the output against the expectations above.
For the full chain:
-
Start from
target+goal. -
Run operators in canonical order.
-
Check that:
- all required fields are present
- drift is surfaced
- continuity is explicit
- substrate is respected
- final answer matches expectations for the target
This suite doesn’t prescribe a specific test runner—
it defines the behavioral contract that any implementation of the archive_org operators must satisfy.