8000 release: preserve inline Markdown delimiters when stamping Maven versions · Issue #47 · project-minigraf/minigraf-java · GitHub
[go: up one dir, main page]

Skip to content

release: preserve inline Markdown delimiters when stamping Maven versions #47

Done

Description

@adityamukho

Problem and observed evidence

During the non-publishing #46 rehearsal run, stamp_java() removed the closing backtick and comma after an already-correct inline Maven coordinate in the root README.

Before preparation:

`io.github.project-minigraf:minigraf-jvm:3.0.0-alpha`, with JNA 5.14.0 unchanged.

After preparing the same 3.0.0-alpha version:

`io.github.project-minigraf:minigraf-jvm:3.0.0-alpha with JNA 5.14.0 unchanged.

The version matcher excludes double quotes and whitespace, but accepts a backtick and the adjacent comma. Its match therefore includes Markdown punctuation that the replacement drops. The resulting inline-code span is unclosed. The requested Maven version and exact core Git dependency remain correct, so this finding does not invalidate #46's suffix-isolation acceptance.

Minimal fix

Stop the version match at a backtick as well as at the existing double-quote and whitespace delimiters. The comma then remains outside the match because it follows the preserved closing backtick.

--- a/.github/java_release.py
+++ b/.github/java_release.py
@@
-        text, count = re.subn(r'(io\.github\.project-minigraf:minigraf-jvm:)[^"\s]+',
+        text, count = re.subn(r'(io\.github\.project-minigraf:minigraf-jvm:)[^"`\s]+',
                               lambda m: m[1] + plan['semver'], path.read_text())

This addresses the quoted Gradle and inline Markdown forms used by the current READMEs. It does not broaden the supported version grammar or change the Maven XML matcher, release routing, or artifact policies.

One regression case

Add this behavioral case to the existing JavaArtifacts tests in .github/test_java_release.py. The existing stamping test covers double-quoted Gradle coordinates and Maven XML but has no inline Markdown coordinate.

    def test_stamp_preserves_inline_markdown_punctuation(self):
        text = '''implementation("io.github.project-minigraf:minigraf-jvm:3.0.0-alpha")
<dependency><artifactId>minigraf-jvm</artifactId><version>3.0.0-alpha</version></dependency>
<dependency><artifactId>jna</artifactId><version>5.14.0</version></dependency>
`io.github.project-minigraf:minigraf-jvm:3.0.0-alpha`, with JNA 5.14.0 unchanged.
'''
        with tempfile.TemporaryDirectory() as tmp:
            root = Path(tmp)
            (root / 'java').mkdir()
            paths = [root / 'README.md', root / 'java/README.md']
            for path in paths:
                path.write_text(text)
            for version in ['3.0.0-alpha', '3.0.0-beta']:
                with self.subTest(version=version):
                    pipeline.stamp_java(root, {'semver': version})
                    expected = text.replace('3.0.0-alpha', version)
                    for path in paths:
                        self.assertEqual(path.read_text(), expected)

The first iteration checks that stamping an already-correct version preserves the complete document. The second checks that an actual version change preserves the backtick, comma, Gradle quoting and unrelated JNA version in both READMEs.

Suggested acceptance

  • The regression fails against the current helper and passes after the delimiter change.
  • Preparing the same requested version no longer changes this README sentence.
  • Keep the fix scoped to stamping and its regression case; no publication or release artifact-policy changes are needed.

Related: #30, #46. This is a pre-existing preparation-formatting defect, separate from artifact suffix isolation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0