Skip to content
Merged
Show file tree
Hide file tree
Changes from 86 commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
b4d4577
simple error page
dbarkowsky May 20, 2026
8adf282
send error to backend for logging
dbarkowsky May 20, 2026
4b2ef5c
remove Hello World page
dbarkowsky May 20, 2026
32709e1
add error boundary pages
dbarkowsky May 20, 2026
3bf6c3e
add useEffect and tests
dbarkowsky May 20, 2026
572838c
test improvement
dbarkowsky May 20, 2026
a400f90
Create TEMPORAL_DATA_FOOTPRINT_REDUCTION_PLAN.md
kmandryk May 25, 2026
f972786
feat(temporal): add shared gzip Temporal payload codec package
kmandryk May 29, 2026
ef80f72
feat(workflow): extract shared graph config hash and overrides package
kmandryk May 29, 2026
a60377e
feat(temporal): add OCR payload blob refs and activity helpers
kmandryk May 29, 2026
9c6b4b9
feat(temporal): persist OCR activity outputs as blob refs
kmandryk May 29, 2026
1a818d2
feat(temporal): load graph config by version and slim workflow results
kmandryk May 29, 2026
0e7a392
feat(temporal): slim benchmark workflows and thread groupId
kmandryk May 29, 2026
f1ac4e6
feat(backend): start graph workflows with version hash and overrides
kmandryk May 29, 2026
aa1bc3a
feat(workflow): add OCR ref migrator and update workflow templates
kmandryk May 29, 2026
f255944
test(integration): update graph workflow integration harness
kmandryk May 29, 2026
900bb91
plain error boundary, no mantine, move up DOM
dbarkowsky Jun 1, 2026
c670fa7
merge commit
kmandryk Jun 4, 2026
44e68fc
Prevent prototype pollution in workflow overrides
kmandryk Jun 4, 2026
bd319ca
Prevent prototype pollution in config overrides
kmandryk Jun 4, 2026
3d15fc9
fix behaviour issues with group join/leave/visibility
dbarkowsky Jun 4, 2026
483110f
separate confusion profiles tab from groups
dbarkowsky Jun 4, 2026
92b052e
batch cancel membership in transaction
dbarkowsky Jun 5, 2026
261724c
Add DB_POOL_MAX handling and defaults (Prisma pools)
kmandryk Jun 5, 2026
9829b39
Support k6 VUS/DURATION and fix seed statuses
kmandryk Jun 6, 2026
22f2344
Merge branch 'develop' into AI-1323
dbarkowsky Jun 8, 2026
145662d
Lower default DB_POOL_MAX from 20 to 10
kmandryk Jun 8, 2026
295fe8e
Merge branch 'develop' into AI-1261
dbarkowsky Jun 8, 2026
6c88d78
Parameterize k6 scripts and add throttling docs
kmandryk Jun 9, 2026
7c16479
Enforce 100MB limit for classifier uploads
kmandryk Jun 9, 2026
18a7e4b
increase helm timeout to 300s
dbarkowsky Jun 9, 2026
e1c6ed6
linting
dbarkowsky Jun 9, 2026
465c03b
Merge branch 'develop' into AI-1261
dbarkowsky Jun 9, 2026
0f5ab25
Merge pull request #172 from bcgov/AI-1261
dbarkowsky Jun 9, 2026
a3ef7ef
Potential fix for pull request finding 'CodeQL / Prototype-polluting …
kmandryk Jun 9, 2026
3ad6f60
Add UploadNormalizationLimiter and overlap writes
kmandryk Jun 9, 2026
3fb9220
fix issue with importing graph workflow package in frontend
dbarkowsky Jun 10, 2026
792ce95
update groups page test
dbarkowsky Jun 10, 2026
7e2db39
Merge branch 'develop' into AI-1323
dbarkowsky Jun 10, 2026
eacab3a
biome fixes
kmandryk Jun 10, 2026
b1479be
update vitest and jsdom; jsdom had to be hoisted to root due to vites…
dbarkowsky Jun 10, 2026
10d8768
change order of files parameter access. Confirmed array first
dbarkowsky Jun 10, 2026
6faf120
update fast-xml packages
dbarkowsky Jun 10, 2026
6d4e99f
update concurrently package
dbarkowsky Jun 10, 2026
3e15542
update axios
dbarkowsky Jun 10, 2026
6934b43
protobufjs override
dbarkowsky Jun 10, 2026
3149098
fast-uri override
dbarkowsky Jun 10, 2026
9e9541b
Merge pull request #189 from bcgov/AI-1239
kmandryk Jun 11, 2026
5589645
Merge branch 'develop' into AI-1238
kmandryk Jun 11, 2026
f893836
Merge pull request #185 from bcgov/AI-1238
kmandryk Jun 11, 2026
780482b
Merge pull request #190 from bcgov/fix/increase-helm-timeout
dbarkowsky Jun 15, 2026
4bf90e9
Merge pull request #180 from bcgov/AI-1323
dbarkowsky Jun 15, 2026
6acf72c
increase loki and promtail memory
dbarkowsky Jun 15, 2026
825bceb
smaller rotation values for more frequent sending
dbarkowsky Jun 15, 2026
956d10d
prometheus metrics for loki
dbarkowsky Jun 15, 2026
28590d7
prometheus service account
dbarkowsky Jun 15, 2026
0364ca2
self review round one
dbarkowsky Jun 15, 2026
1afcd03
grafana recreate strategy
dbarkowsky Jun 15, 2026
1df8edb
alermanager only create receiver if notifications enabled
dbarkowsky Jun 15, 2026
847d0fc
ches only if notificaitons enabled
dbarkowsky Jun 15, 2026
8bfbe06
documentatino update
dbarkowsky Jun 15, 2026
f20997e
bump frontend axios
dbarkowsky Jun 15, 2026
4929395
address additional high tier npm vulns
dbarkowsky Jun 15, 2026
b6bc0a0
Merge branch 'develop' into AI-1392
dbarkowsky Jun 15, 2026
ba0b4d2
update lock file
dbarkowsky Jun 15, 2026
b723838
Merge branch 'develop' (AI-1238) into AI-1223
kmandryk Jun 16, 2026
f6b103f
Add @biomejs/cli-linux-x64 devDependency
kmandryk Jun 16, 2026
c71e0a0
Merge pull request #188 from bcgov/AI-1223
kmandryk Jun 16, 2026
c17a306
Merge branch 'develop' into AI-1240
kmandryk Jun 16, 2026
0473b8c
Add normalization semaphore; preserve originals
kmandryk Jun 16, 2026
2f6646a
add openshift egress ips to allow list
dbarkowsky Jun 16, 2026
6e319a3
Merge branch 'develop' into AI-1392
dbarkowsky Jun 16, 2026
1f3c993
Merge pull request #192 from bcgov/AI-1240
kmandryk Jun 16, 2026
57d9b24
Merge pull request #195 from bcgov/fix/openshift-ip-range-ingress
dbarkowsky Jun 16, 2026
d0f10ea
Merge pull request #194 from bcgov/fix/loki-promtail-mem-bump
dbarkowsky Jun 16, 2026
2cf5727
Merge pull request #193 from bcgov/AI-1392
dbarkowsky Jun 16, 2026
a85c8fc
give deployment service account permission to create separate service…
dbarkowsky Jun 17, 2026
cb95d35
Throw ApplicationFailure on failed OCR responses
kmandryk Jun 17, 2026
fa05b23
Merge pull request #196 from bcgov/fix/plg-user-issue
dbarkowsky Jun 17, 2026
a35b641
merge commit
kmandryk Jun 17, 2026
7f06c2f
biome fixes
kmandryk Jun 17, 2026
cf89662
Merge pull request #179 from bcgov/AI-1264
kmandryk Jun 17, 2026
f5d9947
role based access control permissions
dbarkowsky Jun 17, 2026
012c892
delete immutable stateful set pieces before redeployment to allow edit
dbarkowsky Jun 17, 2026
69d509f
bump up frontend memory
dbarkowsky Jun 17, 2026
06e98cf
Merge pull request #197 from bcgov/fix/plg-user-issue
dbarkowsky Jun 18, 2026
a187dc0
combine graph-workflow and graph-workflow-config packages, make sure …
dbarkowsky Jun 19, 2026
0d285d1
add build step to qa workflows
dbarkowsky Jun 19, 2026
d070609
workflows only run when necessary!
dbarkowsky Jun 19, 2026
646364f
temporal import fix
dbarkowsky Jun 19, 2026
0a4be17
Merge pull request #200 from bcgov/fix/missing-packages-in-build
alex-struk Jun 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
# ── Database (shared by backend-services and temporal worker) ─────────────────
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/ai_doc_intelligence?schema=public"
# Database Connection Pool
# Maximum number of database connections per pod (default: 5)
# Maximum number of database connections per pod (default: 10)
# Scale this based on: concurrent requests per pod, pod count, and Postgres max_connections (default: 100)
# Example: 3 backend pods * 5 connections = 15 total connections
DB_POOL_MAX=5
# Example: 5 backend pods * 10 connections + 4 worker pods * 3 = 62 total connections
DB_POOL_MAX=10

