In the IPv6 mixed notation the IPv6 part holds at most 96 bits, that is
six 16-bit blocks, because the trailing IPv4 part occupies the remaining
32 bits. IPV6_MIXED_COMPRESSED_REGEX uses a * quantifier after '::', so
the number of blocks was unbounded and addresses longer than 128 bits
were reported as valid.
Keep the regexes unchanged and reject the IPv6 part when it holds more
than six blocks.
Fixes: #15763
Co-authored-by: GerardGao <213731635+GerardGao@users.noreply.github.com>
Expose generic Agent definition publication over HTTP and gRPC with optional ordinary auto-submit semantics.
Complete A2A client multi-version endpoint redo and exact/latest polling subscription recovery, with specifications, unit tests, and standalone integration coverage.
Assisted-by: Claude Code
* Remove reflective EnvUtil access from visibility plugin
Assisted-by: Claude Code
* Use first-wins plugin registration and definition normalization
Assisted-by: Claude Code
* [ISSUE #15549] use else-if in JdkHttpClientRequest.execute() when body iis not file
* [ISSUE #15549] add unit-test for JdkHttpClientRequest.execute() when body is file
* [ISSUE #15549] fix unit-test check style for JdkHttpClientRequest.execute()
* [ISSUE #15549] fix spotless problem
---------
Co-authored-by: MajorHe1 <601023364@qq.com>
batchSuccess only checked the upper bound (batch <= size), so batch <= 0 passed the check and then get(batch - 1) threw IndexOutOfBoundsException (e.g. batchSuccess(0) -> get(-1)). The existing test even documents this gap. Add the missing lower-bound check so out-of-range indices are ignored consistently with batch > size, and extend the test to cover 0 and negative.
Remove confirmed unused Java methods and classes across AI, common, config, naming, persistence, copilot, CMDB, and client modules.
Mark preserved compatibility candidates as deprecated instead of removing them.
Assisted-by: Claude Code
Print the effective Jackson adapter version together with the configured adapter property so auto mode diagnostics show the final selected adapter.
Assisted-by: Claude Code
Log the selected JSON adapter once during client and maintainer-client initialization, then remove the temporary migration tracker document.
Assisted-by: Claude Code
* [ISSUE #14466] Add Jackson 3 IT workflow todo
Assisted-by: Claude Code
* [ISSUE #14466] Add Jackson 3 SDK IT profiles
Assisted-by: Claude Code
* [ISSUE #14466] Fix Jackson 3 final field deserialization
Assisted-by: Claude Code
StringUtils.join(Collection, String) skips null elements but appends the
separator based on the element index (i != collection.size() - 1) rather
than on whether another non-null element follows. When the collection ends
with one or more null elements, this leaves a dangling separator, e.g.
join(["a", null], ",") returns "a," instead of "a", and
join(["a", null, "b", null], ",") returns "a,b," instead of "a,b".
Track whether any element has already been appended and emit the separator
before each subsequent non-null element, so trailing, leading, and mixed
null elements no longer produce stray separators.
Signed-off-by: Vasiliy Mikhailov <vasiliy.mikhailov@gmail.com>
Resolve response handler raw classes with JDK Type APIs instead of Jackson JavaType.
Add coverage for parameterized RestResult, custom parameterized responses, and unsupported Type fallback.
Assisted-by: Claude Code
Use the neutral JSON facade in GrpcUtils and add a Nacos-owned ByteBufferInputStream helper for payload parsing.
Update the Jackson adapter migration TODO with stage 5 validation results.
Assisted-by: Claude Code
Add a Java 8 safe Jackson 3 adapter facade and lazy Jackson 3 delegate in nacos-common. Register the adapter through ServiceLoader with provided/optional Jackson 3 dependencies, and cover availability, selection, serialization, deserialization, subtype registration, and error mapping paths.
Assisted-by: Claude Code
* Refactor AI resource trace logging to subscriber
Assisted-by: Claude Code
* Ignore codegraph metadata
Assisted-by: Claude Code
* Exclude codegraph metadata from RAT checks
* Move AI trace log to default plugin
# Conflicts:
# plugin-default-impl/nacos-default-plugin-all/pom.xml
# plugin-default-impl/pom.xml
* Document default AI trace plugin
Three production code paths swallow exceptions by calling
`Throwable.printStackTrace()`. That bypasses the configured logging
framework — the stack trace goes to stderr instead of the Nacos log
files, so it does not participate in log rotation / aggregation and is
easy to miss in clustered deployments.
This is a follow-up to #15179, which fixed the same anti-pattern in
`IoUtils#tryCompress` and `NamingFuzzyWatchContextService#trimFuzzyWatchContext`.
Each site here meaningfully impairs observability for real failures:
- `client/.../ClientWorker.java`
Inside `ClientWorker$ConfigRpcTransportClient#shutdown`, the catch
for `RpcClient#shutdown` errors only printed the stack to stderr;
the surrounding routine already uses `LOGGER.info` for the happy
path of the same loop, so a failed shutdown is the only path that
silently disappears. Switched to `LOGGER.warn` and included the
offending rpc client name in the message so operators can correlate
with the matching `Trying to shutdown rpc client ...` line.
- `common/utils/VersionUtils.java`
The static initializer reads `nacos-version.txt`. If the resource is
missing or unparseable, `version` and `clientVersion` silently remain
unset. Added a class-level slf4j Logger and routed the failure
through `LOGGER.warn`, including the file name and a hint that the
version fields will remain unset.
- `core/.../OptionalTlsProtocolNegotiator.java`
`getDefPne()` uses reflection on `ProtocolNegotiationEvent.DEFAULT`
and falls back to `null` on failure. The caller stores that null in
`PortUnificationServerHandler#pne` and later fires it as a user
event, which can break gRPC TLS negotiation. Logging via slf4j makes
the reflection failure visible at startup; behavior on the happy
path is unchanged.
`AbilityKey#static {}` in the `api/` module uses the same pattern, but
that module has no slf4j dependency today. Touching it would change the
SDK's transitive dependency surface, so it is deliberately left out of
this PR — that change should be discussed separately.
The catch blocks are intentionally preserved in all three sites: the
failure modes are recoverable for their callers (continue shutting
down remaining clients / fall back to unset version / return null for
the reflection failure), and the original behavior should not change.
## Brief changelog
- `client/.../ClientWorker.java` — use existing `LOGGER` to log
`RpcClient#shutdown` failures with the client name
- `common/utils/VersionUtils.java` — add slf4j logger, log
`nacos-version.txt` load failures
- `core/.../OptionalTlsProtocolNegotiator.java` — add slf4j logger,
log `ProtocolNegotiationEvent.DEFAULT` reflection failures
## Verifying this change
- `rg -n 'printStackTrace\(\)' client/src/main/java common/src/main/java core/src/main/java` reports no remaining hits in these three files
- `mvn -pl client,common,core -B checkstyle:check apache-rat:check spotless:check -DskipTests` — passes
- `mvn -pl client,common,core -am -B clean compile spotbugs:check -DskipTests` — passes
- Behavior unchanged on the happy paths; only the failure-mode output channel changes (stderr → slf4j)
Follow this checklist to help us incorporate your contribution quickly and easily:
* [ ] Make sure there is a Github issue filed for the change (usually before you start working on it).
* [√] Format the pull request title like `[ISSUE #123] ...`. Each commit in the pull request should have a meaningful subject line and body.
* [√] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
* [√] Write necessary unit-test (over 80%) to verify your logic correction. If you are creating a function or feature that affects unit-test files, please go to the `nacos-test` module to run all unit-tests to verify whether they pass.
* [√] Run `mvn -B clean package apache-rat:check checkstyle:check spotbugs:check -DskipTests` to make sure basic checks pass. Run `mvn clean install -DskipTests` to make sure all checks pass.
* Replace printStackTrace with proper logging in 2 silent-failure paths
Both `IoUtils#tryCompress` and `NamingFuzzyWatchContextService#trimFuzzyWatchContext`
catch exceptions and call `Throwable.printStackTrace()`, which writes the stack
trace to stderr instead of going through the configured logging framework.
This bypasses log aggregation / rotation in production deployments and makes
the failures harder to spot or correlate with surrounding events.
The second case is also a classic dangerous pattern — `catch (Throwable t)`
followed by a swallowed stack trace can hide an `OutOfMemoryError` or any
runtime invariant violation behind a single line on stderr.
- `common/utils/IoUtils#tryCompress`: log via a new class-level slf4j
Logger with the encoding and original string length attached, so the
silent-empty-byte[] return path leaves a breadcrumb operators can find.
- `naming/core/v2/index/NamingFuzzyWatchContextService#trimFuzzyWatchContext`:
route the swallowed Throwable through `Loggers.SRV_LOG.error(...)`
(the file already imports `Loggers`); the broad `catch (Throwable)`
is intentionally preserved so the scheduled task does not die on
unexpected runtime errors, but the error is now visible.
Behavior is otherwise unchanged. The previous attempt at a similar fix
(PR #14529, for `ClientWorker`) was closed because the author's commit
identity could not be matched to a GitHub user for the CLA, not because
of the direction.
* Correct trimFuzzyWatchContext error log to reflect the scheduled task
Self-review follow-up. The previous commit logged the swallowed
Throwable as `"failed to trim watched-clients context on client release"`,
but `trimFuzzyWatchContext` is the periodic sweep wired up in
`init()` via `scheduleWithFixDelayByCommon(... , 30000)`, not the
client-release path (that flows through `onEvent` →
`removeFuzzyWatchContext`). Operators reading the original phrasing
would chase a non-existent client-release failure. Re-word the
message so it points at the scheduled task it actually runs in.
TlsFileWatcher.fileMd5Map is accessed from both the calling thread
(in addFileChangeListener) and the scheduled executor thread (in the
periodic check task). Using a plain HashMap here is a data race that
can cause missed TLS certificate updates or ConcurrentModificationException
under concurrent access.
Replace HashMap with ConcurrentHashMap to ensure thread-safe reads
and writes to the file MD5 cache.
- Change lineWrappingIndentation from 0 to 4 to match continuation_indentation=1
- Change arrayInitIndent from 8 to 4 to match continuation_indentation_for_array_initializer=1
- Remove all // @formatter:off/on workarounds (no longer needed)
- Re-format modules affected by continuation_indentation_for_array_initializer change
- Add checkstyle:check and spotless:check to CI check step
Signed-off-by: cxhello <caixiaohuichn@gmail.com>
- Enable toggleOffOn in Spotless config to support @formatter:off/on
- Change continuation_indentation_for_array_initializer from 2 to 1
- Use @formatter:off/on for array initializers that conflict with
Checkstyle IndentationCheck
- Add Javadoc to methods triggered by MissingJavadocMethod after
formatting
Signed-off-by: cxhello <caixiaohuichn@gmail.com>
VersionUtils.compareVersion used String::compareTo on each
dot-separated version part, which compares lexicographically:
compareVersion("1.10.0", "1.9.0") < 0 // should be > 0
compareVersion("10.0.0", "9.0.0") < 0 // should be > 0
As soon as any segment of the server version crosses 10, the
comparison starts returning the wrong sign. That directly affects
ConfigChangeClusterSyncRequestHandler.checkCompatity, which uses
compareVersion to decide whether to skip tenant checks for a
newer server version.
Parse each major/minor/patch segment as an int and compare with
Integer.compare instead. Non-numeric segments (e.g. "1.x.0") now
throw IllegalArgumentException, consistent with the method's
documented "x.y.z(-beta)" format. The unused STRING_COMPARATOR
constant and its Comparator/Objects imports are removed because
leaving them violates the project's no-unused-imports rule.
* test(common): add unit tests to improve coverage from 93.27% to 95%
- New test classes:
- BatchTaskCounterTest (6 tests)
- ByteArrayResponseHandlerTest (3 tests)
- Extended test classes:
- FuzzyGroupKeyPatternTest (+17 tests)
- VersionUtilsTest (+14 tests)
- JdkHttpClientRequestTest (+4 tests)
Total: 44 new test methods
Coverage target: 95% achieved
* test(common): add tests for CollectionUtils and DefaultParamChecker to reach 95% Line coverage
- CollectionUtilsTest: +8 tests for getCardinalityMap, isEqualCollection
- DefaultParamCheckerTest: +8 tests for checkMcpNameFormat, checkAgentNameFormat
- JdkHttpClientRequestTest: simplified SSL tests
Total: 16 new tests, +26 covered lines
Line coverage: 94.29% -> 95.15% ✅
* fix(common): fix failing tests - all 842 tests now pass
- BatchTaskCounterTest: remove invalid batchSuccess(0) test case
- DefaultParamCheckerTest: use Chinese characters for illegal name test
- FuzzyGroupKeyPatternTest: fix case sensitivity in pattern matching tests
Test results (JDK 17):
- Tests Run: 842
- Failures: 0
- Errors: 0
- Line Coverage: 95.59%
* feat(ai): add shared types and AiResourceManager for operation service refactor (phase1 & phase2)
Phase 1 - Extract shared types:
- AiResourceConstants: shared constants (status, version status, labels, retry count)
- ResourceVersionInfo: replaces SkillVersionInfo and AgentSpecVersionInfo inner classes
- PublishPipelineInfo: replaces SkillPublishPipelineInfo and AgentSpecPublishPipelineInfo inner classes
Phase 2 - Add AiResourceManager:
- Generic CAS retry loop (doCasLoop) with CasResult enum
- CAS update methods: updateVersionInfoCas, updateBizTagsCas, metaEnableDisable, bumpMetaDescription, syncImportedMeta
- Query/validation helpers: requireMeta, requireVersionInfo, parseVersionInfo, parsePublishPipelineInfo, ensureReadableOrNotFound, buildQueryCondition, buildEmptyPage, resolveScope
- Version resolution: resolveVersion
- Pipeline callback: onPipelineComplete
* test(ai): add unit tests for AiResourceConstants and AiResourceManager
* refactor(ai,common): extract semver utilities from SkillOperationServiceImpl and AgentSpecOperationServiceImpl into VersionUtils
Move version-related helper methods (normalizeSemver, isSemver, parseSemver,
compareSemverVersion, nextSemverPatch, maxSemver, maxVNumber) from both
SkillOperationServiceImpl and AgentSpecOperationServiceImpl into
common/VersionUtils to eliminate duplication and make them reusable.
* refactor(ai): extract duplicated logic from SkillOperationServiceImpl and AgentSpecOperationServiceImpl into AiResourceManager
- Extract resolveBaseVersion, ensureNoWorkingVersion, buildPageResult,
deleteResourceWithVersions, runPipelineExecution to AiResourceManager
- Add VersionUtils.isGreaterVersion for unified version comparison
- Inline listExistingVersions calls, remove redundant meta fetch in
overwriteUploaded*, simplify validateTargetVersion with VersionUtils
- Unify submit pipeline execution and delete flow via shared methods
- Reduce ~900 lines of duplicated code across both service classes
* docs(skills): add npx usage option for nacos-cli in skill registry guide
* feat(common): support pre-release suffix in VersionUtils semver methods (x.y.z-xxx)
Extend semver pattern to accept optional pre-release labels like 0.0.1-beta, 1.0.0-rc.1.
Pre-release versions have lower precedence than the same version without pre-release per semver spec.
🤖 Generated with [Qoder][https://qoder.com]
* fix(console-ui-next): pre-fill existing biz tags and version label bindings when editing
BizTagEditDialog and LabelBindDialog initialised draft state only inside
the onOpenChange callback, which was not triggered when the parent set
`open` to true directly. This caused the edit dialogs to open with empty
tags / unchecked labels, and saving would wipe out existing values.
Replace the onOpenChange-based init with a useEffect keyed on `open` (and
the relevant props) so the draft state is always synchronised when the
dialog becomes visible. Affects both Skill and AgentSpec detail pages.
* test(ai): add unit tests for AgentSpecOperationServiceImpl, SkillOperationServiceImpl, and AiResourceManager
Cover version detail retrieval, delete, search, draft lifecycle, submit,
publish, force-publish, online/offline, label/bizTag updates, scope
changes, and download counting for both Skill and AgentSpec services.
Also add tests for AiResourceManager shared helpers.
* fix(ai): resolve checkstyle violations in ai module tests
- Remove unused imports (HashMap, doAnswer) in AgentSpecOperationServiceImplTest - Fix single-line lambda to multi-line block in SkillOperationServiceImplTest to satisfy LeftCurlyCheck and OneStatementPerLineCheck
* docs(ai): add English inline comments to SkillOperationServiceImpl and AgentSpecOperationServiceImpl
Add step-by-step inline comments inside method bodies to improve code readability,
covering key logic flows such as upload, bootstrap, draft CRUD, submit, publish,
and online status toggling.
* fix(common): resolve SpotBugs NP_BOOLEAN_RETURN_NULL in VersionUtils.isGreaterVersion
- Change return type from Boolean to boolean (primitive) - Return false instead of null for unrecognized version formats - Update caller in SkillOperationServiceImpl to match new primitive return type
* [ai-registry-adaptor] Rename mcp-registry module to ai-registry
* [ai-registry-adaptor] Update unit tests for ai-registry rename
* [bootstrap] Separate mcp/skill registry enable switches and migrate port config
* fix: correct license comment indentation in AbstractNacosRestTemplate
* feat(param): add skillName parameter extraction and validation.
* fix(paramcheck): improve ParamCheckerFilter bad request response handling.
* feat(skills): validate skill name format during skill upload.
* update grpc version to 1.78.0
Change-Id: I75ad213dd7c8b32e24897933e8609a066c785a97
* update grpc version to 1.78.0
Change-Id: Ia465e749d70d0116b19ddb0575c1130a4215ce0a
* fix grpc version
Change-Id: I340ce9f43aa4f1f0752244ae52be9420465e2745
Add null check for @Nullable grpcResponse parameter before passing
to GrpcUtils.parse() to prevent potential NullPointerException.
Remove NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE exclusion
from spotbugs-exclude.xml.
Signed-off-by: cxhello <caixiaohuichn@gmail.com>
Remove the entire com.alibaba.nacos.common.cache package which has
zero production references. This package was originally created as a
replacement for Guava Cache but was abandoned after bugs were found
and the code was rolled back to Guava.
Also remove the LruCache targeted SpotBugs exclusion from
spotbugs-exclude.xml since the class no longer exists.
Fixes https://github.com/alibaba/nacos/issues/14545
Signed-off-by: cxhello <caixiaohuichn@gmail.com>
Add explicit StandardCharsets.UTF_8 to all DM_DEFAULT_ENCODING
occurrences reported by SpotBugs under threshold=High, and remove
the global exclusion from spotbugs-exclude.xml.
Affected modules: client-basic, client, common, config, core,
k8s-sync, naming, sys.
Signed-off-by: cxhello <caixiaohuichn@gmail.com>
* optimize: update checkStyle version
* optimize: update checkStyle version
* optimize: update checkStyle version
* optimize: update checkStyle version