Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 17 additions & 3 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ env:
# sudo drops the environment, so each `sudo apt-get` also sets this inline.
DEBIAN_FRONTEND: "noninteractive"
# Installed into each job's .venv before the lock; equal to `.gitlab-ci.yml`'s.
PIP_VERSION: "26.2.2"
PIP_VERSION: "26.3"

jobs:
verify:
Expand All @@ -52,7 +52,7 @@ jobs:
AWS_DEFAULT_REGION: "us-east-1"
# Exact Node release for the relay; its major must equal the relay Lambda runtime, and it
# equals `.gitlab-ci.yml`'s NODE_VERSION.
NODE_VERSION: "24.22.1"
NODE_VERSION: "24.22.3"

steps:
- name: Checkout
Expand Down Expand Up @@ -123,7 +123,7 @@ jobs:
- name: Set up pinned Terraform
uses: hashicorp/setup-terraform@dfe3c3f87815947d99a8997f908cb6525fc44e9e # v4.0.1
with:
terraform_version: 1.17.0
terraform_version: 1.17.2
# tests/unit/_terraform_fixture.py parses the real binary's stdout, not the wrapper's.
terraform_wrapper: false

Expand Down Expand Up @@ -327,6 +327,20 @@ jobs:
working-directory: .
run: .venv/bin/python -m pytest tests/integration/test_envelope_groups_contract.py tests/integration/test_eval_envelopes_contract.py