# ── MinIO (object storage) ────────────────────────────────────────────────────
MINIO_ROOT_USER=minioadmin
Expand Down
21 changes: 20 additions & 1 deletion .github/workflows/deploy-instance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,25 @@ jobs:
"app.kubernetes.io/instance=${INSTANCE_NAME}" --overwrite \
-n "${OC_NAMESPACE}" || true

- name: Delete immutable PLG StatefulSets before upgrade
if: env.DEPLOY_PLG == 'true'
env:
INSTANCE_NAME: ${{ needs.metadata.outputs.instance-name }}
OC_NAMESPACE: ${{ needs.metadata.outputs.namespace || secrets.OPENSHIFT_NAMESPACE }}
run: |
set -euo pipefail
PLG_RELEASE="${INSTANCE_NAME}-plg"
# StatefulSet volumeClaimTemplates are immutable in Kubernetes.
# Delete the StatefulSets so Helm can recreate them with the correct
# spec. PVCs are not deleted and data is preserved.
for ss in loki prometheus; do
SS_NAME="${PLG_RELEASE}-${ss}"
if oc get statefulset "${SS_NAME}" -n "${OC_NAMESPACE}" &>/dev/null; then
echo "Deleting StatefulSet ${SS_NAME} for clean upgrade..."
oc delete statefulset "${SS_NAME}" -n "${OC_NAMESPACE}" --cascade=orphan
fi
done

