mirror of
https://github.com/temporalio/temporal.git
synced 2026-08-30 18:41:49 -07:00
## What changed? - Moves `activity.linkValidator` into `common/links`. - Moves `callback.Validator` into `common/callbacks` In addition, this PR performs some minor refactorings for consistency and clarity. - Moved some `links.Validator`-specific tests from `chasm/lib/activity/validator_test.go` elsewhere. - Introduced a `callbacks.ValidatorConfig` to bundle all of the specific settings. (Since we'll need to wire 3+ more parameters when updating the `callbacks.Validator` to support worker callbacks.) > The singular package names `common/link` or `common/callback` would be more consistent. But `common/links` already existed, there are other pluralized ones like `common/enums` or `common/headers`. And IMHO, the plural seems a little more applicable since the validations are only on groupings of links or callbacks. ## Why? The `activity.linkValidator` and `callback.Validator` types are great, but they aren't able to be used as across other CHASM components as easily. Moreover, `callback.Validator` uses types that are exposed from the CHASM `callback` package, it will lead to circular dependencies in the future. (I'm hitting this now in PRs for landing worker callbacks.) Moving the `commonpb` protobuf validation into `common/` means we can better separate the the distinction between validation logic and the CHASM executions that rely on it. ## How did you test it? - [x] built - [x] run locally and tested manually - [x] covered by existing tests - [x] added new unit test(s) - [ ] added new functional test(s) ## Potential risks This should just be a standard refactoring. There should not be any new validation checks enabled on codepaths where they weren't already present. (Or in test cases, we initialize fields of `callback.ValidatorConfig` that weren't used before.)