Skip to content

feat: semchunk sidecar + AWS environment blueprint + quick-start (v1.57.0 → v1.59.0)#5

Merged
johntooth merged 6 commits into
mainfrom
claude/semchunk-sidecar-aws-iac-ubbx22
Jul 2, 2026
Merged

feat: semchunk sidecar + AWS environment blueprint + quick-start (v1.57.0 → v1.59.0)#5
johntooth merged 6 commits into
mainfrom
claude/semchunk-sidecar-aws-iac-ubbx22

Conversation

@johntooth

@johntooth johntooth commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Phase summary

Three phases on this branch:

v1.57.0 — opt-in semchunk sidecar + AWS IaC (ADR-030 executed, ADR-033). A new IChunker domain port injected into DocumentIndexingService; CHUNKER_PROVIDER=semchunk routes chunking through a Python FastAPI sidecar (services/semchunk/) with automatic, logged fallback to the existing fixed-window chunker — indexing degrades rather than fails; unset means byte-identical behaviour to before. New indexing only (corpus re-chunk stays deferred per ADR-030 Decision 2). Plus a production Dockerfile.web and a compose profile.

v1.58.0 — AWS environment blueprint (ADR-034). infra/aws became a two-layer blueprint so third parties can stamp Wayfinder environments on demand: core/ (apply once — VPC, ECS cluster + Service Connect namespace, shared RDS Postgres 16, ALB with wildcard HTTPS listener, ECR) and environments/ (one Terraform workspace per stamp — own database via cyrilgdn/postgresql, own S3 bucket/secrets/IAM, web service + https://<env>.<base_domain> host rule, optional per-env semchunk sidecar). scripts/new-environment.sh / destroy-environment.sh + optional workflow_dispatch workflow. Breaking for v1.57.0 infra adopters (flat layout removed; destroy-before-adopt documented).

v1.59.0 — quick-start (ADR-035). Setup for a cloud engineer collapsed to three commands:

./scripts/bootstrap.sh --region … --state-bucket … --base-domain … --route53-zone-id …
./scripts/db-tunnel.sh &
./scripts/new-environment.sh dev --via-tunnel
  • bootstrap.sh: idempotent preflight → state bucket → config generation → core apply → image build/push
  • core issues the wildcard ACM cert itself when a Route53 zone is given (certificate_arn now optional, plan-time guard requires one of the two)
  • default-on SSM bastion (t4g.nano, SSM-only, IMDSv2, ≈$4/mo, enable_bastion=false to remove) + db-tunnel.sh + --via-tunnel on stamp/destroy — removes the RDS network-path footgun; overrides redirect only the terraform provider, the stamped DATABASE_URL keeps the in-VPC host
  • environments inherit route53_zone_id from core

Files changed

  • App (v1.57.0): packages/domain/src/ports/chunker.ts; packages/adapters/src/extraction/{fixed-window,semchunk,fallback}-chunker.ts (+tests); indexing-service chunker injection; apps/web/src/lib/{env,container}.ts; services/semchunk/; docker-compose.yml; Dockerfile.web; .env.example
  • Infra (v1.58–59): infra/aws/{core,environments}/, modules network/database-server/cluster/environment/semchunk-service, scripts/{bootstrap,db-tunnel,new-environment,destroy-environment}.sh, backend.hcl.example; .github/workflows/provision-environment.yml
  • Repo: validate.sh check 16 (guarded terraform fmt/validate over both roots); PRD §10a; ADR-030/033/034/035; phase docs + summaries under implemented/v1.57.0–v1.59.0

Version bump

MINOR ×3 — 1.56.0 → 1.59.0 (VERSION + root package.json in sync; no DB schema changes in any phase).

Test coverage

  • Unit: 4 new adapter test files + extended indexing tests; ./validate.sh green after every phase (15 PASS, 0 FAIL)
  • Sidecar: 8 pytest contract tests, also executed during the image build
  • E2E: apps/web/e2e/phase-semchunk-sidecar.spec.ts — 4/4 passed against a live sidecar during the build
  • Scripts (documented e2e deviation — no in-repo runtime surface for IaC): all four scripts exercised directly — usage/exit codes, name validation, missing-binary/credentials/cert-or-zone errors, --via-tunnel parsing incl. invalid ports, tunnel-not-listening fail-fast

Notes for review

  • Terraform could not execute in the build sandbox (network policy): run terraform -chdir=infra/aws/core init -backend=false && terraform -chdir=infra/aws/core validate (same for environments/) before applying.
  • db-tunnel.sh assumes the AWS Session Manager plugin is installed.
  • Cert auto-issuance hangs if the hosted zone doesn't serve the domain's NS records (bootstrap prints a hint first).

🤖 Generated with Claude Code

https://claude.ai/code/session_01WR73cFcTm6JKJfGckK8JNa

claude added 4 commits July 1, 2026 21:35
Adds the planning docs for executing ADR-030's opt-in path plus a new
AWS deployment story:

- PRD: semchunk sidecar behind an IChunker port (env-var opt-in, new
  indexing only, fixed-window fallback) and Terraform on ECS Fargate
- ADR-033: Terraform + ECS Fargate topology, secrets, and the
  enable_semchunk variable gating the sidecar
- ADR-030: amended to Accepted (opt-in scope); corpus re-embedding
  migration remains deferred
- Phase doc targeting v1.57.0 (MINOR, no schema change)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WR73cFcTm6JKJfGckK8JNa
Executes ADR-030's opt-in path and implements ADR-033:

- IChunker domain port; FixedWindowChunker (existing behaviour),
  SemchunkChunker (HTTP client, Result-pattern errors), FallbackChunker
  (degrades to fixed windows and logs when the sidecar is down)
- DocumentIndexingService takes an injected IChunker; wiring selects by
  CHUNKER_PROVIDER env var (default: fixed, no network)
- services/semchunk: FastAPI wrapper around semchunk 4.x with healthz,
  input caps, offline tokenizer fallback; tests run in the image build
- docker-compose "semchunk" profile; production Dockerfile.web
  (real next build, AUTH_BYPASS dead in production)
- infra/aws Terraform: VPC, RDS Postgres 16, S3 + scoped IAM user,
  ECS Fargate + ALB, Secrets Manager; enable_semchunk deploys the
  sidecar behind Service Connect and wires the web task env atomically
- validate.sh check 16: guarded terraform fmt/validate

MINOR bump 1.56.0 -> 1.57.0. No DB changes. Corpus re-chunk migration
remains deferred (ADR-030 Decision 2).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WR73cFcTm6JKJfGckK8JNa
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WR73cFcTm6JKJfGckK8JNa
…(v1.58.0)

Implements ADR-034 (amends ADR-033): the repo becomes a blueprint third
parties use to provision Wayfinder environments on demand.

- infra/aws/core: apply once — VPC, ECS cluster + Service Connect
  namespace, shared RDS Postgres 16, ALB with wildcard HTTPS listener
  (fixed-404 default), shared ECR repositories
- infra/aws/environments: one terraform workspace per environment;
  each stamp owns its database (cyrilgdn/postgresql provider on the
  shared server), S3 bucket + scoped IAM user, secrets, task roles,
  web service + host rule <env>.<base_domain>, optional Route53 record,
  optional per-env semchunk sidecar (semchunk-<env> alias)
- scripts/new-environment.sh / destroy-environment.sh: one-command
  stamp/teardown with name validation and --plan dry-run
- .github/workflows/provision-environment.yml: optional
  workflow_dispatch stamping (inert until AWS vars/OIDC configured)
- partial backend config (backend.hcl.example) shared by local applies
  and the workflow; validate.sh check 16 covers both roots
- README rewritten around bootstrap → core → stamp → destroy

MINOR bump 1.57.0 -> 1.58.0. No app code or schema changes. Breaking
for v1.57.0 infra adopters: flat layout removed, destroy-before-adopt
(documented).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WR73cFcTm6JKJfGckK8JNa
@johntooth johntooth changed the title feat: opt-in semchunk sidecar + AWS Terraform IaC (v1.57.0) feat: opt-in semchunk sidecar + AWS environment blueprint (v1.57.0 → v1.58.0) Jul 1, 2026
…v1.59.0)

