Repository navigation
Description
What/Why
What are you proposing?
Create opensearch-project/codemods, a community-maintained repository for open-source, deterministic codemods that help developers upgrade OpenSearch application code, client integrations, plugins, and checked-in configuration.
The goal is to ship tested, reusable transformations alongside breaking changes and deprecations, making OpenSearch upgrades easier and safer.
This complements OpenSearch Migration Assistant, which focuses on cluster data, metadata, and traffic. Codemods focus on the source code and configuration maintained in Git repositories.
What users have asked for this feature?
Following a conversation with @ps48 at KubeCon, I opened OpenSearch issue #23617 to discuss this idea.
We've also built an initial proof of concept covering selected OpenSearch 2.x to 3.0 breaking changes, with automated transformations and test fixtures.
Similar community-led codemod initiatives are already helping developers automate upgrades and handle breaking changes across major open-source ecosystems, including Node.js, ESLint, Express.js, Webpack, Backstage, and pnpm.
These projects provide a proven model for maintainers and contributors to collaboratively build, review, and maintain automated migrations.
What problems are you trying to solve?
Upgrading OpenSearch can require developers to manually update deprecated APIs, configuration settings, and application code across multiple repositories.
Codemods automate repetitive changes, reduce migration errors, and let developers review the resulting diffs before merging.
For maintainers, they also provide a reusable way to help the community adopt new releases.
What is the developer experience going to be?
Developers can select a codemod for their migration, run it locally or in CI, review the changes, and validate them using their existing tests.
Each codemod will include documentation, version compatibility information, and test fixtures.
The initial implementation uses the open-source Codemod CLI and JSSG/ast-grep. The project can evaluate additional transformation engines as the community grows.
Security considerations: Codemods operate on local source files without requiring access to live OpenSearch clusters or credentials. Dependencies and transforms should be reviewed and tested.
Breaking API changes: None to OpenSearch APIs. These tools help users adapt to existing breaking changes.
What is the user experience going to be?
A typical upgrade would involve finding the relevant codemod in the migration guide, running it against an application repository, reviewing the resulting changes, and running tests.
Changes that cannot safely be automated will be documented as manual migration steps.
Breaking UX changes: None. This is opt-in developer tooling.
Why should it be built? Any reason not to?
It will make OpenSearch upgrades easier, encourage adoption of newer releases, and provide maintainers and contributors with a dedicated place to collaborate on migration tooling.
A separate repository makes sense because codemods have their own release cycles, support multiple languages, and run outside OpenSearch Core and Migration Assistant. It also makes it easier for codemod experts in the community to contribute to and maintain OpenSearch codemods without having to work in the main repo.
The main risk is incorrect transformations. We'll address this through conservative matching, automated tests, community review, and clearly documented limitations.
What will it take to execute?
- Create an empty
opensearch-project/codemodsrepository. - Codemod team can contribute the initial OpenSearch 2.x to 3.0 codemods, subject to maintainer review.
- Establish testing, contribution guidelines, and maintenance workflows.
- Collaborate with OpenSearch maintainers to identify future migrations and link mature codemods from upgrade documentation.
I'm happy to help bootstrap the project alongside interested OpenSearch community members.
Any remaining open questions?
- Which maintainers should help review and own the initial codemods?
- Which migration scenarios should be prioritized?
Looking forward to community feedback and guidance on getting this repository established!
Activity