Skip to content

fix(flutter-symbols): Validate version parameter is not empty before upload#2072

Merged
jhssilva merged 6 commits intomasterfrom
hugo.silva/flutter-symbols-version-required
Jan 27, 2026
Merged

fix(flutter-symbols): Validate version parameter is not empty before upload#2072
jhssilva merged 6 commits intomasterfrom
hugo.silva/flutter-symbols-version-required

Conversation

@jhssilva
Copy link
Contributor

@jhssilva jhssilva commented Jan 26, 2026

What and why?

  • Adds comprehensive validation for the --version parameter in the flutter-symbols upload command to prevent uploads with empty or invalid version strings.
  • The deobfuscation backend requires a valid version to correctly associate symbol files.
  • Jira

How?

  • Version validation: If --version is not provided, empty, or whitespace-only, the command now attempts to extract the version from pubspec.yaml
  • Final validation: After all resolution attempts, if the version is still empty/whitespace, the command fails with a clear error message: Error: parameter "version" is required
  • Tests: Added 4 new test cases covering:
    • Empty string version without valid pubspec (should fail)
    • Whitespace-only version without valid pubspec (should fail)
    • Empty string version with valid pubspec (should succeed using pubspec version)
    • Whitespace-only version with valid pubspec (should succeed using pubspec version)

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)

Test check

yarn test packages/datadog-ci/src/commands/flutter-symbols

@jhssilva jhssilva requested a review from buranmert January 26, 2026 12:50
Comment on lines +550 to +552
// Final validation: ensure we have a non-empty version after all resolution attempts
if (!this.version || this.version.trim().length === 0) {
this.context.stderr.write(renderArgumentMissingError('version'))
Copy link
Contributor

Choose a reason for hiding this comment

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

you also need to update README in this directory. it says version is optional, we should state it's required

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Updated the README in the latest commit.
Context:

  • This PR is primarily a bug fix. The --version parameters was never truly "optional" - a version was always required for the upload to succeeded (either from the flag version or from the pubspec.yaml).
  • The bug allowed to pass whitespace-only values like --version " ", and this would bypass the pubspec fallback (!this.version && (await this.parsePubspecVersion(this.pubspecLocation)) (since non-empty strings are truthy in JS).
  • The fix ensures whitespace-only versions are treated the same as empty/missing versions, and adds an explicit client-side error message when no valid version can be determined.

Added a note in the README.MD, clarifying the need for the version having a fallback for pubspec.yaml.

@buranmert buranmert added rum Related to [dsyms, flutter-symbols, react-native, sourcemaps, unity-symbols] bug Something isn't working labels Jan 26, 2026
@jhssilva jhssilva marked this pull request as ready for review January 27, 2026 08:54
@jhssilva jhssilva requested review from a team as code owners January 27, 2026 08:54
@jhssilva jhssilva requested a review from buranmert January 27, 2026 08:54
Copy link
Contributor

@Drarig29 Drarig29 left a comment

Choose a reason for hiding this comment

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

LGTM. This breaking change is a bug fix, so we won't cut a major release for it.

Clarify version requirement for upload in README.
Copy link
Member

@mariusc83 mariusc83 left a comment

Choose a reason for hiding this comment

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

LGTM

@jhssilva jhssilva merged commit 35dedbd into master Jan 27, 2026
28 of 29 checks passed
@jhssilva jhssilva deleted the hugo.silva/flutter-symbols-version-required branch January 27, 2026 14:45
@Drarig29 Drarig29 mentioned this pull request Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working mergequeue-status: removed rum Related to [dsyms, flutter-symbols, react-native, sourcemaps, unity-symbols]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants