14 KiB
Checks and quality evaluation
Routine checks prove individual code properties. They do not establish ranking accuracy, grade validity, production latency, or complete product readiness.
Commands
Use the root Make targets:
make test
make check
make verify
make docs-check
make test runs backend, frontend, and ML tests. make check also runs API contract, formatting, lint, type, build, Compose, observability, and documentation checks. make verify sequentially generates contracts, checks generated drift, runs root check, API toolchain/backend race and integration checks, and then starts an isolated deployment smoke. It uses Docker.
Useful focused commands:
| Command | Coverage |
|---|---|
| make -C api check | Schema merge, bundles, OpenAPI lint, merge-script tests |
| make -C backend test | Go unit suite with race detector |
| make -C backend test-fast | Faster Go tests without race instrumentation |
| make -C backend test-int | Go integration tests with Testcontainers/PostgreSQL/Redis/SeaweedFS |
| make -C frontend check | Prettier, ESLint, Stylelint, TypeScript, Vitest, FSD boundaries, build |
| make -C ml check | Ruff, mypy, pytest, and wheel build |
| make -C ml check-generated | Pydantic models match the ML bundle without rewriting files |
| make -C deploy config | Render Compose configurations without starting them |
| make -C deploy smoke | Isolated technical smoke of service health routes |
| make -C deploy test-e2e | Playwright browser suite against an isolated throwaway stack |
| make -C observability check | Validate Prometheus, Loki, Alloy, and dashboard JSON |
make -C deploy test-e2e currently runs a technical browser suite, not a business-flow suite; see Browser E2E suite.
make -C ml check-generated uses datamodel-code-generator --check: a mismatch fails the check and leaves the models file unchanged. Prepare the bundle with make -C api bundle before checking; use make -C ml generate to update Python models. Generated models do not establish inference functionality or support for every OpenAPI 3.2 feature.
Security checks run separately: make -C security check scans source/dependencies/secrets, make -C security test validates local Semgrep fixtures, installer integrity, and govulncheck failure handling, and make -C security images builds and scans all three service images. Install tools with make -C security install first. Scanner failure is a failed check, not a clean result. See SECURITY.md for Git/Docker requirements, blocking findings, and CI reports.
Current scaffold coverage
Existing checks cover health/readiness, backend PostgreSQL, Redis, and SeaweedFS connectivity, migration up, down to zero, and up again on an isolated database, concurrent migration runners that apply each migration once, the transactional outbox (atomic commit, rollback on error, panic, and context cancellation, nested-transaction rejection, an observed row-lock wait between concurrent transactions, edge payloads, and constraints), identity storage (a unique normalized email, hash-only storage of email and session tokens, exactly one successful consumption of a token under parallel confirmations and an observed lock wait between two consumes, rejection of expired, invalidated, and superseded tokens, including a re-registration that commits during a confirmation, session idle, absolute, and revocation limits and touch throttling, batch cleanup of unverified accounts that skips locked accounts without waiting, a deadlock reported as a retryable conflict, cascade deletes, rollback with the surrounding transaction, and constraints), cache operations and TTL, S3 operations and object persistence, metrics, the API client, ML schemas, and current endpoint availability. There are no registration, login, assessment, search, invitation, or file workflows and no real model inference to validate as product behavior.
API verification checks the OpenAPI subset exercised by pinned tools, fixtures, and contracts that actually ran. Its result applies only to those inputs. CI YAML in the repository does not mean a workflow has run on GitHub.
Deployment smoke checks infrastructure routes, Compose startup, PostgreSQL/Redis/SeaweedFS readiness, Redis authentication and cache configuration, rejection of anonymous SeaweedFS bucket access, and the backend startup log for EMAIL_PROVIDER=disabled. It stops Redis and SeaweedFS in turn to verify that /readyz returns 503 while /api/v1/healthz remains available, then verifies readiness recovery after each dependency restarts. It sends no mail and does not check mail delivery, contact release, protection of product data, ML robustness, ranking quality, PDF export, or the two-role flow. A separate monitoring check does not verify the core database or end-to-end telemetry from the application.
Browser E2E suite
make -C deploy test-e2e runs the Playwright suite from frontend/e2e/ in Chromium against the real frontend and backend images. It needs Docker and frontend dependencies installed with make -C frontend install; no browser is installed on the host. deploy/scripts/e2e.sh does the following:
- Reads the exact
@playwright/testversion fromfrontend/package.json, checks that the installed package matches it, and runs the suite in the officialmcr.microsoft.com/playwright:v<version>-nobleimage withfrontend/mounted read-only. - Starts the core stack under a unique project
lincodex-e2e-<random>with fresh volumes and a generated throwaway env file: random passwords,EMAIL_PROVIDER=disabled, no mail transport settings. Shell variables other than Docker client settings do not reach Compose. The run refuses to reuse an existing project, network, or volume. - Publishes no host port. The browser container shares the frontend container's network namespace, so it opens
http://localhost:8080, the same loopback origin asAPP_PUBLIC_URL. The Playwright config refuses a base URL outside a loopback host. - Waits for backend readiness, runs the suite with retries disabled, and returns its exit code; make reports any failure as exit status 2.
- Removes the containers, volumes, network, locally built images, and env file on every exit, including failures and interrupts. Only the cached Playwright image and the build cache remain.
Artifacts of the last run are in frontend/test-results/e2e/, which Git ignores; the runner prints the path. report/ holds the HTML report (pnpm exec playwright show-report test-results/e2e/report from frontend/). For each failed test, results/ keeps trace.zip and a screenshot (pnpm exec playwright show-trace <trace.zip> needs a local browser; trace.playwright.dev opens the file without one). After a failed run, stand.log holds the stack logs. E2E_SPEC_DIR=<dir> runs specs from another directory, such as a scratch copy, against the same isolated stack.
The current suite (frontend/e2e/smoke.spec.ts) checks that the SPA serves / with lang="ru" and its heading, that /status shows the technical page with a live API, that /api/v1/healthz returns 200 {"status":"ok"} through the frontend proxy, that an unknown SPA route shows the not-found page, and that /api/v1/missing returns 404 application/problem+json with code not_found. It needs no data. Later business tests create their own synthetic users and records through the public API in the fresh stack of each run; they do not use shared fixtures or real data.
The suite does not cover candidate or employer workflows, sign-in, mail delivery, dependency failures (deployment smoke covers those), browsers other than desktop Chromium, layout, or accessibility. CI does not run it yet.
Integration test bootstrap
The shared helper lives in backend/integration_test/bootstrap_test.go. Calling env := bootstrap(t) starts PostgreSQL, Redis, and SeaweedFS, waits for adapter readiness, and returns an environment with configuration and clients. To test one adapter, use bootstrap(t, postgresService), bootstrap(t, redisService), or bootstrap(t, seaweedfsService). Multiple services can be selected.
Call bootstrap once in the parent test and share its environment with its subtests. Each call creates separate containers with dynamic ports and a separate SeaweedFS volume when needed. Cleanup is registered through t.Cleanup, including partial startup. Redis outage and SeaweedFS recreation scenarios manage resources through environment helpers without affecting other tests. Tests fail when Docker is unavailable.
Bootstrap starts infrastructure and clients. When PostgreSQL is selected, it applies every embedded migration with the startup runner. postgres_helpers_test.go adds env.newPool for a pool to that database, env.createIsolatedDatabase for a separate database in the same container when a test changes the whole schema (for example up, down, and up again), env.newPoolWithMaxConns for concurrency tests that need one connection per transaction, and truncateTables for resetting shared tables between sequential subtests. Tests reach the transaction behind a unit of work only through postgres.TransactionForIntegrationTest, which is compiled only with the integration build tag. Test-only aggregates live in their own schema created by the test, not in production migrations. The application HTTP server, ML, and product fixtures are not included yet. The full-environment test exercises combined PostgreSQL, Redis, and SeaweedFS readiness.
Integration test sharding
make -C backend test-int runs the full suite through backend/scripts/run-integration-suite.py. The runner discovers every top-level Test* in ./integration_test/..., sorts by package and name, and distributes tests round-robin. Each test belongs to exactly one shard with all its subtests. Changing the test set may change the assignment; duration-based balancing is not implemented.
make -C backend test-int-list
TEST_SHARD_INDEX=1 TEST_SHARD_TOTAL=2 make -C backend test-int
TEST_SHARD_INDEX=2 TEST_SHARD_TOTAL=2 make -C backend test-int
Indexes start at 1. Set both variables together; invalid settings, an empty suite, excess shards, and discovery failures fail the command. test-int-list compiles test packages and lists selected tests without starting containers. make -C backend test-scripts verifies complete, disjoint coverage, parent-test selection, and runner failure propagation. It is included in make -C backend check.
CI uses a separate matrix of two integration jobs with GOFLAGS=-race and fail-fast: false. Every shard must pass before aggregate and deployment smoke succeed. Run GOFLAGS='-race -shuffle=on' make -C backend test-int locally to check races and order independence. Shards use their own containers; runners do not share a database. Increase the matrix size together with TEST_SHARD_TOTAL when suite duration warrants more runners.
Future software validation
Go unit tests should exercise domain/usecase rules with explicit inputs, results, and errors. Integration tests should use a real PostgreSQL at the same major version, apply goose migrations, and exercise sqlc, constraints, transactions, rollback, and concurrent transitions. The HTTP path should use chi, middleware, usecases, and the database; replace external ML with a controlled HTTP fake and email with a test adapter.
Isolate test data by database/schema or run scenarios with a sequential reset. Do not run parallel cases against shared truncation. Reuse the bootstrap environment within a parent test; independent tests create their own environments. Integration CI must not silently skip tests when its container runtime is unavailable.
Validate contract changes with bundle, lint, codegen for every Go, TypeScript, and Python consumer, and generated drift, including new untracked files. Frontend component tests do not replace browser tests of the complete flow. After product implementation, extend the Playwright suite with both roles and a synthetic candidate without FSP history.
Critical future checks:
- Before offer acceptance, another company sees no contacts through API, search, PDF, errors, or ML explanations.
- A candidate cannot access another user's invitations, files, jobs, or attempts; a company cannot access another company's needs or search runs.
- Assessment failure does not lower grade; the first lower-level retry is allowed; concurrent requests cannot bypass cooldown.
- Repeated submission or acceptance is idempotent; concurrent status transitions are serialized.
- The manual path works with ML off; expired worker leases recover; stale results do not overwrite a newer profile.
- Missing FSP history differs from an integration error and does not exclude the candidate.
- Search refinement preserves an earlier snapshot; a withdrawn profile disappears from it.
Future quality evaluation
Evaluate ranking separately from functional tests. Initial plan: 60-100 synthetic candidates, 8-12 needs, two independent labelers, disagreement review, and a holdout split by need. Near-duplicate profiles must not appear in both tuning and holdout.
Compare keyword search, verified skills, and ML. Measure Precision@5, nDCG@5, hard-filter violations, category coverage, and the share of relevant results without FSP history. Define the denominator before the run when fewer than five candidates qualify and report result-set size. Synthetic data does not prove quality for the real market.
Assessment evaluation needs a human pilot and independent expert skill ratings. Compare equivalent forms, vary their order, and measure grade agreement, score spread, task-level decisions, and group separation. Synthetic answers help debug a rubric; they do not replace a pilot.
ML evaluation records a fixed document set and field labels, extraction precision, invented facts, recommendation usefulness, schema-valid rate, latency, and failures. Record model, prompt/schema version, parameters, and date. Compare against a simple baseline and use lawfully handled de-identified documents.
Proposed targets are 30 concurrent users, p95 profile reads under 500 ms, and baseline search under one second on demo data excluding external network time. These are future acceptance criteria; no results are available. Set a separate ML latency budget.