You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#319 (PR #345) routes every AWS SDK client through an attributed factory (makeClient/makeDocClient in TS; tenant_client/platform_client in Python) so no outbound AWS call loses solution attribution. But that invariant is currently convention-only — a contributor can still write a naked new S3Client({}) / boto3.client(...) and it compiles, passes tests, and works, silently losing attribution. This is exactly how the pattern decayed before: 5 naked SDK sites appeared on mainwhile #345 was in review.
The factory is the easy path; this issue adds the hard gate that makes a naked client fail the build.
Proposed enforcement (mirrors the repo's existing invariant-regression pattern)
scripts/check-ua-coverage.mjs modeled on scripts/check-types-sync.ts — scans cdk/src + cli/src (TS) and agent/src (Python) for client construction outside the helper modules; exits non-zero on any naked site. Wire into mise.tomldrift-prevention (a build dependency) + a repo:local prek hook.
ESLint no-restricted-syntaxNewExpression[callee.name=/Client$/] in cdk/eslint.config.mjs + cli/eslint.config.mjs, with an override disabling it in the ua.ts helper files (sharper than the script for the TS side).
Python side via ruff flake8-tidy-imports banned-api or a .semgrep/ rule (the latter gives the # nosemgrep: <rule-id> -- <reason> allowlist the repo already documents).
Problem
#319 (PR #345) routes every AWS SDK client through an attributed factory (
makeClient/makeDocClientin TS;tenant_client/platform_clientin Python) so no outbound AWS call loses solution attribution. But that invariant is currently convention-only — a contributor can still write a nakednew S3Client({})/boto3.client(...)and it compiles, passes tests, and works, silently losing attribution. This is exactly how the pattern decayed before: 5 naked SDK sites appeared onmainwhile #345 was in review.The factory is the easy path; this issue adds the hard gate that makes a naked client fail the build.
Proposed enforcement (mirrors the repo's existing invariant-regression pattern)
scripts/check-ua-coverage.mjsmodeled onscripts/check-types-sync.ts— scanscdk/src+cli/src(TS) andagent/src(Python) for client construction outside the helper modules; exits non-zero on any naked site. Wire intomise.tomldrift-prevention(abuilddependency) + arepo:localprek hook.'cdk/src/' 'cli/src/'(directory prefix), not'cdk/src/**/*.ts'— the**/*.tsglob does not match files directly undersrc/and hid a bypass during feat(observability): solution attribution via native AWS_SDK_UA_APP_ID (#319, alt to #338) #345 review (cli/src/webhook-test.ts).no-restricted-syntaxNewExpression[callee.name=/Client$/]incdk/eslint.config.mjs+cli/eslint.config.mjs, with an override disabling it in theua.tshelper files (sharper than the script for the TS side).flake8-tidy-importsbanned-api or a.semgrep/rule (the latter gives the# nosemgrep: <rule-id> -- <reason>allowlist the repo already documents).scripts/check-deadcode-ratchet.mjs) only if debt must remain temporarily; feat(observability): solution attribution via native AWS_SDK_UA_APP_ID (#319, alt to #338) #345 leaves the census at zero, so a hard gate should be feasible immediately.Acceptance
new XxxClient({})(cdk/cli) orboto3.client(...)(agent, outsideaws_session.py) failsmise run buildand the prek hook.md/sanitizers stay locked identical via a shared cross-language fixture.Context