Skip to content

Optimisation: Pre-export reconciliation of CREATE followed by DELETE PendingExports #218

@JayVDZ

Description

@JayVDZ

Summary

When a PendingExport for CREATE or UPDATE exists for a CSO but hasn't been exported yet, and a subsequent DELETE PendingExport is created for the same object, JIM should detect this scenario and internally reconcile these PendingExports rather than exporting both operations.

Current Behaviour

Currently, if the following sequence occurs:

  1. PendingExport(CREATE) is created for a new object
  2. Before the export runs, PendingExport(DELETE) is created for the same object

Both exports would be processed in order:

  1. CREATE would be exported to the connected system
  2. DELETE would be exported to delete the object

Proposed Behaviour

JIM should detect this scenario during export execution and:

  1. Cancel the CREATE PendingExport (no-net-change since object never existed)
  2. Cancel the DELETE PendingExport (nothing to delete since object was never created)
  3. Audit this reconciliation so administrators can see that JIM detected and optimised away these operations

Scenarios to Handle

Existing Export New Export Action
CREATE (pending) DELETE Cancel both - no net change
UPDATE (pending) DELETE Export DELETE only - object exists
CREATE (exported, awaiting confirmation) DELETE Export DELETE - object may have been created

Audit Requirements

The reconciliation should be visible in JIM's audit/activity log:

  • Record that reconciliation occurred
  • Show which PendingExports were reconciled
  • Explain the reason (e.g., "CREATE followed by DELETE detected - no net change")

Technical Notes

Acceptance Criteria

  • Pending CREATE followed by pending DELETE is detected and both are cancelled
  • Reconciliation is audited/logged with clear explanation
  • Unit tests cover the optimisation scenarios
  • Does not affect already-exported PendingExports

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions