wu-sheng opened a new pull request, #13732:
URL: https://github.com/apache/skywalking/pull/13732
### Fix v2 MAL compiler issues in sanitizeName, filter compilation, and
Groovy truth semantics
- [x] Add a unit test to verify that the fix works.
- [x] Explain briefly why the bug exists and how to fix it.
#### 1. `sanitizeName` lost digits for numeric-prefixed metric names
`sanitizeName("4xx")` produced `_xx` (replacing `4` with `_`) instead of
`_4xx` (prepending `_`). Fixed in both `MALCodegenHelper` and
`LALCodegenHelper` to prepend `_` and keep all valid identifier-part characters.
#### 2. v2 filter `.class` files not generated in checker tests
The v1-v2 checker compiled expression classes but not filter classes. Added
filter compilation in `MalComparisonTest` — 56 filter `.class` files now
generated into `generated-classes/` directories. Production `FilterExpression`
also accepts a name hint for deterministic class naming via `configPath`.
#### 3. SourceFile attributes missing YAML traceability
Generated `.class` files had no reference to their source YAML file. Added
`yamlSource` with filename and line number for both expression and filter
classes (e.g., `(gateway-service.yaml:33)gateway_service_filter.java`).
#### 4. Groovy truth semantics for filter closures
v2 filter codegen only checked `!= null` for standalone expressions in
boolean context (e.g., `tags.ApiId || tags.ApiName`), but Groovy truth also
requires non-empty string check. Added `MalRuntimeHelper.isTruthy()` runtime
helper matching Groovy semantics: `null → false`, empty string → `false`,
`Boolean.FALSE → false`.
**Verified**: MalComparisonTest (1268 tests) and MalFilterComparisonTest (31
tests) all pass.
- [ ] If this pull request closes/resolves/fixes an existing issue, replace
the issue number. Closes #<issue number>.
- [ ] Update the [`CHANGES`
log](https://github.com/apache/skywalking/blob/master/docs/en/changes/changes.md).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]