HANDOFF: target project importer

Scope: Only importer requirements are authoritative. Ignore all archived records for other projects. Updates 1–5 have been resolved; superseded choices are discarded. No next update or later questions are available.

CURRENT SETTINGS
{
  "duplicate_policy": "first",
  "fold_case": true,
  "trim_ids": true,
  "tombstone_wins": true,
  "null_mode": "ignore",
  "nested_merge": true,
  "list_merge": "replace",
  "version_floor": 2,
  "order": "input",
  "unknown_fields": "drop",
  "empty_id": "skip",
  "audit_all": true
}

FIXED INTERFACE
Implement evaluate(payload) -> {records:[{id,fields}],audit:[string]}.
Events contain id (string), version (integer), deleted (boolean), and fields (JSON object). Do not mutate input.

PROCESSING CONTRACT WITH CURRENT CHOICES
1. Normalize each id by trimming, then ASCII case folding only (not Unicode case folding).
2. Skip empty normalized ids. Normalize and empty-check BEFORE discarding events whose version is below 2.
3. Deduplicate by normalized (id,version). Select the first event. Retain the pair's first insertion position; processing sort uses the selected event's actual original input index.
4. Process selected events in ascending (version, selected original input index) order.
5. Save each normalized id's first processed index for final record ordering, including if its first processed event is a deletion.
6. Deletion removes an existing record and installs a permanent sticky tombstone. With tombstone_wins=true, all later non-deletions for that id are blocked.
   - A deletion is applied only if a record existed OR it installs a new sticky tombstone.
   - Redundant deletions are blocked/no-change.
7. A non-deletion not blocked by a tombstone merges fields, creating an empty object if needed.
   - Null field values are ignored; they do not delete existing keys.
   - Recursively merge when both old and new values are objects.
   - Otherwise replace object values.
   - When both values are arrays, replace the old array with the new array.
   - Filter TOP-LEVEL fields to name, tags, meta only. Do not drop arbitrary nested keys.
8. Audit every processed event, applied or blocked, in processing order:
   normalized_id:version:applied
   normalized_id:version:blocked
   Events skipped for empty id, discarded below the version floor, or removed by deduplication are not processed audit entries.
9. Return surviving records ordered by each id's first processed index, then normalized id. order="input" does NOT mean raw input order independent of version processing. Preserve audit processing order.

FIXED CONDITIONAL RULES TO RETAIN IF FUTURE UPDATES CHANGE SETTINGS
- trim_ids and fold_case independently control normalization; folding is ASCII only.
- empty_id="error" raises ValueError on empty normalized id, before the version-floor check.
- duplicate_policy="last" selects the last event but retains the pair's first insertion position; sort still uses selected event's actual original index.
- Without sticky tombstones, a deletion of an absent record is blocked/no-change, and later non-deletions can recreate records.
- null_mode="delete" deletes an existing key for a null field value.
- Without nested_merge, object values replace rather than recursively merge.
- list_merge="unique" concatenates new items unequal to every item in the OLD array, using structural JSON equality. Do not deduplicate new-array items against each other.
- unknown_fields="drop" limits top-level fields to name,tags,meta; otherwise retain them.
- audit_all=false records only applied events.
- order="id" sorts surviving records lexically by normalized id; otherwise use first processed index then id.

UNRESOLVED / NOT SPECIFIED
- No explicit pending decisions were supplied.
- The payload envelope/key carrying the events is not specified in the visible contract.
- No further input validation, default settings, or error behavior for malformed events/payloads is specified. Do not infer these from archived projects.
- No implementation or execution results are included in this handoff.