Commit f57b931
* feat(cdk): add Phase-0 deploy-then-verify integ tests (#236)
Introduce automated deploy-then-verify integration testing via
@aws-cdk/integ-tests-alpha + integ-runner — the first synth→deploy→
assert→destroy coverage against real AWS (ADR-013 Tier 3 / Phase 0).
- cdk/test/integ/integ.task-api-smoke.ts: a trimmed TaskApiSmokeStack
(TaskApi + task/events tables; omits orchestrator + AgentCore
Runtime/Memory to avoid colliding with the live backgroundagent-dev
stack and to keep the task at SUBMITTED). Asserts the create-and-
persist happy path: Cognito adminCreateUser → adminSetUserPassword →
initiateAuth → POST /tasks → GET /tasks/{id} (200, SUBMITTED) →
DynamoDB getItem (user_id persisted). Forced teardown on success and
failure.
- .github/workflows/integ.yml: workflow_dispatch + nightly schedule
(never per-PR — it deploys billable resources to a shared account);
OIDC creds, concurrency guard, pinned action SHAs, and an
if: always() force-destroy safety net.
- cdk/mise.toml: mise //cdk:integ task.
- cdk/package.json: pin @aws-cdk/integ-runner 2.199.0 +
@aws-cdk/integ-tests-alpha 2.257.0-alpha.0 (devDeps); exclude
test/integ/ from jest test + coverage paths.
- .gitignore: ignore regenerated *.snapshot/ and cdk-integ.out.* dirs.
- docs(ROADMAP, ADR-013): record Phase 0 landed (+ Starlight mirrors).
* fix(integ): scrub account ID, randomize integ password, harden teardown
Address security-review findings on the Phase-0 integ test (#236):
- Remove the hardcoded AWS account ID from three comments (integ.yml
header, integ.task-api-smoke.ts constructor, cdk/mise.toml task desc).
The runner deploys into whatever account the active credentials /
secrets.AWS_ROLE_TO_ASSUME resolve to, so naming the account added no
value and leaked it into source.
- Generate the throwaway Cognito password per-synth via randomBytes
instead of a hardcoded literal, so no credential-shaped string lives in
the tree. Still satisfies the default Cognito policy by construction.
- Fix the workflow teardown safety-net: `cdk destroy backgroundagent-integ`
synthesizes src/main.ts, which does not contain the integ stack, so it
was a no-op. Delete the stack by its literal CloudFormation name via the
AWS CLI (idempotent) instead.
- Add a gitleaks rule to catch bare 12-digit AWS account IDs going forward,
with allowlists for AWS-published placeholders and lockfiles/snapshots.
* fix(integ): gate dispatch to main, default region, drop dead snapshot flag
Address pre-merge review on the Phase-0 integ harness (#236):
- Add `if: github.ref == 'refs/heads/main'` to the integ job. workflow_dispatch
can target any branch and the job assumes the privileged integ role, so
without this guard a feature-branch edit to test/integ/*.ts could be
dispatched against that role. Complements the OIDC trust-policy restriction.
- Default aws-region to us-east-1 when vars.AWS_REGION is unset, so the
credentials action never runs region-less.
- Drop --update-on-failed from the integ-runner invocation: .snapshot/ is
gitignored, so there is no committed snapshot to diff against or update.
--force still re-runs the deploy-then-verify unconditionally.
* fix(integ): run integ job in `integ` GitHub Environment
The job assumes AWS_ROLE_TO_ASSUME, which is an environment-scoped secret
(deploy.yml's diff/deploy jobs each declare an environment), so a job with
no environment resolves it to empty and configure-aws-credentials fails.
The GitHub role's OIDC trust also gates on `sub = repo:...:environment:<name>`,
so the integ workflow must run in a named environment whose name is added to
the trust policy.
Declare `environment: integ`. Account-side setup (separate, owner has IAM
access) creates the `integ` GitHub Environment, scopes the role/region
secrets to it, and adds `...:environment:integ` to the role's trust `sub`.
* feat(integ): drive integ smoke per-PR via workflow_run, admin-gated
Rework the integ workflow to mirror the deploy.yml model so a reviewer
sees a merge-blocking check on the PR instead of manually dispatching a
job. build.yml completes -> workflow_run resolves whether the diff
touches cdk/** or agent/** -> the `integ` environment's required
reviewer approves -> deploy/assert/destroy runs against the shared
account -> an `integ-smoke` commit status is posted back to the PR head.
Docs/cli-only PRs get an immediate green skip so the required check never
deadlocks. Fork PRs run behind the same approval gate (the approver
authorizes fork-authored test code to run with the privileged role).
Nightly schedule dropped; workflow_dispatch retained (main only).
Refs #236.
* fix(integ): address review nits — error handling, test quality, fork-PR safety
- integ.yml: drop unused actions:read; add EXIT-trap error status, explicit
/files failure handling (no false-green skip), and a safe-to-test fork label
gate in resolve; guard report job on resolve success; region-pin and
fail-loud the teardown wait.
- .gitleaks.toml: report aws-account-id capture group 1 (bare 12-digit ID).
- integ smoke test: add unauthenticated POST assertion (expect 401); clarify
the user_id assertion comment (identity binding proven transitively by the
authenticated GET).
- ADR-013: document residual-risk acceptance for fork-PR integ execution.
---------
Co-authored-by: bgagent <bgagent@noreply.github.com>
Co-authored-by: Sphia Sadek <isadeks@gmail.com>
Co-authored-by: Alain Krok <alkrok@amazon.com>
1 parent 8c0f5e3 commit f57b931
11 files changed
Lines changed: 629 additions & 2 deletions
File tree
- .github/workflows
- cdk
- test/integ
- docs
- decisions
- guides
- src/content/docs
- decisions
- roadmap
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
61 | 72 | | |
62 | 73 | | |
63 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| |||
90 | 92 | | |
91 | 93 | | |
92 | 94 | | |
93 | | - | |
| 95 | + | |
| 96 | + | |
94 | 97 | | |
95 | 98 | | |
96 | | - | |
| 99 | + | |
| 100 | + | |
97 | 101 | | |
98 | 102 | | |
99 | 103 | | |
| |||
0 commit comments