73 Commits

Author SHA1 Message Date
Fredrik Adelöw 8165184fba tests: use describe.each for database test iteration
Refactors all test files that use TestDatabases/TestCaches with
it.each(databases.eachSupportedId()) to instead use describe.each at
the outer level. This ensures that all tests for one database engine
complete before moving to the next, rather than interleaving engines
across individual tests. This reduces the number of concurrent database
connections and should help with test timeout issues in CI.

The TestDatabases.create() call is hoisted to module scope so the
describe.each can iterate over supported IDs at the top level.

40 files changed across packages/backend-defaults,
packages/backend-test-utils, and multiple plugins.

Signed-off-by: Fredrik Adelöw <freben@gmail.com>

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2026-05-15 20:27:43 +02:00
Fredrik Adelöw e9b78e9698 Remove uuid dependency in favor of crypto.randomUUID()
The uuid package dropped its CommonJS entry point in v14, making it
incompatible with Backstage's CJS build output and Jest test runner.
Rather than working around the ESM-only issue, replace all usage with
the built-in crypto.randomUUID() which has been available in Node.js
since v16.7 and in all major browsers since March 2022.

Signed-off-by: Fredrik Adelöw <freben@spotify.com>
Made-with: Cursor
2026-04-23 10:51:43 +02:00
Stanislav Cherkasov aa08b7f135 fix(search): use sub-transaction rollback when truncating document text (#31494)
* fix: implement sub-transactions for partial rollbacks in PgSearchEngineIndexer

Signed-off-by: Stanislav Cherkasov <150145013+stanislav-c@users.noreply.github.com>

* fix: address Copilot review feedback

- Wrap sub-transaction creation in try/catch to handle failures
- Await subTx.commit() and subTx.rollback() to prevent race conditions
- Use inline eslint-disable comments instead of file-level disable
- Use mockResolvedValue for async tx.transaction mock

Signed-off-by: Stanislav Cherkasov <150145013+stanislav-c@users.noreply.github.com>

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Signed-off-by: Stanislav Cherkasov <150145013+stanislav-c@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-14 08:28:45 -04:00
John Philip 26b27db52b Merge pull request #32486 from kuangp/refactor/pg-search-result-count
refactor(pg-search): return numberOfResults with queries
2026-01-29 10:44:15 -05:00
Fredrik Adelöw 7455dae884 require the use of node prefix on native imports
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2026-01-26 13:22:53 +01:00
Phil Kuang 2ee354a36c refactor(pg-search): return numberOfResults with queries
Signed-off-by: Phil Kuang <pkuang@factset.com>
2026-01-22 18:45:00 -05:00
Andre Wanlin d57b13b2d4 Version Policy Update - Postgres 18 to 14
Signed-off-by: Andre Wanlin <awanlin@spotify.com>
2025-10-16 18:44:29 -05:00
Paul Schultz 05f60e1e0a refactor: convert constructor parameter properties for erasableSyntaxOnly compatibility
Signed-off-by: Paul Schultz <pschultz@pobox.com>
2025-10-14 08:29:21 -05:00
yu-kkurii 8d15a51b3e update pg search sanitize list (#31083)
Signed-off-by: Vladimir Kobzev <vkobzev@bol.com>
2025-09-22 15:37:29 -04:00
Stanislav Cherkasov a919ca34b5 feat: truncate document text to fit PostgreSQL index size limit (#30943)
Signed-off-by: Stanislav C <150145013+stanislav-c@users.noreply.github.com>
2025-09-22 09:31:19 -04:00
Fredrik Adelöw 6d024163ec Merge pull request #28443 from Lucifergene/bump-pg
Added support for PostgreSQL 17 and updated related test configurations
2025-03-13 22:52:13 +01:00
Patrick Pulfer 8155b0493f Enable Normalization on Postgres Query (#28573)
* Enable Normalization on Postgres Query

Signed-off-by: patrick.pulfer <patrick.pulfer@digitecgalaxus.ch>
2025-02-20 09:26:48 -05:00
Lucifergene c3a91d5103 Add support for PostgreSQL 17 and update related test configurations
Signed-off-by: Lucifergene <47265560+Lucifergene@users.noreply.github.com>
2025-01-13 20:09:19 +05:30
Fredrik Adelöw 50648277ef Made it possible to construct mockServices.database with a given knex instance
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2024-11-05 11:35:31 +01:00
Patrik Oldsberg b071eec7d7 plugins/search-backend-module-*: flip around alpha exports to stable
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2024-10-13 12:58:37 +02:00
Patrik Oldsberg 3109c24cb3 promote all backend feature exports to main entry point
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2024-10-11 16:47:41 +02:00
Camila Belo 25b8873121 refactor: deprecate create router
Signed-off-by: Camila Belo <camilaibs@gmail.com>
2024-08-20 12:29:37 +02:00
Raghunandan Balachandran 8ecb7a5e84 Update search plugin ownership
Signed-off-by: Raghunandan Balachandran <raghunandan@spotify.com>
2024-07-25 20:08:20 +02:00
Camila Belo e49d0fd53b refactor: apply review suggestions
Signed-off-by: Camila Belo <camilaibs@gmail.com>
2024-05-18 21:21:47 +02:00
Camila Belo a98f851133 refactor: create a void logger service impl
Signed-off-by: Camila Belo <camilaibs@gmail.com>
2024-05-16 11:25:30 +02:00
Camila Belo d229dc49ad refator(backend-common): extract path utilities to plugin api
Signed-off-by: Camila Belo <camilaibs@gmail.com>
2024-05-13 13:23:45 +02:00
Tomasz Szuba cf163a53c3 Enable @backstage/plugin-search-backend-module-pg module only on supported databases
Signed-off-by: Tomasz Szuba <tszuba@box.com>
2024-03-13 18:33:02 +01:00
Camila Belo 744c0cbf97 refactor(search-backend): use credential for authorized search engines
Signed-off-by: Camila Belo <camilaibs@gmail.com>
2024-02-26 10:49:11 +01:00
Andre Wanlin b7de76ae72 Introduced version policy for PostgreSQL
Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Added changeset

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Updated API Report

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Updated references to use 12 and 16

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Attempt to fix tests

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Added back old Ids

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Fixed test

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Updated API Report and test

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Added new setDefaults static method and related changes

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Updated API Report

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Improved logic based on feedback

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Added missing changeset

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Changes based on feedback

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

API Report correction

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Updated to use new setDefaults

Signed-off-by: Andre Wanlin <awanlin@spotify.com>
2023-12-15 12:27:51 -06:00
Patrik Oldsberg cc4228ec11 switch all backend module IDs to use kebab-case
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2023-11-28 11:53:57 +01:00
Mariia Maksimova 3d8fd93515 Optimize document deletion query for pgsearchengine
Signed-off-by: Mariia Maksimova <mariia.maksimova@transferwise.com>
2023-11-01 23:48:45 +00:00
Patrik Oldsberg 71114ac50e plugins: refactory to use default export for new backend system
Co-authored-by: Fredrik Adelöw <freben@gmail.com>
Co-authored-by: Camila Belo <camilaibs@gmail.com>
Co-authored-by: Johan Haals <johan.haals@gmail.com>
Co-authored-by: Philipp Hugenroth <philipph@spotify.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2023-09-07 18:53:48 +02:00
Andre Wanlin 4ccf9204bc Added indexerBatchSize option and debug logging
Signed-off-by: Andre Wanlin <67169551+awanlin@users.noreply.github.com>
2023-08-24 14:03:43 -05:00
Vincenzo Scamporlino 2cccf58ef1 chore: config to rootConfig
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
2023-07-31 17:11:00 +02:00
rdeepc 4a44b9f3d8 Updated test with 3 items in array
Signed-off-by: rdeepc <12953177+rdeepc@users.noreply.github.com>
2023-05-23 20:48:29 -04:00
rdeepc 4b2a9b5509 Updated fields search for postgres to support array item
Signed-off-by: rdeepc <12953177+rdeepc@users.noreply.github.com>
2023-05-22 21:45:52 -04:00
Eric Peterson 719602451e Test that rollback is only attempted once in all cases.
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
2023-04-10 11:13:36 +02:00
Eric Peterson b4bbf9e18e Check that transaction is not completed before attempting rollback
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
2023-04-10 11:12:57 +02:00
Eric Peterson acb9ae3672 Assert that rollback is not attempted when there are no errors.
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
2023-04-10 11:11:20 +02:00
Eric Peterson 8bcbe27215 Fix tests on node v16
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
2023-04-07 15:52:37 +02:00
Eric Peterson 87ca22ce9c Close transaction on upstream error
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
2023-04-07 15:52:05 +02:00
Fredrik Adelöw c4a258f5e4 use jest.setTimeout consistently
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2023-03-28 12:30:49 +02:00
Camila Belo 1adc2c787e feat(search): create search collator modules
Co-authored-by: Emma Indal <emma.indahl@gmail.com>
Signed-off-by: Camila Belo <camilaibs@gmail.com>
2023-03-21 09:30:04 +01:00
Emma Indal 5db02fc935 generate api reports
Signed-off-by: Emma Indal <emma.indahl@gmail.com>
Co-authored-by: Camila Loiola <camilaibs@gmail.com>
2023-03-20 13:29:09 +01:00
Emma Indal 4cc252bdd5 use alpha exports
Signed-off-by: Emma Indal <emma.indahl@gmail.com>
Co-authored-by: Camila Loiola <camilaibs@gmail.com>
2023-03-20 13:29:03 +01:00
Emma Indal d5fe020807 update plugin id to match naming conventions
Signed-off-by: Emma Indal <emma.indahl@gmail.com>
2023-03-20 13:22:37 +01:00
Emma Indal 97e5d514d1 create backend modules for search engines
Signed-off-by: Emma Indal <emma.indahl@gmail.com>
2023-03-20 13:22:28 +01:00
Fredrik Adelöw 85b04f659a get rid of usages of substr which is deprecated
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2023-01-23 14:35:21 +01:00
Eric Peterson b24cf5a99e Update pg engine to preserve pre-existing indices if indexer receives 0 documents
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
2022-12-01 17:29:12 +01:00
Eric Peterson e48fc1f1ae Add optional, backward compatible logger to PG engine/indexer
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
2022-12-01 17:29:12 +01:00
Eric Peterson aff7351fa5 Use non-deprecated TestPipeline static methods
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
2022-11-25 15:22:32 +01:00
Camila Belo 4ed1fa2480 refactor: apply review suggestions
Signed-off-by: Camila Belo <camilaibs@gmail.com>
2022-10-04 10:54:09 +02:00
Fredrik Adelöw aaab1e34da Fix linting errors after #13392
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2022-08-30 13:44:09 +02:00
Fredrik Adelöw 6a001acf8c plugin-search-backend-module-pg
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2022-08-19 12:31:26 +02:00
Daniel Dias Branco Arthaud 833e2e4904 fix(search-backend-module-pg): Allow it to skip migrations
Signed-off-by: Daniel Dias Branco Arthaud <arthaud@gmail.com>
2022-08-18 10:55:20 -03:00