refactor(idc): split configure_identity_center into a package with tenacity resilience (#924) #935
All Vouch review confidence checks passed
Residual risk 0.27 = Change Risk (0.69) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.69 · 462 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.367
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.069
Real PR Conversation Timeline
1 comments
"Review active on #935"
general
weight: 0.35
shapirov103
Summary
Implements the IDC half of #924: refactor the oversized
scripts/configure_identity_center.py(995 lines) to apply the maintainabilityprinciples Mikhail raised in the #917 review
— reduce the single-file size, and replace hand-rolled
range()/sleep()resilience with the standard
tenacitylibrary.
What changed
New
scripts/idc/package, split by concern (principle 2):| module | responsibility |
|---|---|
|
resilience.py| centralized tenacity retry policies + transient-error classification (tenacity + stdlib only — import-light, unit-testable) ||
constants.py| shared temp-file paths + realm name ||
credentials.py| AWS credential load/refresh + console sign-in URL ||
keycloak.py| Keycloak admin API + SAML client creation ||
scim.py| SCIM user/group export + federation verification ||
browser.py| Playwright/Chromium console-navigation helpers ||
orchestrator.py| the end-to-endconfigure_identity_centerflow |scripts/configure_identity_center.pyis now a thin CLI entrypoint (108 lines,down from 995). The argparse interface and stdout SCIM-token redaction are
preserved verbatim, so
task idc:configureand the SSMbashrc.dpath areunchanged.
How the principles are applied
1 + 3 — standard resilience, centralized classification. The three bespoke
retry loops are replaced by shared policies in
resilience.py:retry_http(3 attempts, 5s fixed) on aTransientHTTPErrorpage.gotoretry →retry_nav(exponential backoff) on thetransient nav-error token set
poll_until(300s / 30s)The transient-nav token set and the transient-HTTP classification now live in
one place instead of being duplicated per call site.
4 — tighten broad excepts. The SAML-descriptor poll retries only on
requests.RequestException+ a falsy result, instead of a blanketexcept Exception:that could mask a real bug for five minutes.5 — unit tests.
scripts/tests/test_idc_resilience.py— 24 hermetic tests(no network/boto3/playwright) covering transient classification and the
retry_nav/retry_http/poll_untilpolicies: recover-after-transient,give-up-after-N, no-retry-on-deterministic-error, timeout,
unlisted-exception-propagation, and async-coroutine support.
Dependency
tenacityis added to theidc:configurepip line and bootstrapped atentrypoint import (mirroring the existing Playwright bootstrap), so the SSM
bashrc.dpath — which has no pip step — still gets it. It runs on the IDE(mise/uv-managed) where adding it is trivial.
Behavior preserved (acceptance criteria)
retry_nav) — not regressed.(
verify_federation_active) are unchanged.pyflakes(no undefined names) and every modulepy_compiles clean.Scope note — the sweep script follows separately
#924 also covers
workshop/scripts/sweep-workshop-resources.py. That half isintentionally sequenced behind #933 (which is actively editing that file, so
refactoring it now would conflict massively) and additionally needs the teardown
CodeBuild buildspec dependency change (destruction-critical runtime — see the
runtime caveat in the issue). It will land in a follow-up PR once #933 merges.
Closes the IDC portion of #924.