Skip to content

SK-2963: warn at startup when a beta/dev build targets a Production vault - #406

Open
Devesh-Skyflow wants to merge 2 commits into
mainfrom
devesh/SK-2963
Open

SK-2963: warn at startup when a beta/dev build targets a Production vault#406
Devesh-Skyflow wants to merge 2 commits into
mainfrom
devesh/SK-2963

Conversation

@Devesh-Skyflow

Copy link
Copy Markdown
Collaborator

Why

Beta/dev builds of the SDK are meant for acceptance testing only, but nothing today stops a customer from picking one up and pointing it at a Production vault. We want an explicit, unmissable signal the moment that happens so it gets caught early instead of surfacing as a support ticket.

Goal

  • At Skyflow.builder().build(), emit a WARN-level log once when both are true: the SDK's own version is non-GA (has a -beta.N and/or -dev.<sha> suffix) and at least one configured vault resolves to Env.PROD.
  • Implemented identically in both flowvault and skyvault modules, backed by a shared, pure BaseUtils.isNonGaVersion() check in common so the regex logic is unit-testable without touching the real Constants.SDK_VERSION.
  • Non-goal: this PR only covers the Java SDK. It's the reference implementation for the cross-SDK design in SK-2963 — the other 8 SDKs (node, python, go, js, react-js, react-native, android, iOS) will follow in separate PRs against their own repos.

Testing

  • Added BaseUtilsTests cases covering isNonGaVersion: plain semver (GA), -beta.N suffix, -dev.<sha> suffix, combined -beta.N-dev.<sha>, null, and non-semver strings.
  • Added anyVaultIsProd unit tests in both flowvault and skyvaultSkyflowTests (empty collection, no PROD vaults, one-of-many PROD, all PROD).
  • Added an end-to-end build() test in both modules asserting a GA build (the current Constants.SDK_VERSION in this checkout) never emits the beta warning even when configured against a PROD vault.
  • Could not run the suite locally in this environment (no mvn/java on PATH) — relying on CI to run mvn test across modules.

🤖 Generated with Claude Code

…ault
Adds a WARN-level log, emitted once at Skyflow.builder().build(), when the
SDK's own version is non-GA (any -beta.N or -dev.<sha> suffix) and at least
one configured vault resolves to Env.PROD. Mirrors the pattern in both the
flowvault and skyvault modules.
- BaseUtils.isNonGaVersion(): pure regex check, reused by both modules via
Utils, so it's testable without touching the real Constants.SDK_VERSION.
- SkyflowClientBuilder.anyVaultIsProd(): package-private, same reason.
- New WarningLogs.BETA_BUILD_WARNING message.
This is the reference implementation for the cross-SDK design in SK-2963;
the other 8 SDKs (node, python, go, js, react-js, react-native, android,
iOS) follow in separate PRs against their own repos.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Gitleaks Findings: No secrets detected. Safe to proceed!

@github-actions

Copy link
Copy Markdown

Semgrep Findings: Issues with Error level severity are found (Error is Highest severity in Semgrep), Please resolve the issues before merging.

@codecov

codecovBot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.72727% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.43%. Comparing base (1145b80) to head (5a2392a).

Files with missing linesPatch %Lines
flowvault/src/main/java/com/skyflow/Skyflow.java66.66%2 Missing and 1 partial ⚠️
skyvault/src/main/java/com/skyflow/Skyflow.java66.66%2 Missing and 1 partial ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #406 +/- ##
============================================
+ Coverage 91.30% 91.43% +0.13% - Complexity 0 461 +461 
============================================
Files 157 157 Lines 6392 6413 +21 Branches 850 858 +8 ============================================
+ Hits 5836 5864 +28 + Misses 364 355 -9 - Partials 192 194 +2 
FlagCoverage Δ
common89.42% <100.00%> (+1.03%)⬆️
flowvault88.56% <66.66%> (-0.09%)⬇️
skyvault94.63% <66.66%> (-0.09%)⬇️
unittests-flowvault90.49% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

ComponentsCoverage Δ
Module: common89.42% <100.00%> (+1.03%)⬆️
Module: skyvault94.63% <66.66%> (-0.09%)⬇️
Module: flowvault88.56% <66.66%> (-0.09%)⬇️
Service Account86.69% <ø> (ø)
Vault Data91.42% <ø> (ø)
Vault Tokens99.03% <ø> (ø)
Vault Connection100.00% <ø> (ø)
Vault Controller85.31% <ø> (ø)
Detect100.00% <ø> (ø)
Audit100.00% <ø> (ø)
BIN Lookup100.00% <ø> (ø)
Config96.26% <ø> (ø)
Utils89.22% <100.00%> (+0.01%)⬆️
Errors100.00% <ø> (ø)
Enums100.00% <ø> (ø)
Logs100.00% <100.00%> (+4.67%)⬆️
Files with missing linesCoverage Δ
...on/src/main/java/com/skyflow/logs/WarningLogs.java100.00% <100.00%> (+100.00%)⬆️
...mon/src/main/java/com/skyflow/utils/BaseUtils.java78.00% <100.00%> (+0.44%)⬆️
flowvault/src/main/java/com/skyflow/Skyflow.java89.52% <66.66%> (-2.15%)⬇️
skyvault/src/main/java/com/skyflow/Skyflow.java78.37% <66.66%> (-1.04%)⬇️

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1145b80...5a2392a. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

build() previously could only be exercised end-to-end against whatever
GA Constants.SDK_VERSION this checkout ships, so the actual && wiring
between isNonGaVersion and anyVaultIsProd was never driven down its
true branch by any test. Extract shouldWarnBetaBuildInProd(version,
vaultConfigs) in both flowvault and skyvault so it's directly testable
with an injected version string, and add true/false-path tests for it.
Also add a test proving the %s1 placeholder in BETA_BUILD_WARNING is
fully substituted (not left literal), and a test documenting the
current 0.x-is-GA behavior (0.9.0 matches the plain major.minor.patch
pattern) so a future change to that is a deliberate decision rather
than a silent regression.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Gitleaks Findings: No secrets detected. Safe to proceed!

@github-actions

Copy link
Copy Markdown

Semgrep Findings: Issues with Error level severity are found (Error is Highest severity in Semgrep), Please resolve the issues before merging.

Sign up for freeto 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

@Devesh-Skyflow