From 219c1dfd4bbca64a116249402b5cb3e584a5e1a8 Mon Sep 17 00:00:00 2001 From: soreavis <263610811+soreavis@users.noreply.github.com> Date: Fri, 4 Dec 2026 03:36:12 +0100 Subject: [PATCH] fix(doctor): stop warning that GCP, Azure and OCI images are below the AWS minimum (#93) doctor's image.version check held every product's image to 1.5.0, the AWS emulator's minimum. floci-gcp, floci-az and floci-oci are versioned on their own 0.x lines (0.14.0, 0.18.0 and 0.8.0 are current), so every current image warned "below minimum 1.5.0", and the suggested pull could not clear it. The minimum now applies to the AWS image only, as in version, status and config validate; the other images report their version as ok. The skill no longer tells agents to ignore the warning. Signed-off-by: soreavis <263610811+soreavis@users.noreply.github.com> --- plugin.json | 2 +- skills/floci/references/troubleshooting.md | 2 - .../cli/doctor/checks/ImageVersionCheck.java | 16 ++++-- .../floci/cli/unit/ImageVersionCheckTest.java | 54 +++++++++++++++++++ 4 files changed, 67 insertions(+), 7 deletions(-) diff --git a/plugin.json b/plugin.json index 4506817..2670a81 100644 --- a/plugin.json +++ b/plugin.json @@ -1,7 +1,7 @@ { "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json", "name": "floci", - "version": "1.0.8", + "version": "1.0.10", "description": "Run, wire up and troubleshoot Floci, the free local emulators for AWS, GCP, Azure and OCI: floci-cli lifecycle, safe wiring of aws, gcloud, az, oci and the SDKs, docker run and Docker Compose files, several instances side by side, and lookups in the published docs.", "author": { "name": "Floci", diff --git a/skills/floci/references/troubleshooting.md b/skills/floci/references/troubleshooting.md index 5092565..d3f3d7d 100644 --- a/skills/floci/references/troubleshooting.md +++ b/skills/floci/references/troubleshooting.md @@ -12,8 +12,6 @@ floci logs --since 5m `fail`, and the exit code is 1 only when a check fails. `doctor` changes nothing itself. Read a `fix` critically and tell the user what it changes before applying it: -- `image.version` on GCP, Azure and OCI may warn that the server is "below minimum 1.5.0". - That number is the AWS emulator's; ignore the warning when the image is current. - `aws.cli.endpoint` and `az.cli.connection-string` warn whenever `doctor` runs in a shell that has not loaded `env`. Run both in one command line to check the wiring. - `aws.cli.s3.pathstyle` suggests editing `~/.aws/config`. Do not: with the default diff --git a/src/main/java/io/floci/cli/doctor/checks/ImageVersionCheck.java b/src/main/java/io/floci/cli/doctor/checks/ImageVersionCheck.java index 500e73c..8458c1c 100644 --- a/src/main/java/io/floci/cli/doctor/checks/ImageVersionCheck.java +++ b/src/main/java/io/floci/cli/doctor/checks/ImageVersionCheck.java @@ -28,21 +28,26 @@ public class ImageVersionCheck implements Check { /** {@code docker} is shared across one doctor run so each docker fact is fetched once. */ public ImageVersionCheck(String image, DockerClient docker) { - this(image, docker, "floci"); + this(image, docker, "floci", true); } - /** {@code product}'s image, with hints that name its tree. */ + /** + * {@code product}'s image, with hints that name its tree. Only the AWS image has a minimum: the + * other emulators are versioned on their own lines (0.x), where it would flag every release. + */ public ImageVersionCheck(ProductProfile product, DockerClient docker) { - this(product.image(), docker, product.commandPrefix()); + this(product.image(), docker, product.commandPrefix(), "aws".equals(product.name())); } - private ImageVersionCheck(String image, DockerClient docker, String commandPrefix) { + private ImageVersionCheck(String image, DockerClient docker, String commandPrefix, boolean hasMinimum) { this.image = image; this.docker = docker; this.pullHint = commandPrefix + " start --pull always"; + this.hasMinimum = hasMinimum; } private final String pullHint; + private final boolean hasMinimum; @Override public CheckResult run(String endpoint, String container) { @@ -62,6 +67,9 @@ public class ImageVersionCheck implements Check { if (version == null) { return CheckResult.ok("image.version", "Image version unknown (no label); assuming compatible"); } + if (!hasMinimum) { + return CheckResult.ok("image.version", "Server image version " + version); + } if (meetsMinimum(version, MIN_VERSION)) { return CheckResult.ok("image.version", "Server image version " + version + " (>= " + MIN_VERSION + ")"); } diff --git a/src/test/java/io/floci/cli/unit/ImageVersionCheckTest.java b/src/test/java/io/floci/cli/unit/ImageVersionCheckTest.java index 035b577..94bb9c5 100644 --- a/src/test/java/io/floci/cli/unit/ImageVersionCheckTest.java +++ b/src/test/java/io/floci/cli/unit/ImageVersionCheckTest.java @@ -1,13 +1,24 @@ package io.floci.cli.unit; +import io.floci.cli.ProductProfile; +import io.floci.cli.docker.DockerClient; +import io.floci.cli.doctor.CheckResult; +import io.floci.cli.doctor.CheckStatus; import io.floci.cli.doctor.checks.ImageVersionCheck; +import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; +import java.util.Map; +import java.util.Optional; + import static org.junit.jupiter.api.Assertions.*; class ImageVersionCheckTest { + private static final Map PRODUCTS = Map.of( + "aws", ProductProfile.AWS, "gcp", ProductProfile.GCP, "az", ProductProfile.AZ, "oci", ProductProfile.OCI); + @ParameterizedTest @CsvSource({ "1.5.0, 1.5.0, true", @@ -19,4 +30,47 @@ class ImageVersionCheckTest { void testSemVerComparison(String version, String minimum, boolean expected) { assertEquals(expected, ImageVersionCheck.meetsMinimum(version, minimum)); } + + @ParameterizedTest + @CsvSource({ + "aws, 1.4.9, warn, Server image version 1.4.9 is below minimum 1.5.0, docker pull floci/floci:latest", + "aws, 2.6.0, ok, Server image version 2.6.0 (>= 1.5.0),", + "gcp, 0.14.0, ok, Server image version 0.14.0,", + "az, 0.18.0, ok, Server image version 0.18.0,", + "oci, 0.8.0, ok, Server image version 0.8.0,", + "oci, , ok, Image version unknown (no label); assuming compatible," + }) + void onlyTheAwsImageIsHeldToTheMinimum(String product, String version, CheckStatus status, String message, + String fix) { + ProductProfile profile = PRODUCTS.get(product); + + CheckResult r = new ImageVersionCheck(profile, imageVersioned(version)) + .run(profile.defaultEndpoint(), profile.defaultContainer()); + + assertEquals(status, r.status()); + assertEquals(message, r.message()); + assertEquals(fix, r.fix()); + } + + @Test + void theImageConstructorKeepsTheMinimum() { + CheckResult r = new ImageVersionCheck("floci/floci", imageVersioned("1.4.9")).run("http://localhost:4566", "floci"); + + assertEquals(CheckStatus.warn, r.status()); + } + + /** A local image whose version label is {@code version}, or that has none when it is null. */ + private static DockerClient imageVersioned(String version) { + return new DockerClient() { + @Override + public boolean isImagePresent(String image) { + return true; + } + + @Override + public Optional imageLabel(String image, String key) { + return Optional.ofNullable(version); + } + }; + } }