From 9003d1dabe9c35633ce66cab4da9bbfd7bb5e490 Mon Sep 17 00:00:00 2001 From: James Maes Date: Thu, 15 Oct 2026 01:33:04 -0500 Subject: [PATCH] fix: the qbit metadata version comes from the build, not a hardcoded constant The producer read a literal version, so released artifacts reported a stale or -SNAPSHOT version. qbit-web-performance.properties (version=${project.version}) is Maven-filtered and the producer loads it; tests assert producer == bundle == artifact version. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 1 + pom.xml | 11 +++++++ .../qbits/webperf/WebPerfQBitProducer.java | 33 ++++++++++++++++++- .../resources/qbit-web-performance.properties | 1 + .../qbits/webperf/WebPerfHelpBundleTest.java | 8 ++++- .../webperf/WebPerfQBitProducerTest.java | 3 ++ 6 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/qbit-web-performance.properties diff --git a/CHANGELOG.md b/CHANGELOG.md index f5f70f2..1490aaf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to this project are documented here. The format follows Keep ## [0.1.0] - Unreleased ### Fixed +- Read the QBit metadata version from the build so release artifacts report their actual version, matching the help bundle. - Use dropdowns for tier, scope, source, strategy, metric, comparator and severity, preserving existing stored values. - Allow manual Tested Pages inserts with a URL. Validate absolute HTTPS URLs and fill in the site, path and Manual source automatically; validate URL edits too. diff --git a/pom.xml b/pom.xml index c1bf090..ba99e27 100644 --- a/pom.xml +++ b/pom.xml @@ -137,6 +137,7 @@ true help/*.yaml + qbit-web-performance.properties @@ -144,10 +145,20 @@ false help/*.yaml + qbit-web-performance.properties + + org.apache.maven.plugins + maven-surefire-plugin + + + ${project.version} + + + org.jacoco jacoco-maven-plugin diff --git a/src/main/java/com/kingsrook/qbits/webperf/WebPerfQBitProducer.java b/src/main/java/com/kingsrook/qbits/webperf/WebPerfQBitProducer.java index d24d981..dbc8f08 100644 --- a/src/main/java/com/kingsrook/qbits/webperf/WebPerfQBitProducer.java +++ b/src/main/java/com/kingsrook/qbits/webperf/WebPerfQBitProducer.java @@ -21,8 +21,11 @@ package com.kingsrook.qbits.webperf; +import java.io.IOException; +import java.io.InputStream; import java.util.ArrayList; import java.util.List; +import java.util.Properties; import com.kingsrook.qbits.webperf.metadata.WebPerfMetaData; import com.kingsrook.qqq.backend.core.exceptions.QException; import com.kingsrook.qqq.backend.core.logging.QLogger; @@ -62,13 +65,41 @@ public class WebPerfQBitProducer implements QBitMetaDataProducer assertThat(bundle.getId()).isEqualTo("qbit-web-performance")); + .satisfies(bundle -> + { + assertThat(bundle.getId()).isEqualTo("qbit-web-performance"); + assertThat(System.getProperty("qbit.artifactVersion")).isNotBlank(); + assertThat(bundle.getVersion()).isEqualTo(System.getProperty("qbit.artifactVersion")) + .isEqualTo(WebPerfQBitProducer.VERSION); + }); HelpBundleAssertions.forInstance(qInstance) .bundles("help/qbit-web-performance.yaml") .owning(target -> target.name().startsWith("web_performance_") || target.name().startsWith("webPerformance")) diff --git a/src/test/java/com/kingsrook/qbits/webperf/WebPerfQBitProducerTest.java b/src/test/java/com/kingsrook/qbits/webperf/WebPerfQBitProducerTest.java index 094d159..4ce349e 100644 --- a/src/test/java/com/kingsrook/qbits/webperf/WebPerfQBitProducerTest.java +++ b/src/test/java/com/kingsrook/qbits/webperf/WebPerfQBitProducerTest.java @@ -74,6 +74,9 @@ class WebPerfQBitProducerTest @Test void testRegistersIntoAFreshInstance() throws Exception { + assertThat(System.getProperty("qbit.artifactVersion")).isNotBlank(); + assertThat(WebPerfQBitProducer.VERSION).isEqualTo(System.getProperty("qbit.artifactVersion")); + assertThat(new WebPerfQBitProducer().getQBitMetaData().getVersion()).isEqualTo(WebPerfQBitProducer.VERSION); QInstance qInstance = WebPerfTestSupport.newInstance(); new WebPerfQBitProducer().withQBitConfig(WebPerfTestSupport.config() .withUrlSource(new SitemapUrlSource("https://www.example.com/sitemap.xml")) -- 2.54.0