Skip to content

feat(semver): add edge case scenarios for v-prefix, partial versions, and build metadata#341

Open
aepfli wants to merge 3 commits intomainfrom
test/semver-edge-cases
Open

feat(semver): add edge case scenarios for v-prefix, partial versions, and build metadata#341
aepfli wants to merge 3 commits intomainfrom
test/semver-edge-cases

Conversation

@aepfli
Copy link
Copy Markdown
Member

@aepfli aepfli commented Mar 12, 2026

Summary

Adds @semver-edge-cases tagged scenarios to targeting.feature covering edge cases from flagd#1873.

New Tag

@semver @semver-edge-cases — SDK implementations can opt in to run these as part of their @semver suite or target @semver-edge-cases independently.

New Scenarios

v-prefix handling (semver-v-prefix-flag)

Rule compares against v1.0.0 (v-prefixed). Both 1.0.0 and v1.0.0 in context should match — the prefix is stripped transparently on both sides.

context version expected
1.0.0 match
v1.0.0 match
2.0.0 no-match

Partial version handling (semver-partial-version-flag)

Rule compares against 1 (partial — missing minor and patch). Should be treated as 1.0.0 and match any compatible 1.x.y.

context version expected
1.5.0 match
1.0.0 match
2.0.0 no-match

Build metadata ignored (semver-build-metadata-flag)

Rule compares against 1.0.0+build. Build metadata MUST be ignored per SemVer 2.0.0 Rule 10 — so 1.0.0 and 1.0.0+other both equal 1.0.0+build.

context version expected
1.0.0 match
1.0.0+other match
2.0.0 no-match

Related

@aepfli aepfli requested a review from a team as a code owner March 12, 2026 15:15
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the testing suite for semantic versioning (SemVer) operations by adding comprehensive scenarios for edge cases. These new tests ensure that the system correctly handles version strings with 'v' prefixes, partial version numbers, and build metadata, aligning with the SemVer specification and addressing identified issues in flagd.

Highlights

  • SemVer v-prefix handling: Introduced a new scenario to verify that sem_ver operations correctly strip the 'v' prefix from version strings, ensuring v1.0.0 and 1.0.0 are treated equivalently.
  • SemVer partial version handling: Added a scenario to confirm that sem_ver operations correctly interpret partial versions (e.g., 1) as their full equivalent (e.g., 1.0.0), matching compatible versions.
  • SemVer build metadata ignored: Implemented a test case to ensure sem_ver operations correctly ignore build metadata (e.g., +build, +other) as per SemVer 2.0.0 Rule 10, treating 1.0.0+build and 1.0.0+other as 1.0.0.
  • New @semver-edge-cases tag: Introduced a new Gherkin tag @semver-edge-cases to group these specific semver scenarios, allowing SDK implementations to selectively run them.
Changelog
  • flags/custom-ops.json
    • Added semver-v-prefix-flag definition to test v-prefix handling.
    • Added semver-partial-version-flag definition to test partial version handling.
    • Added semver-build-metadata-flag definition to test build metadata ignoring.
  • gherkin/targeting.feature
    • Added a new Scenario Outline for sem_ver v-prefix handling with examples.
    • Added a new Scenario Outline for sem_ver partial version handling with examples.
    • Added a new Scenario Outline for sem_ver build metadata ignored with examples.
    • Applied @semver and @semver-edge-cases tags to the new scenarios.
Activity
  • No activity has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds test scenarios for semver edge cases, including v-prefixes, partial versions, and build metadata. New flag definitions are added to flags/custom-ops.json and corresponding test scenarios are added to gherkin/targeting.feature. The added tests cover the intended cases as described. My review of the changes did not identify any issues.

@aepfli
Copy link
Copy Markdown
Member Author

aepfli commented Mar 12, 2026

relates to open-feature/flagd#1873

aepfli added a commit that referenced this pull request Mar 18, 2026
- semver edge cases: v-prefix, partial version, build metadata (@semver-edge-cases)
- operator error null-return fallback (@operator-errors): semver invalid version/operator, fractional null bucket key
- nested $ref resolution via is_privileged (@evaluator-ref-edge-cases)
- nested fractional expressions: if/var as bucket variant names (@fractional-nested)
- fractional hash edge cases (@fractional-v2)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
aepfli added a commit that referenced this pull request Mar 18, 2026
- semver edge cases: v-prefix, partial version, build metadata (@semver-edge-cases)
- operator error null-return fallback (@operator-errors): semver invalid version/operator, fractional null bucket key
- nested $ref resolution via is_privileged (@evaluator-ref-edge-cases)
- nested fractional expressions: if/var as bucket variant names (@fractional-nested)
- fractional hash edge cases (@fractional-v2)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
aepfli added a commit that referenced this pull request Mar 18, 2026
- semver edge cases: v-prefix, partial version, build metadata (@semver-edge-cases)
- operator error null-return fallback (@operator-errors): semver invalid version/operator, fractional null bucket key
- nested $ref resolution via is_privileged (@evaluator-ref-edge-cases)
- nested fractional expressions: if/var as bucket variant names (@fractional-nested)
- fractional hash edge cases (@fractional-v2)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
aepfli added a commit that referenced this pull request Mar 18, 2026
- semver edge cases: v-prefix, partial version, build metadata (@semver-edge-cases)
- operator error null-return fallback (@operator-errors): semver invalid version/operator, fractional null bucket key
- nested $ref resolution via is_privileged (@evaluator-ref-edge-cases)
- nested fractional expressions: if/var as bucket variant names (@fractional-nested)
- fractional hash edge cases (@fractional-v2)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
@aepfli
Copy link
Copy Markdown
Member Author

aepfli commented Mar 30, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces new semantic versioning test cases and flag definitions to handle edge cases such as 'v' prefixes, partial versions, and build metadata. The changes are applied across both the evaluator and general flag/feature definitions. Feedback was provided regarding the duplication of these new flags and Gherkin scenarios across multiple files, which could lead to maintenance overhead.

@aepfli aepfli changed the title test(semver): add edge case scenarios for v-prefix, partial versions, and build metadata feat(semver): add edge case scenarios for v-prefix, partial versions, and build metadata Mar 30, 2026
@aepfli aepfli force-pushed the test/semver-edge-cases branch from 841884a to 54bf38d Compare March 30, 2026 14:48
aepfli and others added 3 commits March 30, 2026 20:12
… and build metadata

Adds @semver-edge-cases tagged scenarios covering:
- v-prefix versions (v1.0.0) stripped transparently on both sides
- Partial versions (1, 1.2) padded with .0 components
- Build metadata ignored per SemVer 2.0.0 Rule 10

Addresses: open-feature/flagd#1873

Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds the v-prefix, partial version, and build-metadata semver scenarios
from the SDK-level gherkin (gherkin/targeting.feature) to the evaluator
suite, with matching flag definitions in evaluator/flags/testkit-flags.json.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
Adds @semver-v-prefix, @semver-partial-version and @semver-build-metadata
subtags so SDK implementations can exclude individual edge-case scenarios
during their migration period (e.g. -t 'not @semver-v-prefix'), mirroring
the pattern used by @fractional-nested.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
@aepfli aepfli force-pushed the test/semver-edge-cases branch from 54bf38d to 734c18f Compare March 30, 2026 18:17
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