# The bundled relay and the real Runtime handle the same reconnect bodies.
- name: SPA-relay-Runtime reconnect contract (the frontend's pinned Node)
working-directory: .
run: .venv/bin/python -m pytest tests/integration/test_resume_contract.py

# The tier-comparison UI contract rewrites the fixture the frontend unit tests read.
- name: Tier-comparison UI contract
working-directory: .
run: .venv/bin/python -m pytest tests/integration/test_tier_comparison_ui_contract.py

- name: Tier-comparison fixture matches the committed copy
working-directory: .
run: git diff --exit-code -- frontend/src/pages/evals/__fixtures__/tierComparison.json

# src/types/generated/ is gitignored, so types are generated before anything consumes them.
- name: Generate types from the Python toolspec
run: npm run gen:types
Expand Down
54 changes: 41 additions & 13 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Runs `make verify` -- the offline aggregate gate: lint, typecheck, unit, stub, integration,
# relay, gates, shellcheck. No AWS credential and no cost.
# Tag must match the interpreter in .python-version.
image: python:3.13.18-slim
image: python:3.14.10-slim

stages:
- verify
Expand All @@ -13,7 +13,7 @@ variables:
LC_ALL: "C.UTF-8"
DEBIAN_FRONTEND: "noninteractive"
# Installed into each job's .venv before the lock.
PIP_VERSION: "26.2.2"
PIP_VERSION: "26.3"

# Base packages both jobs install.
.apt_deps: &apt_deps
Expand All @@ -40,17 +40,17 @@ verify:
AWS_ACCESS_KEY_ID: "local"
AWS_SECRET_ACCESS_KEY: "local" # pragma: allowlist secret
AWS_DEFAULT_REGION: "us-east-1"
TERRAFORM_VERSION: "1.17.0"
TERRAFORM_VERSION: "1.17.2"
GITLEAKS_VERSION: "8.30.1"
GITLEAKS_SHA256_X64: "551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb" # pragma: allowlist secret
GITLEAKS_SHA256_ARM64: "e4a487ee7ccd7d3a7f7ec08657610aa3606637dab924210b3aee62570fb4b080" # pragma: allowlist secret
SHELLCHECK_VERSION: "0.11.0"
SHELLCHECK_SHA256_X86_64: "8c3be12b05d5c177a04c29e3c78ce89ac86f1595681cab149b65b97c4e227198" # pragma: allowlist secret
SHELLCHECK_SHA256_AARCH64: "12b331c1d2db6b9eb13cfca64306b1b157a86eb69db83023e261eaa7e7c14588" # pragma: allowlist secret
# Major must equal the relay Lambda runtime in infra/modules/agent_relay/variables.tf.
NODE_VERSION: "24.22.1"
NODE_SHA256_X64: "6c172a9ab6718f7b801fb5a7bd486af2ee5e32758086a04b84fcce2aa77095e6" # pragma: allowlist secret
NODE_SHA256_ARM64: "dbabf7a1cbf947e6059ffad2c27b80041db97dea1e553b62afdee7f13fca336e" # pragma: allowlist secret
NODE_VERSION: "24.22.3"
NODE_SHA256_X64: "4f2b175a6d53a5c617a80dba2676238a0688cef28c6da4eba35c7d844e66fcfb" # pragma: allowlist secret
NODE_SHA256_ARM64: "6e51a2ada00f0011cc266f65d98922b403d7ad88f809ca2aa615a5fe1ce6e86c" # pragma: allowlist secret
# Minimum pytest-xdist worker count; equal to the Makefile's PYTEST_WORKERS default.
PYTEST_WORKERS_FLOOR: "4"
cache:
Expand Down Expand Up @@ -240,12 +240,17 @@ verify:
# Frontend lint, typecheck, unit tests and build, plus the emitted-CSS gate.
frontend:
stage: verify
image: node:26.13.0-slim
# Tag must match the interpreter in .python-version; Node comes from the pinned tarball below.
image: python:3.14.10-slim
variables:
NPM_CONFIG_FUND: "false"
NPM_CONFIG_AUDIT: "false"
CRM_REQUIRE_EMITTED_CSS: "1"
CRM_REQUIRE_TS_CONTRACTS: "1"
# Must equal frontend/.nvmrc.
FRONTEND_NODE_VERSION: "26.13.1"
FRONTEND_NODE_SHA256_X64: "5c063e46bab0fbc1c17cc445d7ff129cbdcd0471be6ed83b6ab864f8143bc864" # pragma: allowlist secret
FRONTEND_NODE_SHA256_ARM64: "89e1853138db51e8b82d3e98ba9c0d3f2956a28e5e55ea1b7e12d25aae92d5dd" # pragma: allowlist secret
cache:
key:
files:
Expand All @@ -255,14 +260,32 @@ frontend:
before_script:
- set -euo pipefail
- apt-get update -qq
- apt-get install -y -qq --no-install-recommends python3 python3-venv make git
- apt-get install -y -qq --no-install-recommends make git xz-utils curl ca-certificates libatomic1
- |
# Fail unless the image's Node matches frontend/.nvmrc.
# Install the pinned Node release; it must match frontend/.nvmrc.
pinned="$(cat frontend/.nvmrc)"
installed="$(node --version | sed 's/^v//')"
[ "$installed" = "$pinned" ] || {
echo "ERROR: frontend/.nvmrc pins ${pinned} but the image ships ${installed}" >&2; exit 1; }
echo "frontend Node ${installed} matches frontend/.nvmrc"
[ "${FRONTEND_NODE_VERSION}" = "$pinned" ] || {
echo "ERROR: frontend/.nvmrc pins ${pinned} but FRONTEND_NODE_VERSION is ${FRONTEND_NODE_VERSION}" >&2; exit 1; }
case "$(uname -m)" in
x86_64) node_arch="x64"; frontend_node_sha="${FRONTEND_NODE_SHA256_X64}" ;;
aarch64) node_arch="arm64"; frontend_node_sha="${FRONTEND_NODE_SHA256_ARM64}" ;;
*) echo "ERROR: no pinned Node digest for architecture $(uname -m)" >&2; exit 1 ;;
esac
node_dir="node-v${FRONTEND_NODE_VERSION}-linux-${node_arch}"
asset="${node_dir}.tar.xz"
curl -fsSL --retry 3 --retry-all-errors -o "/tmp/${asset}" \
"https://nodejs.org/dist/v${FRONTEND_NODE_VERSION}/${asset}"
echo "${frontend_node_sha} /tmp/${asset}" | sha256sum --check --strict -
tar -xJf "/tmp/${asset}" -C /usr/local --strip-components=1 --no-same-owner \
"${node_dir}/bin" "${node_dir}/include" "${node_dir}/lib"
rm -f "/tmp/${asset}"
resolved="$(command -v node)"
[ "$resolved" = /usr/local/bin/node ] || {
echo "ERROR: PATH resolves node to ${resolved}, not the pinned install" >&2; exit 1; }
installed="$(node --version)"
[ "$installed" = "v${pinned}" ] || {
echo "ERROR: frontend/.nvmrc pins ${pinned} but PATH resolves ${installed}" >&2; exit 1; }
echo "frontend node ${installed} (npm $(npm --version)) pinned at ${resolved}"
- python3 -m venv .venv
- .venv/bin/python -m pip install --no-input "pip==${PIP_VERSION}"
- |
Expand All @@ -275,6 +298,11 @@ frontend:
script:
- .venv/bin/python -m pytest tests/unit/test_check_emitted_css.py
- .venv/bin/python -m pytest tests/integration/test_envelope_groups_contract.py tests/integration/test_eval_envelopes_contract.py
# The SPA-relay-Runtime reconnect contract: the bundled relay and the real Runtime on the same bodies.
- .venv/bin/python -m pytest tests/integration/test_resume_contract.py
# The tier-comparison UI contract rewrites the fixture the frontend unit tests read.
- .venv/bin/python -m pytest tests/integration/test_tier_comparison_ui_contract.py
- git diff --exit-code -- frontend/src/pages/evals/__fixtures__/tierComparison.json
- cd frontend
- npm run gen:types
# The full gate, including the frontend consumer byte-diff the verify job defers.
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:

