Skip to content

promote: foundation batch and platform gates - #20

Merged
BeforeLights merged 93 commits into
mainfrom
dev
Aug 2, 2026
Merged

promote: foundation batch and platform gates#20
BeforeLights merged 93 commits into
mainfrom
dev

Conversation

@BeforeLights

@BeforeLights BeforeLights commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Promotion summary

Promote the reviewed dev integration branch to main after feature PR #19 merged successfully.

This promotion contains the complete currently merged foundation baseline, including:

  • DataBreeze monorepo shells and shared contracts/design system/brand preservation.
  • IAM, audit, entitlements, artifacts, datasets, jobs, approvals, device/sync, and offline foundations already merged to dev.
  • The 73-commit foundation batch from PR feat: harden foundation local infrastructure and delivery gates #19: safe local infrastructure lifecycle and persistence tooling, AWS hardening, content-safe telemetry, CI/supply-chain gates, and evidence/runbook updates.

Promotion gates

  • Feature PR feat: harden foundation local infrastructure and delivery gates #19 to dev: hosted checks passed (repository, Android, Python, security/dependency scans, and scope detection).
  • Local final verification: format, lint, typecheck, contracts, orchestration, requirements, all workspace tests, builds, 91 Python engine tests, and Android debug unit tests passed.
  • Environment-gated items remain documented: OpenTofu validation without the local binary; live Docker checks without a running daemon; Android instrumentation and signed release packaging.

This PR is the only promotion review point. CodeRabbit should perform one full review here; no CodeRabbit review was requested on the feature PR.

Summary by CodeRabbit

  • New Features

    • Added lifecycle tools for managing, validating, and monitoring local services.
    • Added configurable worker sizing and stronger production infrastructure safeguards.
    • Added safer telemetry handling for malformed or sensitive diagnostic data.
  • Bug Fixes

    • Improved validation for artifacts, command options, and infrastructure settings.
    • Enhanced local service persistence, logging, networking, and disk-space checks.
    • Strengthened CI checks for timeouts, permissions, credentials, releases, and provenance.
  • Documentation

    • Expanded development, operations, infrastructure, telemetry, and release-process guidance.

…-batch

feat: harden foundation local infrastructure and delivery gates
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@BeforeLights, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 5 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 48853c86-034a-4825-b1af-b666837c78fb

📥 Commits

Reviewing files that changed from the base of the PR and between 0172494 and 783a471.

📒 Files selected for processing (1)
  • tools/repo-cli/test/terraform-safety.test.mjs
📝 Walkthrough

Walkthrough

This PR hardens CI workflows, AWS infrastructure, local service management, telemetry parsing, artifact CLIs, and execution policy validation. It also updates operational evidence, development instructions, and foundation handoff records.

Changes

Foundation quality and infrastructure