- name: Deploy PLG monitoring stack
if: env.DEPLOY_PLG == 'true'
env:
Expand Down Expand Up @@ -482,7 +501,7 @@ jobs:
--set "alertmanager.ches.adapterUrl=http://${PLG_RELEASE}-ches-adapter:3003/" \
--set "chesAdapter.secretName=${INSTANCE_NAME}-ches-adapter-secrets" \
--set "alertmanager.teams.webhookUrl=${ALERTMANAGER_TEAMS_WEBHOOK_URL:-placeholder}" \
--wait --timeout 120s
--wait --timeout 300s

- name: Restart deployments and wait
env:
Expand Down
9 changes: 5 additions & 4 deletions apps/backend-services/integration-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ MANAGE_WORKER=true npm run test:int:workflow
npm run test:int:workflow:with-worker

# Run with specific template and test file
WORKFLOW_TEMPLATE=multi-page-report-workflow TEST_FILE=multi-page-sample-1.pdf npm run test:int:workflow:with-worker
WORKFLOW_SLUG=multi-page-report TEST_FILE=multi-page-sample-1.pdf npm run test:int:workflow:with-worker
```

**Benefits:**
Expand All @@ -64,7 +64,7 @@ npm run dev

# Terminal 2: Run the test
cd ~/GitHub/ai-adoption-document-intelligence/apps/backend-services
WORKFLOW_TEMPLATE=multi-page-report-workflow TEST_FILE=multi-page-sample-1.pdf npm run test:int:workflow
WORKFLOW_SLUG=multi-page-report TEST_FILE=multi-page-sample-1.pdf npm run test:int:workflow
```

**Benefits:**
Expand All @@ -78,7 +78,8 @@ WORKFLOW_TEMPLATE=multi-page-report-workflow TEST_FILE=multi-page-sample-1.pdf n
|----------|---------|-------------|
| `MANAGE_WORKER` | `false` | Set to `true` to have the test start/stop the worker |
| `WORKER_STARTUP_DELAY` | `5000` | Milliseconds to wait for worker to initialize (when `MANAGE_WORKER=true`) |
| `WORKFLOW_TEMPLATE` | `standard-ocr-workflow` | Workflow template to test (from `docs-md/templates/`) |
| `WORKFLOW_SLUG` | `standard-ocr` | Seeded workflow lineage slug (`workflow_versions` in DB) |
| `WORKFLOW_VERSION` | *(head)* | Optional pin to a specific `version_number` |
| `TEST_FILE` | `test-document.jpg` | Test file to upload (from `integration-tests/`) |
| `BACKEND_URL` | `http://localhost:3002` | Backend API URL |
| `TEMPORAL_ADDRESS` | `localhost:7233` | Temporal server address |
Expand Down Expand Up @@ -125,7 +126,7 @@ Example output:

