fix: resolve CI failures in Python tests and admin-compliance build
Some checks failed
Build + Deploy / build-admin-compliance (push) Successful in 1m37s
Build + Deploy / build-backend-compliance (push) Successful in 12s
Build + Deploy / build-ai-sdk (push) Successful in 10s
Build + Deploy / build-developer-portal (push) Successful in 12s
Build + Deploy / build-tts (push) Successful in 12s
Build + Deploy / build-document-crawler (push) Successful in 11s
Build + Deploy / build-dsms-gateway (push) Successful in 12s
CI/CD / loc-budget (push) Successful in 21s
CI/CD / guardrail-integrity (push) Has been skipped
CI/CD / go-lint (push) Has been skipped
CI/CD / python-lint (push) Has been skipped
CI/CD / nodejs-lint (push) Has been skipped
CI/CD / test-go-ai-compliance (push) Successful in 42s
CI/CD / test-python-backend-compliance (push) Has started running
CI/CD / test-python-document-crawler (push) Has been cancelled
CI/CD / test-python-dsms-gateway (push) Has been cancelled
CI/CD / sbom-scan (push) Has been cancelled
CI/CD / validate-canonical-controls (push) Has been cancelled
Build + Deploy / trigger-orca (push) Successful in 2m19s

Python: add missing 'import enum' to compliance/db/models.py shim.
TypeScript: remove duplicate export of useVendorCompliance from
  vendor-compliance/context.tsx (already exported from ./hooks).
Docs: add mandatory pre-push checklist (lint + test + build) to
  AGENTS.python.md and AGENTS.go.md. [guardrail-change]

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Sharang Parnerkar
2026-04-19 16:41:39 +02:00
parent 71a4a3d7f3
commit c05a71163b
4 changed files with 42 additions and 15 deletions

View File

@@ -143,6 +143,26 @@ Domain errors are defined in `internal/domain/<aggregate>/errors.go` as sentinel
- Pass `ctx` everywhere. Cancellation respected. - Pass `ctx` everywhere. Cancellation respected.
- No global mutexes for request data. Use per-request context. - No global mutexes for request data. Use per-request context.
## Before every push — MANDATORY
Run all steps for `ai-compliance-sdk/` before pushing. CI runs the same checks and will fail if you skip this.
```bash
cd ai-compliance-sdk
# 1. Vet + lint
go vet ./...
golangci-lint run --timeout 5m ./...
# 2. Tests
go test ./...
# 3. Build
go build ./...
```
All steps must exit 0. Do not push if any step fails.
## What you may NOT do ## What you may NOT do
- Touch DB schema/migrations. - Touch DB schema/migrations.

View File

@@ -135,6 +135,26 @@ from .schemas.consent import * # noqa: F401, F403
- Log via `structlog` with bound context (`tenant_id`, `request_id`). Never log secrets, PII, or full request bodies. - Log via `structlog` with bound context (`tenant_id`, `request_id`). Never log secrets, PII, or full request bodies.
- Audit-relevant actions go through the audit logger, not the application logger. - Audit-relevant actions go through the audit logger, not the application logger.
## Before every push — MANDATORY
Run all three steps for every Python service you touched before pushing. CI runs the same checks and will fail if you skip this.
```bash
cd <service> # backend-compliance | document-crawler | dsms-gateway | compliance-tts-service
# 1. Lint
ruff check .
mypy compliance/ # only for backend-compliance
# 2. Tests
pytest -x
# 3. Import sanity (catches NameError at collection time)
python -c "import compliance" # or the service's main module
```
All steps must exit 0. Do not push if any step fails.
## What you may NOT do ## What you may NOT do
- Add a new Alembic migration. - Add a new Alembic migration.

View File

@@ -268,19 +268,4 @@ export function VendorComplianceProvider({
) )
} }
// ==========================================
// HOOK
// ==========================================
export function useVendorCompliance(): VendorComplianceContextValue {
const context = useContext(VendorComplianceContext)
if (!context) {
throw new Error(
'useVendorCompliance must be used within a VendorComplianceProvider'
)
}
return context
}

View File

@@ -25,6 +25,8 @@ DO NOT add new classes to this file. Add them to the appropriate aggregate
module and re-export here. module and re-export here.
""" """
import enum # noqa: F401 — used by inline enum classes below
# Order matters: later modules reference classes defined in earlier ones via # Order matters: later modules reference classes defined in earlier ones via
# SQLAlchemy string relationships. Keep foundational aggregates first. # SQLAlchemy string relationships. Keep foundational aggregates first.