Layer / File(s) Summary
CI and supply-chain validation
.github/workflows/*, tools/repo-cli/src/check-ci-policy.mjs, tools/repo-cli/src/generate-*.mjs, tools/repo-cli/test/*, docs/operations/foundation-ci-supply-chain-2026-08-02.md
Workflows now enforce timeouts, read-only contents permissions, non-persisted checkout credentials, protected release environments, and fail-closed artifact uploads. Provenance and SBOM argument validation rejects missing paths.
AWS infrastructure hardening
infrastructure/aws/**, tools/repo-cli/src/check-aws-infrastructure.mjs, tools/repo-cli/src/terraform-safety.mjs, tools/repo-cli/test/aws-infrastructure.test.mjs, tools/repo-cli/test/terraform-safety.test.mjs
AWS modules add ECS hardening, production image digest requirements, validated worker sizing, production Performance Insights, S3 lifecycle controls, and static safety checks.
Local service lifecycle
infrastructure/local/**, tools/repo-cli/src/local-services*.mjs, tools/repo-cli/test/local-infrastructure.test.mjs, package.json, docs/operations/*, docs/plans/010-engineering-foundation.md
A centralized local:services CLI validates and manages Compose services, including preflight, health, restart, logging, reset, and Redis persistence checks. Compose uses shared logging, init handling, and a project-scoped network.
Telemetry input safety
packages/telemetry/**, services/engine/**, docs/operations/telemetry-safety.md
Telemetry sanitization avoids accessor execution, rejects unreadable values and invalid headers, and normalizes unexpected mapping failures. JavaScript and Python tests cover these cases.
Execution policy and delivery records
docs/plans/*, tools/repo-cli/src/check-execution-orchestration.mjs, tools/repo-cli/test/execution-orchestration.test.mjs, docs/operations/foundation-*.md
Commit-budget limits and checkpoint metadata now use the revised policy. Foundation records document FND-003 and FND-006 verification and environment-gated checks.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.08% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the promotion of the foundation batch and platform gates, which matches the pull request objectives.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 10

🧹 Nitpick comments (12)
tools/repo-cli/test/sbom.test.mjs (1)

20-33: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Assert that the requested SBOM file exists.

The test does not inspect output after the generator exits. Assert that the file exists, and preferably parse it, so the test verifies the explicit output-path contract.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/repo-cli/test/sbom.test.mjs` around lines 20 - 33, Update the
explicit-output test around “SBOM generation writes to an explicit output path”
to assert that the requested output file exists after the process succeeds, and
parse its contents as JSON to validate it is a readable SBOM artifact before the
temporary directory is removed.
tools/repo-cli/test/provenance.test.mjs (1)

11-29: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Assert the recorded SHA-256 digests.

The test verifies only sorted subject paths. A regression that emits an incorrect or missing digest still passes. Compute the expected digests for a and z, then assert the corresponding provenance subject values.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/repo-cli/test/provenance.test.mjs` around lines 11 - 29, Extend the
test around provenance.subject in “provenance generation records sorted artifact
digests” to compute SHA-256 digests for the fixture contents “a” and “z”, then
assert each sorted subject’s recorded digest value matches the corresponding
expected digest. Keep the existing path-order assertion and verify the digest
field used by the provenance output.
tools/repo-cli/test/ci-policy.test.mjs (1)

63-169: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract a shared fixture builder to reduce duplication.

The tests at Line 63-113 and Line 115-169 each rebuild nearly identical quality.yml, security.yml, and release.yml fixtures, differing only in the one property under test. A shared helper that returns valid baseline fixtures, with an override for the property under test, would remove this duplication and make future required-workflow changes easier to keep in sync across tests.

♻️ Example helper approach
function validWorkflowSet(checkout, overrides = {}) {
  const base = {
    'quality.yml': [
      'name: q', 'permissions:', '  contents: read', 'jobs:', '  check:',
      '    runs-on: ubuntu-24.04', '    timeout-minutes: 10', '    steps:',
      `      - uses: ${checkout}`, '        with:', '          persist-credentials: false',
    ].join('\n'),
    // security.yml, release.yml similarly...
  };
  return { ...base, ...overrides };
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/repo-cli/test/ci-policy.test.mjs` around lines 63 - 169, Extract the
duplicated workflow fixture construction from the timeout and artifact policy
tests into a shared validWorkflowSet helper, using the checkout reference and
optional overrides for test-specific changes. Keep the shared quality.yml,
security.yml, and release.yml definitions valid by default, then override only
the timeout or artifact property needed by each test while preserving their
existing assertions.
tools/repo-cli/src/local-services.mjs (4)

67-76: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove the unreachable comment guard and trim value whitespace.

The key group is ([A-Z][A-Z0-9_]*), so match[1] can never start with #. The match[1].startsWith('#') test is dead code. Also, (.*)\s*$ is greedy, so .* consumes trailing whitespace and the trailing \s* matches nothing. A value written as POSTGRES_PORT=5432 keeps its trailing spaces.

♻️ Proposed change
   for (const line of readFileSync(file, 'utf8').split(/\r?\n/u)) {
-    const match = /^\s*([A-Z][A-Z0-9_]*)\s*=\s*(.*)\s*$/u.exec(line);
-    if (!match || match[1].startsWith('#')) continue;
-    values.set(match[1], match[2].replace(/^(['"])(.*)\1$/u, '$2'));
+    const match = /^\s*([A-Z][A-Z0-9_]*)\s*=\s*(.*?)\s*$/u.exec(line);
+    if (!match) continue;
+    values.set(match[1], match[2].replace(/^(['"])(.*)\1$/u, '$2'));
   }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/repo-cli/src/local-services.mjs` around lines 67 - 76, Update
parseEnvFile to remove the unreachable match[1].startsWith('#') guard and ensure
captured environment values have trailing whitespace trimmed before quote
removal. Preserve the existing key matching and quoted-value handling.

389-419: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

persistence-check leaves the sentinel key if a later step fails.

The SET uses EX 300, so the key expires. That bound is good. However, if the GET comparison fails, fail throws before the DEL runs, and the key stays until expiry. The behavior is safe because of the TTL. Consider a try/finally around the delete so the check is self-cleaning in every path.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/repo-cli/src/local-services.mjs` around lines 389 - 419, Update the
persistence-check flow around runDocker and fail so the Redis sentinel cleanup
runs in a finally block even when the GET comparison or readiness step fails.
Keep the existing TTL and success logging behavior, while ensuring DEL executes
on every path after the sentinel is created.

176-209: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

portAvailable checks only the loopback interface.

server.listen({ host: '127.0.0.1', port }) detects a conflict only when another process binds 127.0.0.1 or 0.0.0.0. Compose publishes the same ports on all interfaces. A process bound to a specific non-loopback address passes this preflight and then breaks docker compose up. This is acceptable for a local preflight, but record the limit so a later failure is easier to diagnose.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/repo-cli/src/local-services.mjs` around lines 176 - 209, Document the
interface limitation in or immediately above portAvailable: its 127.0.0.1 probe
does not detect conflicts on specific non-loopback addresses, even though
Compose publishes ports on all interfaces. Keep the existing preflight behavior
unchanged and state that such undetected conflicts may only surface when docker
compose up runs.

115-144: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Add a timeout to every spawnSync call.

Neither runDocker nor requireDocker sets timeout. If the Docker daemon becomes unresponsive, docker info, docker compose config, or docker compose up -d blocks the process forever. The CLI then hangs in local use and in any CI job that calls it. Set a bounded timeout and map the resulting ETIMEDOUT error to a clear message.

♻️ Proposed change
+const dockerTimeoutMs = 120_000;
+
 function runDocker(args, { allowFailure = false } = {}) {
-  const result = spawnSync('docker', args, { cwd: repositoryRoot, encoding: 'utf8' });
+  const result = spawnSync('docker', args, {
+    cwd: repositoryRoot,
+    encoding: 'utf8',
+    timeout: dockerTimeoutMs,
+  });
   const result = spawnSync('docker', ['info', '--format', '{{.ServerVersion}}'], {
     cwd: repositoryRoot,
     encoding: 'utf8',
+    timeout: 30_000,
   });

Note that up -d and image pulls can be slow, so choose the value for runDocker with that in mind.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/repo-cli/src/local-services.mjs` around lines 115 - 144, Update every
spawnSync invocation in runDocker and requireDocker to use bounded timeouts,
choosing a sufficiently generous limit for docker compose up and image pulls.
Detect timeout results, including ETIMEDOUT, and route them to clear fail
messages distinguishing the Docker operation from daemon unavailability;
preserve existing ENOENT and nonzero-status handling for other failures.
docs/operations/foundation-local-infrastructure-2026-08-02.md (1)

13-16: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add persistence-check to the command list.

The list names config, preflight, check, start, stop, reset, restart-check, status, logs, and smoke. It omits persistence-check, which Line 23 of this file then describes in detail. Add it so the boundary list matches the CLI in tools/repo-cli/src/local-services.mjs.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/operations/foundation-local-infrastructure-2026-08-02.md` around lines
13 - 16, Update the local-services command list in the introductory
documentation to include persistence-check alongside the existing commands,
matching the CLI commands described later and implemented by local-services.mjs.
tools/repo-cli/test/local-infrastructure.test.mjs (3)

40-40: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the network-membership count as well.

Lines 36 and 45 count init: true and logging: *default-logging at seven occurrences each. Line 40 only proves that networks: [local] appears once. A service that loses its network membership still passes. Use the same counting form for symmetry.

💚 Proposed change
-  assert.match(compose, /networks: \[local\]/u);
+  assert.equal((compose.match(/^\s{4}networks: \[local\]$/gmu) ?? []).length, 7);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/repo-cli/test/local-infrastructure.test.mjs` at line 40, Update the
network assertion in the local infrastructure test to count all occurrences of
the networks: [local] configuration, matching the counting style used for init:
true and logging: *default-logging, and assert the expected service-membership
count rather than merely checking presence.

214-219: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

A conditional assertion can silence a real failure.

If composeConfig.status is non-zero, the block runs no assertion at all. The test then passes on a machine without the Docker CLI and on a machine where docker compose config rejects compose.yml. Distinguish the two cases: treat a missing Docker CLI as a skip, and treat a Compose validation error as a failure.

💚 Proposed change
   const composeConfig = spawnSync(process.execPath, [helpScript, 'config'], {
     cwd: repositoryRoot,
     encoding: 'utf8',
   });
-  if (composeConfig.status === 0)
-    assert.match(composeConfig.stdout, /Compose configuration is valid/u);
+  const composeOutput = `${composeConfig.stdout}\n${composeConfig.stderr}`;
+  if (composeConfig.status === 0) {
+    assert.match(composeConfig.stdout, /Compose configuration is valid/u);
+  } else {
+    assert.match(composeOutput, /Docker CLI is not installed/u, composeOutput);
+  }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/repo-cli/test/local-infrastructure.test.mjs` around lines 214 - 219,
Update the composeConfig check in the local infrastructure test to explicitly
detect a missing Docker CLI and skip only in that environment; for any other
non-zero status from the helpScript config invocation, fail the test with the
command’s stderr or equivalent error details. Keep the existing success
assertion for valid Compose configuration.

148-156: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Source-text assertions do not verify behavior.

These assertions read local-services.mjs as a string and match identifiers such as statfsSync, portAvailable, and configured = new Map. A match proves only that the text exists. The test still passes if the function is defined and never called, or if a caller is removed. The same applies to the doesNotMatch guards: a rename to dockerRemove would satisfy /docker\s+(?:rm|volume\s+rm|system\s+prune)/iu while the destructive behavior remains.

The negative guards on --volumes and FLUSHALL still have value as a cheap policy gate. Keep them, but add unit coverage that imports main and asserts observable behavior for the argument-validation and command-dispatch paths. That coverage would also catch the logs output defect noted in tools/repo-cli/src/local-services.mjs.

Also applies to: 220-225

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/repo-cli/test/local-infrastructure.test.mjs` around lines 148 - 156,
Replace the positive source-text assertions in the local infrastructure test
with unit coverage that imports main and exercises observable
argument-validation and command-dispatch behavior, including the logs output
path. Retain the negative --volumes and FLUSHALL policy guards, while removing
or limiting identifier-presence checks that do not verify execution; ensure the
tests detect removed callers and renamed destructive Docker operations through
behavior.
infrastructure/local/compose.yml (1)

17-19: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Consider binding published ports to the loopback interface.

The published ports use the short form, so Docker binds them to 0.0.0.0. The stack ships default credentials such as databreeze-local-change-me. On a shared or untrusted network, PostgreSQL, Redis, and MinIO become reachable from other hosts. Prefix the host side with 127.0.0.1 to keep the stack local.

🔒 Example for the PostgreSQL mapping
     ports:
-      - '${POSTGRES_PORT:-5432}:5432'
+      - '127.0.0.1:${POSTGRES_PORT:-5432}:5432'

Apply the same change to the Redis, MinIO, Mailpit, and OpenTelemetry mappings. If remote access from another device is a deliberate local-development need, keep the current form and record that decision in infrastructure/local/README.md.

Also applies to: 38-39, 58-60, 97-99, 115-118

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@infrastructure/local/compose.yml` around lines 17 - 19, Update the port
mappings in the local Compose service definitions for PostgreSQL, Redis, MinIO,
Mailpit, and OpenTelemetry to bind the host side explicitly to 127.0.0.1,
preserving each existing host-port variable and container-port mapping. If
remote access is intentionally required, leave the mappings unchanged and
document that decision in the local README instead.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/operations/foundation-local-infrastructure-2026-08-02.md`:
- Around line 30-36: Move the persistence-check command from the Passed list to
the Environment-gated list in the FND-003 evidence record, preserving its
Docker-gated annotation. Keep the other passed commands unchanged and ensure the
final lists accurately reflect that persistence-check did not run without a
Docker daemon.

In `@infrastructure/aws/modules/compute/variables.tf`:
- Around line 90-99: Update the validation for worker_memory, in coordination
with worker_cpu, to accept only AWS-supported Fargate CPU/memory combinations
before aws_ecs_task_definition.worker is created. Preserve the existing overall
memory bounds while enforcing each var.worker_cpu value’s allowed memory range
or values, including rejecting combinations such as 1024 CPU with 512 MiB.

In `@infrastructure/local/.env.example`:
- Line 5: Update parseArguments/main in the local-services CLI so minFreeGib
reads DATABREEZE_MIN_FREE_GIB from the parsed environment Map, while preserving
process.env as the higher-priority value and the existing default when neither
is set. Do not move this logic into environment(), since that is resolved after
argument parsing.

In `@packages/telemetry/src/v1.ts`:
- Around line 169-175: Update packages/telemetry/src/v1.ts at lines 169-175 in
ownDataEntries to catch Object.keys and getOwnPropertyDescriptor failures and
return an empty sanitized attribute record; at lines 200-205, convert
reflective-read exceptions into the existing stable strict-validation rejection;
and at lines 266-277, convert reflective-read exceptions into “Unreadable
telemetry ... header” while accepting direct header values only when typeof
value is string or when they are arrays. Add regression tests covering throwing
Proxy traps and {"x-correlation-id": 1}.

In `@services/engine/src/databreeze_engine/telemetry.py`:
- Around line 183-191: Update the attribute-validation block around
_validate_key and _safe_scalar to distinguish locally raised validation
ValueErrors from provider failures, normalizing all exceptions originating from
attributes.items(), iteration, or values to “telemetry attributes are not
readable”; apply the same change to the header-validation block at
services/engine/src/databreeze_engine/telemetry.py lines 259-276, normalizing
provider failures to “telemetry headers are not readable”. Add tests covering
items() raising ValueError("provider cause must not escape") at both sites and
verify the provider message is not exposed.

In `@tools/repo-cli/src/check-aws-infrastructure.mjs`:
- Around line 61-66: Update the infrastructure checks around the existing
Terraform regexes to detect wildcard principals in structured principals blocks,
including the rendered aws_s3_bucket_policy.web policy when applicable, and
replace the 400-character ingress scan with logic that evaluates each complete
ingress block regardless of length. Preserve the existing fail messages and
reject unrestricted 0.0.0.0/0 ingress and wildcard principals in all supported
forms.

In `@tools/repo-cli/src/check-ci-policy.mjs`:
- Around line 33-64: Update the workflow validation around assertBoundedJobs and
assertArtifactOutputs to parse each workflow as YAML before applying policy
checks. Validate the parsed top-level permissions map contains contents: read,
require timeout-minutes on every runner job, and inspect each upload-artifact
step’s with mapping for if-no-files-found: error. Replace the regex-based text
matching that truncates step and job context while preserving the existing
policy errors and checks.
- Around line 94-96: Update the release-gate configuration associated with
check-ci-policy so the protected release environment exists and has required
reviewers and deployment branch restrictions configured; ensure the existing
release.yml validation remains aligned with that protected environment.

In `@tools/repo-cli/src/local-services.mjs`:
- Around line 115-127: Update runDocker and the logs command path so log output
is streamed directly to the terminal rather than captured in
result.stdout/result.stderr, avoiding the default buffer limit for large
multi-service logs. Preserve captured output for commands that need to inspect
results, and add a behavioral test in the local infrastructure test suite when a
Docker-capable environment is available.
- Around line 211-223: Update inspectHealth so the docker inspect call uses
allowFailure: true, matching the existing ps call. Handle empty or failed
inspect output by returning a transient non-ready health result instead of
allowing runDocker to throw, while preserving the existing parsed state/health
result for valid output.

---

Nitpick comments:
In `@docs/operations/foundation-local-infrastructure-2026-08-02.md`:
- Around line 13-16: Update the local-services command list in the introductory
documentation to include persistence-check alongside the existing commands,
matching the CLI commands described later and implemented by local-services.mjs.

In `@infrastructure/local/compose.yml`:
- Around line 17-19: Update the port mappings in the local Compose service
definitions for PostgreSQL, Redis, MinIO, Mailpit, and OpenTelemetry to bind the
host side explicitly to 127.0.0.1, preserving each existing host-port variable
and container-port mapping. If remote access is intentionally required, leave
the mappings unchanged and document that decision in the local README instead.

In `@tools/repo-cli/src/local-services.mjs`:
- Around line 67-76: Update parseEnvFile to remove the unreachable
match[1].startsWith('#') guard and ensure captured environment values have
trailing whitespace trimmed before quote removal. Preserve the existing key
matching and quoted-value handling.
- Around line 389-419: Update the persistence-check flow around runDocker and
fail so the Redis sentinel cleanup runs in a finally block even when the GET
comparison or readiness step fails. Keep the existing TTL and success logging
behavior, while ensuring DEL executes on every path after the sentinel is
created.
- Around line 176-209: Document the interface limitation in or immediately above
portAvailable: its 127.0.0.1 probe does not detect conflicts on specific
non-loopback addresses, even though Compose publishes ports on all interfaces.
Keep the existing preflight behavior unchanged and state that such undetected
conflicts may only surface when docker compose up runs.
- Around line 115-144: Update every spawnSync invocation in runDocker and
requireDocker to use bounded timeouts, choosing a sufficiently generous limit
for docker compose up and image pulls. Detect timeout results, including
ETIMEDOUT, and route them to clear fail messages distinguishing the Docker
operation from daemon unavailability; preserve existing ENOENT and
nonzero-status handling for other failures.

In `@tools/repo-cli/test/ci-policy.test.mjs`:
- Around line 63-169: Extract the duplicated workflow fixture construction from
the timeout and artifact policy tests into a shared validWorkflowSet helper,
using the checkout reference and optional overrides for test-specific changes.
Keep the shared quality.yml, security.yml, and release.yml definitions valid by
default, then override only the timeout or artifact property needed by each test
while preserving their existing assertions.

In `@tools/repo-cli/test/local-infrastructure.test.mjs`:
- Line 40: Update the network assertion in the local infrastructure test to
count all occurrences of the networks: [local] configuration, matching the
counting style used for init: true and logging: *default-logging, and assert the
expected service-membership count rather than merely checking presence.
- Around line 214-219: Update the composeConfig check in the local
infrastructure test to explicitly detect a missing Docker CLI and skip only in
that environment; for any other non-zero status from the helpScript config
invocation, fail the test with the command’s stderr or equivalent error details.
Keep the existing success assertion for valid Compose configuration.
- Around line 148-156: Replace the positive source-text assertions in the local
infrastructure test with unit coverage that imports main and exercises
observable argument-validation and command-dispatch behavior, including the logs
output path. Retain the negative --volumes and FLUSHALL policy guards, while
removing or limiting identifier-presence checks that do not verify execution;
ensure the tests detect removed callers and renamed destructive Docker
operations through behavior.

In `@tools/repo-cli/test/provenance.test.mjs`:
- Around line 11-29: Extend the test around provenance.subject in “provenance
generation records sorted artifact digests” to compute SHA-256 digests for the
fixture contents “a” and “z”, then assert each sorted subject’s recorded digest
value matches the corresponding expected digest. Keep the existing path-order
assertion and verify the digest field used by the provenance output.

In `@tools/repo-cli/test/sbom.test.mjs`:
- Around line 20-33: Update the explicit-output test around “SBOM generation
writes to an explicit output path” to assert that the requested output file
exists after the process succeeds, and parse its contents as JSON to validate it
is a readable SBOM artifact before the temporary directory is removed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d8330588-58ef-4a06-82cb-601328761e73

📥 Commits

Reviewing files that changed from the base of the PR and between a2fcba3 and 0f47f81.

📒 Files selected for processing (46)
  • .github/workflows/quality.yml
  • .github/workflows/release.yml
  • .github/workflows/security.yml
  • docs/development/README.md
  • docs/operations/engineering-foundation-verification.md
  • docs/operations/foundation-batch-handoff-2026-08-02.md
  • docs/operations/foundation-ci-supply-chain-2026-08-02.md
  • docs/operations/foundation-local-infrastructure-2026-08-02.md
  • docs/operations/foundation-reconciliation-2026-08-02.md
  • docs/operations/telemetry-safety.md
  • docs/plans/000-platform-program.md
  • docs/plans/003-luna-handoff-runbook.md
  • docs/plans/010-engineering-foundation.md
  • docs/plans/execution-orchestration.json
  • infrastructure/aws/README.md
  • infrastructure/aws/environments/alpha/README.md
  • infrastructure/aws/environments/alpha/main.tf
  • infrastructure/aws/environments/alpha/variables.tf
  • infrastructure/aws/modules/compute/main.tf
  • infrastructure/aws/modules/compute/variables.tf
  • infrastructure/aws/modules/data/main.tf
  • infrastructure/aws/modules/web/main.tf
  • infrastructure/local/.env.example
  • infrastructure/local/README.md
  • infrastructure/local/compose.yml
  • package.json
  • packages/telemetry/README.md
  • packages/telemetry/src/v1.ts
  • packages/telemetry/test/telemetry-v1.test.mjs
  • services/engine/src/databreeze_engine/telemetry.py
  • services/engine/tests/test_telemetry.py
  • tools/repo-cli/src/check-aws-infrastructure.mjs
  • tools/repo-cli/src/check-ci-policy.mjs
  • tools/repo-cli/src/check-execution-orchestration.mjs
  • tools/repo-cli/src/detect-change-scope.mjs
  • tools/repo-cli/src/generate-provenance.mjs
  • tools/repo-cli/src/generate-sbom.mjs
  • tools/repo-cli/src/local-services-smoke.mjs
  • tools/repo-cli/src/local-services.mjs
  • tools/repo-cli/test/aws-infrastructure.test.mjs
  • tools/repo-cli/test/change-scope.test.mjs
  • tools/repo-cli/test/ci-policy.test.mjs
  • tools/repo-cli/test/execution-orchestration.test.mjs
  • tools/repo-cli/test/local-infrastructure.test.mjs
  • tools/repo-cli/test/provenance.test.mjs
  • tools/repo-cli/test/sbom.test.mjs

Comment thread docs/operations/foundation-local-infrastructure-2026-08-02.md
Comment thread infrastructure/aws/modules/compute/variables.tf
Comment thread infrastructure/local/.env.example
Comment thread packages/telemetry/src/v1.ts Outdated
Comment thread services/engine/src/databreeze_engine/telemetry.py
Comment thread tools/repo-cli/src/check-aws-infrastructure.mjs Outdated
Comment thread tools/repo-cli/src/check-ci-policy.mjs Outdated
Comment thread tools/repo-cli/src/check-ci-policy.mjs Outdated
Comment on lines +94 to +96
if (!/^\s+environment:\s*release\s*$/im.test(release)) {
throw new Error('release.yml must use the protected release environment');
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="$(gh repo view --json nameWithOwner --jq '.nameWithOwner')"
gh api "repos/${repo}/environments/release" \
  --jq '{name, protection_rules, deployment_branch_policy}'

Repository: DatabreezeService/databreeze-platform

Length of output: 333


🏁 Script executed:

set -euo pipefail

printf '%s\n' '--- candidate files ---'
git ls-files | grep -E '(^|/)(check-ci-policy\.mjs|release\.ya?ml)$' || true

printf '%s\n' '--- checker context ---'
file="$(git ls-files | grep -E '(^|/)tools/repo-cli/src/check-ci-policy\.mjs$' | head -n1)"
if [ -n "$file" ]; then
  sed -n '1,150p' "$file"
fi

printf '%s\n' '--- release workflow references ---'
rg -n -C 4 'environment:|release|required_review|deployment' .github tools 2>/dev/null || true

Repository: DatabreezeService/databreeze-platform

Length of output: 24039


🏁 Script executed:

set -euo pipefail

repo="$(gh repo view --json nameWithOwner --jq '.nameWithOwner')"
printf '%s\n' '--- repository access context ---'
gh repo view "$repo" --json nameWithOwner,visibility,viewerPermission \
  --jq '{nameWithOwner,visibility,viewerPermission}'

printf '%s\n' '--- configured environments ---'
gh api "repos/${repo}/environments" \
  --jq '.environments[] | {name,protection_rules,deployment_branch_policy}' || true

printf '%s\n' '--- release environment response ---'
gh api --include "repos/${repo}/environments/release" 2>&1 || true

Repository: DatabreezeService/databreeze-platform

Length of output: 1698


Configure the protected release environment.

The repository has no visible release environment. The checker validates only the workflow name and cannot enforce required reviewers or deployment branch restrictions. Configure these protections before relying on this release gate.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/repo-cli/src/check-ci-policy.mjs` around lines 94 - 96, Update the
release-gate configuration associated with check-ci-policy so the protected
release environment exists and has required reviewers and deployment branch
restrictions configured; ensure the existing release.yml validation remains
aligned with that protected environment.

Comment thread tools/repo-cli/src/local-services.mjs Outdated
Comment thread tools/repo-cli/src/local-services.mjs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/telemetry/test/telemetry-v1.test.mjs`:
- Around line 97-111: Strengthen the assertions around
sanitizeTelemetryAttributesV1, assertSafeTelemetryAttributesV1, and
correlationFromHeadersV1 to verify the exact normalized error key/message rather
than only the error type or prefix. Assert that the normalized outputs do not
expose “attribute trap cause” or “header trap cause”, while preserving the
existing safe empty-object result and expected error classes.

In `@tools/repo-cli/src/check-aws-infrastructure.mjs`:
- Around line 35-65: Update balancedBlocks to ignore Terraform line comments,
block comments, and heredoc bodies both when matching block starts and when
tracking brace depth, so braces inside those constructs cannot terminate a block
before its full contents. Preserve quoted-string handling and add fixtures
covering # comments, /* ... */ comments, and heredoc bodies containing braces.

