Skip to content

Refuse colliding import keys and read sources from disks - #18

Merged
imanimanyara merged 1 commit into
mainfrom
fix/importer-collisions-and-disks
Nov 11, 2026
Merged

imanimanyara merged 1 commit into
mainfrom
fix/importer-collisions-and-disks

Conversation

@imanimanyara

Copy link
Copy Markdown
Member

Summary

Closes the two gaps in the importers that the consolidation audit found.

  • Colliding keys are refused. ImportedKeys::values() normalises every source key first. If two or more land on one settings key, the import throws InvalidImport and lists every group ([Mail-Host, mail_host] -> mail_host). It fails in dry run and apply alike and writes nothing. The spatie, toolkit and akaunting importers all use it.
  • Sources can come from any filesystem disk. The new DiskImporter contract is implemented by ToolkitJsonImporter through the injected filesystem factory. import --disk= takes any disk, S3 included. With no source, it reads toolkit's own laranail.toolkit.settings.{disk,path}, and falls back to local with laranail/settings.json.
  • Docs: import-export.md, importers.md, commands.md, the spatie recipe, and a new recipe for migrating from laranail/toolkit, plus README and CHANGELOG entries.

Behaviour change

Two identical unscoped akaunting rows now fail the import instead of the last row winning.

Verification (local)

  • 12 new tests; 11 failed on the old code, and the golden-output test was proven red by removing ksort.
  • Pest: 708 passed. PHPStan, Rector and Pint: clean.

Copilot AI balanced review requested due to automatic review settings November 11, 2026 18:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@imanimanyara
imanimanyara merged commit 2a98b7d into main Nov 11, 2026
11 checks passed
@imanimanyara
imanimanyara deleted the fix/importer-collisions-and-disks branch November 11, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants