Success counters miss broken relationships
A task can be marked delivered while its asset reference is absent, or a project can select an asset belonging to an obsolete local attempt. These inconsistencies may arise after crashes or migrations even when recent requests succeed.
What to do next
- 01
Define auditable invariants
Examples include one action mapping to at most one intended remote task, delivered records naming a verified asset, and selected outputs referencing existing immutable versions. Tailor checks to your schema rather than assuming one universal task table.
- 02
Classify findings by risk
Separate missing observations, orphan local assets, stale selections and contradictory terminal evidence. Record the affected identities and safe repair options, with restricted diagnostics that avoid copying private media into general reports.
- 03
Repair through explicit workflows
Re-read known remote tasks or repair local references where evidence supports it. Require review for contradictions, and never use a reconciliation sweep as an unapproved batch regeneration tool. Keep a record of each repair and its evidence.
A concrete example
Illustrative example: an audit finds twelve delivered rows with eleven verified local asset references. The missing reference enters a delivery-repair queue using its existing completed job, while the eleven valid assets and their selections remain untouched.
Before you call it ready
- Checks compare related records.
- Findings preserve affected identities.
- Repairs do not create unapproved creative work.
A locally executed, reproducible check
A join detects an asset with no matching task, and an enabled foreign key rejects a new orphan.
We executed this exact synthetic fixture on November 16, 2026 with Python 3.12.10 and SQLite 3.49.1. It ran locally with no network requests, account data or model generation. The recorded output below is an observation from that environment, not a platform benchmark. Copy the code into a separate Python file to repeat it in a suitable local environment; compare the mechanism and check your runtime version.
import sqlite3
c=sqlite3.connect(':memory:')
c.executescript('CREATE TABLE task(id TEXT PRIMARY KEY); CREATE TABLE asset(id TEXT PRIMARY KEY,task_id TEXT REFERENCES task(id));')
c.execute("INSERT INTO asset VALUES('asset-old','missing')")
c.commit()
print('existing orphan:',c.execute('SELECT asset.id FROM asset LEFT JOIN task ON asset.task_id=task.id WHERE task.id IS NULL').fetchall())
c.execute('PRAGMA foreign_keys=ON')
print('foreign key enabled:',c.execute('PRAGMA foreign_keys').fetchone()[0])
try:
c.execute("INSERT INTO asset VALUES('asset-new','missing')")
except sqlite3.IntegrityError:
print('new orphan: rejected')
print('historical violations:',len(c.execute('PRAGMA foreign_key_check').fetchall()))
Recorded output and interpretation
This run explicitly begins with foreign-key enforcement off for the synthetic connection and enables it outside a transaction. Enabling enforcement does not repair the old orphan. It does not describe or modify AISwapLab’s production schema or prove financial reconciliation.
A matching local output establishes only the illustrated library or database behavior under these inputs. It does not certify a production integration. Preserve the approved action, authorization boundaries and current AISwapLab request contract when applying the idea.
existing orphan: [('asset-old',)]
foreign key enabled: 1
new orphan: rejected
historical violations: 1
When to stop or choose another method
Stop equating a clean request-error dashboard with consistent task, asset and editorial records after crashes or migrations.