Implements ADR-035: collapses blueprint adoption from ~10 manual steps
to three commands and removes both setup footguns.

- scripts/bootstrap.sh: idempotent core setup (preflight, state bucket,
  backend.hcl + tfvars generation, core init/apply, image build+push)
- core issues the *.<base_domain> ACM certificate itself when
  route53_zone_id is set (certificate_arn now optional; plan-time guard
  requires one of the two)
- default-on SSM bastion (t4g.nano, SSM-only, IMDSv2, no ingress) +
  scripts/db-tunnel.sh + --via-tunnel on new/destroy-environment.sh:
  stamping works from a laptop; overrides redirect only the postgresql
  provider, stored DATABASE_URL keeps the in-VPC host
- environments inherit route53_zone_id from core ("" still opts out)
- README leads with the three-command quick start

MINOR bump 1.58.0 -> 1.59.0. No app code or schema changes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WR73cFcTm6JKJfGckK8JNa
@johntooth johntooth changed the title feat: opt-in semchunk sidecar + AWS environment blueprint (v1.57.0 → v1.58.0) feat: semchunk sidecar + AWS environment blueprint + quick-start (v1.57.0 → v1.59.0) Jul 2, 2026
@johntooth johntooth merged commit 9ab5d3e into main Jul 2, 2026
4 checks passed
@johntooth johntooth deleted the claude/semchunk-sidecar-aws-iac-ubbx22 branch July 3, 2026 04:14
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.

2 participants