fix(roles): surface source ids on sync failure + paginated-list truncation#614
Merged
Merged
Conversation
riyazsh
force-pushed
the
riyaz/HAMR-392-roles-phase2-visibility-phase6-remap
branch
from
July 9, 2026 14:43
e9343b9 to
c46aa9b
Compare
…ation Three linked observability fixes for cross-process cascade correlation: 1. roles.create/update: log source id + role name at ERROR on failure before re-raising, so downstream sync-cli invocations for other resource types can correlate missing-dependency cascades. 2. Counter: track failed / missing-deps source ids by resource type. apply_resources emits a per-type summary at end so operators see which specific ids to search for in downstream cascade logs. 3. paginated_request: elevate non-5xx mid-pagination failure log to say TRUNCATED explicitly and mention downstream cascade risk. A 403 Forbidden on one page silently truncated the returned list before; now the truncation is unambiguous in logs. 11 new unit tests. 821 total (was 810). Co-Authored-By: Claude Opus 4.7 <[email protected]>
riyazsh
force-pushed
the
riyaz/HAMR-392-roles-phase2-visibility-phase6-remap
branch
from
July 9, 2026 15:10
c46aa9b to
8e49fca
Compare
nathantournant
approved these changes
Jul 9, 2026
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.
Summary
Three linked observability fixes so operators can correlate cross-process cascade failures when sync-cli is invoked once per resource type as separate processes:
Roles.create_resource/update_resource— log source id + role name atERRORbefore re-raising on unhandled failure. Previously the module logged nothing before propagating the HTTP error, so a downstream resource type that later couldn't remap the role UUID had no way to see which specific role failed to sync.Counter— track failed and missing-dependency source ids by resource type.apply_resourcesemits a per-type summary at end so a subsequent sync-cli invocation can find the exact ids to search for in cascade logs. Ids are chunked at 50 per line to stay under common log-shipper truncation caps. Backwards-compatible: existing callers that pass no ids still increment the numeric counter as before.paginated_request— elevate the non-5xx mid-pagination failure log to sayTRUNCATEDexplicitly and mention downstream cascade risk. A 403 Forbidden on one page previously produced a benign-lookingError during paginated request ...line and silently truncated the returned resource list; downstream syncs saw a partial source list without knowing why.Motivation
When sync-cli is orchestrated as one process per resource type (each reading state from a shared store), a failure in an earlier process can cascade into "missing connections" errors in later processes referencing ids that never appeared in any prior log. These three changes make that failure mode debuggable from logs alone.
No behavior change for callers that
Roles.create/update(2xx and handled 4xx paths unchanged)Test plan
pytest tests/unit/— 829 passing (19 new across 4 new test files).paginated_requesttruncation log wording (403 path) + regression guard for 5xx isolation path.