[MM-69594] Write resolved manifest (with version) into bundled plugin.json - #217
Conversation
….json The bundle Makefile target copied the source plugin.json verbatim, which has no version field, so released boards bundles shipped a plugin.json without a version. Add a `dist` subcommand to the manifest tool that writes the resolved manifest (with the build-time version and release notes URL) into the bundle directory, and use it in the bundle target, matching the playbooks / starter-template pattern. Co-authored-by: mattermost-code <matty-code@mattermost.com>
Refactor distManifest to accept the destination directory as a parameter for testability, and add tests covering manifest distribution and the build-time version fallback in findManifest. Co-authored-by: mattermost-code <matty-code@mattermost.com>
…tion Cover the latest-tag fallback, release-notes URL generation, the version-already-present path, and an end-to-end regression test that the repo source plugin.json (which ships without a version) yields a versioned plugin.json in the bundle. Co-authored-by: mattermost-code <matty-code@mattermost.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR adds a ChangesManifest dist generation
🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
build/manifest/main_test.go (1)
50-64: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low valueGlobal build-var/cwd mutation across subtests relies on test execution order.
writeTempManifestmutates process-wide state (os.Chdir, and indirectlyBuildTagCurrent/BuildTagLatest/BuildHashShortvia cleanup) shared across all tests in the package. This works today because no test callst.Parallel()and tests execute sequentially in source order, but it's fragile: a future contributor addingt.Parallel()to any of these tests (or a new test using these globals) would silently produce racy/incorrect results since there's no synchronization on the shared globals or cwd.This is acceptable for now given the sequential execution, but worth a comment noting the implicit ordering dependency, or guarding with
t.Parallel()exclusion notes.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@build/manifest/main_test.go` around lines 50 - 64, `writeTempManifest` in `main_test.go` mutates process-wide state (`os.Chdir` and the shared build vars `BuildTagCurrent`, `BuildTagLatest`, `BuildHashShort`) in a way that depends on sequential, ordered test execution. Add an explicit note near `writeTempManifest` and the affected tests documenting that these tests must not use `t.Parallel()` and rely on shared cwd/global state, or otherwise make the helper/test setup self-contained so future changes don’t accidentally introduce racy behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@build/manifest/main_test.go`:
- Around line 50-64: `writeTempManifest` in `main_test.go` mutates process-wide
state (`os.Chdir` and the shared build vars `BuildTagCurrent`, `BuildTagLatest`,
`BuildHashShort`) in a way that depends on sequential, ordered test execution.
Add an explicit note near `writeTempManifest` and the affected tests documenting
that these tests must not use `t.Parallel()` and rely on shared cwd/global
state, or otherwise make the helper/test setup self-contained so future changes
don’t accidentally introduce racy behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 7639b4c9-5f58-492e-bc61-0fafbeddfb5f
📒 Files selected for processing (3)
Makefilebuild/manifest/main.gobuild/manifest/main_test.go
Add comments noting that tests using writeTempManifest or mutating process-wide cwd/build vars must not call t.Parallel(). Co-authored-by: mattermost-code <matty-code@mattermost.com>
|
Test server destroyed |
|
/cherry-pick release-9.2 |
|
Cherry pick is scheduled. |
|
Error trying doing the automated Cherry picking. Please do this manually |
…#232) * [MM-69594] Write resolved manifest (with version) into bundled plugin.json (#217) * [MM-69594] Write resolved manifest (with version) into bundled plugin.json The bundle Makefile target copied the source plugin.json verbatim, which has no version field, so released boards bundles shipped a plugin.json without a version. Add a `dist` subcommand to the manifest tool that writes the resolved manifest (with the build-time version and release notes URL) into the bundle directory, and use it in the bundle target, matching the playbooks / starter-template pattern. Co-authored-by: mattermost-code <matty-code@mattermost.com> * [MM-69594] Add tests for manifest dist subcommand Refactor distManifest to accept the destination directory as a parameter for testability, and add tests covering manifest distribution and the build-time version fallback in findManifest. Co-authored-by: mattermost-code <matty-code@mattermost.com> * [MM-69594] Expand manifest tests for version and release-notes resolution Cover the latest-tag fallback, release-notes URL generation, the version-already-present path, and an end-to-end regression test that the repo source plugin.json (which ships without a version) yields a versioned plugin.json in the bundle. Co-authored-by: mattermost-code <matty-code@mattermost.com> * Document sequential test ordering for writeTempManifest helpers Add comments noting that tests using writeTempManifest or mutating process-wide cwd/build vars must not call t.Parallel(). Co-authored-by: mattermost-code <matty-code@mattermost.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: mattermost-code <matty-code@mattermost.com> # Conflicts: # Makefile * Add FIPS build support for Linux/amd64 plugin releases (#210) * Add FIPS build support for Linux/amd64 plugin releases. Introduces build/fips.mk and CI dist-fips job so delivery-platform can produce FIPS-compliant artifacts alongside standard builds. Co-authored-by: Cursor <cursoragent@cursor.com> * Fix FIPS docker build ldflags quoting. Boards embeds single-quoted -ldflags in GO_BUILD_FLAGS, which broke the docker inner shell and caused go build to omit -o. Co-authored-by: Cursor <cursoragent@cursor.com> * Gate FIPS CI on test jobs and disambiguate artifact names. Align dist-fips with the Playbooks FIPS workflow so builds run only after server and webapp CI pass, and artifact uploads include the short SHA. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # Makefile --------- Co-authored-by: cursor[bot] <206951365+cursor[bot]@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: mattermost-code <matty-code@mattermost.com> Co-authored-by: Nick Misasi <nick.misasi@mattermost.com>
|
/cherry-pick release-9.3 |
|
Cherry pick is scheduled. |
….json (#217) (#233) * [MM-69594] Write resolved manifest (with version) into bundled plugin.json The bundle Makefile target copied the source plugin.json verbatim, which has no version field, so released boards bundles shipped a plugin.json without a version. Add a `dist` subcommand to the manifest tool that writes the resolved manifest (with the build-time version and release notes URL) into the bundle directory, and use it in the bundle target, matching the playbooks / starter-template pattern. * [MM-69594] Add tests for manifest dist subcommand Refactor distManifest to accept the destination directory as a parameter for testability, and add tests covering manifest distribution and the build-time version fallback in findManifest. * [MM-69594] Expand manifest tests for version and release-notes resolution Cover the latest-tag fallback, release-notes URL generation, the version-already-present path, and an end-to-end regression test that the repo source plugin.json (which ships without a version) yields a versioned plugin.json in the bundle. * Document sequential test ordering for writeTempManifest helpers Add comments noting that tests using writeTempManifest or mutating process-wide cwd/build vars must not call t.Parallel(). --------- (cherry picked from commit 162e5a5) Co-authored-by: cursor[bot] <206951365+cursor[bot]@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: mattermost-code <matty-code@mattermost.com>
Summary
The released
mattermost-plugin-boardsbundle shipped aplugin.jsonwith noversionfield, unlike Playbooks. ThebundleMakefile target copied the sourceplugin.jsonverbatim (cp $(MANIFEST_FILE) ...), and the checked-inplugin.jsonhas never had aversionkey. The boardsbuild/manifesttool already resolved a build-time version infindManifest(), but no step wrote that resolved manifest into the bundle.This matches the Playbooks /
mattermost-plugin-starter-templatepattern:distsubcommand tobuild/manifest/main.gothat writes the resolved manifest (including the build-timeversionand generatedrelease_notes_url) asplugin.jsoninto the bundle directory.bundletarget to call./build/bin/manifest dist $(BUNDLE_DIR)/$(PLUGIN_NAME)instead of the rawcp.The source
plugin.jsonis intentionally left without aversion(resolved at build time), and the bundle now always carries one.Ticket
MM-69594
Testing
bundlerecipe: the bundleddist/boards/plugin.jsonhad noversionfield.plugin.jsoncarriesversion(e.g.9.3.0-rc3, resolved from the git tag) and a populatedrelease_notes_url; the tarball name was already correct.build/manifest/main_test.gocoveringdistManifest, the version-resolution branches (tag at current commit, latest-tag fallback, dev fallback, version-already-present), release-notes URL generation, and an end-to-end test asserting the repo's real (version-less)plugin.jsonyields a versioned bundled manifest.gofmt,go vet, andgo test ./...for the build module all pass.Before
After
Change Impact: 🟡 Medium
Regression Risk: Limited to build/bundling behavior, but it changes how the bundle’s
plugin.jsonis produced (via newdistoutput) and relies on manifest resolution; bundling failures or incorrect metadata are possible if path/CLI wiring differs from expectations.QA Recommendation: Light manual QA: run the bundle build once and confirm the bundled
plugin.jsonincludes a resolvedversionandrelease_notes_urlin addition to the automated tests.Generated by CodeRabbitAI