Skip to content

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

Description

@HoneyTyagii

Summary

java/README.md advertises 1.0.5-01 in its Maven install snippet. java/pom.xml is on
1.0.10-preview.2-SNAPSHOT. Anyone following the primary Java install path gets a version
several releases behind.

It is not a one-off stale string: the release workflow tries to rewrite that snippet on every
release and silently fails to match it, so it stays wrong until the regex is fixed.

The inconsistency

Same "Installation" section, two different versions for one artifact:

Location Version
java/README.md:35 (Maven) 1.0.5-01
java/README.md:42 (Gradle) 1.0.9-preview.2-01
java/pom.xml:10 (authoritative) 1.0.10-preview.2-SNAPSHOT

CHANGELOG.md:85 dates java/v1.0.5-01 to 2026-07-01; the newest Java entry is
java/v1.0.6 at line 67.

Root cause

.github/workflows/java-publish-maven.yml:204-205:

sed -i "s|<version>[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-[a-z][a-z0-9-]*\.[0-9][0-9]*\)*</version>|<version>${VERSION}</version>|g" README.md
sed -i "s|copilot-sdk-java:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-[a-z][a-z0-9-]*\.[0-9][0-9]*\)*|copilot-sdk-java:${VERSION}|g" README.md

The qualifier group \(-[a-z][a-z0-9-]*\.[0-9][0-9]*\)* requires a qualifier to start with a
letter and contain a .N part. -01 satisfies neither, so:

  1. Sed #1 cannot match <version>1.0.5-01</version> (after 1.0.5 it needs </version>,
    finds -01). The Maven snippet has never been bumped.
  2. Sed Fix snapshot filename collisions on case-insensitive filesystems #2 matches only the copilot-sdk-java:1.0.9-preview.2 prefix and leaves -01 in place,
    carrying it forward each release. That is where 1.0.9-preview.2-01 came from; it is a sed
    artifact, not a real coordinate.

The workflow's own validator at line 178,
^[0-9]+\.[0-9]+\.[0-9]+(-(preview|(beta-)?java(-preview)?)\.[0-9]+)?$, rejects -01
versions, so this pipeline cannot even emit the coordinates its docs advertise.

Reproduction

Run those two seds with VERSION="1.0.11-preview.1" over the repo's real version strings.
Actual output (GNU sed, verified locally):

<version>1.0.5-01</version>                   <- unchanged, bug 1
<version>1.0.11-preview.1</version>           <- correctly rewritten
copilot-sdk-java:1.0.11-preview.1-01          <- stray -01 survives, bug 2

Expected: line 1 rewritten, line 3 without the trailing -01.

Why CI misses it

  • java/src/test/java/com/github/copilot/DocumentationSamplesTest.java reads README.md and
    jbang-example.java (documentationFiles(), lines 132-138) but only asserts
    setOnPermissionRequest usage. No version assertion exists anywhere.
  • .github/workflows/java-smoke-test.yml:55 builds from source and consumes the local
    SNAPSHOT, so it never resolves the README's pinned release version.
  • No workflow compiles or runs jbang-example.java; jbang is never installed in CI.

Suggested fix

  1. Widen the qualifier group to accept numeric-only qualifiers, e.g.
    \(-[a-z0-9][a-z0-9.-]*\)\?, and anchor the copilot-sdk-java: replacement so it consumes
    the whole coordinate. Re-test against the SNAPSHOT lines too: the comment at lines 206-208
    shows the snapshot seds depend on the release seds matching first.
  2. Drop the -01 suffixes; use versions the line 178 validator accepts.
  3. Add a CI guard asserting documented coordinates match java/pom.xml.
    DocumentationSamplesTest already loads both files.

Also in that section: duplicate ### Gradle headings at java/README.md:39 and :65 (the root
README.md:27 anchor can only reach the first), and lines 65-70 say "latest release from Maven
Central" while showing a -SNAPSHOT.

Not verified

No network access here, so which versions actually exist on Maven Central is unconfirmed.
Everything else is backed by repo files at main plus the local sed run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions