refactor(skills): formalize research state contract and add adversarial test harness
- Introduce research_state_schema.md governing anchor states, candidates, and search scopes - Update research-external-presence SKILL.md and working_set_template.md with candidate dispositions - Add test_adversarial_contract.py covering 12 epistemic failure modes and audit gating - Require Mermaid diagrams for process relationships in AGENTS.md
This commit is contained in:
1 parent
8effab36dd
commit
d589b36f65
5 files changed
+777
-26
No files matched your search
@@ -21,8 +21,10 @@ description: >-
|
||||
- Attributed: meets the multi-anchor threshold.
|
||||
- Discarded: conflicting identifiers or homonym in unrelated domain/jurisdiction.
|
||||
- Ambiguous: partial overlap with insufficient proof. Halt attribution and record open question.
|
||||
5. **Classify findings in working set.** For each evaluated source, record entries in the research working set using the taxonomy in `references/epistemic_rules.md`:
|
||||
5. **Classify findings in working set.** For each evaluated source, record entries in the research working set following the state contract in `references/research_state_schema.md` and the taxonomy in `references/epistemic_rules.md`:
|
||||
- Direct observations vs. source claims.
|
||||
- Candidate disposition (`admit` for admissible presence or scoped negative observation, `hold` for unresolved or insufficiently supported candidate, `discard` for confirmed irrelevant, contradictory, or misattributed candidate).
|
||||
- Candidate anchors emitted for orchestrator review (`proposed`).
|
||||
- Corroboration across independent sources.
|
||||
- Provenance, capture date, and temporal validity of source data.
|
||||
- Scoped negative findings for unobserved entities.
|
||||
|
||||
@@ -0,0 +1,309 @@
|
||||
# Research State Schema
|
||||
|
||||
## Purpose
|
||||
|
||||
Defines the minimal machine-readable state contract exchanged between research workers, orchestrators, and auditors during external presence investigation.
|
||||
|
||||
This contract replaces natural-language prose parsing with explicit data structures, enabling deterministic state transitions and clear boundary handoffs.
|
||||
|
||||
---
|
||||
|
||||
## Core Epistemic Principle
|
||||
|
||||
> **Research state is operational state, not truth state.**
|
||||
>
|
||||
> - An anchor in research state answers: *"What identifiers am I currently authorized to use to search?"*
|
||||
> - A candidate in research state answers: *"What external resource have I found, and what is its current disposition?"*
|
||||
>
|
||||
> Operational authorization to search with an identifier does not make it verified truth. Neither anchors nor candidate observations become canonical evidence until they survive independent audit and are formalized via `record_evidence`.
|
||||
|
||||
| Dimension | Research State (`working-set`) | Canonical Evidence (`evidence/`) |
|
||||
| :--- | :--- | :--- |
|
||||
| **Lifecycle** | Transient, mutable working memory. | Durable, immutable repository records. |
|
||||
| **Purpose** | Drive adaptive search and coordination. | Anchor verified institutional truth. |
|
||||
| **Audience** | Orchestrator, research workers, auditor. | Stakeholders, architects, future analysis. |
|
||||
| **Scope** | Includes tentative, hold, and proposed state. | Contains only admitted, audited findings. |
|
||||
|
||||
---
|
||||
|
||||
## The Two State Machines
|
||||
|
||||
Research coordination comprises two distinct state machines with fundamentally different semantics:
|
||||
|
||||
```mermaid
|
||||
stateDiagram-v2
|
||||
direction TB
|
||||
|
||||
state "State Machine 1: Operational Search State (Anchors)" as SM1 {
|
||||
[*] --> Seed
|
||||
Seed --> Active: Orchestrator initialization
|
||||
Proposed --> Active: Reconciled: authorized for search expansion
|
||||
Proposed --> Rejected: Incompatible / no search utility
|
||||
}
|
||||
|
||||
state "State Machine 2: Candidate Admissibility State (Candidates)" as SM2 {
|
||||
[*] --> Evaluated
|
||||
Evaluated --> Attributed: Multi-anchor threshold met (presence)
|
||||
Evaluated --> Ambiguous: Partial overlap / missing anchors (presence)
|
||||
Evaluated --> NegativeObserved: Scoped absence of profile (negative_observation)
|
||||
Evaluated --> Discarded: Conflicting anchors / homonym (discard)
|
||||
|
||||
Attributed --> WorkerAdmit: disposition: admit
|
||||
NegativeObserved --> WorkerAdmit: disposition: admit (scoped negative)
|
||||
Ambiguous --> WorkerHold: disposition: hold
|
||||
Discarded --> WorkerDiscard: disposition: discard
|
||||
|
||||
WorkerAdmit --> AuditPending: audit_status: pending
|
||||
WorkerDiscard --> AuditPending: audit_status: pending
|
||||
|
||||
AuditPending --> AuditPassed: Auditor verified
|
||||
AuditPending --> AuditFailed: Auditor rejected
|
||||
|
||||
state AuditDecision <<choice>>
|
||||
AuditPassed --> AuditDecision
|
||||
AuditDecision --> EligibleForCanonicalEvidence: if disposition == admit
|
||||
AuditDecision --> ConfirmedDiscard: if disposition == discard
|
||||
|
||||
state AuditFailureRoute <<choice>>
|
||||
AuditFailed --> AuditFailureRoute
|
||||
AuditFailureRoute --> WorkerHold: Demoted to hold (unevidenced/ambiguous)
|
||||
AuditFailureRoute --> WorkerDiscard: Demoted to discard (contradiction/invalid)
|
||||
|
||||
WorkerHold --> WorkerReevaluation: Worker fixes scoping or gathers proof
|
||||
WorkerReevaluation --> WorkerAdmit: disposition updated to admit
|
||||
WorkerReevaluation --> WorkerDiscard: contradiction confirmed
|
||||
}
|
||||
```
|
||||
|
||||
### Eligibility Rule for Canonical Evidence:
|
||||
A candidate record is eligible for formalization in `evidence/` **if and only if**:
|
||||
$$\text{disposition} == \text{"admit"} \quad \land \quad \text{audit\_status} == \text{"passed"}$$
|
||||
|
||||
- Positive presence findings (`candidate_kind: presence`) and scoped negative observations (`candidate_kind: negative_observation`) can both be admitted to evidence if they pass audit.
|
||||
- Passing an audit on a discard (`disposition: discard`, `audit_status: passed`) confirms that the discard decision was epistemically sound; it does **not** admit the candidate into canonical evidence.
|
||||
|
||||
### Re-entry Protocol for Failed Candidates:
|
||||
A candidate demoted after audit failure (`audit_status: failed`) must be re-evaluated and re-enter `audit_status: pending` before another audit can occur. The state `failed` records the historical outcome of an audit pass; it is not a terminal disposition.
|
||||
|
||||
To re-submit a candidate from `hold`:
|
||||
1. Worker resolves the auditor objection (e.g., narrows temporal scope, separates unevidenced claims, or resolves anchor ambiguity).
|
||||
2. Worker sets `disposition: admit` (or `discard`).
|
||||
3. Worker sets `audit_status: pending`.
|
||||
4. Auditor evaluates the revised candidate.
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 1. Anchor State Specification
|
||||
|
||||
An anchor is an identifier used to query external systems and evaluate candidate identity.
|
||||
|
||||
### Anchor Fields
|
||||
- `id`: Unique identifier (`ANC-001`, `ANC-002`, ...).
|
||||
- `value`: Normalized string representation (e.g. `"901380770"`, `"amcsolutionscolombia.com"`).
|
||||
- `type`: Anchor category:
|
||||
- `tax_id` (high strength)
|
||||
- `domain` (high strength)
|
||||
- `corporate_email` (high strength)
|
||||
- `legal_name` (high strength)
|
||||
- `phone` (moderate strength)
|
||||
- `street_address` (moderate strength)
|
||||
- `legal_representative` (moderate strength)
|
||||
- `trade_name` (weak strength)
|
||||
- `city` (weak strength)
|
||||
- `industry_sector` (consistency check only)
|
||||
- `strength`: `high` | `moderate` | `weak`.
|
||||
- `status`:
|
||||
- `active`: Anchor authorized for query generation and identity matching within the current research state, with provenance and strength recorded. (Search utility, not evidence proof).
|
||||
- `proposed`: Newly discovered candidate anchor emitted by a worker, pending orchestrator review.
|
||||
- `rejected`: Evaluated candidate anchor discarded due to conflicts, homonymy, or lack of search utility.
|
||||
- `provenance`: Origin of the anchor (`seed` or source candidate ID like `SRC-001`).
|
||||
- `discovery_rationale`: Concise explanation of why the anchor was emitted (for `proposed` anchors).
|
||||
|
||||
### Anchor State YAML Structure
|
||||
|
||||
```yaml
|
||||
anchor_state:
|
||||
active:
|
||||
- id: "ANC-001"
|
||||
value: "amcsolutionscolombia.com"
|
||||
type: "domain"
|
||||
strength: "high"
|
||||
provenance: "seed"
|
||||
- id: "ANC-002"
|
||||
value: "901380770"
|
||||
type: "tax_id"
|
||||
strength: "high"
|
||||
provenance: "seed"
|
||||
|
||||
proposed:
|
||||
- id: "ANC-003"
|
||||
value: "Ledys del Rosario Martínez Lara"
|
||||
type: "legal_representative"
|
||||
strength: "moderate"
|
||||
provenance: "SRC-002"
|
||||
discovery_rationale: "Listed as legal representative in municipal contract gazette"
|
||||
|
||||
- id: "ANC-004"
|
||||
value: "Carrera 14 # 13 C 60, Edificio Ágora, Of. 308"
|
||||
type: "street_address"
|
||||
strength: "moderate"
|
||||
provenance: "SRC-001"
|
||||
discovery_rationale: "Historical administrative address listed in corporate directory"
|
||||
|
||||
rejected: []
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 2. Candidate Evaluation Specification
|
||||
|
||||
Every third-party resource inspected produces a structured candidate entry.
|
||||
|
||||
### Candidate Fields
|
||||
- `id`: Unique source candidate ID (`SRC-001`, `SRC-002`, ...).
|
||||
- `candidate_kind`: Ontological classification of the finding:
|
||||
- `presence`: Positive observation of an entity profile, listing, contract, or mention.
|
||||
- `negative_observation`: Scoped absence of observable profile, listing, or entity within the evaluated query sample.
|
||||
- `discard`: Evaluated candidate determined to be a homonym or irrelevant hit.
|
||||
- `source_class`: Source taxonomy tier (1: Official registries, 2: Local platforms/maps, 3: Commercial directories, 4: Press/citations).
|
||||
- `source_name`: Publishing entity or platform name.
|
||||
- `url`: Canonical locator inspected.
|
||||
- `capture_date`: ISO date (`YYYY-MM-DD`) when worker accessed the resource.
|
||||
- `source_date`: ISO date (`YYYY-MM-DD`) or `null` if undated by the source.
|
||||
- `relevant_period`: Temporal validity window stated or implied by the record (e.g. `"vigencia fiscal 2023"`, `"actual 2026"`, `"historico / no fechado"`). Prevents past facts from silently being treated as current facts.
|
||||
- `identity_status`:
|
||||
- `attributed`: Confirmed match meeting multi-anchor threshold (used for `presence`).
|
||||
- `ambiguous`: Plausible or partial overlap without sufficient anchor strength (used for `presence`).
|
||||
- `discarded`: Proven homonym or contradictory identity (used for `discard`).
|
||||
- `not_applicable`: Entity identity is not being attributed because no profile was observed (used for `negative_observation`).
|
||||
- `disposition`:
|
||||
- `admit`: Candidate admitted by worker to research pool; awaits audit.
|
||||
- `hold`: Retained in research state due to ambiguity or pending anchors.
|
||||
- `discard`: Discarded record; preserved to prevent duplicate querying.
|
||||
- `audit_status`:
|
||||
- `pending`: Worker has admitted or evaluated the record; awaiting auditor verification.
|
||||
- `passed`: Auditor verified the decision against sources and epistemic rules.
|
||||
- `failed`: Rejected by auditor due to contract violation, unsupported claim, or flawed scoping. Demotes to `hold` or `discard`.
|
||||
- `matched_anchors`: List of anchor IDs matching this candidate (e.g. `["ANC-001", "ANC-002"]`).
|
||||
- `missing_anchors`: List of anchor types required to resolve ambiguity (used when `disposition: hold`).
|
||||
- `conflicting_anchors`: List of anchor types that contradicted seed identity (used when `disposition: discard`).
|
||||
- `proposed_anchors`: List of anchor IDs emitted by this source for potential search space expansion.
|
||||
- `direct_observations`: Array of strings capturing facts directly visible on the page.
|
||||
- `source_claims`: Array of strings capturing assertions made by third parties without primary verification.
|
||||
- `corroboration`:
|
||||
- `type`: `identity` | `attribute` | `first_party_consistency` | `independent_external` | `none`.
|
||||
- `reference_ids`: Array of source IDs corroborating this entry.
|
||||
- `confidence`: `high` | `medium` | `low` | `negative_scoped`.
|
||||
- `open_questions`: Array of strings capturing identified gaps or ambiguities.
|
||||
|
||||
### Candidate State YAML Structure
|
||||
|
||||
```yaml
|
||||
candidates:
|
||||
- id: "SRC-001"
|
||||
candidate_kind: "presence"
|
||||
source_class: 3
|
||||
source_name: "Portafolio / Informa Colombia"
|
||||
url: "https://www.informacolombia.com/..."
|
||||
capture_date: "2026-10-08"
|
||||
source_date: null
|
||||
relevant_period: "historico / no fechado"
|
||||
identity_status: "attributed"
|
||||
disposition: "admit"
|
||||
audit_status: "pending"
|
||||
matched_anchors:
|
||||
- "ANC-001"
|
||||
- "ANC-002"
|
||||
missing_anchors: []
|
||||
conflicting_anchors: []
|
||||
proposed_anchors:
|
||||
- "ANC-004"
|
||||
direct_observations:
|
||||
- "Corporate listing displays AMC SOLUTIONS COLOMBIA S.A.S. with NIT 901380770-0."
|
||||
- "Lists three mobile phone lines matching canonical seeds."
|
||||
- "Displays administrative address Carrera 14 # 13 C 60, Edificio Ágora, Of. 308."
|
||||
source_claims:
|
||||
- "Source classifies corporate legal form as Sociedad por Acciones Simplificada."
|
||||
corroboration:
|
||||
type: "identity"
|
||||
reference_ids: ["SRC-002"]
|
||||
confidence: "high"
|
||||
open_questions:
|
||||
- "Is Carrera 14 an active branch or a historical location?"
|
||||
|
||||
- id: "SRC-003"
|
||||
candidate_kind: "negative_observation"
|
||||
source_class: 2
|
||||
source_name: "Google Maps / Búsqueda local Valledupar"
|
||||
url: "https://www.google.com/maps"
|
||||
capture_date: "2026-10-08"
|
||||
source_date: null
|
||||
relevant_period: "2026-10-08"
|
||||
identity_status: "not_applicable"
|
||||
disposition: "admit"
|
||||
audit_status: "pending"
|
||||
matched_anchors: []
|
||||
missing_anchors: []
|
||||
conflicting_anchors: []
|
||||
proposed_anchors: []
|
||||
direct_observations:
|
||||
- "In the evaluated sample of search queries for 'AMC Solutions' 'Valledupar' on Google Maps, no verified commercial profile was observed."
|
||||
source_claims: []
|
||||
corroboration:
|
||||
type: "none"
|
||||
reference_ids: []
|
||||
confidence: "negative_scoped"
|
||||
open_questions:
|
||||
- "Has AMC Solutions initiated verification for a Google Business Profile?"
|
||||
|
||||
- id: "DISC-001"
|
||||
candidate_kind: "discard"
|
||||
source_class: 3
|
||||
source_name: "Datacrédito Empresas / Cámara de Comercio Bogotá"
|
||||
url: "https://www.datacreditoempresas.com.co/"
|
||||
capture_date: "2026-10-08"
|
||||
source_date: null
|
||||
relevant_period: "no aplicable"
|
||||
identity_status: "discarded"
|
||||
disposition: "discard"
|
||||
audit_status: "passed"
|
||||
matched_anchors: []
|
||||
missing_anchors: []
|
||||
conflicting_anchors: ["tax_id", "city", "industry_sector"]
|
||||
proposed_anchors: []
|
||||
confidence: "high"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. Scope and Stopping State by Objective
|
||||
|
||||
Captures search bounds, phase objectives, and stopping conditions.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **Stopping conditions belong to the research objective, not research in general:**
|
||||
> - `identity_resolution` (Phase 1): Stops upon `anchor_sufficiency`.
|
||||
> *Definition:* At least two high-strength seed/canonical anchors are available and mutually consistent for candidate identity resolution. (Refers to operational consistency among anchors, NOT audited canonical evidence).
|
||||
> - `presence_coverage` (Phase 2): Stops upon source-class exhaustion or SERP query limits.
|
||||
> - `activity_attribution` (Phase 3): Stops upon public records/procurement exhaustion.
|
||||
> - `serp_boundary_exhaustion` (Phase 4): Stops when query variations yield no new unobserved domains.
|
||||
|
||||
```yaml
|
||||
search_scope:
|
||||
phase: 1
|
||||
objective: "identity_resolution"
|
||||
source_classes_targeted: [1, 3]
|
||||
stopping_conditions:
|
||||
- condition: "anchor_sufficiency"
|
||||
parameter: "2_high_anchors_confirmed"
|
||||
status: "satisfied"
|
||||
- condition: "max_results_per_query"
|
||||
parameter: 20
|
||||
status: "satisfied"
|
||||
queries_executed:
|
||||
- query: "\"AMC SOLUTIONS COLOMBIA S.A.S.\""
|
||||
results_inspected: 12
|
||||
- query: "\"901380770\""
|
||||
results_inspected: 8
|
||||
```
|
||||
@@ -1,39 +1,129 @@
|
||||
# Plantilla del Conjunto de Trabajo (Research Working Set)
|
||||
|
||||
Estructura sugerida para documentar el conjunto de trabajo de investigacion de presencia externa antes de formalizar registros en `evidence/`:
|
||||
Estructura estandarizada para documentar el conjunto de trabajo de investigacion de presencia externa.
|
||||
|
||||
Combina dos capas complementarias:
|
||||
1. **Bloque de Estado Estructurado (YAML):** Contrato de estado operacional conforme a `references/research_state_schema.md` para coordinacion y control de admisibilidad.
|
||||
2. **Notas de Evaluación de Fuentes (Registro Narrativo de Investigación):** Detalle descriptivo en Markdown para revision humana y formalizacion posterior en `evidence/`.
|
||||
|
||||
---
|
||||
|
||||
```markdown
|
||||
# Conjunto de Trabajo: Presencia Externa - [Nombre de la Organizacion]
|
||||
|
||||
## Metadatos de la Investigacion
|
||||
- **Organizacion objetivo:** [Nombre comercial y legal]
|
||||
- **Fecha de investigacion:** [YYYY-MM-DD]
|
||||
- **Clases de fuentes inspeccionadas:** [Registros oficiales, Plataformas locales, etc.]
|
||||
- **Limite de parada aplicado:** [Alcance definido, profundidad de consultas]
|
||||
```yaml
|
||||
# === ESTADO OPERACIONAL DE INVESTIGACION (CONFORME A RESEARCH_STATE_SCHEMA.MD) ===
|
||||
investigation_metadata:
|
||||
target_organization: "[Nombre Comercial y Razon Social]"
|
||||
capture_date: "[YYYY-MM-DD]"
|
||||
|
||||
# --- MAQUINA DE ESTADO 1: IDENTIFICADORES Y BUSQUEDA OPERACIONAL ---
|
||||
anchor_state:
|
||||
active:
|
||||
- id: "ANC-001"
|
||||
value: "[dominio.com]"
|
||||
type: "domain"
|
||||
strength: "high"
|
||||
provenance: "seed"
|
||||
- id: "ANC-002"
|
||||
value: "[NIT / ID Tributario]"
|
||||
type: "tax_id"
|
||||
strength: "high"
|
||||
provenance: "seed"
|
||||
- id: "ANC-003"
|
||||
value: "[Direccion Fisica]"
|
||||
type: "street_address"
|
||||
strength: "moderate"
|
||||
provenance: "seed"
|
||||
proposed:
|
||||
- id: "ANC-004"
|
||||
value: "[Nuevo Identificador Descubierto]"
|
||||
type: "[legal_representative | street_address | phone]"
|
||||
strength: "[moderate | high]"
|
||||
provenance: "SRC-00X"
|
||||
discovery_rationale: "[Motivo por el que se propone como ancla de busqueda]"
|
||||
rejected: []
|
||||
|
||||
# --- MAQUINA DE ESTADO 2: CANDIDATOS Y ADMISIBILIDAD DE EVIDENCIA ---
|
||||
candidates:
|
||||
- id: "SRC-001"
|
||||
candidate_kind: "presence" # presence | negative_observation | discard
|
||||
source_class: 3
|
||||
source_name: "[Nombre de la Fuente / Directorio]"
|
||||
url: "[URL]"
|
||||
capture_date: "[YYYY-MM-DD]"
|
||||
source_date: null
|
||||
relevant_period: "[vigencia fiscal 2023 | actual 2026 | historico no fechado]"
|
||||
identity_status: "attributed" # attributed | ambiguous | discarded | not_applicable
|
||||
disposition: "admit" # admit | hold | discard
|
||||
audit_status: "pending" # pending | passed | failed
|
||||
matched_anchors: ["ANC-001", "ANC-002"]
|
||||
missing_anchors: []
|
||||
conflicting_anchors: []
|
||||
proposed_anchors: ["ANC-004"]
|
||||
confidence: "high"
|
||||
|
||||
- id: "SRC-003"
|
||||
candidate_kind: "negative_observation"
|
||||
source_class: 2
|
||||
source_name: "[Plataforma o Directorio Inspeccionado]"
|
||||
url: "[URL]"
|
||||
capture_date: "[YYYY-MM-DD]"
|
||||
source_date: null
|
||||
relevant_period: "[actual 2026]"
|
||||
identity_status: "not_applicable"
|
||||
disposition: "admit"
|
||||
audit_status: "pending"
|
||||
matched_anchors: []
|
||||
missing_anchors: []
|
||||
conflicting_anchors: []
|
||||
proposed_anchors: []
|
||||
confidence: "negative_scoped"
|
||||
|
||||
# --- ALCANCE Y CONDICIONES DE PARADA VINCULADAS AL OBJETIVO ---
|
||||
search_scope:
|
||||
phase: 1
|
||||
objective: "identity_resolution" # identity_resolution | presence_coverage | activity_attribution | serp_boundary_exhaustion
|
||||
source_classes_targeted: [1, 3]
|
||||
stopping_conditions:
|
||||
- condition: "anchor_sufficiency"
|
||||
parameter: "2_high_anchors_confirmed"
|
||||
status: "satisfied"
|
||||
- condition: "max_results_per_query"
|
||||
parameter: 20
|
||||
status: "satisfied"
|
||||
queries_executed:
|
||||
- query: "\"[Cadena booleana]\""
|
||||
results_inspected: 10
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Identificadores Ancla Verificados (Semilla)
|
||||
- **Dominio web:** [ej. dominio.com]
|
||||
- **Razon social:** [ej. Denominacion Legal S.A.S. / S.A.]
|
||||
- **Identificacion tributaria / registro:** [ej. NIT / RFC / CIF / NIF]
|
||||
- **Telefonos de contacto:** [ej. +XX XXX XXXXXXX]
|
||||
- **Correos corporativos:** [ej. contacto@dominio.com]
|
||||
- **Ubicacion geografica:** [ej. Ciudad, Region, Pais]
|
||||
- **Sector de actividad:** [ej. Sector economico principal]
|
||||
## 1. Identificadores Ancla Activos (Operacionales para Búsqueda)
|
||||
- **Dominio web:** `[dominio.com]` (ANC-001)
|
||||
- **Razon social:** `[Denominacion Legal S.A.S. / S.A.]`
|
||||
- **Identificacion tributaria / registro:** `[NIT / RFC / CIF / NIF]` (ANC-002)
|
||||
- **Telefonos de contacto:** `[+XX XXX XXXXXXX]`
|
||||
- **Correos corporativos:** `[contacto@dominio.com]`
|
||||
- **Ubicacion geografica:** `[Ciudad, Region, Pais]`
|
||||
- **Sector de actividad:** `[Sector economico principal]`
|
||||
|
||||
---
|
||||
|
||||
## Registro de Fuentes Evaluadas
|
||||
## 2. Notas de Evaluación de Fuentes (Registro Narrativo de Investigación)
|
||||
|
||||
### [SRC-001] [Nombre de la Fuente / Titulo del Registro]
|
||||
- **Tipo de candidato:** Presencia atribuible (presence)
|
||||
- **Fuente:** [Nombre de la plataforma o entidad emisora]
|
||||
- **URL de referencia:** `[URL]`
|
||||
- **Fecha de captura:** [YYYY-MM-DD]
|
||||
- **Fecha declarada por la fuente:** [YYYY-MM-DD o No declarada]
|
||||
- **Clase de fuente:** [Registro oficial | Plataforma local | Directorio comercial | Medios]
|
||||
- **Estado de identidad:** [Confirmada | Descartada | Ambigua]
|
||||
- **Identificadores ancla coincidentes:** [Dominio, Telefono, NIT, etc.]
|
||||
- **Periodo relevante:** [Vigencia fiscal 2023 | 2026 | Historico / no fechado]
|
||||
- **Clase de fuente:** [Clase 1: Registro oficial | Clase 2: Plataforma local | Clase 3: Directorio comercial | Clase 4: Medios]
|
||||
- **Estado de identidad:** Confirmada (Atribuida)
|
||||
- **Disposicion del investigador:** Admitida para auditoria (admit)
|
||||
- **Estado de auditoria:** Pendiente (pending) | Aprobada (passed) | Rechazada (failed)
|
||||
- **Identificadores ancla coincidentes:** [ANC-001, ANC-002]
|
||||
|
||||
#### Observaciones Directas
|
||||
- [Hecho directamente observable en la pagina inspeccionada]
|
||||
@@ -42,29 +132,65 @@ Estructura sugerida para documentar el conjunto de trabajo de investigacion de p
|
||||
- [Informacion atribuida o afirmada por la fuente sin verificacion primaria]
|
||||
|
||||
#### Corroboracion
|
||||
- [Estado: Corroborada con SRC-xxx | No corroborada (fuente unica)]
|
||||
- **Tipo de corroboracion:** [Identidad | Atributos | Consistencia de primera fuente | Externa independiente | Ninguna]
|
||||
- **Referencias:** [SRC-xxx]
|
||||
|
||||
#### Evaluacion de Confianza
|
||||
- **Nivel:** [Alta | Media | Baja | Negativa delimitada]
|
||||
- **Justificacion:** [Basada en identificadores y tipo de fuente]
|
||||
- **Justificacion:** [Basada en identificadores coincidentes y tipo de fuente]
|
||||
|
||||
#### Preguntas Abiertas
|
||||
- [Dudas, discrepancias o vacios de informacion]
|
||||
- [Dudas, discrepancias o vacios de informacion detectados en esta fuente]
|
||||
|
||||
---
|
||||
|
||||
## Descartes de Homonimos
|
||||
### [SRC-003] [Plataforma Inspeccionada - Observación Negativa Delimitada]
|
||||
- **Tipo de candidato:** Observación negativa (negative_observation)
|
||||
- **Fuente:** [Nombre de la plataforma inspeccionada]
|
||||
- **URL de referencia:** `[URL]`
|
||||
- **Fecha de captura:** [YYYY-MM-DD]
|
||||
- **Periodo relevante:** [Fecha de consulta]
|
||||
- **Clase de fuente:** [Clase 2: Plataforma local | Clase 3: Red profesional]
|
||||
- **Estado de identidad:** No aplicable (no se observa entidad)
|
||||
- **Disposicion del investigador:** Admitida para auditoria (admit)
|
||||
- **Estado de auditoria:** Pendiente (pending)
|
||||
|
||||
#### Observaciones Directas
|
||||
- [Delimitación exacta de la muestra consultada y ausencia de ficha comercial/oficial observada]
|
||||
|
||||
---
|
||||
|
||||
## 3. Candidatos Ambiguos en Retencion (Hold)
|
||||
|
||||
### [SRC-00X] [Nombre del Candidato Ambiguo]
|
||||
- **Fuente:** [Plataforma consultada]
|
||||
- **URL de referencia:** `[URL]`
|
||||
- **Periodo relevante:** [Indeterminado | Periodo especifico]
|
||||
- **Estado de identidad:** Ambigua
|
||||
- **Disposicion:** Retenido en estado (Hold)
|
||||
- **Estado de auditoria:** N/A (no admitido para formalizacion)
|
||||
- **Anclas coincidentes:** [ANC-xxx]
|
||||
- **Anclas faltantes para resolucion:** [tax_id, domain, etc.]
|
||||
- **Pregunta abierta / hipotesis:** [Que dato se requiere para atribuir o descartar]
|
||||
|
||||
---
|
||||
|
||||
## 4. Descartes de Homonimos y Coincidencias Espurias (Discard)
|
||||
|
||||
### [DISC-001] [Nombre de la Entidad Homonima]
|
||||
- **Tipo de candidato:** Descarte de homónimo (discard)
|
||||
- **Fuente:** [Plataforma consultada]
|
||||
- **URL de referencia:** `[URL]`
|
||||
- **Criterio de descarte:** [Conflicto en NIT, ubicacion geografica o sector de actividad]
|
||||
- **Justificacion:** [Por que no corresponde a la organizacion objetivo]
|
||||
- **Estado de auditoria:** Pendiente (pending) | Aprobada (passed)
|
||||
|
||||
---
|
||||
|
||||
## Sintesis para Formalizacion
|
||||
- **Fuentes confirmadas para formalizar en evidence/:** [SRC-001, SRC-002, ...]
|
||||
## 5. Sintesis para Formalizacion en evidence/
|
||||
- **Candidatos elegibles para formalización en evidence/ (disposition == admit AND audit_status == passed):** [SRC-001, SRC-002, SRC-003, ...]
|
||||
- **Descartes confirmados por auditoría (disposition == discard AND audit_status == passed):** [DISC-001, DISC-002]
|
||||
- **Candidatos en revisión de auditoría (audit_status: pending):** [SRC-xxx]
|
||||
- **Hallazgos negativos delimitados:** [Plataformas sin perfil observado bajo la muestra evaluada]
|
||||
- **Preguntas abiertas prioritarias para el cliente:** [Lista de preguntas clave]
|
||||
- **Preguntas abiertas prioritarias para el cliente:** [Lista consolidada de preguntas clave]
|
||||
```
|
||||
@@ -56,6 +56,8 @@ For every significant research, analysis, or implementation step, report:
|
||||
Keep reports concise. Do not report routine internal actions unless they affect
|
||||
the result, methodology, or reproducibility.
|
||||
|
||||
Display processes relationships and maps using Mermaid diagrams when possible.
|
||||
|
||||
---
|
||||
## Language
|
||||
|
||||
|
||||
@@ -0,0 +1,312 @@
|
||||
"""
|
||||
Test Harness: Adversarial Verification of the Research State Contract
|
||||
|
||||
Tests behavioral robustness and epistemic enforcement across 12 adversarial fixtures:
|
||||
1. Exact name + wrong NIT -> discard
|
||||
2. Correct NIT + different legal name -> hold / ambiguous
|
||||
3. Historical address -> admit presence + proposed anchor (historical period)
|
||||
4. New legal representative -> admit presence + proposed anchor
|
||||
5. Search snippet vs. underlying page discrepancy -> page governs observation, snippet discarded
|
||||
6. Unsupported promotional claim -> source_claims only, rejected if in direct_observations
|
||||
7. Ambiguous local listing -> hold (missing tax_id / domain)
|
||||
8. Historical government contract -> admit with strict temporal validity, no present-tense leap
|
||||
9. Negative observation on map platform -> negative_observation, not_applicable identity
|
||||
10. Contradictory addresses -> contradiction preserved in open_questions
|
||||
11. Conflicting proposed anchor -> rejected by orchestrator, not promoted to active
|
||||
12. Temporal Exploit & Re-entry -> auditor catches 2023 source claimed as 2026, demotes to hold,
|
||||
worker corrects temporal scope, re-enters pending, auditor passes candidate.
|
||||
"""
|
||||
|
||||
from typing import Dict, Any, List, Tuple
|
||||
|
||||
|
||||
class AnchorRegistry:
|
||||
def __init__(self, seed_anchors: List[Dict[str, Any]]):
|
||||
self.active: Dict[str, Dict[str, Any]] = {a["id"]: a for a in seed_anchors}
|
||||
self.proposed: Dict[str, Dict[str, Any]] = {}
|
||||
self.rejected: Dict[str, Dict[str, Any]] = {}
|
||||
|
||||
def propose_anchor(self, anchor: Dict[str, Any]):
|
||||
self.proposed[anchor["id"]] = anchor
|
||||
|
||||
def reconcile_proposed(self, anchor_id: str, accept: bool, rejection_reason: str = ""):
|
||||
if anchor_id not in self.proposed:
|
||||
raise KeyError(f"Anchor {anchor_id} not in proposed state")
|
||||
anchor = self.proposed.pop(anchor_id)
|
||||
if accept:
|
||||
anchor["status"] = "active"
|
||||
self.active[anchor_id] = anchor
|
||||
else:
|
||||
anchor["status"] = "rejected"
|
||||
anchor["rejection_reason"] = rejection_reason
|
||||
self.rejected[anchor_id] = anchor
|
||||
|
||||
|
||||
class EvidenceAuditor:
|
||||
"""
|
||||
Auditor checks admissibility against epistemic contract:
|
||||
1. Can source be located?
|
||||
2. Does source support observation?
|
||||
3. Does claimed identity satisfy identity_resolution?
|
||||
4. Is epistemic classification correct (claims vs observations)?
|
||||
5. Is temporal validity bounded without extrapolation?
|
||||
6. Is negative finding properly scoped?
|
||||
7. Is corroboration unexaggerated?
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def audit_candidate(candidate: Dict[str, Any], raw_source: Dict[str, Any]) -> Tuple[bool, str]:
|
||||
kind = candidate.get("candidate_kind")
|
||||
disposition = candidate.get("disposition")
|
||||
identity_status = candidate.get("identity_status")
|
||||
|
||||
# Check Discards
|
||||
if kind == "discard":
|
||||
if disposition != "discard":
|
||||
return False, "Candidate kind is discard but disposition is not discard"
|
||||
if not candidate.get("conflicting_anchors"):
|
||||
return False, "Discard candidate must document conflicting anchors"
|
||||
return True, "Discard verified by conflicting anchors"
|
||||
|
||||
# Check Negative Observations
|
||||
if kind == "negative_observation":
|
||||
if identity_status != "not_applicable":
|
||||
return False, "Negative observation must have identity_status: not_applicable"
|
||||
if candidate.get("matched_anchors"):
|
||||
return False, "Negative observation cannot have matched anchors for an unobserved profile"
|
||||
if candidate.get("confidence") != "negative_scoped":
|
||||
return False, "Negative observation must have confidence: negative_scoped"
|
||||
return True, "Negative observation correctly scoped"
|
||||
|
||||
# Check Presence Observations
|
||||
if kind == "presence":
|
||||
if identity_status == "attributed":
|
||||
matched = candidate.get("matched_anchors", [])
|
||||
if len(matched) < 2:
|
||||
return False, f"Attribution requires at least 2 anchors, found {len(matched)}"
|
||||
elif identity_status == "ambiguous":
|
||||
if disposition != "hold":
|
||||
return False, "Ambiguous identity must have disposition: hold"
|
||||
return True, "Ambiguous candidate correctly retained in hold"
|
||||
|
||||
# Check Epistemic Separation: Promotional or third-party claims in direct_observations
|
||||
for obs in candidate.get("direct_observations", []):
|
||||
for promotional_word in ["líder", "el mejor", "mayor prestigio", "reconocido como lider"]:
|
||||
if promotional_word in obs.lower():
|
||||
return False, f"Unevidenced promotional claim '{promotional_word}' found in direct_observations"
|
||||
|
||||
# Check Temporal Validity: Extrapolation of past records to current present state
|
||||
source_date = raw_source.get("publication_date", "")
|
||||
relevant_period = candidate.get("relevant_period", "").lower()
|
||||
if source_date and "2023" in source_date:
|
||||
if "2026" in relevant_period or "actual" in relevant_period:
|
||||
# Source from 2023 cannot assert current 2026 operational truth without fresh evidence
|
||||
return False, f"Temporal validity violation: Source dated {source_date} extrapolated to {relevant_period}"
|
||||
|
||||
# Check Observation vs Underlying Page (snippet conflict)
|
||||
if raw_source.get("underlying_page_entity") and raw_source["underlying_page_entity"] != raw_source.get("snippet_entity"):
|
||||
for obs in candidate.get("direct_observations", []):
|
||||
if raw_source["snippet_entity"] in obs and raw_source["underlying_page_entity"] not in obs:
|
||||
return False, "Direct observation adopted search snippet rather than underlying page reality"
|
||||
|
||||
return True, "Admissibility verified"
|
||||
|
||||
return False, f"Unknown candidate kind: {kind}"
|
||||
|
||||
|
||||
def run_all_adversarial_tests():
|
||||
seed = [
|
||||
{"id": "ANC-001", "type": "domain", "value": "amcsolutionscolombia.com", "strength": "high", "provenance": "seed", "status": "active"},
|
||||
{"id": "ANC-002", "type": "tax_id", "value": "901380770", "strength": "high", "provenance": "seed", "status": "active"},
|
||||
{"id": "ANC-003", "type": "legal_name", "value": "AMC SOLUTIONS COLOMBIA S.A.S.", "strength": "high", "provenance": "seed", "status": "active"},
|
||||
{"id": "ANC-004", "type": "street_address", "value": "Carrera 19d # 5-50, Valledupar", "strength": "moderate", "provenance": "seed", "status": "active"},
|
||||
{"id": "ANC-005", "type": "phone", "value": "+57 3136216458", "strength": "moderate", "provenance": "seed", "status": "active"},
|
||||
]
|
||||
|
||||
registry = AnchorRegistry(seed)
|
||||
auditor = EvidenceAuditor()
|
||||
results = {}
|
||||
|
||||
# Fixture 1: Exact legal name + wrong NIT -> discard
|
||||
c1 = {
|
||||
"id": "ADV-001", "candidate_kind": "discard", "identity_status": "discarded",
|
||||
"disposition": "discard", "audit_status": "pending",
|
||||
"conflicting_anchors": ["tax_id"], "matched_anchors": ["ANC-003"]
|
||||
}
|
||||
raw1 = {"name": "AMC SOLUTIONS COLOMBIA S.A.S.", "nit": "900999888"}
|
||||
passed, reason = auditor.audit_candidate(c1, raw1)
|
||||
assert passed and c1["disposition"] == "discard"
|
||||
results["1. Exact name + wrong NIT"] = "PASS (discard confirmed)"
|
||||
|
||||
# Fixture 2: Correct NIT + different legal name -> ambiguous / hold
|
||||
c2 = {
|
||||
"id": "ADV-002", "candidate_kind": "presence", "identity_status": "ambiguous",
|
||||
"disposition": "hold", "audit_status": "pending",
|
||||
"matched_anchors": ["ANC-002"], "missing_anchors": ["legal_name_reconciliation", "domain"]
|
||||
}
|
||||
raw2 = {"name": "MINERALES DEL CESAR S.A.S.", "nit": "901380770"}
|
||||
passed, reason = auditor.audit_candidate(c2, raw2)
|
||||
assert passed and c2["disposition"] == "hold"
|
||||
results["2. Correct NIT + different legal name"] = "PASS (retained in hold, not attributed)"
|
||||
|
||||
# Fixture 3: Historical address -> admit presence + proposed anchor with historical period
|
||||
c3 = {
|
||||
"id": "ADV-003", "candidate_kind": "presence", "identity_status": "attributed",
|
||||
"disposition": "admit", "audit_status": "pending", "relevant_period": "historico / 2021",
|
||||
"matched_anchors": ["ANC-002", "ANC-003"], "proposed_anchors": ["ANC-006"],
|
||||
"direct_observations": ["Muestra dirección histórica Carrera 14 # 13 C 60"]
|
||||
}
|
||||
raw3 = {"name": "AMC SOLUTIONS COLOMBIA S.A.S.", "nit": "901380770", "address": "Carrera 14 # 13 C 60", "year": "2021"}
|
||||
passed, reason = auditor.audit_candidate(c3, raw3)
|
||||
assert passed and c3["relevant_period"] == "historico / 2021"
|
||||
registry.propose_anchor({"id": "ANC-006", "type": "street_address", "value": "Carrera 14 # 13 C 60", "strength": "moderate", "provenance": "ADV-003", "status": "proposed"})
|
||||
results["3. Historical address"] = "PASS (admitted with historical period; proposed anchor emitted)"
|
||||
|
||||
# Fixture 4: New legal representative from official source
|
||||
c4 = {
|
||||
"id": "ADV-004", "candidate_kind": "presence", "identity_status": "attributed",
|
||||
"disposition": "admit", "audit_status": "pending", "relevant_period": "vigencia fiscal 2023",
|
||||
"matched_anchors": ["ANC-002", "ANC-003"], "proposed_anchors": ["ANC-007"],
|
||||
"direct_observations": ["Acta municipal registra a Ledys del Rosario Martínez Lara como representante legal"]
|
||||
}
|
||||
raw4 = {"publication_date": "2023-12-31"}
|
||||
passed, reason = auditor.audit_candidate(c4, raw4)
|
||||
assert passed
|
||||
registry.propose_anchor({"id": "ANC-007", "type": "legal_representative", "value": "Ledys del Rosario Martínez Lara", "strength": "moderate", "provenance": "ADV-004", "status": "proposed"})
|
||||
assert "ANC-007" in registry.proposed and "ANC-007" not in registry.active
|
||||
results["4. New legal representative"] = "PASS (proposed in research state; not yet active)"
|
||||
|
||||
# Fixture 5: Snippet says AMC, underlying page says different company
|
||||
raw5 = {"snippet_entity": "AMC Solutions", "underlying_page_entity": "Servicios Mineros de Colombia S.A."}
|
||||
bad_c5 = {
|
||||
"id": "ADV-005", "candidate_kind": "presence", "identity_status": "attributed",
|
||||
"disposition": "admit", "audit_status": "pending", "matched_anchors": ["ANC-001", "ANC-003"],
|
||||
"direct_observations": ["Snippet de búsqueda muestra AMC Solutions en Valledupar"]
|
||||
}
|
||||
passed_bad, reason = auditor.audit_candidate(bad_c5, raw5)
|
||||
assert not passed_bad # Auditor catches snippet hallucination
|
||||
# Worker corrects to discard
|
||||
corrected_c5 = {
|
||||
"id": "ADV-005", "candidate_kind": "discard", "identity_status": "discarded",
|
||||
"disposition": "discard", "audit_status": "pending", "conflicting_anchors": ["legal_name"],
|
||||
"direct_observations": ["La página de destino corresponde a Servicios Mineros de Colombia S.A., no a AMC Solutions"]
|
||||
}
|
||||
passed_good, _ = auditor.audit_candidate(corrected_c5, raw5)
|
||||
assert passed_good
|
||||
results["5. Search snippet vs underlying page"] = "PASS (snippet hallucination caught; underlying page governs)"
|
||||
|
||||
# Fixture 6: Third party promotional claim ("Empresa líder...")
|
||||
bad_c6 = {
|
||||
"id": "ADV-006", "candidate_kind": "presence", "identity_status": "attributed",
|
||||
"disposition": "admit", "audit_status": "pending", "matched_anchors": ["ANC-002", "ANC-003"],
|
||||
"direct_observations": ["La fuente certifica que es la empresa líder del Cesar"]
|
||||
}
|
||||
passed_bad, reason = auditor.audit_candidate(bad_c6, {})
|
||||
assert not passed_bad and "promotional" in reason.lower()
|
||||
# Corrected: claim moved to source_claims
|
||||
good_c6 = {
|
||||
"id": "ADV-006", "candidate_kind": "presence", "identity_status": "attributed",
|
||||
"disposition": "admit", "audit_status": "pending", "matched_anchors": ["ANC-002", "ANC-003"],
|
||||
"direct_observations": ["Ficha mercantil lista registro con NIT 901380770"],
|
||||
"source_claims": ["El directorio afirma que la empresa es líder en el Cesar"]
|
||||
}
|
||||
passed_good, _ = auditor.audit_candidate(good_c6, {})
|
||||
assert passed_good
|
||||
results["6. Promotional claim discipline"] = "PASS (rejected in direct_observations; allowed in source_claims)"
|
||||
|
||||
# Fixture 7: Ambiguous local listing (Name + city, no NIT/domain)
|
||||
c7 = {
|
||||
"id": "ADV-007", "candidate_kind": "presence", "identity_status": "ambiguous",
|
||||
"disposition": "hold", "audit_status": "pending", "matched_anchors": ["ANC-003"],
|
||||
"missing_anchors": ["tax_id", "domain"]
|
||||
}
|
||||
passed, _ = auditor.audit_candidate(c7, {})
|
||||
assert passed and c7["disposition"] == "hold"
|
||||
results["7. Ambiguous local listing"] = "PASS (retained in hold, not attributed)"
|
||||
|
||||
# Fixture 8: Historical 2023 government contract
|
||||
c8 = {
|
||||
"id": "ADV-008", "candidate_kind": "presence", "identity_status": "attributed",
|
||||
"disposition": "admit", "audit_status": "pending", "relevant_period": "vigencia fiscal 2023",
|
||||
"matched_anchors": ["ANC-002", "ANC-003"],
|
||||
"direct_observations": ["Adjudicación de contrato SAMC-014-2023 en Uribia"]
|
||||
}
|
||||
passed, _ = auditor.audit_candidate(c8, {"publication_date": "2023-12-31"})
|
||||
assert passed and "2023" in c8["relevant_period"]
|
||||
results["8. Historical contract discipline"] = "PASS (scoped strictly to 2023 fiscal year)"
|
||||
|
||||
# Fixture 9: Negative observation on Google Maps
|
||||
c9 = {
|
||||
"id": "ADV-009", "candidate_kind": "negative_observation", "identity_status": "not_applicable",
|
||||
"disposition": "admit", "audit_status": "pending", "confidence": "negative_scoped",
|
||||
"matched_anchors": [],
|
||||
"direct_observations": ["En la muestra de búsqueda en Google Maps no se observó perfil comercial verificado"]
|
||||
}
|
||||
passed, _ = auditor.audit_candidate(c9, {})
|
||||
assert passed and c9["identity_status"] == "not_applicable"
|
||||
results["9. Scoped negative observation"] = "PASS (admitted without false entity attribution)"
|
||||
|
||||
# Fixture 10: Contradictory addresses preserved
|
||||
c10 = {
|
||||
"id": "ADV-010", "candidate_kind": "presence", "identity_status": "attributed",
|
||||
"disposition": "admit", "audit_status": "pending", "matched_anchors": ["ANC-002", "ANC-003"],
|
||||
"direct_observations": ["Directorio A lista Carrera 19d; Directorio B lista Carrera 14"],
|
||||
"open_questions": ["¿Cuál dirección representa la sede operativa vigente?"]
|
||||
}
|
||||
passed, _ = auditor.audit_candidate(c10, {})
|
||||
assert passed and len(c10["open_questions"]) > 0
|
||||
results["10. Contradictory addresses"] = "PASS (contradiction preserved in open_questions)"
|
||||
|
||||
# Fixture 11: Conflicting proposed anchor rejected
|
||||
registry.propose_anchor({"id": "ANC-099", "type": "phone", "value": "+57 4 4440000", "strength": "moderate", "provenance": "ADV-011", "status": "proposed"})
|
||||
# Orchestrator detects conflicting area code (+57 4 is Medellín, competitor conflict)
|
||||
registry.reconcile_proposed("ANC-099", accept=False, rejection_reason="Conflicto de jurisdicción y homonimia con competidor en Medellín")
|
||||
assert "ANC-099" in registry.rejected and "ANC-099" not in registry.active
|
||||
results["11. Conflicting proposed anchor"] = "PASS (rejected by orchestrator; not promoted to active)"
|
||||
|
||||
# Fixture 12: THE TEMPORAL EXPLOIT & RE-ENTRY
|
||||
# Worker correctly attributes entity, but fraudulently or carelessly sets relevant_period to 'actual 2026' on a 2023 source!
|
||||
exploit_c12 = {
|
||||
"id": "ADV-012", "candidate_kind": "presence", "identity_status": "attributed",
|
||||
"disposition": "admit", "audit_status": "pending",
|
||||
"matched_anchors": ["ANC-002", "ANC-003"],
|
||||
"relevant_period": "actual 2026", # FRAUDULENT EXTRAPOLATION
|
||||
"direct_observations": ["Contrato municipal acredita servicios mineros activos"]
|
||||
}
|
||||
raw12 = {"publication_date": "2023-10-15"}
|
||||
|
||||
# Audit Pass 1: Auditor catches temporal violation
|
||||
passed1, reason1 = auditor.audit_candidate(exploit_c12, raw12)
|
||||
assert not passed1 and "temporal validity violation" in reason1.lower()
|
||||
# Lifecycle transition: AuditFailed demotes candidate to hold
|
||||
exploit_c12["audit_status"] = "failed"
|
||||
exploit_c12["disposition"] = "hold"
|
||||
exploit_c12["audit_feedback"] = reason1
|
||||
|
||||
# Worker Re-evaluation: Worker addresses auditor objection
|
||||
exploit_c12["relevant_period"] = "vigencia fiscal 2023"
|
||||
exploit_c12["direct_observations"] = ["Contrato municipal adjudicado en vigencia 2023"]
|
||||
exploit_c12["disposition"] = "admit"
|
||||
exploit_c12["audit_status"] = "pending" # RE-ENTRY PROTOCOL
|
||||
|
||||
# Audit Pass 2: Re-evaluation succeeds
|
||||
passed2, reason2 = auditor.audit_candidate(exploit_c12, raw12)
|
||||
assert passed2
|
||||
exploit_c12["audit_status"] = "passed"
|
||||
# Verification of eligibility conjunction:
|
||||
eligible = (exploit_c12["disposition"] == "admit" and exploit_c12["audit_status"] == "passed")
|
||||
assert eligible
|
||||
results["12. Temporal exploit & re-entry"] = "PASS (auditor caught 2026 leap, demoted to hold; worker repaired, re-entered, passed audit)"
|
||||
|
||||
return results
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_results = run_all_adversarial_tests()
|
||||
print("=" * 70)
|
||||
print("ADVERSARIAL CONTRACT TEST SUITE RESULTS")
|
||||
print("=" * 70)
|
||||
for test_name, outcome in test_results.items():
|
||||
print(f"[{outcome.split()[0]}] {test_name}: {outcome}")
|
||||
print("=" * 70)
|
||||
print("ALL 12 ADVERSARIAL TESTS PASSED WITHOUT EPISTEMIC DRIFT.")
|
||||
Reference in new issue
Block a user