Skip to content

fix: Java README version stuck at 1.0.5-01; release sed regex can't match numeric qualifiers - #2226

Draft
rinceyuan wants to merge 1 commit into
github:mainfrom
rinceyuan:fix/java-readme-version-regex
Draft

fix: Java README version stuck at 1.0.5-01; release sed regex can't match numeric qualifiers#2226
rinceyuan wants to merge 1 commit into
github:mainfrom
rinceyuan:fix/java-readme-version-regex

Conversation

@rinceyuan

Copy link
Copy Markdown
Contributor

Summary

The Maven install snippet in \java/README.md\ is stuck at \1.0.5-01\ because the release workflow's sed regex can't match numeric-only qualifiers.

Root cause

.github/workflows/java-publish-maven.yml\ line 204-205:
\
\(-[a-z][a-z0-9-]\.[0-9][0-9]\)*
\
Requires qualifier to start with a letter and contain .N. -01\ starts with a digit and has no dot — no match.

Fix

  1. Widen the regex to (-[a-zA-Z0-9][a-zA-Z0-9.-])\ — accepts any qualifier starting with an alphanumeric character
  2. Update stale README versions to \1.0.6\ (latest release per CHANGELOG)

Validation

Tested the new regex against all version formats in the issue:

  • \1.0.5-01\ ✓ matches
  • \1.0.9-preview.2-01\ ✓ matches
  • \1.0.11-preview.1\ ✓ matches
  • \1.0.6\ ✓ matches (no qualifier)

Closes #2209

…atch numeric qualifiers

The qualifier group \(-[a-z]...)\ requires qualifiers to start with a
letter. Numeric-only qualifiers like \-01\ don't match, so the Maven
snippet was never updated past 1.0.5-01.

Fix the regex to accept any alphanumeric qualifier start character:
\(-[a-zA-Z0-9][a-zA-Z0-9.-]*)\

Also update the stale README versions to 1.0.6 (latest release).

Closes github#2209
@rinceyuan
rinceyuan requested a review from a team as a code owner August 3, 2026 02:32
@rinceyuan

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree company=Microsoft

1 similar comment
@rinceyuan

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree company=Microsoft

@rinceyuan

Copy link
Copy Markdown
Contributor Author

@SteveSandersonMS Small fix for a stale-version bug in the Java README. The release workflow's sed regex couldn't match numeric qualifiers like -01. Regex widened + README bumped to 1.0.6.

@SteveSandersonMS

Copy link
Copy Markdown
Contributor

Thanks for tracking down the stale Java version references. The underlying bug is real, but this fix is not safe to merge yet.

The widened release regex also matches the -SNAPSHOT suffix. I ran the exact four sed commands from the workflow against this branch with:

VERSION=1.0.10-preview.2
DEV_VERSION=1.0.11-preview.2-SNAPSHOT

Both snapshot examples ended as the release version:

<version>1.0.10-preview.2</version>
implementation 'com.github:copilot-sdk-java:1.0.10-preview.2'

Because the first pass consumed -SNAPSHOT, the later snapshot-specific pass could no longer replace them with 1.0.11-preview.2-SNAPSHOT.

There are two other gaps:

  • java/jbang-example.java remains on nonexistent 1.0.9-preview.2-01; the unchanged JBang regex preserves the trailing -01 on future releases. Maven Central resolution of that coordinate fails.
  • 1.0.6 resolves and compiles, but it is no longer current: Maven Central has stable 1.0.8 and preview 1.0.9-preview.2. Under the workflow's existing behavior, 1.0.9-preview.2 is the intended current documentation value; if docs should instead recommend stable releases, the workflow needs an explicit stable-only policy.

Suggested revision: correct every corrupted coordinate in java/README.md and java/jbang-example.java, keep replacement syntax aligned with the workflow's accepted release-version grammar, and add assertions/tests for stable, preview, snapshot, and JBang outputs so a release fails instead of silently committing malformed documentation.

@SteveSandersonMS
SteveSandersonMS marked this pull request as draft August 3, 2026 12:55
@SteveSandersonMS

Copy link
Copy Markdown
Contributor

Also cc @edburns - can you confirm what kind of fix you want here?

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.

Java README Maven install snippet is stuck at 1.0.5-01; release sed regex can't match numeric qualifiers

2 participants