In `@tools/repo-cli/src/check-ci-policy.mjs`:
- Around line 41-50: Update containsText so matching is restricted to node.run
command values, rather than every string in a workflow node, ensuring name, env,
and action with mappings cannot satisfy the check. Add bypass tests covering
required command text appearing only in non-run fields, while preserving matches
for actual run steps.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3a908a9a-a577-4893-b86e-0a9f4559887d

📥 Commits

Reviewing files that changed from the base of the PR and between 0f47f81 and 7a242f5.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (17)
  • docs/operations/foundation-ci-supply-chain-2026-08-02.md
  • docs/operations/foundation-local-infrastructure-2026-08-02.md
  • infrastructure/aws/modules/compute/main.tf
  • infrastructure/local/README.md
  • infrastructure/local/compose.yml
  • package.json
  • packages/telemetry/src/v1.ts
  • packages/telemetry/test/telemetry-v1.test.mjs
  • services/engine/src/databreeze_engine/telemetry.py
  • services/engine/tests/test_telemetry.py
  • tools/repo-cli/src/check-aws-infrastructure.mjs
  • tools/repo-cli/src/check-ci-policy.mjs
  • tools/repo-cli/src/local-services.mjs
  • tools/repo-cli/test/aws-infrastructure.test.mjs
  • tools/repo-cli/test/local-infrastructure.test.mjs
  • tools/repo-cli/test/provenance.test.mjs
  • tools/repo-cli/test/sbom.test.mjs
