# Authored fictional importer requirement set

This is a NEW teaching-author decision fixed before the fresh campaign, not approved customer/product intent, an authenticated incident or a native Proof audit. The canonical's original save-row/stop-before-checkpoint/replay story was illustrative and its recovery promise undecided. Behavior alone cannot violate an absent promise. The new baseline is assessed against the explicitly added teaching promise below.

Interface: baseline_import/corrected_import/no_op_import(path,source_revision,items,hook=None). Exactly one writer/process invokes the importer at a time. Each case starts a fresh fixture-owned SQLite file. Two source items have distinct nonempty string IDs and the SAME string payload. Source revision batch-A-v1 and the exact source.json bytes/items/order remain immutable across retries. Identity is (source_revision,item_id), not payload. Inputs are well-formed and each source item ID is unique; this is a caller precondition, not a demonstrated validator. The mapping identity→payload remains stable. Changed payload under an existing identity, changing source content/order/revision semantics, malformed values or untrusted paths are outside the contract.

The initial authored inventory has TWO requirements, explicitly scoped to an uninterrupted normal call on the declared seeded state:

- R-ROWS: accept both legitimate source items exactly once with their original IDs/payloads, preserving every unrelated record.
- R-COMPLETE: after that uninterrupted call, retain next_index=2 for this source and preserve unrelated checkpoint state. Return exactly completed/source_revision/next_index/inserted/already_present with normal values completed/batch-A-v1/2/2/0 and exact types.

The third requirement is separately authored BEFORE execution: R-RESTART. After a deliberate process stop once the first item has actually committed but before its checkpoint, a fresh process reading the same file/source must finish with exactly one logical row per declared identity, the complete checkpoint and unrelated state intact. The interrupted attempt has NO returned product response. Retain its process exit86, hook phase and independently reopened state. Restart response must be completed/batch-A-v1/2/1/1 (one new item, one already-present item). A subsequent completed repeat returns completed/batch-A-v1/2/0/0 and preserves all record/checkpoint rows. Response differences are explicitly allowed; no assertion that all full responses are identical.

Baseline commits a record then separately advances its checkpoint, with no identity uniqueness rule. The deterministic test-only hook after the first row COMMIT calls os._exit(86), bypassing normal Python cleanup. The parent opens a NEW connection after that child terminates; restart and completed repeat run in NEW Python child processes against the SAME database file. The controlled stop is process termination, not power loss, disk-full, a failed COMMIT or a measured arbitrary crash.

Correction: a fresh corrected fixture DB adds UNIQUE(source_revision,item_id) via an index; corrected_import uses INSERT ... ON CONFLICT DO NOTHING. This suffices only under the unchanged identity/payload, single-writer source assumptions. The row and checkpoint still use separate transactions; replay can encounter the committed row and safely advance the checkpoint. The correction is code-plus-schema on a fresh initialized database, NOT migration/cleanup of baseline data containing duplicates. No changed-payload conflict resolution, concurrent import, automatic source validation or universal idempotency is claimed.

Both implementations use explicit BEGIN IMMEDIATE/COMMIT per row and checkpoint; sqlite3 connects with isolation_level=None, autocommit=LEGACY_TRANSACTION_CONTROL, journal_mode DELETE and synchronous FULL. Actual runtime/settings are recorded. The observed committed row surviving the selected process restart is evidence at that boundary; pragma names do not establish power-loss/fsync guarantees. A fresh parent connection observes all declared columns of both tables, ordered independently. Unrelated seed record (other-v1,keep,sentinel) and checkpoint (other-v1,7) must survive.

One no-op normal control returns completion without writes. A no-duplicate-only gate can pass while legitimate work/checkpoint evidence fails. Two distinct IDs with equal payload also require both logical rows, rejecting a payload-only collapse without another variant.

Inventory denominators are distinct from item/call/test counts: initial2 and newtotal3 are manual authored requirement IDs, NOT results from l1_system_complete/obligation_completeness/obligation_evidence_complete or proof of complete stakeholder intent. R3 was not discovered or customer-approved in the run. Normal expectations for R1/R2 and the R3 recovery oracle were all fixed before the sole primary campaign. Completed repeat that resumes at next_index=2 is NOT another interrupted duplicate exposure. Concurrent writers, changed inputs, disk-full/partial-checkpoint/power-loss behavior, migration/cleanup, malformed input, HTTP headers/keys/TTL/protocols, native Proof execution, Change acceptance, merge/deploy and exhaustive requirement completeness remain unperformed.