```bash
# Test with managed worker and custom template
MANAGE_WORKER=true WORKFLOW_TEMPLATE=multi-page-report-workflow TEST_FILE=multi-page-sample-1.pdf npm run test:int:workflow
MANAGE_WORKER=true WORKFLOW_SLUG=multi-page-report TEST_FILE=multi-page-sample-1.pdf npm run test:int:workflow

# Test with longer timeout for complex workflows
MANAGE_WORKER=true TEST_TIMEOUT=600000 npm run test:int:workflow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,33 @@ npm run test:int:workflow
## What the Test Does

1. ✓ Checks that Temporal (port 7233) and Backend (port 3002) are running
2. ✓ Loads `docs-md/templates/standard-ocr-workflow.json`
2. ✓ Resolves a workflow by `workflow_slug` and uses its `workflowVersionId`
3. ✓ Loads test image from `integration-tests/test-document.jpg`
4. ✓ Creates workflow config in database
5. ✓ Uploads test document
4. ✓ Uploads test document (which triggers versionId-only Temporal start)
6. ✓ Monitors workflow execution through Temporal
7. ✓ Shows real-time progress of each activity
8. ✓ Cleans up test data when done

## Troubleshooting

### Document status `failed` immediately (no Temporal workflow)

Upload returns before background OCR runs. If the document moves to `failed` without a `workflow_execution_id`, OCR never reached Temporal.

**Common cause:** API key `group_id` contains characters invalid for blob paths (e.g. `seed-default-group`). OCR reads blobs via `validateBlobFilePath`, which requires group ids matching `/^[a-z][0-9a-z]+$/`.

**Fix:** Re-seed and point the API key at the seeded group:

```bash
cd apps/backend-services
npm run db:seed
# Then update api_keys.group_id to seeddefaultgroup for your test key
```

### `workflow not found` in Temporal

Ensure the Temporal worker is running (`cd apps/temporal && npm run dev`) and listening on task queue `ocr-processing` (default). The test now polls the document API for `workflow_execution_id` before monitoring Temporal.

## Expected Behavior

The test will run and **should currently fail** at the `azureOcr.submit` activity with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ The test uses the following environment variables (with defaults):
- `TEMPORAL_NAMESPACE` (default: `default`)
- `TEST_API_KEY` (required for authentication)
- `TEST_TIMEOUT` (default: `300000` ms / 5 minutes)
- `WORKFLOW_TEMPLATE` (default: `standard-ocr-workflow`)
- `WORKFLOW_SLUG` (default: `standard-ocr`) — seeded workflow lineage slug in the database
- `WORKFLOW_VERSION` (optional) — pin a specific `version_number`; default is head version
- `TEST_FILE` (default: `test-document.jpg`)

These are typically already configured in your `.env` file.
Expand Down Expand Up @@ -81,17 +82,21 @@ ts-node -r tsconfig-paths/register integration-tests/test-graph-workflow.ts

### Testing Different Workflows

You can test different workflow templates by setting the `WORKFLOW_TEMPLATE` environment variable:
The harness resolves a **seeded** workflow by `WORKFLOW_SLUG` (not by loading JSON from disk). Re-seed after template changes:

```bash
# Test standard OCR workflow (default)
cd apps/backend-services && npx tsx ../shared/prisma/seed.ts
```

```bash
# Test standard OCR workflow (default slug: standard-ocr)
npm run test:int:workflow

# Test multi-page report workflow
WORKFLOW_TEMPLATE=multi-page-report-workflow npm run test:int:workflow
WORKFLOW_SLUG=multi-page-report npm run test:int:workflow

