Repository navigation
Closed
Labels
maintenancerefactoringConstant technical improvements which are not necessarily related to any issue.
Milestone
Description
Proposal
Goal
Remove existing NOLINT(readability-function-cognitive-complexity) suppressions from test code by refactoring the affected tests into smaller helpers while preserving behavior and coverage.
Background
The repository currently has multiple integration tests with suppressed cognitive-complexity warnings. This keeps CI green, but it hides test-structure debt and makes future maintenance harder.
We already started refactoring unit tests instead of suppressing them. The same cleanup should now be applied to the remaining suppressed integration tests.
Scope
Refactor the following tests so that the suppressions can be removed:
tests/integration/http_json_client_integration_test.cpp
SendMessageHappyPathSetsHeadersAndParsesResponseGetTaskAndCancelTaskHappyPathListTasksBuildsQueryAndParsesTasksSupportsPushNotificationConfigCrudAndList
tests/integration/http_json_streaming_integration_test.cpp
SendStreamingMessageParsesFragmentedEventsInOrderMalformedFrameTriggersObserverErrorCancelDuringActiveStreamStopsWithoutCompletionRemoteCloseWithoutTerminalEventCompletesRemoteErrorEventMapsToObserverProtocolErrorNonSuccessHttpStatusPreservesJsonErrorBody
Requirements
- Remove the
NOLINT(readability-function-cognitive-complexity)suppressions from the refactored tests. - Keep behavior unchanged.
- Prefer extracting reusable helpers over moving complexity into large lambdas.
- Reuse existing helper patterns where possible:
- transport/request builder helpers
- metadata/chunk emission helpers
- shared assertion helpers
- observer/result verification helpers
- Keep code style aligned with the Google C++ Style Guide used in this repository.
- Avoid broad test rewrites that mix unrelated cleanup.
Suggested approach
- Identify repeated setup patterns in integration tests.
- Extract small helpers for:
- building requests
- emitting SSE / streaming chunks
- validating observer state
- validating parsed responses and headers
- Replace inline callback logic that contains multiple
ifbranches with small helper functions. - Split large “do everything” tests into short Arrange / Act / Assert flows.
Validation
Run at least:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DA2A_ENABLE_TESTING=ON
cmake --build build -j"$(nproc)"
ctest --test-dir build --output-on-failure
./scripts/run_clang_tidy.sh --profile strict buildExpected outcome
- No remaining suppressed cognitive-complexity findings in the targeted tests.
- Strict clang-tidy passes for the touched files.
- Tests remain readable and behaviorally equivalent.
Metadata
Metadata
Assignees
Labels
maintenancerefactoringConstant technical improvements which are not necessarily related to any issue.
Type
Projects
- StatusShow more project fieldsDone
Activity