- id: check-log-redaction
name: check no log call site under src/ can emit a token, secret, or full record payload
entry: python3 scripts/check_log_redaction.py
entry: scripts/repo_python.sh scripts/check_log_redaction.py
language: system
pass_filenames: false
always_run: true
Expand All @@ -45,7 +45,7 @@ repos:

- id: gitleaks
name: gitleaks secret scan (working tree, non-ignored files)
entry: env -u GIT_DIR -u GIT_WORK_TREE -u GIT_COMMON_DIR -u GIT_OBJECT_DIRECTORY python3 scripts/check_secret_scan.py
entry: env -u GIT_DIR -u GIT_WORK_TREE -u GIT_COMMON_DIR -u GIT_OBJECT_DIRECTORY scripts/repo_python.sh scripts/check_secret_scan.py
language: system
pass_filenames: false
always_run: true
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.13.18
3.14.10
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# ECR Public mirror of the Docker Official Image. Tag must match .python-version; pip must match
# .gitlab-ci.yml's PIP_VERSION (tests/unit/test_dockerfile_pins.py).
FROM --platform=linux/arm64 public.ecr.aws/docker/library/python:3.13.18-slim AS base
FROM --platform=linux/arm64 public.ecr.aws/docker/library/python:3.14.10-slim AS base

# Fixed UID/GID for the non-root runtime user.
ARG APP_UID=10001
Expand All @@ -20,7 +20,7 @@ WORKDIR /app

# Dependency layer, cached across source-only changes.
COPY requirements.txt ./
RUN pip install --no-cache-dir --no-input pip==26.2.2 \
RUN pip install --no-cache-dir --no-input pip==26.3 \
&& pip install --no-cache-dir --no-input --no-deps -r requirements.txt

# src/providers/capabilities.py reads config/ relative to /app.
Expand Down
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ This is a demo and a research instrument, not a production CRM.

