[FLINK-39860][runtime] Reduce ArchUnit violations: production code must not call @VisibleForTesting methods#28324
Open
spuru9 wants to merge 1 commit into
Open
Conversation
…st not call @VisibleForTesting methods All 23 frozen violations of the "Production code must not call methods annotated with @VisibleForTesting" rule are resolved. In every case the annotation was inaccurate: the target method is genuinely called by production code, so the test-only marker misled maintainers. Removed the annotation from the 12 affected methods (no visibility or signature change) and dropped two now-unused imports. The rule's freeze store is emptied; the freeze() wrapper is kept so the rule now enforces zero such violations going forward.
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
Resolves the 23 frozen violations of the "Production code must not call methods annotated with @VisibleForTesting" ArchUnit rule (
ApiAnnotationRulesinflink-architecture-tests-production). In every case the annotation is inaccurate — the target method is genuinely called by production code — so removing the marker corrects the API signal. This is an annotation-only change; no visibility or behavioral change.Brief change log
@VisibleForTestingfrom 12 production-called methods (and 2 now-unused imports) acrossflink-runtimeandflink-cep:BlobKey#getHash()— 5 callers (blob integrity checks)TaskExecutorResourceUtils#generateDefaultSlotResourceProfile/#generateTotalAvailableResourceProfile— 4EmbeddedLeaderService#grantLeadership()/#revokeLeadership()— 6SourceOperator#getSourceReader()— 2CopyOnWriteStateMap#snapshotMapArrays(),ExecutionVertex#finishPartitionsIfNeeded(),DataSetMetaInfo#withNumRegisteredPartitions(),RecreateOnResetOperatorCoordinator.QuiesceableContext#quiesce(),MailboxProcessor#isDefaultActionAvailable()— 1 eachLockable.LockableTypeSerializer#getElementSerializer()(flink-cep) — 1SourceOperator#getSourceReader()above the// methods for unit testssection (it is now production-used).e5126cae-…, 23 → 0). Thefreeze()wrapper is kept, so the rule now enforces zero such violations going forward.Verifying this change
This change is covered by the existing architecture tests:
mvn -pl flink-architecture-tests/flink-architecture-tests-production test -Dtest=ArchitectureTestpasses; the rule's violation store is reduced from 23 entries to 0.flink-runtimeandflink-cep.Does this pull request potentially affect one of the following parts:
@Public(Evolving): no (annotation-only; affected classes are@Internal, no signature/visibility change)Documentation
Reviewer note
The
EmbeddedLeaderService.grant/revokeLeadership()pair (6 sites) is the one judgment call: the annotation was removed because the production-sourceEmbeddedHaServicesWithLeadershipControlcalls these methods. If reviewers prefer annotating that caller instead, the alternative only affects thehighavailabilityportion — happy to switch.