Skip to content

Conversation

@pyramation
Copy link
Contributor

Summary

Changes the deep merge array strategy from mergeArraysUnique (which concatenated and deduplicated arrays) to replaceArrays (which allows later configuration sources to completely override earlier ones).

Before: Arrays were merged and deduplicated

  • ['uuid', 'postgis'] + ['postgis', 'hstore']['uuid', 'postgis', 'hstore']

After: Later arrays completely replace earlier ones

  • ['uuid', 'postgis'] + ['postgis', 'hstore']['postgis', 'hstore']

This fixes the issue where arrays like api.metaSchemas with non-empty defaults could not be fully replaced by config/env/override values.

Review & Testing Checklist for Human

  • Breaking change verification: This changes behavior for all array fields (db.extensions, jobs.*.supported, graphile.schema, api.exposedSchemas, api.metaSchemas, etc.). Verify no existing configurations rely on the old additive merge behavior.
  • Export rename: mergeArraysUnique is now exported as replaceArrays. Check if any external code imports the old name from @pgpmjs/env.
  • Test with real config: Try a real pgpm.json config that sets array values and verify overrides work as expected (later sources completely replace earlier ones).

Notes

  • The user explicitly requested replace behavior after reviewing the tradeoffs
  • Most array fields have empty defaults, so the practical impact is mainly on api.metaSchemas which had non-empty defaults

Link to Devin run: https://app.devin.ai/sessions/c09cd3880f9445d584dd937e037c2da4
Requested by: @pyramation

Changes the deep merge array strategy from mergeArraysUnique (which
concatenated and deduplicated arrays) to replaceArrays (which allows
later configuration sources to completely override earlier ones).

This fixes the issue where arrays like api.metaSchemas with non-empty
defaults could not be fully replaced by config/env/override values.

- Rename mergeArraysUnique to replaceArrays in pgpm/env/src/utils.ts
- Update imports in pgpm/env and graphql/env merge.ts files
- Update tests to reflect new replace behavior
- Update snapshots
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@pyramation pyramation merged commit eff4a61 into main Jan 22, 2026
48 checks passed
@pyramation pyramation deleted the devin/1769066087-array-merge-replace branch January 22, 2026 07:42
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