Skip to content

promote: foundation and artifact safeguards - #37

Merged
BeforeLights merged 80 commits into
mainfrom
promote/dev-20260803-05
Aug 3, 2026
Merged

promote: foundation and artifact safeguards#37
BeforeLights merged 80 commits into
mainfrom
promote/dev-20260803-05

Conversation

@BeforeLights

@BeforeLights BeforeLights commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Promotion packet\n\nPromotes the first 58 commits from dev after the reviewed PR #35 slice.\n\n- foundation/local/AWS validation and telemetry safeguards\n- artifact, dataset, spreadsheet-audit, and engine contract hardening\n- IAM/IAE/DSM/SA regression coverage and OpenAPI updates\n- 101 changed files; this packet remains under the 79-commit and 260-file promotion limits\n\n## Verification\n\n- source branch is an ancestor of origin/dev at 8eccfa4\n- git diff --check passes\n- repository gates passed on the merged dev foundation before slicing\n\nThis is a main-bound promotion packet. CodeRabbit should perform its single full review here; do not rerun it after disposition.

Summary by CodeRabbit

  • New Features

    • Added AWS infrastructure validation with pinned tooling, locked providers, safe mocked plans, and automated checks.
    • Improved local service readiness reporting for initialization completion and failures.
    • Added stricter API validation for timestamps, collection sizes, spreadsheet limits, and numeric fields.
  • Bug Fixes

    • Improved telemetry failure handling without exposing provider error details.
    • Strengthened artifact upload, export, retention, authorization, and concurrency safeguards.
    • Corrected dataset quality handling and spreadsheet formula-gap detection.
  • Documentation

    • Added infrastructure verification records, review dispositions, and updated execution plans.

BeforeLights and others added 30 commits August 3, 2026 15:20
fix: close promotion review and foundation gates
@BeforeLights

Copy link
Copy Markdown
Contributor Author

PR #37 CodeRabbit disposition: review run d034f311-c043-4139-8372-ed69b774a83f completed once. All seven inline findings were valid and fixed in focused commits; the disposition is recorded in docs/operations/coderabbit-pr-37-disposition.md. The general walkthrough/docstring coverage warning was not adopted because it is not an enforced repository gate. Scoped and root verification pass (AWS tests, API tests, repo:check, repo:build). No second CodeRabbit run will be triggered.

@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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
services/api/openapi/v1.json (1)

7710-7710: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Make maxByteSize an integer in the OpenAPI contract.

AdmitArtifactDto.maxByteSize remains type: "number" at Line 7713. The runtime DTO uses @IsInt() for this field. Clients can submit a documented-valid fractional value that the API rejects.

Change maxByteSize to type: "integer". Add an OpenAPI regression assertion for both byte-size fields.

Proposed fix
           "actualByteSize": { "type": "integer", "minimum": 0 },
           "detectedMediaType": { "type": "string" },
           "scanState": { "type": "string", "enum": ["PENDING", "CLEAN", "MALICIOUS", "FAILED"] },
-          "maxByteSize": { "type": "number", "minimum": 0 },
+          "maxByteSize": { "type": "integer", "minimum": 0 },
🤖 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 `@services/api/openapi/v1.json` at line 7710, Update the OpenAPI schema for
AdmitArtifactDto.maxByteSize to use type "integer", matching its runtime
`@IsInt`() validation, and add a regression assertion covering both maxByteSize
and actualByteSize as integer fields.
🤖 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
`@services/api/src/features/iae/adapter/prisma-artifact-lineage-repository.adapter.ts`:
- Around line 99-107: The isUniqueConstraintViolation helper currently treats
every Prisma P2002 error as a derived-version conflict. Inspect P2002’s
meta.target to distinguish the id constraint from derivedArtifactVersionId,
route id conflicts through the existing immutable-lineage comparison, and map
only derivedArtifactVersionId conflicts to IAE_DERIVED_LINEAGE_CONFLICT; add a
regression test covering a same-ID, different-payload race with meta.target in
the Prisma error fixture.

