fix: fix operator precedence bug in startup callback state check#1752
fix: fix operator precedence bug in startup callback state check#1752aws-kevinrickard merged 1 commit intomainfrom
Conversation
cd67359 to
a564a48
Compare
|
Binary incompatibility detected for commit 05e9938. com.aws.greengrass.tes.CredentialRequestHandler is binary incompatible and is source incompatible because of FIELD_REMOVED Produced by binaryCompatability.py |
|
Unit Tests Coverage Report
Minimum allowed coverage is Generated by 🐒 cobertura-action against 05e9938 |
|
Integration Tests Coverage Report
Minimum allowed coverage is Generated by 🐒 cobertura-action against 05e9938 |
a564a48 to
f9af3e0
Compare
f9af3e0 to
8705979
Compare
d3b7c00 to
42a9090
Compare
be3f098 to
71c5b0c
Compare
71c5b0c to
05e9938
Compare
Issue #, if available:
V1980934725
Fix operator precedence bug in startup callback state check
Description
Fixes a bug in GenericExternalService.startup() where the startup callback could incorrectly report errors for stale callbacks when the service state is RUNNING.
Problem
The original condition:
Due to operator precedence, this evaluates as:
This means whenever the state is RUNNING, the block executes regardless of whether the generation has changed. A stale callback from a previous startup attempt could then incorrectly call serviceErrored for a non-zero exit code, even though the service has already moved on to a new lifecycle.
Fix
Added parentheses to ensure correct evaluation:
Now both conditions must be true: the generation must match AND the state must be STARTING or RUNNING.
Testing
Added a unit test that:
Documentation Checklist:
Compatibility Checklist:
any deprecated method or type.
Refer to Compatibility Guidelines for more information.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.