From afff27928c552e26e22d1eb8cc769804078fcd82 Mon Sep 17 00:00:00 2001 From: Chao Wang Date: Wed, 4 Feb 2026 09:28:24 +0800 Subject: [PATCH 1/3] fix: fix various issues --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 84f231eb..3f399232 100644 --- a/pom.xml +++ b/pom.xml @@ -425,7 +425,7 @@ limitations under the License.]]> io/github/guacsec/trustifyda/api/* io/github/guacsec/trustifyda/api/serialization/* io/github/guacsec/trustifyda/exception/* - + io/github/guacsec/trustifyda/impl/* io/github/guacsec/trustifyda/logging/* io/github/guacsec/trustifyda/image/ImageUtils.class @@ -778,7 +778,7 @@ limitations under the License.]]> true - ${project.basedir}/license-header --> + ${project.basedir}/license-header @@ -851,7 +851,7 @@ limitations under the License.]]> org.junit.jupiter junit-jupiter-engine - 5.9.1 + ${junit-jupiter.version} From 896d271075fc3ee2d59fc5302c612e7edc22ff50 Mon Sep 17 00:00:00 2001 From: Chao Wang Date: Wed, 4 Feb 2026 09:31:11 +0800 Subject: [PATCH 2/3] build: various component upgrade --- pom.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 3f399232..0cbf4eb5 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ 2.21 2.1.1 2.0.5 - 11.0.1 + 12.0.1 1.1.1 3.27.7 @@ -39,21 +39,21 @@ 3.2.8 3.5.1 3.1.1 - 3.3.0 + 3.5.0 3.12.0 3.0.0 3.3.1 4.0.0-M6 3.2.1 3.5.3 - 3.4.1 - 3.4.0 + 3.6.1 + 3.6.0 1.6.2 - 1.4.1 - 0.8.10 + 1.7.3 + 0.8.14 1.1.8 4.1 - 1.13.2 + 1.22.1 1.1.2 2.15.0 3.5.3 From b813e208ba9d047ba43b02f94df85bbf203506cb Mon Sep 17 00:00:00 2001 From: "qodo-code-review[bot]" <151058649+qodo-code-review[bot]@users.noreply.github.com> Date: Tue, 3 Feb 2026 15:41:33 +0000 Subject: [PATCH 3/3] Generated best practices file --- best_practices.md | 128 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 best_practices.md diff --git a/best_practices.md b/best_practices.md new file mode 100644 index 00000000..8430ea01 --- /dev/null +++ b/best_practices.md @@ -0,0 +1,128 @@ + +Pattern 1: Require explicit runtime configuration for backend/service endpoints and fail fast when required environment variables or CLI arguments are missing, rather than shipping defaults or vendor-specific endpoints. Ensure docs and examples stay provider-agnostic and do not include internal/third-party service URLs. + + +Example code before: +``` +private static final String DEFAULT_ENDPOINT = "https://vendor.example.com"; + +String endpoint = Environment.get("BACKEND_URL", DEFAULT_ENDPOINT); +// continues with default even when not configured +``` + +Example code after: +``` +String endpoint = Environment.get("BACKEND_URL"); +if (endpoint == null || endpoint.trim().isEmpty()) { + throw new IllegalStateException( + "Backend URL not configured. Please set BACKEND_URL."); +} +endpoint = endpoint.trim(); +``` + +
Examples for relevant past discussions: + +- https://github.com/guacsec/trustify-da-java-client/pull/211#discussion_r2536810895 +- https://github.com/guacsec/trustify-da-java-client/pull/211#discussion_r2537678862 +
+ + +___ + +Pattern 2: When introducing a new configuration key/behavior that supersedes a legacy one, enforce deterministic precedence (new overrides old) and migrate examples/docs to primarily show the new key; only mention the legacy key as backwards compatibility. In code, centralize these keys as constants and implement the precedence logic once. + + +Example code before: +``` +// scattered literals and unclear precedence +var node = json.get("legacyIgnore"); +if (node == null || node.isEmpty()) { + node = json.get("newIgnore"); +} +``` + +Example code after: +``` +// constants + explicit precedence: new wins +var node = json.get(IGNORE_NEW); +if (node == null || node.isEmpty()) { + node = json.get(IGNORE_LEGACY); +} +if (node == null || node.isEmpty()) return Set.of(); +``` + +
Examples for relevant past discussions: + +- https://github.com/guacsec/trustify-da-java-client/pull/205#discussion_r2526224893 +- https://github.com/guacsec/trustify-da-java-client/pull/205#discussion_r2526228973 +- https://github.com/guacsec/trustify-da-java-client/pull/205#discussion_r2526232347 +- https://github.com/guacsec/trustify-da-java-client/pull/205#discussion_r2526242594 +- https://github.com/guacsec/trustify-da-java-client/pull/205#discussion_r2526258368 +
+ + +___ + +Pattern 3: Prefer failing with exceptions (and include stderr/context) over merely logging when an external tool/process invocation or required precondition fails, so callers get actionable failures. Use logging for diagnostics, not as a substitute for error handling. + + +Example code before: +``` +String out = Operations.run(cmd); +if (out == null) { + LOG.warning("Tool failed, continuing"); + return ""; +} +``` + +Example code after: +``` +ProcessResult r = Operations.runWithResult(cmd); +if (r.exitCode() != 0) { + throw new IOException("Tool failed: " + r.stderr()); +} +return r.stdout(); +``` + +
Examples for relevant past discussions: + +- https://github.com/guacsec/trustify-da-java-client/pull/167#discussion_r2228021393 +
+ + +___ + +Pattern 4: Keep documentation and code comments minimal, accurate, and non-redundant: avoid repeating the same environment-variable setup in every example, remove outdated/irrelevant comments, and ensure parameter names match their Javadoc. Prefer a single “export once” step and then concise usage examples. + + +Example code before: +``` +# Example 1 +export BACKEND_URL=http://localhost:8080 +tool cmd1 + +# Example 2 +export BACKEND_URL=http://localhost:8080 +tool cmd2 +``` + +Example code after: +``` +# Configure once +export BACKEND_URL=http://localhost:8080 + +# Examples +tool cmd1 +tool cmd2 +``` + +
Examples for relevant past discussions: + +- https://github.com/guacsec/trustify-da-java-client/pull/211#discussion_r2537683064 +- https://github.com/guacsec/trustify-da-java-client/pull/211#discussion_r2537686339 +- https://github.com/guacsec/trustify-da-java-client/pull/127#discussion_r2047246406 +- https://github.com/guacsec/trustify-da-java-client/pull/114#discussion_r2031484262 +
+ + +___