# Test with a different file
TEST_FILE=my-test-file.pdf WORKFLOW_TEMPLATE=multi-page-report-workflow npm run test:int:workflow
TEST_FILE=my-test-file.pdf WORKFLOW_SLUG=multi-page-report npm run test:int:workflow
```

## Test Flow
Expand All @@ -102,10 +107,9 @@ TEST_FILE=my-test-file.pdf WORKFLOW_TEMPLATE=multi-page-report-workflow npm run
└─ Check Backend API health endpoint

2. Test Setup
├─ Load workflow config from docs-md/templates/{WORKFLOW_TEMPLATE}.json
├─ Resolve workflow version by WORKFLOW_SLUG (seeded workflow_versions row)
├─ Load test file (from integration-tests/{TEST_FILE})
├─ Create workflow configuration in database
└─ Upload document via /api/upload
└─ Upload document via /api/upload (workflow_config_id → versionId-only Temporal start)

3. Workflow Execution
├─ Initialize Temporal client
Expand Down Expand Up @@ -177,19 +181,21 @@ When running successfully, you'll see output like:
- Ensure backend is running: `cd apps/backend-services && npm run start:dev`
- Check health endpoint: `curl http://localhost:3001/health`

### "Workflow template not found"
### "Workflow not found" / unknown slug

- Verify the template exists: `ls docs-md/templates/standard-ocr-workflow.json`
- Re-seed: `npx tsx ../shared/prisma/seed.ts` from `apps/backend-services`
- List slugs in DB or check seed: `standard-ocr`, `multi-page-report`
- Canonical JSON templates: `docs-md/graph-workflows/templates/standard-ocr-workflow.json`

### "Test file not found"

- Verify the test file exists: `ls apps/backend-services/integration-tests/test-document.jpg`

## Test Data

- **Workflow Templates**:
- `docs-md/templates/standard-ocr-workflow.json` (default)
- `docs-md/templates/multi-page-report-workflow.json`
- **Workflow slugs (seed)**:
- `standard-ocr` (default) — template `docs-md/graph-workflows/templates/standard-ocr-workflow.json`
- `multi-page-report` — template `docs-md/graph-workflows/templates/multi-page-report-workflow.json`
- **Test Documents**:
- `apps/backend-services/integration-tests/test-document.jpg` (default)
- You can add your own test files and reference them via `TEST_FILE` env var
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
# script lives at apps/backend-services/integration-tests/graph-workflow-tests
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../../.." && pwd)"
BACKEND_DIR="$PROJECT_ROOT/apps/backend-services"

# Colors
RED='\033[0;31m'
Expand All @@ -24,15 +26,18 @@ echo -e "${BLUE}===========================================================${NC}
echo ""

# Check if services are running
check_service() {
check_http_service() {
local name=$1
local url=$2
local max_attempts=3
local attempt=1

while [ $attempt -le $max_attempts ]; do
if curl -s -f -o /dev/null "$url"; then
echo -e "${GREEN}✓${NC} $name is running"
# Backend health check: 200 or 401 both indicate the server is up.
local status
status=$(curl -s -o /dev/null -w "%{http_code}" "$url" || true)
if [ "$status" = "200" ] || [ "$status" = "401" ]; then
echo -e "${GREEN}✓${NC} $name is running (HTTP $status)"
return 0
fi
attempt=$((attempt + 1))
Expand All @@ -45,18 +50,33 @@ check_service() {
return 1
}

# Temporal gRPC endpoint is not HTTP; just check the TCP port is open.
check_tcp_port() {
local name=$1
local host=$2
local port=$3
if command -v nc >/dev/null 2>&1; then
if nc -z "$host" "$port" >/dev/null 2>&1; then
echo -e "${GREEN}✓${NC} $name is listening on $host:$port"
return 0
fi
fi
echo -e "${YELLOW}⚠${NC} Could not verify $name port ($host:$port). Install netcat (nc) to enable this check."
return 0
}

# Service checks
echo "Checking required services..."
echo ""

TEMPORAL_OK=false
BACKEND_OK=false

if check_service "Temporal Server" "http://localhost:7233"; then
if check_tcp_port "Temporal Server" "localhost" "7233"; then
TEMPORAL_OK=true
fi

if check_service "Backend API" "http://localhost:3002/api/models"; then
if check_http_service "Backend API" "http://localhost:3002/api/models"; then
BACKEND_OK=true
fi

Expand Down
Loading
Loading