Skip to content

feat(api-search-index-tasks): platform agnostic index tasks - #5487

Merged
brunozoric merged 38 commits into
nextfrom
bruno/feat/api-search-index-tasks/convert
Jul 25, 2026
Merged

feat(api-search-index-tasks): platform agnostic index tasks#5487
brunozoric merged 38 commits into
nextfrom
bruno/feat/api-search-index-tasks/convert

Conversation

@brunozoric

Copy link
Copy Markdown
Contributor

Changes

Our current api-elasticsearch-tasks are strictly connected to DynamoDB + OpenSearch.
Split api-elasticsearch-tasks into base api-search-index - can be OS or ES, unfortunately they have some differences in APIs.
Implementations for the OpenSearch now live in api-search-index-os.
Implementations for the DynamoDB + OpenSearch now live in api-search-index-ddb-os. This package wires the OS impl and adds its own stuff for DynamoDB.

Reasoning

We will soon have Postgres + OpenSearch tasks implementation. It will probably be a single pg-os package, but I wanted to split as much of the abstractions as possible so it is later easier to add Elasticsearch support if someone requires it.

TODO

Basically, all current strict OpenSearch packages should follow this same principle: have index engine abstractions, as much as possible, then dedicated -os or -es packages implement their own specific stuff if there is any. If not, single package can be reused in OS / ES deployments.

brunozoric and others added 24 commits July 24, 2026 09:53
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…s dependency

The package needs webiny.config.js for yarn build -p to find it, and
@webiny/background-tasks for the TaskController augmentation (response,
state, logger, runtime).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Register all search index tasks and runners in a single feature.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…rFactory

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…iter

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove unused @webiny/error and @webiny/utils from api-search-index-tasks
- Remove unused @webiny/aws-sdk and @webiny/error from api-search-index-tasks-ddb-os
- Re-register old IndexManagerFactory/settings impls in ElasticsearchTasksFeature
  (dataSynchronization depends on old DI key "ElasticsearchTasks/IndexManagerFactory")
- Format all files

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
IndexSettingsManager abstraction, DisableIndexing, EnableIndexing, and
their error classes are engine-agnostic logic — they operate on the
IndexSettingsManager abstraction, not on OS directly. Only the
IndexSettingsManager impl (which calls OS putSettings/getSettings)
stays in the bridge package.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Bridge consumers only need SearchIndexTasksDdbOsFeature. All
abstractions come from the core package.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Group files into storage/, indexManager/, settings/ directories
instead of flat root layout.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
No need for separate feature.ts when index.ts only exports the feature.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Separate OpenSearch-specific impls (IndexSettingsManager, IndexManager,
IndexManagerFactory) into @webiny/api-search-index-tasks-os. The ddb-os
bridge now composes the OS feature + DDB scanner/writer.

Package hierarchy:
  api-search-index-tasks        (platform-agnostic tasks + abstractions)
  api-search-index-tasks-os     (OpenSearch impls)
  api-search-index-tasks-ddb-os (DDB impls, composes OS feature)

When pg-os arrives, it will compose the same OS feature with PG
scanner/writer — no duplication.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@brunozoric brunozoric self-assigned this Jul 24, 2026
@brunozoric brunozoric added this to the 6.6.0 milestone Jul 24, 2026
brunozoric and others added 4 commits July 24, 2026 11:43
Package fully replaced by:
  @webiny/api-search-index-tasks     (platform-agnostic tasks)
  @webiny/api-search-index-tasks-os  (OpenSearch impls)
  @webiny/api-search-index-tasks-ddb-os (DDB impls)

dataSynchronization task dropped — can be rebuilt if needed.

Migrated consumers:
  - api-headless-cms-ddb-es: OpenSearchTenantIndexFactory → TenantIndexFactory
  - api-background-tasks-os: ElasticsearchTasksFeature → SearchIndexTasks + DdbOs features

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Port indexManager.test.ts from deleted api-elasticsearch-tasks. Tests
OsIndexManager construction, disable indexing, and enable indexing
with mocked OpenSearch client.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ReindexRunner now creates missing indexes using TenantIndexFactory
configs instead of skipping them. ReindexTask builds an index configs
map from TenantIndexFactory before calling the runner.

9 unit tests covering: empty scan, multiple indexes, create missing
index, skip when no config, matching filter, published + latest
records, timeout continuation, overwrite via put, skip empty entity.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
brunozoric and others added 10 commits July 24, 2026 13:39
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ReindexTask no longer knows about TenantIndexFactory, TenantContext, or
ListTenantsUseCase. ReindexRunner resolves index configs internally so
it works standalone without the task definition.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use Abstraction.Interface/Settings/SettingsMap instead of direct
interface imports. Remove unused IListIndicesResponse. Add vitest
devDep to api-search-index-tasks-os.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
SQL storage adds isLatest/isPublished columns for query efficiency but
these are internal — not part of the CMS entry contract. Strip them
from the returned storageEntry so all backends return consistent shape.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pure wiring package with no logic — consumers should depend on
api-search-index-tasks and api-search-index-tasks-ddb-os directly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pure pass-through — only re-exported BackgroundTasksFeature from
@webiny/background-tasks. Consumers should depend on background-tasks
directly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pure re-export of HcmsTasksFeature from @webiny/api-headless-cms-tasks.
Consumers already import from the source package directly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@brunozoric
brunozoric marked this pull request as ready for review July 25, 2026 20:45
@brunozoric
brunozoric merged commit e2be68e into next Jul 25, 2026
36 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.

1 participant