Skip to content

Add shadow migration strategy with dk flags#523

Draft
renatoalmeidav wants to merge 5 commits into
mainfrom
feature/shadow-migration-with-dk-flags
Draft

Add shadow migration strategy with dk flags#523
renatoalmeidav wants to merge 5 commits into
mainfrom
feature/shadow-migration-with-dk-flags

Conversation

@renatoalmeidav

@renatoalmeidav renatoalmeidav commented Feb 23, 2026

Copy link
Copy Markdown
Contributor

What problem is this solving?

  • Use a shadow request structure to validate sensitive API migration. To support this architecture, DK flags was integrated. Using the flag values, the ShadowMigration class can decide which requests make, and which one will be the response, while log diff if it exists.
  • This new structure was integrated with the fetchProduct request used to resolve the query product

Complete flow with flags

flowchart TD
  Start([execute legacyFn, nextFn, ctx]) --> Eval[Evaluate flags in FeatureHub]
  Eval --> Fallback{Failure?}
  Fallback -->|Yes| LegacyOnly[Use legacy only]
  Fallback -->|No| Complete{migrationComplete?}
  Complete -->|Yes| NewOnly[Call nextFn → return new result]
  Complete -->|No| Shadow{shadow?}
  Shadow -->|No| LegacyOnly
  Shadow -->|Yes| Parallel[Call legacyFn and nextFn in parallel]
  Parallel --> Compare[Background: normalize + structuralCompare + log]
  Compare --> ReturnNew{returnNew?}
  ReturnNew -->|Yes| ReturnNewResult[Return result from new source]
  ReturnNew -->|No| ReturnLegacyResult[Return result from legacy source]
Loading

How should this be manually tested?

Workspace

Checklist/Reminders

  • Updated README.md.
  • Updated CHANGELOG.md.
  • Linked this PR to a Clubhouse story (if applicable).
  • Updated/created tests (important for bug fixes).
  • Deleted the workspace after merging this PR (if applicable).

Screenshots or example usage

Type of changes

✔️ Type of Change
_ Bug fix
_ New feature
_ Breaking change
_ Technical improvements

Notes

@vtex-io-ci-cd

vtex-io-ci-cd Bot commented Feb 23, 2026

Copy link
Copy Markdown

Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖

Please select which version do you want to release:

  • Patch (backwards-compatible bug fixes)

  • Minor (backwards-compatible functionality)

  • Major (incompatible API changes)

And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.

  • No thanks, I would rather do it manually 😞

@vtex-io-docs-bot

Copy link
Copy Markdown

Beep boop 🤖

I noticed you didn't make any changes at the docs/ folder

  • There's nothing new to document 🤔
  • I'll do it later 😞

In order to keep track, I'll create an issue if you decide now is not a good time

  • I just updated 🎉🎉

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