---

Outside diff comments:
In `@services/api/openapi/v1.json`:
- Line 7710: Update the OpenAPI schema for AdmitArtifactDto.maxByteSize to use
type "integer", matching its runtime `@IsInt`() validation, and add a regression
assertion covering both maxByteSize and actualByteSize as integer fields.
🪄 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: 6fd78011-f34d-414f-a9a8-2a696e772375

📥 Commits

Reviewing files that changed from the base of the PR and between 18f4a36 and 01bf508.

📒 Files selected for processing (12)
  • docs/operations/coderabbit-pr-37-disposition.md
  • infrastructure/aws/README.md
  • services/api/openapi/v1.json
  • services/api/src/features/iae/adapter/prisma-artifact-lineage-repository.adapter.ts
  • services/api/src/features/iae/api/artifact-retention.dto.ts
  • services/api/src/features/iae/api/inbox-item.dto.ts
  • services/api/src/features/sa/api/spreadsheet-audit.dto.ts
  • services/api/test/features/iae/prisma-artifact-lineage-repository.test.ts
  • services/api/test/openapi.test.ts
  • tools/repo-cli/src/check-aws-infrastructure.mjs
  • tools/repo-cli/src/validate-aws-opentofu.mjs
  • tools/repo-cli/test/aws-infrastructure.test.mjs
🚧 Files skipped from review as they are similar to previous changes (8)
  • tools/repo-cli/src/validate-aws-opentofu.mjs
  • tools/repo-cli/src/check-aws-infrastructure.mjs
  • services/api/src/features/iae/api/inbox-item.dto.ts
  • tools/repo-cli/test/aws-infrastructure.test.mjs
  • services/api/test/features/iae/prisma-artifact-lineage-repository.test.ts
  • services/api/src/features/iae/api/artifact-retention.dto.ts
  • infrastructure/aws/README.md
  • services/api/src/features/sa/api/spreadsheet-audit.dto.ts

@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: 1

🧹 Nitpick comments (1)
services/api/test/features/iae/artifact-upload.service.test.ts (1)

156-163: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Assert transfer compensation.

The test checks the expiration error. It does not check that the service aborts the transfer issued before revalidation. Use TrackingStorageAdapter and assert one abort call.

Proposed test update
+  const storage = new TrackingStorageAdapter();
   const service = new ArtifactUploadService(
     new RevalidatingUploadRepository(created.value, expired.value),
-    new InMemoryArtifactUploadStorageAdapter(),
+    storage,
   );
   assert.deepEqual(await service.issuePartTransfer(context, created.value.sessionId, 1), {
     accepted: false,
     code: 'UPLOAD_SESSION_EXPIRED',
   });
+  assert.equal(storage.abortCalls, 1);
🤖 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 `@services/api/test/features/iae/artifact-upload.service.test.ts` around lines
156 - 163, Update the test around ArtifactUploadService.issuePartTransfer to use
TrackingStorageAdapter instead of InMemoryArtifactUploadStorageAdapter, retain
the existing expired-session response assertion, and additionally verify the
tracking adapter recorded exactly one abort call for the transfer issued before
revalidation.
🤖 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 `@services/api/test/features/dsm/prisma-dataset-version-repository.test.ts`:
- Around line 99-113: Split this test into two rejection cases: one using the
persisted organizationId and workspaceId with only rowCount changed to -1, and
another using out-of-scope tenant identifiers without combining it with content
tampering. Ensure the rowCount-only case reaches the persisted-domain comparison
in PrismaDatasetVersionRepositoryAdapter.save.

---

Nitpick comments:
In `@services/api/test/features/iae/artifact-upload.service.test.ts`:
- Around line 156-163: Update the test around
ArtifactUploadService.issuePartTransfer to use TrackingStorageAdapter instead of
InMemoryArtifactUploadStorageAdapter, retain the existing expired-session
response assertion, and additionally verify the tracking adapter recorded
exactly one abort call for the transfer issued before revalidation.
🪄 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: 9172f529-f74d-4fa1-9c59-84588bb3c138