| Tool | Version |
|---|---|
| Python | exactly the version in `.python-version` (3.13.18); a newer host `python3` makes `pip install -e .` fail |
| Node.js | 26.13.0 for `frontend/` (`frontend/.nvmrc`); 24 or later for `src/relay/` (deployed on the `nodejs24.x` Lambda runtime) |
| Terraform | 1.17.0 or later (licensed under BUSL-1.1); the AWS provider is pinned to 6.71.0 |
| Python | exactly the version in `.python-version` (3.14.10); a host `python3` of any other minor version makes `pip install -e .` fail |
| Node.js | 26.13.1 for `frontend/` (`frontend/.nvmrc`); 24 or later for `src/relay/` (deployed on the `nodejs24.x` Lambda runtime) |
| Terraform | 1.17.2 tested; 1.17.0 or later required (licensed under BUSL-1.1); the AWS provider is pinned to 6.72.0 |
| Docker | for DynamoDB Local (`amazon/dynamodb-local:3.3.2`, pinned by digest in `scripts/run_local_dynamodb.sh`) |
| ShellCheck | 0.11.0 (pinned in CI); `make verify` runs it |
| gitleaks | 8.30.1 (pinned in CI); optional locally, where `check_secret_scan` skips without it |
Expand Down Expand Up @@ -105,7 +105,7 @@ and route tables, and the API Gateway logging role and setting. See
## Install

```bash
python3.13 -m venv .venv # the interpreter whose version matches .python-version
python3.14 -m venv .venv # the interpreter whose version matches .python-version
# On a version mismatch this prints "wrong interpreter" and installs no Python packages.
{ [ "$(.venv/bin/python --version)" = "Python $(cat .python-version)" ] || { echo "wrong interpreter" >&2; false; }; } &&
.venv/bin/pip install --no-input --no-deps -r requirements.txt &&
Expand Down Expand Up @@ -473,13 +473,18 @@ the backend must go before the Runtime's network interfaces are released.
- Most `violation_*.json` plan fixtures still record AWS provider 6.62.0, the version of the plan
they were derived from. The compliant plan fixtures and the two violation fixtures derived from
them are built at test time by `scripts/plan_fixtures.py`, from
`tests/fixtures/plans/compliant.base.ndjson`, which was captured from a plan under the
then-pinned 6.68.0 provider.
- The last grype scan covered the previous AWS provider pin, `hashicorp/aws` 6.70.0 (go1.26.10,
`golang.org/x/net` v0.61.0): no matches against its DB built 2026-10-25, measured 2026-10-25. The
pinned 6.71.0 has not been scanned. The binary is local Terraform tooling and is never deployed.
`tests/fixtures/plans/compliant.base.ndjson`, which was captured from a plan under
Terraform 1.17.2 and the pinned 6.72.0 provider.
- The last grype scan (grype 0.121.2) covered the pinned AWS provider's `darwin_arm64` build only,
`hashicorp/aws` 6.72.0 (go1.27.3, `golang.org/x/net` v0.62.0): one match against its DB built
2026-11-13, measured 2026-11-13. The match is GO-2026-6859 in the Go standard library, a race in
HTTP/1 servers that use `MaxBytesReader`, with severity unknown and the fix in go1.27.4. The
binary is local Terraform tooling and is never deployed.
- The JWKS fetch in `scripts/smoke/cognito_claims.py` uses PyJWT's own HTTP client, not the smoke
harness's https-only opener.
- When the tool-output bound trims a page of records, the page's `next_cursor` still resumes after
the full page, so paging on cannot reach the trimmed records. Requesting the page again with a
smaller `limit` does.
- **Principal boundary.** Resource policies deny the data and administration of these stores to every
principal outside the project roles that use them, the operators in `crm_operator_principal_arns`
and, for administration, the account root:
Expand All @@ -506,6 +511,10 @@ the backend must go before the Runtime's network interfaces are released.
- The CRM log groups stay readable by any principal in the account with CloudWatch Logs read
permissions. CloudWatch Logs decrypts under its own service identity, so the logs key Deny
refuses direct key use but not log reads. Log redaction applies to what they can read.
- Chat history items in the `reps` table expire 24 hours after their last write, but DynamoDB
deletes expired items in the background, typically within a few days of expiry, and `reps`'
point-in-time recovery keeps them for its 35-day window. Removing a user's history sooner means deleting its `history#` items as an operator (see
`docs/runbook.md`, "Conversation history").
- Until the first secret rotation, the MCP app client's secret stays readable through
`cognito-idp:DescribeUserPoolClient` by any principal allowed that action; Cognito user pools have
no resource policy. After a rotation (`scripts/rotate_mcp_client_secret.py`, see
Expand Down
Loading
Loading