🚧 Files skipped from review as they are similar to previous changes (14)
  • tools/repo-cli/test/provenance.test.mjs
  • infrastructure/local/README.md
  • package.json
  • infrastructure/local/compose.yml
  • docs/operations/foundation-local-infrastructure-2026-08-02.md
  • packages/telemetry/src/v1.ts
  • infrastructure/aws/modules/compute/main.tf
  • tools/repo-cli/test/sbom.test.mjs
  • docs/operations/foundation-ci-supply-chain-2026-08-02.md
  • services/engine/src/databreeze_engine/telemetry.py
  • tools/repo-cli/test/aws-infrastructure.test.mjs
  • tools/repo-cli/test/local-infrastructure.test.mjs
  • services/engine/tests/test_telemetry.py
  • tools/repo-cli/src/local-services.mjs

Comment thread packages/telemetry/test/telemetry-v1.test.mjs Outdated
Comment thread tools/repo-cli/src/check-aws-infrastructure.mjs Outdated
Comment thread tools/repo-cli/src/check-ci-policy.mjs Outdated
fix: close incremental promotion review findings

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
tools/repo-cli/test/terraform-safety.test.mjs (1)

6-28: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a test case for // line comments.

maskTerraformNonCode masks // line comments the same way as # comments. No test exercises this branch. Add a fixture with a // comment containing a misleading brace or identifier, similar to the existing # comment case.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/repo-cli/test/terraform-safety.test.mjs` around lines 6 - 28, Extend
the test source in “Terraform block scanning ignores comments, heredocs, and
braces in strings” with a // line comment containing a misleading ingress
identifier or brace. Keep the existing assertions and ensure balancedBlocks
still returns only the real ingress block, confirming maskTerraformNonCode
handles // comments.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tools/repo-cli/test/terraform-safety.test.mjs`:
- Around line 6-28: Extend the test source in “Terraform block scanning ignores
comments, heredocs, and braces in strings” with a // line comment containing a
misleading ingress identifier or brace. Keep the existing assertions and ensure
balancedBlocks still returns only the real ingress block, confirming
maskTerraformNonCode handles // comments.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f9ad944a-0ab9-467b-8b49-5690d44c3fa6

📥 Commits

Reviewing files that changed from the base of the PR and between 7a242f5 and 0172494.

📒 Files selected for processing (6)
  • packages/telemetry/test/telemetry-v1.test.mjs
  • tools/repo-cli/src/check-aws-infrastructure.mjs
  • tools/repo-cli/src/check-ci-policy.mjs
  • tools/repo-cli/src/terraform-safety.mjs
  • tools/repo-cli/test/ci-policy.test.mjs
  • tools/repo-cli/test/terraform-safety.test.mjs
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/telemetry/test/telemetry-v1.test.mjs
  • tools/repo-cli/src/check-ci-policy.mjs
  • tools/repo-cli/test/ci-policy.test.mjs

@BeforeLights
BeforeLights merged commit 3ed3d77 into main Aug 2, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant