grada-run 0.49.4 → 0.49.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/package.json +1 -1
  2. package/src/commands/add.js +1 -1
  3. package/src/commands/alerts.js +1 -1
  4. package/src/commands/apply.js +2 -2
  5. package/src/commands/db/backup.js +3 -3
  6. package/src/commands/db/connect.js +2 -2
  7. package/src/commands/db/enable-vector.js +1 -1
  8. package/src/commands/db/import.js +2 -2
  9. package/src/commands/db/migrate.js +7 -6
  10. package/src/commands/destroy.js +6 -6
  11. package/src/commands/diagnose.js +1 -1
  12. package/src/commands/domain.js +2 -2
  13. package/src/commands/exec.js +1 -1
  14. package/src/commands/gc.js +2 -2
  15. package/src/commands/init.js +7 -7
  16. package/src/commands/logs.js +3 -3
  17. package/src/commands/rollback.js +4 -4
  18. package/src/commands/secrets.js +18 -18
  19. package/src/commands/status.js +3 -3
  20. package/src/commands/wake.js +2 -2
  21. package/src/utils/addons.js +1 -1
  22. package/src/utils/backup.js +1 -1
  23. package/src/utils/ecs-runner.js +3 -3
  24. package/src/utils/generator.js +3 -3
  25. package/src/utils/prompts.js +1 -1
  26. package/src/utils/resolvers.js +8 -10
  27. package/src/utils/terraform.js +1 -1
  28. package/templates/github/deploy-lambda.yml +2 -2
  29. package/templates/github/deploy-static.yml +1 -1
  30. package/templates/github/deploy.yml +2 -2
  31. package/templates/github/drift.yml +1 -1
  32. package/templates/github/plan.yml +2 -2
  33. package/templates/github/preview-lambda.yml +4 -4
  34. package/templates/github/preview.yml +4 -4
  35. package/templates/github/teardown.yml +3 -3
  36. package/templates/terraform/addons/bedrock.tf +1 -1
  37. package/templates/terraform/backend.tf +1 -1
  38. package/templates/terraform/cloudfront-lambda.tf +2 -2
  39. package/templates/terraform/cloudfront.tf +3 -3
  40. package/templates/terraform/database-aurora-postgresql.tf +1 -1
  41. package/templates/terraform/main.tf +3 -3
  42. package/templates/terraform/oidc.tf +29 -14
  43. package/templates/terraform/secrets.tf +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grada-run",
3
- "version": "0.49.4",
3
+ "version": "0.49.5",
4
4
  "description": "Provision production-ready AWS infrastructure and CI/CD pipelines in seconds.",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -706,7 +706,7 @@ export function renderWorkerAutoscalingBlock(hasWorker) {
706
706
  function renderAddonTemplate(templateContent, templateVars = {}, conditionalBlocks = {}) {
707
707
  let rendered = String(templateContent ?? '');
708
708
  // Replacement FUNCTIONS (not strings): `$` patterns in values (cron
709
- // commands, ARNs) land byte-identical (BUG-156).
709
+ // commands, ARNs) land byte-identical.
710
710
  for (const [key, value] of Object.entries(templateVars)) {
711
711
  const literal = String(value ?? '');
712
712
  rendered = rendered.replaceAll(`{{${key}}}`, () => literal);
@@ -187,7 +187,7 @@ export function buildAlertsTf({ projectName, target = 'ecs', email, webhook, thr
187
187
  const defaults = ALERT_TARGET_DEFAULTS[target] || ALERT_TARGET_DEFAULTS.ecs;
188
188
  const limit = threshold ?? defaults.threshold;
189
189
  // All targets use the workspace-aware local: flat ECS names let a
190
- // preview apply clobber the prod alarm (BUG-132). Existing trees
190
+ // preview apply clobber the prod alarm. Existing trees
191
191
  // migrate on the next `grada alerts` + apply (topic/alarm recreate).
192
192
  const namePrefix = '${local.app_name}';
193
193
  const aliasLine = target === 'static' ? ' provider = aws.us_east_1\n' : '';
@@ -492,7 +492,7 @@ async function applyStackMain(input = {}) {
492
492
  if (!sleepGuard.proceed) return sleepGuard.result;
493
493
  }
494
494
 
495
- // 1d. Preflight secret/env collisions (BUG-81): stale,
495
+ // 1d. Preflight secret/env collisions: stale,
496
496
  // confirmed-through, or hand-edited keys files would die late on
497
497
  // the raw ECS 400 — fail here naming the key and the fix. ECS-only
498
498
  // (Lambda maps no secrets into env), unconditional (a collision is
@@ -671,7 +671,7 @@ async function applyStackMain(input = {}) {
671
671
  if (cfUrl) finalMessage += `\n 🌍 App URL: ${color.cyan(cfUrl)} ${color.dim('(global CDN — share this link)')}`;
672
672
  // The origin only answers CloudFront (listener rule 403s direct
673
673
  // hits without the origin-secret header) — label the URL as
674
- // unreachable instead of a working bypass (BUG-136).
674
+ // unreachable instead of a working bypass.
675
675
  if (albUrl) finalMessage += `\n 🚦 Direct URL: ${color.gray(albUrl)} ${color.dim('(CloudFront-only origin — direct hits 403)')}`;
676
676
  // Lambda stacks have no CDN: without a CloudFront URL the API
677
677
  // URL is the primary link, not a debug bypass.
@@ -33,7 +33,7 @@ function snapshotSourceDb(snapshot, isCluster) {
33
33
  return isCluster ? snapshot.DBClusterIdentifier : snapshot.DBInstanceIdentifier;
34
34
  }
35
35
 
36
- // BUG-204 failure: the reused id names another database's snapshot.
36
+ // The reused id names another database's snapshot.
37
37
  // Shared by the wait and no-wait paths (they differ only in `waited`).
38
38
  function failSnapshotMismatch({ spinnerHandle, snapshotId, foreignDb, targetId, projectName, waited, dbIdentifier, region }) {
39
39
  spinnerHandle.stop(color.red('❌ Snapshot belongs to another database.'));
@@ -202,7 +202,7 @@ async function runDbBackupMain(input = {}) {
202
202
 
203
203
  if (noWait) {
204
204
  if (reusedExisting) {
205
- // BUG-204: verify ownership even when not waiting — one
205
+ // Verify ownership even when not waiting — one
206
206
  // describe, fail closed on a foreign snapshot. A
207
207
  // not-found here is transient (eventual consistency),
208
208
  // so only proceed past it.
@@ -268,7 +268,7 @@ async function runDbBackupMain(input = {}) {
268
268
  throw error;
269
269
  }
270
270
  const snapshot = snapshots[0] || null;
271
- // BUG-204: an explicit --id can name another database's
271
+ // An explicit --id can name another database's
272
272
  // snapshot (AlreadyExists proves existence, not
273
273
  // ownership) — fail closed instead of adopting a
274
274
  // foreign snapshot as our safety backup. Checked
@@ -272,7 +272,7 @@ async function runDbConnectMain(input = {}) {
272
272
  });
273
273
 
274
274
  // Node reports signal death as code null — a killed tunnel is a
275
- // failure naming the signal, never `?? 0` success (BUG-149).
275
+ // failure naming the signal, never `?? 0` success.
276
276
  const { code, signal } = await new Promise((resolve) => {
277
277
  const child = spawnImpl('aws', ssmArgs, { stdio: 'inherit' });
278
278
  child.on('error', (err) => {
@@ -288,7 +288,7 @@ async function runDbConnectMain(input = {}) {
288
288
  // Telemetry carries only non-sensitive fields. Credentials never leave this process
289
289
  // except to the terminal above and the local SSM session below.
290
290
  // Success is recorded only for a clean tunnel exit: a failed tunnel
291
- // reports the tunnel's own exit code instead of ok:true (BUG-103).
291
+ // reports the tunnel's own exit code instead of ok:true.
292
292
  if (code !== 0) {
293
293
  const tunnelCode = Number.isInteger(code) && code > 0 ? Math.min(code, 255) : 1;
294
294
  return failCommand({
@@ -322,7 +322,7 @@ async function runDbEnableVectorMain(input = {}) {
322
322
  const exitCode = outcome.exitCode;
323
323
  const stoppedReason = outcome.stoppedReason;
324
324
  if (exitCode === 0) {
325
- // Owner pairs its own start/stop (see migrate.js BUG-202).
325
+ // Owner pairs its own start/stop: a callee must never stop its caller's spinner.
326
326
  try { s.stop(color.green('pgvector extension enabled.')); } catch { /* already stopped */ }
327
327
  console.log(color.green('\n✅ pgvector extension enabled.'));
328
328
  try {
@@ -159,7 +159,7 @@ function targetEnv(targetScheme, password) {
159
159
  }
160
160
 
161
161
  // Source-side dump env: the SOURCE is arbitrary user infra (often no
162
- // TLS), so prefer TLS instead of requiring it (BUG-148). MySQL sources
162
+ // TLS), so prefer TLS instead of requiring it. MySQL sources
163
163
  // were never forced; the target side keeps `require`.
164
164
  function sourceEnv(scheme, password) {
165
165
  if (scheme === 'mysql') {
@@ -172,7 +172,7 @@ function waitForExit(child) {
172
172
  return new Promise((resolve) => {
173
173
  child.once('error', (error) => resolve({ code: 1, error }));
174
174
  // Node reports signal death as code null — resolve it as failure
175
- // (with the signal), never `?? 0` success (BUG-149).
175
+ // (with the signal), never `?? 0` success.
176
176
  child.once('close', (code, signal) => resolve(signal ? { code: 1, signal } : { code: code ?? 0 }));
177
177
  });
178
178
  }
@@ -101,7 +101,7 @@ function renderGateBlock({ includeSetupNode, steps }) {
101
101
  lines.push(
102
102
  ` - name: ${stepName}`,
103
103
  // Gates run AWS calls: honor the credential-skip outcome like
104
- // every other post-assume step (BUG-138). Neutral on deploy
104
+ // every other post-assume step. Neutral on deploy
105
105
  // (a failed assume fails the run before any gate runs).
106
106
  ` if: steps.aws-creds.outcome == 'success'`,
107
107
  ' run: |',
@@ -147,7 +147,7 @@ function injectGateBlock(content, { steps, anchor }) {
147
147
  // Idempotently injects (or refreshes) the migration gate block into a
148
148
  // deploy.yml document. Returns the updated content, or null when neither
149
149
  // anchor step is present. Pure and unit-tested. The snapshot id embeds
150
- // the database identifier (BUG-205): bare pre-deploy-<sha> ids match no
150
+ // the database identifier: bare pre-deploy-<sha> ids match no
151
151
  // guardrail or gc name pattern, so they were never protected or retired.
152
152
  export function injectMigrationGate(workflowContent, { cmd, cliVersion, dbIdentifier } = {}) {
153
153
  if (typeof dbIdentifier !== 'string' || dbIdentifier.trim() === '') {
@@ -297,7 +297,7 @@ async function runDbMigrateMain(input = {}) {
297
297
 
298
298
  // 2. --setup-ci: patch the workflow file, no AWS calls.
299
299
  if (setupCi) {
300
- // BUG-191: the gate runs migrations as an ephemeral ECS task —
300
+ // The gate runs migrations as an ephemeral ECS task —
301
301
  // refuse on lambda/static (no ECS to run on). Init auto-skips
302
302
  // with a warning; this explicit command fails closed.
303
303
  const setupTarget = readTerraformComputeTarget(cwd);
@@ -328,12 +328,13 @@ async function runDbMigrateMain(input = {}) {
328
328
  resultExtra: { cluster, service, region },
329
329
  });
330
330
  }
331
- // BUG-205: the gate always targets production (deploy.yml), so
331
+ // The gate always targets production (deploy.yml), so
332
332
  // resolve the prod db id even with a preview workspace checked
333
333
  // out locally. Aurora needs the cluster prefix: cluster
334
334
  // snapshots named with the instance prefix would miss the
335
335
  // cluster-snapshot guardrail pattern.
336
- const setupDbResolver = readTerraformDbKind(cwd) === 'cluster' ? resolveDbClusterIdentifier : resolveDbIdentifier;
336
+ const setupDbKind = readTerraformDbKind(cwd);
337
+ const setupDbResolver = setupDbKind === 'cluster' ? resolveDbClusterIdentifier : resolveDbIdentifier;
337
338
  const setupDbIdentifier = setupDbResolver({ projectName, workspace: 'default' }, cwd);
338
339
  const updated = injectMigrationGate(workflowContent, { cmd: resolvedCmd, cliVersion: getCliVersion(), dbIdentifier: setupDbIdentifier });
339
340
  if (updated === null) {
@@ -367,7 +368,7 @@ async function runDbMigrateMain(input = {}) {
367
368
  }
368
369
  }
369
370
  }
370
- await trackSuccess('db_migrate_run', { projectName, cmd_source: cmdSource, ci_setup: true });
371
+ await trackSuccess('db_migrate_run', { projectName, cmd_source: cmdSource, ci_setup: true, db_kind: setupDbKind });
371
372
  outro(color.green('Setup complete.'));
372
373
  return { ok: true, ciSetup: true, workflowFile, cmdSource };
373
374
  }
@@ -123,7 +123,7 @@ export async function handleDestroyTerraformError({ options, tfDirPath, attemptD
123
123
  return namedFail('STATE_LOCK_HELD');
124
124
  }
125
125
 
126
- // BUG-210: a drained bucket can still report versions when terraform
126
+ // A drained bucket can still report versions when terraform
127
127
  // runs (S3 empty-visibility race). Settle briefly, then retry the
128
128
  // destroy exactly once — a second BucketNotEmpty is terminal.
129
129
  if (code === 'BUCKET_NOT_EMPTY') {
@@ -447,11 +447,11 @@ async function destroyStackMain(input = {}) {
447
447
  }
448
448
  // Wait for the snapshot to reach `available` before touching the
449
449
  // database: deleting while it is still `creating` races snapshot
450
- // completion on large DBs (BUG-98). A failed snapshot or a timeout
450
+ // completion on large DBs. A failed snapshot or a timeout
451
451
  // refuses the destroy — re-run with --allow-data-loss to skip.
452
452
  // Re-message (never re-start): the phase spinner is already
453
453
  // running, and a second start leaks clack's first interval so the
454
- // session never exits (BUG-198).
454
+ // session never exits.
455
455
  s.message(truncateSpinnerText(`Waiting for snapshot ${snapshotId} to complete...`));
456
456
  const snapshotReady = await pollUntil({
457
457
  intervalMs: pollIntervalMs,
@@ -477,7 +477,7 @@ async function destroyStackMain(input = {}) {
477
477
  if (status === 'failed' || status === 'deleted') {
478
478
  return { done: true, value: { failed: true, reason: `snapshot ${status}` } };
479
479
  }
480
- // BUG-196: surface PercentProgress while creating so long
480
+ // Surface PercentProgress while creating so long
481
481
  // snapshots don't look wedged.
482
482
  const detail = typeof percent === 'number' ? `${status || 'pending'} (${percent}% complete)` : (status || 'pending');
483
483
  s.message(truncateSpinnerText(`Waiting for snapshot ${snapshotId} to complete... (${detail})`));
@@ -613,7 +613,7 @@ async function destroyStackMain(input = {}) {
613
613
  resultExtra: { region },
614
614
  });
615
615
  }
616
- // BUG-210: versioned deletes can lag S3's empty-reads, so
616
+ // Versioned deletes can lag S3's empty-reads, so
617
617
  // verify each drained bucket reads empty before terraform
618
618
  // destroy runs — otherwise destroy flakes on BucketNotEmpty.
619
619
  // A bucket deleted out-of-band counts as empty.
@@ -690,7 +690,7 @@ async function destroyStackMain(input = {}) {
690
690
  });
691
691
  if (refused) return refused;
692
692
  }
693
- // BUG-198: "spin this back up" overstated recovery — apply
693
+ // "spin this back up" overstated recovery — apply
694
694
  // recreates compute, never the destroyed database. Name the
695
695
  // snapshot (or its absence) so the choice is informed.
696
696
  const dbRecoveryNote = snapshotReadyId
@@ -262,7 +262,7 @@ async function runDiagnoseMain(input = {}) {
262
262
  cwd = resolveCwd(options);
263
263
  projectName = resolveProjectName(options, cwd);
264
264
  region = resolveRegion(options, cwd);
265
- // Workspace-namespaced resources (BUG-90): --workspace (or the
265
+ // Workspace-namespaced resources: --workspace (or the
266
266
  // local .terraform/environment) targets a preview stack like
267
267
  // rollback and db do. Explicit flags/env keep winning; telemetry
268
268
  // keeps the raw project name.
@@ -529,7 +529,7 @@ async function runDomainAdd({ options, projectName, domain, zoneId, domainTfPath
529
529
  cloudfrontPatched = patched.changed;
530
530
  } else if (previousDomain && previousDomain !== domain) {
531
531
  // External-pending wires nothing new, but a --force replace must
532
- // still release the previous ACTIVE aliases (BUG-100).
532
+ // still release the previous ACTIVE aliases.
533
533
  const read = await readCloudFrontDistribution(cloudfrontTfPath, 'add', noExit);
534
534
  if (!read.ok) return read.failure;
535
535
  const updated = unpatchCloudFrontDomain(read.content, previousDomain);
@@ -799,7 +799,7 @@ async function runDomainRemove({ options, projectName, domainTfPath, cloudfrontT
799
799
  console.log(color.yellow(`⚠ ${remainingAliases.length} alias(es) remain (${remainingAliases.join(', ')}): the ACM viewer_certificate is kept, but its validation resource is deleted with domain.tf — rewire the certificate by hand before applying.`));
800
800
  } else if (!unpatched) {
801
801
  // The aliases were never touched: claiming a restore would send
802
- // the next apply into a stale-alias failure (BUG-99).
802
+ // the next apply into a stale-alias failure.
803
803
  console.log(color.green(`\n✅ Custom domain ${domain || ''} removed.`.replace(' ', ' ')));
804
804
  const why = !domain
805
805
  ? 'terraform/domain.tf was unparseable, so CloudFront aliases were left untouched'
@@ -109,7 +109,7 @@ async function runExecMain(input = {}) {
109
109
  cwd = resolveCwd(options);
110
110
  region = resolveRegion(options, cwd);
111
111
  projectName = resolveProjectName(options, cwd);
112
- // Workspace-namespaced resources (BUG-90): --workspace (or the
112
+ // Workspace-namespaced resources: --workspace (or the
113
113
  // local .terraform/environment) targets a preview stack like
114
114
  // rollback and db do — exec into a preview must not land in
115
115
  // production. Explicit flags/env keep winning.
@@ -287,7 +287,7 @@ async function discoverOldManualSnapshots({ rdsClient, dbIdentifier, dbClusterId
287
287
  .map((id) => id.trim().toLowerCase());
288
288
  const patterns = dbIds
289
289
  .map((id) => new RegExp(`^${escapeRegExp(id)}-manual-\\d{8}-\\d{6}$`));
290
- // BUG-205: the gate's pre-deploy snapshots are per-commit, so without
290
+ // The gate's pre-deploy snapshots are per-commit, so without
291
291
  // a discovery rule they accumulate into the region snapshot quota.
292
292
  const predeployPatterns = dbIds
293
293
  .map((id) => new RegExp(`^${escapeRegExp(id)}-pre-deploy-[0-9a-f]{7,40}$`));
@@ -589,7 +589,7 @@ export async function deleteDiscoveredResources(clients, discovered) {
589
589
  try {
590
590
  summary[target.summary] = await target.remove(clients, discovered[target.field] || []);
591
591
  } catch (error) {
592
- // One target's API failure must not strand the rest (BUG-105):
592
+ // One target's API failure must not strand the rest:
593
593
  // record it, zero its count, and keep deleting.
594
594
  errors.push({ target: target.summary, error });
595
595
  summary[target.summary] = 0;
@@ -144,7 +144,7 @@ export function resolveDefaultBranch(targetDir, deployBranch, execSyncImpl = exe
144
144
  // Renders both CI roles' trust claims as HCL fragments from the resolved
145
145
  // repo trust: the deploy role binds to the effective deploy branch (the
146
146
  // same value rendered into the deploy trigger, so the two stay in sync),
147
- // the preview role binds to pull request events. BUG-209: scheduled drift
147
+ // the preview role binds to pull request events. Scheduled drift
148
148
  // runs on the default branch, so when it differs from the deploy branch
149
149
  // the deploy role trusts both refs. The open trust and hand-customized
150
150
  // claims render verbatim — never silently widened.
@@ -193,7 +193,7 @@ export function buildRoleArn(accountId, roleName) {
193
193
  // dual-format pair resolves back to its classic entry so re-init stays
194
194
  // stable; anything richer is described for warnings and guarded against
195
195
  // silent widening.
196
- // Recognizes our own canonical dual-branch trust (BUG-209): two classic
196
+ // Recognizes our own canonical dual-branch trust: two classic
197
197
  // branch refs for one slug plus each entry's immutable companion, in
198
198
  // render order. Returns { deploySub, branches } or null.
199
199
  function parseCanonicalDualTrust(entries) {
@@ -492,7 +492,7 @@ async function mainStackMain(input = {}) {
492
492
  target = targetAnswer;
493
493
  }
494
494
 
495
- // Capability-vs-target policy for --with (BUG-157): refuse fast when
495
+ // Capability-vs-target policy for --with: refuse fast when
496
496
  // the requested capability cannot render on this target (static has
497
497
  // no task role or VPC), before any prompt/AWS call/write. Interactive
498
498
  // multiselect offers only compatible targets' caps; this covers --with.
@@ -962,7 +962,7 @@ async function mainStackMain(input = {}) {
962
962
 
963
963
  // 7. Synthesize Templates
964
964
  s.message('Synthesizing Terraform templates...');
965
- // BUG-209: live origin/HEAD wins when it names a real branch; when
965
+ // Live origin/HEAD wins when it names a real branch; when
966
966
  // detection falls back, a re-init keeps the tree's own default branch
967
967
  // so dual trust never narrows silently.
968
968
  const treeDefaultBranch = oidcResolution.treeBranches?.[1] ?? null;
@@ -1025,7 +1025,7 @@ async function mainStackMain(input = {}) {
1025
1025
  if (migrationGateEnabled && migrationCmd) {
1026
1026
  const deployYmlPath = path.join(dirConfig.targetDir, '.github', 'workflows', 'deploy.yml');
1027
1027
  const workflowContent = readFileSafe(deployYmlPath);
1028
- // BUG-205: scope the gate's snapshot id to the database (aurora
1028
+ // Scope the gate's snapshot id to the database (aurora
1029
1029
  // takes the cluster prefix) so guardrails and gc can name it.
1030
1030
  const gateDbRefs = resolveDbEngineRefs(config.dbEngine);
1031
1031
  const gateDbIdentifier = `${dirConfig.actualProjectName}${resourceSuffix}-db${gateDbRefs.isCluster ? '-cluster' : ''}`;
@@ -1053,7 +1053,7 @@ async function mainStackMain(input = {}) {
1053
1053
 
1054
1054
  if (driftEnabled) {
1055
1055
  // drift.yml rides the manifest + backup like deploy.yml now
1056
- // (BUG-158): re-init backs the old file up and regenerates fresh
1056
+ // Re-init backs the old file up and regenerates fresh
1057
1057
  // (current role ARN) instead of silently keeping a stale copy.
1058
1058
  // Hand edits trip refuse-dirty before this point; --force regenerates.
1059
1059
  const drifted = scaffoldDriftWorkflow(dirConfig.targetDir, {
@@ -1235,7 +1235,7 @@ async function mainStackMain(input = {}) {
1235
1235
  console.log(color.dim(' 💡 Vector-search dependencies detected: managed pgvector support is coming soon.'));
1236
1236
  }
1237
1237
  // Static targets refuse `add cron` (no compute) — don't send
1238
- // static users down a dead end (BUG-157).
1238
+ // static users down a dead end.
1239
1239
  if (upcoming.cron && target !== 'static') {
1240
1240
  console.log(color.dim(' 💡 Scheduled-task dependencies detected: scaffold a schedule with "grada add cron".'));
1241
1241
  }
@@ -117,7 +117,7 @@ function eventKey(event) {
117
117
 
118
118
  // Fetches the most recent matching events from a log group.
119
119
  // FilterLogEvents pages oldest-first, so slicing the first page shows the
120
- // OLDEST N on groups larger than one page (BUG-87). This probes with a
120
+ // OLDEST N on groups larger than one page. This probes with a
121
121
  // small page (cheap when the group fits), and only multi-page groups pay
122
122
  // for a wide-page scan to the live edge; a rolling window keeps memory
123
123
  // O(tail). Returns `{ events, nextToken }` — the trailing window plus the
@@ -195,7 +195,7 @@ async function runLogsMain(input = {}) {
195
195
  try {
196
196
  cwd = resolveCwd(options);
197
197
  region = resolveRegion(options, cwd);
198
- // Workspace-namespaced resources (BUG-90): --workspace (or the
198
+ // Workspace-namespaced resources: --workspace (or the
199
199
  // local .terraform/environment) targets a preview stack like
200
200
  // rollback and db do. Explicit flags/env keep winning.
201
201
  const namespacedOptions = withWorkspaceNamespace(options, cwd);
@@ -212,7 +212,7 @@ async function runLogsMain(input = {}) {
212
212
  const isLambda = isComputeTarget(cwd, 'lambda');
213
213
  const explicitService = hasExplicitService(options) && !isLambda;
214
214
 
215
- // Explicit garbage fails loud (BUG-107): silently substituting defaults
215
+ // Explicit garbage fails loud: silently substituting defaults
216
216
  // for a mistyped --tail/--since shows logs the user never asked for.
217
217
  // Absent flags still default via the normalizers below.
218
218
  const rawTail = options.tail ?? options.tailLines ?? options.lines;
@@ -178,7 +178,7 @@ async function runRollbackMain(input = {}) {
178
178
  let targetTaskDefArn;
179
179
  let targetRevisionNum;
180
180
  // Case A only: the requested web revision's image, for worker
181
- // pairing (BUG-153). Null in Case B and when undescribable.
181
+ // pairing. Null in Case B and when undescribable.
182
182
  let requestedWebImage = null;
183
183
 
184
184
  if (options.revision !== undefined && options.revision !== null && String(options.revision).trim() !== '') {
@@ -236,7 +236,7 @@ async function runRollbackMain(input = {}) {
236
236
  exitCode: 1,
237
237
  });
238
238
  }
239
- // BUG-127: a NEWER explicit revision would silently
239
+ // A NEWER explicit revision would silently
240
240
  // roll FORWARD — rollback only moves to older revisions.
241
241
  if (Number.isInteger(Number(targetRevisionNum)) && Number.isInteger(currentRevNum)
242
242
  && Number(targetRevisionNum) > currentRevNum) {
@@ -322,7 +322,7 @@ async function runRollbackMain(input = {}) {
322
322
  }
323
323
  }
324
324
 
325
- // 1b. Worker rollback (BUG-85): deploys advance web AND worker,
325
+ // 1b. Worker rollback: deploys advance web AND worker,
326
326
  // so a rollback must move both — otherwise the worker keeps the bad
327
327
  // image. Explicit --service keeps single-service semantics (the
328
328
  // escape hatch); workerless trees (no worker.tf) skip. Resolved
@@ -352,7 +352,7 @@ async function runRollbackMain(input = {}) {
352
352
  exitCode: 1,
353
353
  });
354
354
  }
355
- // BUG-153: in Case A the worker target pairs with the
355
+ // In Case A the worker target pairs with the
356
356
  // REQUESTED web image (deploys pin both to the same SHA) —
357
357
  // newest-previous regardless would skew the pairing. When
358
358
  // no eligible worker revision carries the web image, fall
@@ -64,7 +64,7 @@ function resolveSecretsFile(envFilePath) {
64
64
  }
65
65
 
66
66
  function resolveSecretsProject(projectName) {
67
- // BUG-162: the terraform project name (what provisioned the vault)
67
+ // The terraform project name (what provisioned the vault)
68
68
  // outranks the directory basename — a renamed directory otherwise
69
69
  // silently aims at a missing vault.
70
70
  if (typeof projectName === 'string' && projectName.trim()) return projectName.trim();
@@ -87,7 +87,7 @@ export async function resolveSecretsRegion(options = {}) {
87
87
  try {
88
88
  const backendTfPath = path.join(process.cwd(), 'terraform', 'backend.tf');
89
89
  const backendTfContent = await fs.readFile(backendTfPath, 'utf-8');
90
- // BUG-164: scan line-wise skipping comments — the old whole-file
90
+ // Scan line-wise skipping comments — the old whole-file
91
91
  // regex resolved commented-out regions (or legacy lines) as live.
92
92
  for (const rawLine of backendTfContent.split('\n')) {
93
93
  const line = rawLine.trim();
@@ -181,7 +181,7 @@ export async function getManagedEnvNames(cwd = process.cwd(), target = 'ecs') {
181
181
  }
182
182
  // NODE_ENV is injected only when the worker renders (the generator
183
183
  // scopes it to worker trees): on workerless trees it is a legitimate
184
- // custom key and must not auto-skip (BUG-95). Unreadable dirs keep
184
+ // custom key and must not auto-skip. Unreadable dirs keep
185
185
  // the base set above (fail-closed; the TF precondition backstops
186
186
  // real collisions there).
187
187
  if (!tfFiles.includes('worker.tf')) names.delete('NODE_ENV');
@@ -252,9 +252,9 @@ function vaultPayloadShape(parsed) {
252
252
  }
253
253
 
254
254
  // Validates a GetSecretValue response into the managed JSON object.
255
- // Refuses binary payloads (BUG-145: they read as "empty" and a push
255
+ // Refuses binary payloads (They read as "empty" and a push
256
256
  // would full-replace them away without the removal confirm) and
257
- // non-object/non-string payloads (BUG-159: phantom `0,1` removals,
257
+ // non-object/non-string payloads (Phantom `0,1` removals,
258
258
  // garbage pull keys, TypeError crashes). A response carrying neither
259
259
  // field means an empty/new vault — live AWS never returns that shape
260
260
  // for a valued secret.
@@ -289,7 +289,7 @@ function vaultPayloadObject(resp, secretId) {
289
289
  const ATTEMPTED_KEY_RE = /^\s*([^=:#\s][^=:]*?)\s*[=:]/;
290
290
 
291
291
  // Finds .env input lines dotenv silently dropped plus duplicate keys
292
- // (BUG-143). Multiline double-quoted values span lines — continuation
292
+ //. Multiline double-quoted values span lines — continuation
293
293
  // lines are value text, not dropped lines. Pure and unit-tested via
294
294
  // push output.
295
295
  function analyzeEnvLines(envContent, parsedSecrets) {
@@ -363,7 +363,7 @@ async function handleSecretsCatch({
363
363
  } else if (handleAuthErrorBranch(error, s, opts)) {
364
364
  return;
365
365
  }
366
- // BUG-161: failures after the vault write (keys file, ECS restart)
366
+ // Failures after the vault write (keys file, ECS restart)
367
367
  // must report the vault as updated with the recovery step — a bare
368
368
  // "Failed to push" lies about what succeeded.
369
369
  const postVaultHints = {
@@ -415,7 +415,7 @@ export async function pushSecrets(envFilePath, projectName, options = {}) {
415
415
  }
416
416
 
417
417
  async function pushSecretsMain(envFilePath, projectName, options = {}) {
418
- // BUG-144: push is read-modify-full-replace — serialize local
418
+ // Push is read-modify-full-replace — serialize local
419
419
  // concurrent pushes like every other mutating family (the re-read
420
420
  // before UpdateSecret below covers cross-machine second writers).
421
421
  return withProjectLock(process.cwd(), () => pushSecretsInner(envFilePath, projectName, options));
@@ -456,14 +456,14 @@ async function pushSecretsInner(envFilePath, projectName, options = {}) {
456
456
  resolvedFilePath = '.env';
457
457
  }
458
458
 
459
- // BUG-162: shared helper — the terraform project name outranks the
459
+ // Shared helper — the terraform project name outranks the
460
460
  // directory basename (a renamed directory must not aim at a phantom).
461
461
  const resolvedProjectName = resolveSecretsProject(explicitProjectName);
462
462
 
463
463
  const s = spinner();
464
464
  s.start(truncateSpinnerText(`Reading ${envFilePath} and pushing to AWS Secrets Manager...`));
465
465
 
466
- // BUG-161: write progress for the catch below — names the post-vault
466
+ // Write progress for the catch below — names the post-vault
467
467
  // follow-up step when one fails, so the report says the vault is
468
468
  // updated instead of misreporting a failed push.
469
469
  let postVaultStep = null;
@@ -518,7 +518,7 @@ async function pushSecretsInner(envFilePath, projectName, options = {}) {
518
518
 
519
519
  const parsedSecrets = dotenv.parse(envContent);
520
520
 
521
- // BUG-143: dotenv silently drops lines it cannot parse (and
521
+ // Dotenv silently drops lines it cannot parse (and
522
522
  // last-wins duplicates) — name them so the success count below
523
523
  // reconciles with the file. Runs before the empty early-return
524
524
  // so an all-dropped file explains itself.
@@ -540,7 +540,7 @@ async function pushSecretsInner(envFilePath, projectName, options = {}) {
540
540
  return;
541
541
  }
542
542
 
543
- // Pre-write guards (BUG-79/81): colliding keys are auto-skipped
543
+ // Pre-write guards: colliding keys are auto-skipped
544
544
  // on ECS — pushing them can only brick the deploy, so excluding
545
545
  // them with a loud notice beats refusing and demanding a hand
546
546
  // edit. Local-dev wiring values warn. Everything surfaces before
@@ -612,18 +612,18 @@ async function pushSecretsInner(envFilePath, projectName, options = {}) {
612
612
  }
613
613
  }
614
614
 
615
- // BUG-80: push is full-replace, so vault keys absent from .env are
615
+ // Push is full-replace, so vault keys absent from .env are
616
616
  // deleted by the update below. Name every victim before writing;
617
617
  // interactive runs confirm first, headless proceeds loudly.
618
618
  // Skipped keys are present in .env, so they never land here — their
619
619
  // exclusion from the vault write is covered by the skip notice
620
620
  // above, not by this confirm.
621
621
  const removed = (existingKeys ?? []).filter((key) => !Object.hasOwn(parsedSecrets, key));
622
- // BUG-89: skipped keys are present in .env (so they never land in
622
+ // Skipped keys are present in .env (so they never land in
623
623
  // `removed`) but excluded from the vault write — a stale vault
624
624
  // value for a skipped key is wiped by the full-replace update.
625
625
  // Name every such victim loudly. The skip notice above is the
626
- // acknowledgment, so unlike BUG-80 removals these never confirm.
626
+ // acknowledgment, so unlike true removals these never confirm.
627
627
  const staleSkipped = skipped.filter((key) => (existingKeys ?? []).includes(key));
628
628
  if (staleSkipped.length > 0) {
629
629
  console.log(color.yellow(`⚠️ ${staleSkipped.length} skipped ${staleSkipped.length === 1 ? 'key' : 'keys'} still ${staleSkipped.length === 1 ? 'has' : 'have'} a stale vault value that this push deletes (no longer pushed):`));
@@ -656,7 +656,7 @@ async function pushSecretsInner(envFilePath, projectName, options = {}) {
656
656
  s.start(truncateSpinnerText(`Reading ${envFilePath} and pushing to AWS Secrets Manager...`));
657
657
  }
658
658
 
659
- // BUG-144: the confirm above can wait unboundedly — re-read the
659
+ // The confirm above can wait unboundedly — re-read the
660
660
  // vault immediately before the full-replace write and abort when
661
661
  // a second writer moved the payload since the first read.
662
662
  let rereadSecretString = null;
@@ -690,7 +690,7 @@ async function pushSecretsInner(envFilePath, projectName, options = {}) {
690
690
  const keys = Object.keys(pushableSecrets);
691
691
  const keysFilePath = path.join(process.cwd(), 'terraform', 'secret_keys.json');
692
692
 
693
- // BUG-160: skip the write when the file is already byte-identical
693
+ // Skip the write when the file is already byte-identical
694
694
  // so unchanged pushes don't dirty `git status`.
695
695
  const nextKeysContent = JSON.stringify(keys, null, 2);
696
696
  let keysUnchanged = false;
@@ -1041,7 +1041,7 @@ async function auditSecretsMain(envFilePath, projectName, options = {}) {
1041
1041
  }
1042
1042
  }
1043
1043
 
1044
- // BUG-79: flag both limbs — keys colliding with Grada-managed
1044
+ // Flag both limbs — keys colliding with Grada-managed
1045
1045
  // environment names (fatal on ECS, shadowing on Lambda) and
1046
1046
  // wiring-like values that look like local-dev placeholders.
1047
1047
  const auditTarget = readTerraformComputeTarget(process.cwd());
@@ -453,7 +453,7 @@ async function runStatusMain(input = {}) {
453
453
  return runStaticStatus({ ...options, cwd, region, projectName });
454
454
  }
455
455
  const resourceSuffix = readResourceSuffix(cwd);
456
- // Workspace-namespaced resources (BUG-90): --workspace (or the local
456
+ // Workspace-namespaced resources: --workspace (or the local
457
457
  // .terraform/environment) targets a preview stack like rollback and db
458
458
  // do. Explicit flags/env keep winning; telemetry keeps the raw name.
459
459
  const namespacedProject = resolveNamespacedProject(projectName, options, cwd);
@@ -502,9 +502,9 @@ async function runStatusMain(input = {}) {
502
502
  return;
503
503
  }
504
504
 
505
- // Namespaced stem (BUG-151): the raw project prefix merged prod
505
+ // Namespaced stem: the raw project prefix merged prod
506
506
  // + preview alarms into one verdict and could auto-diagnose the
507
- // wrong cluster. Paired with workspace-aware alarm names (BUG-132).
507
+ // wrong cluster. Paired with workspace-aware alarm names.
508
508
  const alarmsResp = await cloudWatchClient.send(new DescribeAlarmsCommand({ AlarmNamePrefix: `${namespacedProject}${resourceSuffix}`, MaxRecords: 100 }));
509
509
  const rawAlarms = [...(alarmsResp.MetricAlarms || []), ...(alarmsResp.CompositeAlarms || [])];
510
510
 
@@ -221,7 +221,7 @@ async function runWakeMain(input = {}) {
221
221
  // both must reach the main flow, never the already-awake
222
222
  // skip. Every other status (available, starting, …) is
223
223
  // started or self-resolving, so there is nothing for wake
224
- // to do (BUG-152).
224
+ // to do.
225
225
  const dbAwake = !foundDb || (foundDb.status !== 'stopped' && foundDb.status !== 'stopping');
226
226
  if (servicesAwake && dbAwake) {
227
227
  return reportSleepWakeSkip({
@@ -258,7 +258,7 @@ async function runWakeMain(input = {}) {
258
258
  // A transitional database (stopping/starting/…) can neither
259
259
  // start nor serve: settle first (mirroring destroy), then
260
260
  // start when it lands on `stopped`. Never restore ECS +
261
- // report success over an unsettled database (BUG-152).
261
+ // report success over an unsettled database.
262
262
  if (dbTarget && dbTarget.status !== 'stopped' && dbTarget.status !== 'available') {
263
263
  const transitional = dbTarget.status;
264
264
  const isCluster = dbTarget.kind === 'cluster';
@@ -83,7 +83,7 @@ export const ADDON_REGISTRY = {
83
83
  export const ADDON_TARGET_POLICY = {
84
84
  // Static trees have no task role or VPC: every one of these renders
85
85
  // a dangling aws_iam_role.task_role / aws_vpc reference on static
86
- // (BUG-157) — refuse fast instead of emitting unplannable TF.
86
+ // Refuse fast instead of emitting unplannable TF.
87
87
  'storage:s3': { ecs: 'allow', lambda: 'allow', static: 'refuse' },
88
88
  'db:dynamodb': { ecs: 'allow', lambda: 'allow', static: 'refuse' },
89
89
  'db:redis': { ecs: 'allow', lambda: 'allow', static: 'refuse' },
@@ -32,7 +32,7 @@ function collectManifestFiles(targetDir) {
32
32
  // Preview/teardown/drift carry project names + role ARNs and invite
33
33
  // hand edits like deploy.yml — manifest them so re-init refuses
34
34
  // dirty trees and backs them up instead of silently overwriting or
35
- // leaving them stale (BUG-158).
35
+ // leaving them stale.
36
36
  for (const rel of ['Dockerfile', 'preview.yml', 'teardown.yml', 'drift.yml', 'plan.yml'].map((name) => (
37
37
  name === 'Dockerfile' ? name : path.join('.github', 'workflows', name)
38
38
  ))) {
@@ -311,7 +311,7 @@ export async function runEphemeralEcsTask({
311
311
  // Sniffs the URL scheme from discrete credentials. Explicit values win;
312
312
  // when DB_ENGINE/DB_PORT are secrets-sourced (valueFrom, values unknown
313
313
  // to the CLI) the reference text is sniffed for engine/port hints
314
- // instead (BUG-171). Indeterminate stays postgresql (back-compat).
314
+ // instead. Indeterminate stays postgresql (back-compat).
315
315
  function sniffRunnerScheme(entries, values) {
316
316
  const engine = values.get('DB_ENGINE');
317
317
  if (typeof engine === 'string' && engine !== '') {
@@ -326,7 +326,7 @@ function sniffRunnerScheme(entries, values) {
326
326
  return 'postgresql';
327
327
  }
328
328
 
329
- // Runtime userinfo encoder for the synthesized URL (BUG-139): node sees
329
+ // Runtime userinfo encoder for the synthesized URL: node sees
330
330
  // only shell references, never the values, so the encoding ladder ships
331
331
  // inside the script — node (encodeURIComponent) → sed (the URL-breaking
332
332
  // subset: %, ?, #, @, :, /) → warned raw. Quoting alone cannot save a
@@ -510,7 +510,7 @@ export async function reportRunnerOutcome({
510
510
  if (exitCode === 0) {
511
511
  // Owner pairs its own start/stop: the runner usually stops
512
512
  // first (idempotent no-op then), but success must never
513
- // depend on a callee for the spinner lifecycle (BUG-202).
513
+ // depend on a callee for the spinner lifecycle.
514
514
  try { s.stop(color.green(`${label} succeeded.`)); } catch { /* already stopped */ }
515
515
  console.log(color.green(`\n✅ ${label} succeeded.`));
516
516
  await trackSuccess(event, { ...telemetry });
@@ -17,7 +17,7 @@ const __dirname = path.dirname(__filename);
17
17
  // name stays a writable candidate so pre-rebrand docs keep updating.
18
18
  export const MANAGED_DOC_FALLBACK = 'GRADA.md';
19
19
  export const LEGACY_MANAGED_DOC_FALLBACK = 'DEPLOY-STACK.md';
20
- // Greppable, boot-failing Rails master-key seed (BUG-146): Rails cannot
20
+ // Greppable, boot-failing Rails master-key seed: Rails cannot
21
21
  // boot on it, so a tree that never pushes the real key fails closed.
22
22
  export const RAILS_MASTER_KEY_PLACEHOLDER = 'REPLACE_ME_PUSH_REAL_RAILS_MASTER_KEY';
23
23
 
@@ -505,7 +505,7 @@ export async function generateTemplates(targetDir, config) {
505
505
  // Build the initial HCL map for AWS Secrets Manager
506
506
  let initialSecretMap = `{\n EXAMPLE_API_KEY = "replace_me_in_aws_console"`;
507
507
 
508
- // 4.1. Seed a placeholder for the Rails master key (BUG-146): the
508
+ // 4.1. Seed a placeholder for the Rails master key: the
509
509
  // live key must never render into committed .tf (or linger in
510
510
  // state), and no constant dummy may boot prod. The placeholder is
511
511
  // greppable and boot-failing; the loud instruction tells the
@@ -587,7 +587,7 @@ resource "aws_lb_listener_rule" "vercel_redirect_${index}" {
587
587
 
588
588
  // Inject variables. Replacement FUNCTION (not string): `$&`/`$'`/
589
589
  // `$$` in values (Procfile commands, compose env vars) must land
590
- // byte-identical, not interpolate match text (BUG-156).
590
+ // byte-identical, not interpolate match text.
591
591
  for (const [key, value] of Object.entries(config)) {
592
592
  const literal = String(value ?? '');
593
593
  content = content.replace(new RegExp(`{{${key}}}`, 'g'), () => literal);
@@ -90,7 +90,7 @@ export async function getProjectConfig(isHeadless, headlessOptions, targetDir, d
90
90
  const skipsContainerSizing = hints && typeof hints === 'object'
91
91
  && (hints.target === 'lambda' || hints.target === 'static');
92
92
  if (isHeadless) {
93
- // BUG-211: an undetectable framework with a package.json present is
93
+ // An undetectable framework with a package.json present is
94
94
  // a plain-Node project, not a static site — defaulting to 'static'
95
95
  // renders an nginx Dockerfile that can neither build scriptless
96
96
  // projects nor run node payloads. No package.json keeps 'static'.
@@ -46,17 +46,15 @@ export function readTerraformComputeTarget(cwd = process.cwd()) {
46
46
  }
47
47
 
48
48
  // Offline database-kind detection for `--setup-ci` (no AWS calls): the
49
- // generator copies exactly one database template, so the aurora file's
50
- // presence means cluster snapshots. Unknown/absent means instance — the
51
- // runtime backup resolves the live kind anyway; the id prefix only
52
- // name-scopes the snapshot for guardrails + gc.
49
+ // generator and `add` always render to database.tf regardless of engine,
50
+ // so the kind comes from the rendered content — an aurora tree declares
51
+ // an rds cluster. Unknown/absent means instance — the runtime backup
52
+ // resolves the live kind anyway; the id prefix only name-scopes the
53
+ // snapshot for guardrails + gc.
53
54
  export function readTerraformDbKind(cwd = process.cwd()) {
54
55
  const base = resolveCwd({}, cwd);
55
- try {
56
- if (fsSync.existsSync(path.join(base, 'terraform', 'database-aurora-postgresql.tf'))) return 'cluster';
57
- } catch {
58
- // Fall through to the instance default
59
- }
56
+ const databaseTf = readFileSafe(path.join(base, 'terraform', 'database.tf'));
57
+ if (typeof databaseTf === 'string' && databaseTf.includes('resource "aws_rds_cluster"')) return 'cluster';
60
58
  return 'instance';
61
59
  }
62
60
 
@@ -210,7 +208,7 @@ function scanBracketBlock(content, openIdx) {
210
208
  // reference, so it never matches; the shape filter drops resource names
211
209
  // (`${...}`, hyphens, paths). Sorted, deduplicated, [] when unreadable.
212
210
  //
213
- // Scoped to secret-receiving containers (BUG-93): ECS collides secrets
211
+ // Scoped to secret-receiving containers: ECS collides secrets
214
212
  // with environment per container definition, so sidecar `environment`
215
213
  // arrays (whose containers get no secrets) must not contribute names —
216
214
  // parsing them would falsely render same-named secrets undeployable.
@@ -218,7 +218,7 @@ export function runTerraformCommand(args, cwd, spin, loadingPrefix, options = {}
218
218
  if (timer && typeof timer.unref === 'function') timer.unref();
219
219
  }
220
220
 
221
- // BUG-213: pipe chunks split lines at arbitrary byte offsets, so
221
+ // Pipe chunks split lines at arbitrary byte offsets, so
222
222
  // each chunk's trailing fragment is carried over and only
223
223
  // newline-terminated lines are delivered. Splitting per chunk
224
224
  // injects newlines into giant single-line JSON (show -json),
@@ -64,7 +64,7 @@ jobs:
64
64
  aws-region: ${{ env.AWS_REGION }}
65
65
 
66
66
  # Deploy never skips: a failed assume fails the run with the
67
- # bootstrap pointer (BUG-138).
67
+ # bootstrap pointer.
68
68
  - name: Interpret credential failure
69
69
  if: steps.aws-creds.outcome == 'failure'
70
70
  run: |
@@ -179,7 +179,7 @@ jobs:
179
179
 
180
180
  # A cancelled apply/destroy can strand the S3 state lockfile: point
181
181
  # at recovery instead of leaving the next run to fail obscurely
182
- # (BUG-194). Generic by necessity — the lock ID only exists in the
182
+ #. Generic by necessity — the lock ID only exists in the
183
183
  # follow-up run's own error.
184
184
  - name: Cancellation recovery note
185
185
  if: cancelled()
@@ -64,7 +64,7 @@ jobs:
64
64
  aws-region: ${{ env.AWS_REGION }}
65
65
 
66
66
  # Deploy never skips: a failed assume fails the run with the
67
- # bootstrap pointer (BUG-201).
67
+ # bootstrap pointer.
68
68
  - name: Interpret credential failure
69
69
  if: steps.aws-creds.outcome == 'failure'
70
70
  run: |
@@ -68,7 +68,7 @@ jobs:
68
68
  aws-region: ${{ env.AWS_REGION }}
69
69
 
70
70
  # Deploy never skips: a failed assume fails the run with the
71
- # bootstrap pointer (BUG-138).
71
+ # bootstrap pointer.
72
72
  - name: Interpret credential failure
73
73
  if: steps.aws-creds.outcome == 'failure'
74
74
  run: |
@@ -272,7 +272,7 @@ jobs:
272
272
 
273
273
  # A cancelled apply/destroy can strand the S3 state lockfile: point
274
274
  # at recovery instead of leaving the next run to fail obscurely
275
- # (BUG-194). Generic by necessity — the lock ID only exists in the
275
+ #. Generic by necessity — the lock ID only exists in the
276
276
  # follow-up run's own error.
277
277
  - name: Cancellation recovery note
278
278
  if: cancelled()
@@ -34,7 +34,7 @@ jobs:
34
34
  # STS denies a missing role and a trust mismatch with the same
35
35
  # message, so the API won't support distinguishing them: every
36
36
  # assume failure skips loud (green) with both cases + pointers
37
- # named (BUG-199).
37
+ # named.
38
38
  - name: Interpret credential failure
39
39
  if: steps.aws-creds.outcome == 'failure'
40
40
  run: |
@@ -3,7 +3,7 @@ name: Terraform Plan on PR
3
3
  on:
4
4
  # pull_request_target (not pull_request): this file comes from the base
5
5
  # branch, so a fork PR cannot delete the same-repo guard below to reach
6
- # the privileged CI roles (BUG-140). The PR head is checked out explicitly by
6
+ # the privileged CI roles. The PR head is checked out explicitly by
7
7
  # SHA in the guarded step instead.
8
8
  pull_request_target:
9
9
  types: [opened, synchronize, reopened]
@@ -53,7 +53,7 @@ jobs:
53
53
  aws-region: ${{ env.AWS_REGION }}
54
54
 
55
55
  # Plan-on-PR is a merge signal: a failed assume fails the run with
56
- # the bootstrap pointer (deploy shape, BUG-138) — never green-silent.
56
+ # the bootstrap pointer (deploy shape) — never green-silent.
57
57
  - name: Interpret credential failure
58
58
  if: steps.aws-creds.outcome == 'failure'
59
59
  run: |
@@ -3,7 +3,7 @@ name: Ephemeral PR Preview
3
3
  on:
4
4
  # pull_request_target (not pull_request): this file comes from the base
5
5
  # branch, so a fork PR cannot delete the same-repo guard below to reach
6
- # the privileged CI roles (BUG-140). The PR head is checked out explicitly by
6
+ # the privileged CI roles. The PR head is checked out explicitly by
7
7
  # SHA in the guarded step instead.
8
8
  pull_request_target:
9
9
  types: [opened, synchronize, reopened]
@@ -58,7 +58,7 @@ jobs:
58
58
  # STS denies a missing role and a trust mismatch with the same
59
59
  # message, so the API won't support distinguishing them: every
60
60
  # assume failure skips loud (green) with both cases + pointers
61
- # named (BUG-199).
61
+ # named.
62
62
  - name: Interpret credential failure
63
63
  if: steps.aws-creds.outcome == 'failure'
64
64
  run: |
@@ -137,7 +137,7 @@ jobs:
137
137
 
138
138
  # One sticky comment per PR (updated in place), never a new
139
139
  # comment per push — and a failed run overwrites the green URL
140
- # instead of leaving it standing as truth (BUG-190).
140
+ # instead of leaving it standing as truth.
141
141
  - name: Comment PR
142
142
  if: steps.aws-creds.outcome == 'success'
143
143
  uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
@@ -199,7 +199,7 @@ jobs:
199
199
 
200
200
  # A cancelled apply can strand the S3 state lockfile: point at
201
201
  # recovery instead of leaving the next run to fail obscurely
202
- # (BUG-194). Generic by necessity — the lock ID only exists in the
202
+ #. Generic by necessity — the lock ID only exists in the
203
203
  # follow-up run's own error.
204
204
  - name: Cancellation recovery note
205
205
  if: cancelled()
@@ -3,7 +3,7 @@ name: Ephemeral PR Preview
3
3
  on:
4
4
  # pull_request_target (not pull_request): this file comes from the base
5
5
  # branch, so a fork PR cannot delete the same-repo guard below to reach
6
- # the privileged CI roles (BUG-140). The PR head is checked out explicitly by
6
+ # the privileged CI roles. The PR head is checked out explicitly by
7
7
  # SHA in the guarded step instead.
8
8
  pull_request_target:
9
9
  types: [opened, synchronize, reopened]
@@ -58,7 +58,7 @@ jobs:
58
58
  # STS denies a missing role and a trust mismatch with the same
59
59
  # message, so the API won't support distinguishing them: every
60
60
  # assume failure skips loud (green) with both cases + pointers
61
- # named (BUG-199).
61
+ # named.
62
62
  - name: Interpret credential failure
63
63
  if: steps.aws-creds.outcome == 'failure'
64
64
  run: |
@@ -119,7 +119,7 @@ jobs:
119
119
 
120
120
  # One sticky comment per PR (updated in place), never a new
121
121
  # comment per push — and a failed run overwrites the green URL
122
- # instead of leaving it standing as truth (BUG-190).
122
+ # instead of leaving it standing as truth.
123
123
  - name: Comment PR
124
124
  if: steps.aws-creds.outcome == 'success'
125
125
  uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
@@ -183,7 +183,7 @@ jobs:
183
183
 
184
184
  # A cancelled apply can strand the S3 state lockfile: point at
185
185
  # recovery instead of leaving the next run to fail obscurely
186
- # (BUG-194). Generic by necessity — the lock ID only exists in the
186
+ #. Generic by necessity — the lock ID only exists in the
187
187
  # follow-up run's own error.
188
188
  - name: Cancellation recovery note
189
189
  if: cancelled()
@@ -3,7 +3,7 @@ name: Destroy PR Preview
3
3
  on:
4
4
  # pull_request_target (not pull_request): this file comes from the base
5
5
  # branch, so a fork PR cannot smuggle privileged steps into its own
6
- # teardown run (BUG-140). The PR head is checked out explicitly by SHA
6
+ # teardown run. The PR head is checked out explicitly by SHA
7
7
  # in the guarded step instead.
8
8
  pull_request_target:
9
9
  types: [closed]
@@ -52,7 +52,7 @@ jobs:
52
52
  # STS denies a missing role and a trust mismatch with the same
53
53
  # message, so the API won't support distinguishing them: every
54
54
  # assume failure skips loud (green) with both cases + pointers
55
- # named (BUG-199).
55
+ # named.
56
56
  - name: Interpret credential failure
57
57
  if: steps.aws-creds.outcome == 'failure'
58
58
  run: |
@@ -109,7 +109,7 @@ jobs:
109
109
 
110
110
  # A cancelled destroy can strand the S3 state lockfile: point at
111
111
  # recovery instead of leaving the next run to fail obscurely
112
- # (BUG-194). Generic by necessity — the lock ID only exists in the
112
+ #. Generic by necessity — the lock ID only exists in the
113
113
  # follow-up run's own error.
114
114
  - name: Cancellation recovery note
115
115
  if: cancelled()
@@ -7,7 +7,7 @@
7
7
  # chosen model in the AWS Bedrock console first.
8
8
 
9
9
  # --- Least-Privilege IAM Policy for the ECS Task Role ---
10
- # Scoped to the chosen model in the deploy region (BUG-102): the
10
+ # Scoped to the chosen model in the deploy region: the
11
11
  # foundation-model ARN names the model exactly, and the
12
12
  # inference-profile line stays (profile-style model IDs invoke through
13
13
  # profiles) but pinned to the region.
@@ -10,7 +10,7 @@ terraform {
10
10
  source = "hashicorp/tls"
11
11
  version = "~> 4.0"
12
12
  }
13
- # Declared unconditionally (BUG-137): the conditional injection left
13
+ # Declared unconditionally: the conditional injection left
14
14
  # pre-existing trees without the pin when the DB arrived via
15
15
  # `add database`. Unused on DB-less trees; init installs it anyway.
16
16
  random = {
@@ -2,7 +2,7 @@
2
2
  # is wrong for an app server — one slot per path gets shared by HTML docs,
3
3
  # API/RSC variants, redirects, and errors, so a cacheable variant poisons
4
4
  # every other viewer of that path. Each traffic class below gets its own
5
- # key instead (BUG-82).
5
+ # key instead.
6
6
  data "aws_cloudfront_cache_policy" "disabled" {
7
7
  name = "Managed-CachingDisabled"
8
8
  }
@@ -63,7 +63,7 @@ data "aws_cloudfront_origin_request_policy" "all_viewer" {
63
63
  }
64
64
 
65
65
  # Managed security headers (HSTS, frame/clickjacking guards, content-type
66
- # sniffing) on every behavior (BUG-92).
66
+ # sniffing) on every behavior.
67
67
  data "aws_cloudfront_response_headers_policy" "security" {
68
68
  name = "Managed-SecurityHeadersPolicy"
69
69
  }
@@ -2,7 +2,7 @@
2
2
  # is wrong for an app server — one slot per path gets shared by HTML docs,
3
3
  # API/RSC variants, redirects, and errors, so a cacheable variant poisons
4
4
  # every other viewer of that path. Each traffic class below gets its own
5
- # key instead (BUG-82).
5
+ # key instead.
6
6
  data "aws_cloudfront_cache_policy" "disabled" {
7
7
  name = "Managed-CachingDisabled"
8
8
  }
@@ -63,7 +63,7 @@ data "aws_cloudfront_origin_request_policy" "all_viewer" {
63
63
  }
64
64
 
65
65
  # Managed security headers (HSTS, frame/clickjacking guards, content-type
66
- # sniffing) on every behavior (BUG-92).
66
+ # sniffing) on every behavior.
67
67
  data "aws_cloudfront_response_headers_policy" "security" {
68
68
  name = "Managed-SecurityHeadersPolicy"
69
69
  }
@@ -81,7 +81,7 @@ resource "aws_cloudfront_distribution" "cdn" {
81
81
  domain_name = aws_lb.main.dns_name
82
82
  origin_id = "ALBOrigin"
83
83
 
84
- # Origin secret (BUG-91): proves to the ALB that the request came
84
+ # Origin secret: proves to the ALB that the request came
85
85
  # through THIS distribution — any other tenant's distro, or a direct
86
86
  # ALB hit, lacks the header and gets a 403 from the listener rule.
87
87
  custom_header {
@@ -41,7 +41,7 @@ resource "aws_rds_cluster" "postgres" {
41
41
  storage_encrypted = true
42
42
 
43
43
  # Match the instance engines: 7-day retention with explicit off-peak
44
- # UTC windows instead of AWS-assigned ones (BUG-203).
44
+ # UTC windows instead of AWS-assigned ones.
45
45
  backup_retention_period = 7
46
46
  preferred_backup_window = "03:00-04:00"
47
47
  preferred_maintenance_window = "sun:04:00-sun:05:00"
@@ -30,7 +30,7 @@ locals {
30
30
  # Safely read the keys generated by the CLI, default to empty list if file doesn't exist.
31
31
  # distinct() collapses hand-duplicated entries (duplicates render the
32
32
  # same RegisterTaskDefinition 400 as a name collision) while preserving
33
- # file order, so upgrading trees get no task-definition churn (BUG-81).
33
+ # file order, so upgrading trees get no task-definition churn.
34
34
  secret_keys = fileexists("${path.module}/secret_keys.json") ? distinct(jsondecode(file("${path.module}/secret_keys.json"))) : []
35
35
 
36
36
  # Exact container env + static-secret names (union over app and worker
@@ -230,7 +230,7 @@ resource "aws_lb_target_group" "app" {
230
230
  }
231
231
  }
232
232
 
233
- # Origin secret (BUG-91): only requests bearing the header CloudFront
233
+ # Origin secret: only requests bearing the header CloudFront
234
234
  # injects may reach the app. The CloudFront edge-IP security group alone
235
235
  # cannot prove WHICH distribution sent a request — any tenant's distro
236
236
  # could point at this ALB — so the listener forwards solely on a header
@@ -348,7 +348,7 @@ output "ecs_task_role_arn" {
348
348
  # State-only alarm: visible in the console, notifies nobody. There is no
349
349
  # notification destination at scaffold time; `grada alerts` provisions
350
350
  # separate alarms wired to SNS, and this one stays as a console signal so
351
- # quiet trees still show red (BUG-101).
351
+ # quiet trees still show red.
352
352
  resource "aws_cloudwatch_metric_alarm" "alb_5xx_errors" {
353
353
  alarm_name = "${local.app_name}-high-5xx-errors"
354
354
  comparison_operator = "GreaterThanThreshold"
@@ -80,7 +80,7 @@ locals {
80
80
  guardrail_snapshot_deletion_resources = [
81
81
  "arn:aws:rds:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:snapshot:${local.prod_prefix}-db-*",
82
82
  "arn:aws:rds:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:cluster-snapshot:${local.prod_prefix}-db-cluster-*",
83
- # BUG-205: legacy bare pre-deploy-<sha> ids carry no db prefix, so
83
+ # Legacy bare pre-deploy-<sha> ids carry no db prefix, so
84
84
  # they match no prod pattern above — deny them outright. gc never
85
85
  # runs under preview credentials, so nothing legitimate needs them.
86
86
  "arn:aws:rds:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:snapshot:pre-deploy-*",
@@ -255,7 +255,7 @@ resource "aws_iam_role_policy" "preview_guardrails" {
255
255
  Resource = "*"
256
256
  },
257
257
  {
258
- # BUG-207: the preview role carries IAMFullAccess, so without this
258
+ # The preview role carries IAMFullAccess, so without this
259
259
  # statement it can delete its own guardrails, delete the deploy
260
260
  # role, or widen trust in one call. Scoped to the CI role ARNs
261
261
  # (not *): preview stacks legitimately manage their own
@@ -325,7 +325,7 @@ resource "aws_iam_role_policy" "preview_guardrails" {
325
325
  Resource = local.guardrail_table_deletion_resources
326
326
  },
327
327
  {
328
- # BUG-208: manual snapshots (grada names them
328
+ # Manual snapshots (grada names them
329
329
  # <db-identifier>-manual-<stamp> and
330
330
  # <db-identifier>-pre-deploy-<sha>) are directly deletable;
331
331
  # automated snapshots can only go away via retention changes or
@@ -353,7 +353,7 @@ resource "aws_iam_role_policy" "preview_guardrails" {
353
353
  Resource = local.guardrail_log_deletion_resources
354
354
  },
355
355
  {
356
- # BUG-212: every role preview credentials create must carry the
356
+ # Every role preview credentials create must carry the
357
357
  # boundary — a missing key fails StringNotEquals, so unbounded
358
358
  # creation is denied and born-capped roles cannot escalate.
359
359
  Sid = "DenyRoleWithoutBoundary"
@@ -387,7 +387,7 @@ resource "aws_iam_role_policy" "preview_guardrails" {
387
387
  ]
388
388
  },
389
389
  {
390
- # BUG-215: close by target — deny the execution APIs on prod
390
+ # Close by target — deny the execution APIs on prod
391
391
  # ARNs while pr-* stays allowed. No describes: plan.yml
392
392
  # refreshes prod state with preview credentials, so describing
393
393
  # prod is legitimate traffic.
@@ -395,6 +395,15 @@ resource "aws_iam_role_policy" "preview_guardrails" {
395
395
  Effect = "Deny"
396
396
  Action = ["ecs:RunTask", "ecs:StopTask", "ecs:ExecuteCommand", "ecs:CreateService"]
397
397
  Resource = local.guardrail_task_execution_resources
398
+ # The bounded scheduler role must RunTask its task
399
+ # definition at trigger time. A no-op on this side (the preview
400
+ # role is never the scheduler, assumable only by the scheduler
401
+ # service) but kept so the twins stay identical.
402
+ Condition = {
403
+ StringNotEquals = {
404
+ "aws:PrincipalArn" = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/${local.prod_prefix}-cron-scheduler-role"
405
+ }
406
+ }
398
407
  },
399
408
  {
400
409
  # RegisterTaskDefinition is likely resource-*-only (void half);
@@ -425,7 +434,7 @@ resource "aws_iam_role_policy" "preview_guardrails" {
425
434
  })
426
435
  }
427
436
 
428
- # BUG-212: permissions boundary capping every role preview credentials
437
+ # Permissions boundary capping every role preview credentials
429
438
  # can create. The guardrail above denies CreateRole unless the request
430
439
  # carries this boundary, so a backdoor role is born capped: its
431
440
  # effective permissions are its own policies intersected with this one.
@@ -447,7 +456,7 @@ resource "aws_iam_policy" "preview_boundary" {
447
456
  Resource = "*"
448
457
  },
449
458
  {
450
- # BUG-214: capped roles must pass their task roles to ECS (the
459
+ # Capped roles must pass their task roles to ECS (the
451
460
  # scheduler role passes at invocation time), so PassRole is
452
461
  # carved out here and re-gated on service + target below.
453
462
  # Explicit Action list on purpose: a Deny with NotAction would
@@ -550,6 +559,14 @@ resource "aws_iam_policy" "preview_boundary" {
550
559
  Effect = "Deny"
551
560
  Action = ["ecs:RunTask", "ecs:StopTask", "ecs:ExecuteCommand", "ecs:CreateService"]
552
561
  Resource = local.guardrail_task_execution_resources
562
+ # The bounded scheduler role must RunTask its task
563
+ # definition at trigger time; every other capped caller stays
564
+ # denied. Mirrors the twin's condition above.
565
+ Condition = {
566
+ StringNotEquals = {
567
+ "aws:PrincipalArn" = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/${local.prod_prefix}-cron-scheduler-role"
568
+ }
569
+ }
553
570
  },
554
571
  {
555
572
  Sid = "BoundaryDenyTaskDefinitionRegistration"
@@ -557,12 +574,10 @@ resource "aws_iam_policy" "preview_boundary" {
557
574
  Action = ["ecs:RegisterTaskDefinition", "ecs:DeregisterTaskDefinition"]
558
575
  Resource = local.guardrail_task_definition_resources
559
576
  },
560
- {
561
- Sid = "BoundaryDenyPassRole"
562
- Effect = "Deny"
563
- Action = ["iam:PassRole"]
564
- Resource = local.guardrail_app_role_resources
565
- },
577
+ # No flat BoundaryDenyPassRole twin: it denied the scheduler's
578
+ # own PassRole unconditionally, defeating the OffScheduler
579
+ # carve-out (any Deny wins). The OffService/OffTarget/
580
+ # OffScheduler trio below gates PassRole alone.
566
581
  {
567
582
  Sid = "BoundaryDenyAppRoleMutation"
568
583
  Effect = "Deny"
@@ -570,7 +585,7 @@ resource "aws_iam_policy" "preview_boundary" {
570
585
  Resource = local.guardrail_app_role_resources
571
586
  },
572
587
  {
573
- # BUG-214: carved PassRole may only pass to the ECS tasks
588
+ # Carved PassRole may only pass to the ECS tasks
574
589
  # service (mirrors the scheduler policy's own condition).
575
590
  Sid = "BoundaryDenyPassRoleOffService"
576
591
  Effect = "Deny"
@@ -5,7 +5,7 @@ resource "aws_secretsmanager_secret" "app_secrets" {
5
5
  count = terraform.workspace == "default" ? 1 : 0
6
6
  name = "{{PROJECT_NAME}}{{RESOURCE_SUFFIX}}-secrets"
7
7
  description = "Environment variables for {{PROJECT_NAME}}"
8
- # 30-day recovery (BUG-163): an instant-delete vault turns any destroy
8
+ # 30-day recovery: an instant-delete vault turns any destroy
9
9
  # bug into unrecoverable secret loss. Lower per-tree if you must.
10
10
  recovery_window_in_days = 30
11
11
  }