📥 Commits

Reviewing files that changed from the base of the PR and between 01bf508 and 3c22c78.

📒 Files selected for processing (15)
  • apps/android/app/src/test/java/com/databreeze/android/TelemetryContractTest.kt
  • docs/operations/coderabbit-pr-37-disposition.md
  • services/api/src/features/dsm/adapter/prisma-dataset-profile-repository.adapter.ts
  • services/api/src/features/dsm/adapter/prisma-dataset-quality-repository.adapter.ts
  • services/api/src/features/dsm/adapter/prisma-dataset-version-repository.adapter.ts
  • services/api/src/features/dsm/api/dataset-quality.dto.ts
  • services/api/src/features/iae/adapter/prisma-artifact-export-repository.adapter.ts
  • services/api/src/features/iae/adapter/prisma-artifact-lineage-repository.adapter.ts
  • services/api/src/features/iae/application/artifact-upload.service.ts
  • services/api/src/platform/prisma-error.ts
  • services/api/test/features/dsm/dataset-quality.controller.test.ts
  • services/api/test/features/dsm/prisma-dataset-profile-repository.test.ts
  • services/api/test/features/dsm/prisma-dataset-quality-repository.test.ts
  • services/api/test/features/dsm/prisma-dataset-version-repository.test.ts
  • services/api/test/features/iae/artifact-upload.service.test.ts
🚧 Files skipped from review as they are similar to previous changes (10)
  • services/api/test/features/dsm/dataset-quality.controller.test.ts
  • services/api/src/features/dsm/adapter/prisma-dataset-profile-repository.adapter.ts
  • apps/android/app/src/test/java/com/databreeze/android/TelemetryContractTest.kt
  • services/api/src/features/dsm/adapter/prisma-dataset-quality-repository.adapter.ts
  • services/api/src/features/iae/adapter/prisma-artifact-lineage-repository.adapter.ts
  • services/api/test/features/dsm/prisma-dataset-quality-repository.test.ts
  • services/api/test/features/dsm/prisma-dataset-profile-repository.test.ts
  • services/api/src/features/dsm/api/dataset-quality.dto.ts
  • services/api/src/features/dsm/adapter/prisma-dataset-version-repository.adapter.ts
  • services/api/src/features/iae/adapter/prisma-artifact-export-repository.adapter.ts

Comment on lines +99 to +113
const persisted = rows[0];
if (!persisted) throw new Error('fixture version was not persisted');
await assert.rejects(
new PrismaDatasetVersionRepositoryAdapter(
client([
{
...persisted,
organizationId: '00000000-0000-4000-8000-000000000821',
workspaceId: '00000000-0000-4000-8000-000000000822',
rowCount: -1,
},
]),
).save(tenantContext, created.value),
/DSM_IMMUTABLE_DATASET_VERSION/u,
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Separate tenant visibility and content tampering cases.

This test changes organizationId, workspaceId, and rowCount together. In services/api/src/features/dsm/adapter/prisma-dataset-version-repository.adapter.ts, Lines [126-145], save checks tenant visibility before comparing the persisted domain value. The changed tenant identifiers can trigger rejection before the rowCount mismatch is evaluated.

Add one case with unchanged tenant identifiers and only rowCount: -1. Keep a separate case for out-of-scope tenant identifiers.

🤖 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 `@services/api/test/features/dsm/prisma-dataset-version-repository.test.ts`
around lines 99 - 113, Split this test into two rejection cases: one using the
persisted organizationId and workspaceId with only rowCount changed to -1, and
another using out-of-scope tenant identifiers without combining it with content
tampering. Ensure the rowCount-only case reaches the persisted-domain comparison
in PrismaDatasetVersionRepositoryAdapter.save.

@BeforeLights
BeforeLights merged commit c2f2c61 into main Aug 3, 2026
6 checks passed
@BeforeLights
BeforeLights deleted the promote/dev-20260803-05 branch August 3, 2026 13:26
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