Skip to content

feat(codereadiness): add hook for version-based flag validation#1819

Draft
marcin11858 wants to merge 1 commit into
open-feature:mainfrom
marcin11858:feature/codereadiness-hook
Draft

feat(codereadiness): add hook for version-based flag validation#1819
marcin11858 wants to merge 1 commit into
open-feature:mainfrom
marcin11858:feature/codereadiness-hook

Conversation

@marcin11858

Copy link
Copy Markdown

Introduce the codereadiness hook to control feature flag evaluation by comparing the application's current version with a required minimum version specified in the flag's metadata. If the comparator returns false the hook returns an error to trigger fallback to the default flag value.

This PR

Introduces the codereadiness hook under hooks/codereadiness to control feature flag evaluation based on the application's running code version.

How it works

  • Compares the application's current version with the required minimum version specified in the flag's metadata (by default, in the minCodeVersion key).
  • If the comparison fails (by default, if the current version in SemVer format is lower than the minimum or invalid), the hook throws a GeneralError to trigger the SDK's fallback mechanism, returning the flag's default value.
  • The hook supports custom comparison logic (via .comparator(...)), custom metadata keys (via .metadataMinVerKey(...)), and optional strict validation (via .validationRequired(...)).

Notes

  • Includes comprehensive JUnit 5 unit tests in CodeReadinessHookTest.java and SemVerComparatorTest.java.
  • Includes a README.md with setup, configuration examples, and dependency setup.

Follow-up Tasks

None.

How to test

Run the module unit tests using Maven from the project root:

mvn test -pl hooks/codereadiness

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 090c6828-9b23-4821-bebc-90199fa702ba

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@marcin11858 marcin11858 force-pushed the feature/codereadiness-hook branch from 59cde52 to c8244d9 Compare June 30, 2026 13:09
@marcin11858 marcin11858 force-pushed the feature/codereadiness-hook branch 5 times, most recently from 95ec132 to 3e3f136 Compare July 2, 2026 13:22
Introduce the codereadiness hook to control feature flag evaluation
by comparing the application's current version with a required minimum
version specified in the flag's metadata. If the comparator returns
false the hook returns an error to trigger fallback to
the default flag value.
@marcin11858 marcin11858 force-pushed the feature/codereadiness-hook branch from 3e3f136 to 07126e5 Compare July 2, 2026 13:38
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