Skip to content

fix: an unparsable config file no longer deletes the database entry on import - #239

Merged
boazpoolman merged 4 commits into
pluginpal:masterfrom
PaulRichez:fix/unparsable-config-file
Nov 9, 2026
Merged

boazpoolman merged 4 commits into
pluginpal:masterfrom
PaulRichez:fix/unparsable-config-file

Conversation

@PaulRichez

@PaulRichez PaulRichez commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What does it do?

readConfigFile returns null only when the file doesn't exist (ENOENT). When the file exists but isn't valid JSON, it throws an error naming the file.

  • The diff leaves that file out, with a warning saying why (instead of "An empty config file").
  • The import of that config fails with the error, instead of deleting the config from the database.

Why is it needed?

A merge conflict left in a sync file deleted the config (here the Public role) on import. See #238.

How to test it?

The new integration test Import (unparsable file) breaks user-role.public.json, imports it, checks the error, puts the file back and checks the diff is empty (the role is still in the database). It fails without the fix.

Lint and integration tests pass locally (Node 22, playground on Strapi 5.37).

Related issue(s)/PR(s)

@codecov

codecov Bot commented Nov 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (f8c91c9) to head (774c79e).
⚠️ Report is 11 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #239   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines           22        22           
  Branches         3         3           
=========================================
  Hits            22        22           
Flag Coverage Δ
unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@boazpoolman boazpoolman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @PaulRichez! I've made some changes to the PR, mainly about the communication towards the users about this invalid file. Good to go!

@boazpoolman
boazpoolman merged commit d39b3a5 into pluginpal:master Nov 9, 2026
8 checks passed
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