Skip to content

Latest commit

 

History

History
133 lines (91 loc) · 7.92 KB

development.md

File metadata and controls

133 lines (91 loc) · 7.92 KB

Local development

Prerequisites

Use JDK 21, Maven 3.9 and Node.js >=20.11. Backend integration tests require PostgreSQL 16, OpenSearch 2.18 and an SQS protocol server (ElasticMQ 1.6.11). Docker Compose is optional; portable Windows distributions also work. Playwright uses installed Chrome by default.

The Java root package is io.architectureintelligence; the executable is services/platform/target/architecture-intelligence-platform-1.0.0.jar. Existing DESIGN5_* configuration keys remain stable; see compatibility identifiers.

Local credentials and services

Supply values through your shell or secret manager. Do not paste credentials into source, command arguments or committed files.

Variable Purpose
DESIGN5_DB_PASSWORD Your local PostgreSQL password
DESIGN5_JWT_SECRET Your local signing key, at least 32 characters
DESIGN5_DEMO_USER_PASSWORD Required only when explicitly seeding/signing into the local demo account
DESIGN5_DEMO_USER_EMAIL Optional; defaults to demo@architecture-intelligence.local
DESIGN5_TEST_DB_PASSWORD Password for the disposable integration database
DESIGN5_TEST_JWT_SECRET Signing key for the isolated integration context

No reusable password is distributed. Compose can read an ignored root .env with --env-file .env; Maven and PowerShell scripts do not load that file automatically.

Service Local endpoint
PostgreSQL 127.0.0.1:55433; user platform, database architecture_intelligence
Integration database Same server; architecture_intelligence_test only, disposable
OpenSearch http://127.0.0.1:9201
SQS protocol http://127.0.0.1:9325
API / health http://127.0.0.1:8080 / /actuator/health
Frontend http://127.0.0.1:5179

Docker Compose

docker compose --env-file .env -f infra/docker/docker-compose.yml config --quiet
docker compose --env-file .env -f infra/docker/docker-compose.yml up --build

The architecture-intelligence Compose project uses dedicated PostgreSQL, OpenSearch and document-store volumes. The API and worker share document storage. A fresh database volume initializes both database names; existing volumes are not reset. Seeding defaults to false. To create the synthetic demo corpus on a fresh development database, explicitly supply DESIGN5_DEMO_SEED_ON_STARTUP=true and your demo credentials.

Docker source is provided and statically audited; runtime/build execution has not been verified on the validation workstation. Keep these unauthenticated search/queue development services loopback-bound.

Portable Windows services

Set DESIGN5_TOOLS to installed portable distributions, or use the default ignored .tools/ directory:

<tools>/jdk/jdk-*/
<tools>/maven/apache-maven-*/
<tools>/pg/pgsql/
<tools>/opensearch/opensearch-*/
<tools>/elasticmq.jar

JAVA_HOME can supply the JDK instead. Put Maven's bin on PATH. The scripts read distributions and write local data, configuration, logs and owned process records under ignored .runtime/.

.\scripts\stack-up.ps1
mvn -f services/platform/pom.xml package
.\scripts\run-api.ps1 -Seed
npm ci
npm start

Use run-api.ps1 without -Seed for ordinary startup. -Role api and -Role worker run separate roles; give them different HTTP ports. An API-only role needs a worker for asynchronous indexing. Scripts refuse unidentified occupied service ports and verify the database directory and process ownership.

.\scripts\stop-api.ps1
.\scripts\stack-down.ps1

Stopping preserves data. There is no reset command. Stop the API before rebuilding its JAR on Windows.

Backend verification

With dependencies running and credentials present:

$env:DESIGN5_TEST_DB_PASSWORD = $env:DESIGN5_DB_PASSWORD
$env:DESIGN5_TEST_JWT_SECRET = $env:DESIGN5_JWT_SECRET
mvn -f services/platform/pom.xml clean verify

Surefire runs *Test.java; Failsafe runs *IT.java during verify. test and package alone do not run integration tests. Full verification also checks Spotless, SpotBugs and JaCoCo reporting. Apply configured formatting with mvn -f services/platform/pom.xml spotless:apply. The optional SBOM command is mvn -f services/platform/pom.xml -Psbom package.

Integration tests clear only architecture_intelligence_test, with separate design5test indices and design5-test-* queues. Never point them at application data. Missing dependencies can cause JUnit assumption skips; a complete result requires zero skipped integration tests. Endpoint overrides are DESIGN5_TEST_DB_URL, DESIGN5_TEST_OPENSEARCH_ENDPOINT and DESIGN5_TEST_SQS_ENDPOINT; database identity also supports DESIGN5_TEST_DB_USERNAME.

Frontend verification

npm ci
npm test
# Keep the seeded API and npm start running; supply the demo password in this shell.
npm run test:browser

The full browser suite uses committed geometry fixtures and does not require a separate archive snapshot. FRONTEND_URL, ARCHITECTURE_API_BASE_URL and PLAYWRIGHT_CHANNEL override defaults. Optional BASELINE_URL also compares a separately served reference frontend. Reports/screenshots use ignored test-results/; traces/videos remain off to avoid recording credentials. See frontend.

Corpus and evaluation

The committed JSON, Markdown documents, RFP briefs and fixed-seed generator are intentional synthetic fixtures. They do not describe real buildings. Photographs are separately credited in ASSETS.md.

node tests/evaluation/run-evaluation.mjs
node tests/evaluation/run-rfp-evaluation.mjs
node tests/performance/run-performance.mjs --scale 0

RFP/performance runners require the supplied demo password. The performance runner defaults to --scale 20000 and writes/removes synthetic perf- records; use it only on disposable development data. --scale 0 avoids bulk corpus creation but still performs match runs and index operations. Temporary results are ignored. See evaluation and performance.

node scripts/generate-demo-corpus.mjs --write explicitly replaces tracked demo fixtures from the fixed seed. Do not run it as part of routine startup.

Profiles and existing databases

local uses caller credentials, filesystem storage and deterministic embeddings. prod requires deployment configuration, S3 and an HTTP embedding provider; Flyway is disabled there. prod,migrate performs the separate schema task. migrate disables messaging, seeding, reconciliation and HTTP. Flyway validates checksums, forbids cleaning and does not baseline automatically; Hibernate validates the schema.

Before connecting to an existing database, inspect tables and flyway_schema_history read-only, compare installed V1–V4 checksums and arrange an owner-approved backup. A nonempty database without matching history requires a schema diff and explicit reconciliation. Never repair, replay, reset or baseline it automatically. See runbook.

Frontend routing

npm start binds loopback and supplies public config.js from ARCHITECTURE_API_BASE_URL (default http://127.0.0.1:8080). A deployed static frontend must supply its API base URL, matching backend allowed origins and CSP. Same-origin serving requires an explicit API route; S3 alone does not provide one. Only ship the browser asset allowlist described in frontend.

Terraform validation

Use Terraform >=1.9 for local validation; the example remote S3 backend's native use_lockfile requires >=1.10 when actually initializing that backend. From each dev/staging/prod root:

terraform init -backend=false
terraform validate

Run terraform fmt -check -recursive infra/terraform from the repository root. Backend-disabled initialization downloads providers/modules locally but does not deploy. Keep private backend settings, plans, state and provider caches out of Git.