feat: add candidate profile, questionnaire and company forms

This commit is contained in:
TakuyaYagam1 committed 2026-10-07 16:07:02 +03:00
1 parent 3a61a8e8bb
commit f81cd0ae09
68 files changed
+9517 -54

No files matched your search

+1 -1
View File
@@ -53,7 +53,7 @@ config: ## Render all Compose files with safe example values
APP_PROJECT="$(APP_PROJECT)" APP_NETWORK="$(APP_NETWORK)" LINCODEX_RELEASE_TAG=000000000000 IDENTITY_KEY_SECRET="$(CHECK_IDENTITY_KEY_SECRET)" $(DOCKER) compose --env-file "$(CHECK_ENV_FILE)" -p "$(APP_PROJECT)" -f "$(CORE_FILE)" -f "$(RELEASE_FILE)" config --quiet
APP_PROJECT="$(APP_PROJECT)" APP_NETWORK="$(APP_NETWORK)" LINCODEX_RELEASE_TAG=000000000000 IDENTITY_KEY_SECRET="$(CHECK_IDENTITY_KEY_SECRET)" $(DOCKER) compose --env-file "$(CHECK_ENV_FILE)" -p "$(ML_PROJECT)" -f "$(ML_FILE)" -f "$(ML_RELEASE_FILE)" config --quiet
APP_PROJECT=lincodex-e2e-config APP_NETWORK=lincodex-e2e-config_default PLAYWRIGHT_VERSION="$(PLAYWRIGHT_VERSION)" E2E_UID=1000 E2E_GID=1000 E2E_SPEC_DIR="$(ROOT)/frontend/e2e" E2E_ARTIFACTS_DIR="$(ROOT)/frontend/test-results/e2e" IDENTITY_KEY_SECRET="$(CHECK_IDENTITY_KEY_SECRET)" $(DOCKER) compose --env-file "$(CHECK_ENV_FILE)" -p lincodex-e2e-config -f "$(CORE_FILE)" -f "$(E2E_FILE)" --profile e2e config --quiet
APP_PROJECT=lincodex-e2e-mail-config APP_NETWORK=lincodex-e2e-mail-config_default PLAYWRIGHT_VERSION="$(PLAYWRIGHT_VERSION)" E2E_UID=1000 E2E_GID=1000 E2E_SPEC_DIR="$(ROOT)/frontend/e2e" E2E_ARTIFACTS_DIR="$(ROOT)/frontend/test-results/e2e" IDENTITY_KEY_SECRET="$(CHECK_IDENTITY_KEY_SECRET)" $(DOCKER) compose --env-file "$(CHECK_ENV_FILE)" -p lincodex-e2e-mail-config -f "$(CORE_FILE)" -f "$(E2E_FILE)" -f "$(E2E_MAIL_FILE)" --profile e2e config --quiet
E2E_COMPANY_FIXTURE_TOKEN=render-only-company-fixture-token-00000000000000000000000000000000 APP_PROJECT=lincodex-e2e-mail-config APP_NETWORK=lincodex-e2e-mail-config_default PLAYWRIGHT_VERSION="$(PLAYWRIGHT_VERSION)" E2E_UID=1000 E2E_GID=1000 E2E_SPEC_DIR="$(ROOT)/frontend/e2e" E2E_ARTIFACTS_DIR="$(ROOT)/frontend/test-results/e2e" IDENTITY_KEY_SECRET="$(CHECK_IDENTITY_KEY_SECRET)" $(DOCKER) compose --env-file "$(CHECK_ENV_FILE)" -p lincodex-e2e-mail-config -f "$(CORE_FILE)" -f "$(E2E_FILE)" -f "$(E2E_MAIL_FILE)" --profile e2e config --quiet
build: ## Build local frontend and backend images
APP_PROJECT="$(APP_PROJECT)" IDENTITY_KEY_SECRET="$(CHECK_IDENTITY_KEY_SECRET)" $(DOCKER) compose --env-file "$(CHECK_ENV_FILE)" -p "$(APP_PROJECT)" -f "$(CORE_FILE)" build
+43
View File
@@ -6,6 +6,8 @@ services:
context: ../../backend
dockerfile: Dockerfile.e2e
environment:
# Browser scenarios share one proxy address in this isolated stand.
IDENTITY_CLIENT_HOURLY_LIMIT: "200"
EMAIL_PROVIDER: resend
EMAIL_ACCOUNT: e2e
EMAIL_FROM: no-reply@example.com
@@ -24,7 +26,48 @@ services:
E2E_MAILBOX_URL: http://mail-fixture:8025/__e2e/inbox
E2E_MAILBOX_TOKEN: local-e2e-mailbox-token
E2E_MAIL_FIXTURE: "1"
E2E_COMPANY_FIXTURE: "1"
E2E_QUESTIONNAIRE_FIXTURE: "1"
E2E_CONSENT_FIXTURE: "1"
E2E_COMPANY_FIXTURE_URL: http://company-fixture:8081/company/memberships/revoke
E2E_COMPANY_FIXTURE_TOKEN: ${E2E_COMPANY_FIXTURE_TOKEN:?Set the per-run company fixture token}
company-fixture:
build:
context: ../../backend
dockerfile: Dockerfile.e2e
entrypoint: ["/company-fixture"]
environment:
E2E_COMPANY_FIXTURE: "1"
E2E_COMPANY_FIXTURE_TOKEN: ${E2E_COMPANY_FIXTURE_TOKEN:?Set the per-run company fixture token}
DATABASE_URL: postgres://${POSTGRES_USER:?Set POSTGRES_USER}:${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:?Set POSTGRES_DB}?sslmode=disable
expose:
- "8081"
read_only: true
cap_drop: [ALL]
security_opt: ["no-new-privileges:true"]
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "/company-fixture", "healthcheck"]
interval: 2s
timeout: 3s
retries: 15
start_period: 2s
stop_grace_period: 5s
networks:
- default
logging:
driver: json-file
options:
max-size: 1m
max-file: "2"
deploy:
resources:
limits:
cpus: "0.25"
memory: 128M
mail-fixture:
build:
+3
View File
@@ -189,6 +189,7 @@ EMAIL_TIMEOUT=10s
APP_PUBLIC_URL=http://localhost:8080
PASSWORD_HASH_CONCURRENCY=1
IDENTITY_KEY_SECRET=$(random_secret)
E2E_COMPANY_FIXTURE_TOKEN=$(od -An -N32 -tx1 /dev/urandom | tr -d ' \n')
POSTGRES_EXPORTER_USER=
POSTGRES_EXPORTER_PASSWORD=
EOF
@@ -263,6 +264,8 @@ try {
# Seed only synthetic consent scopes in this fresh, isolated database.
# The command exists only in the local E2E image and rejects other modes.
compose exec -T backend /consent-fixture
# Publish an explicitly reviewed synthetic bank for the questionnaire flow.
compose exec -T -e E2E_QUESTIONNAIRE_FIXTURE=1 backend /questionnaire-fixture
fi
playwright_command=(node node_modules/@playwright/test/cli.js test)
+38
View File
@@ -11,6 +11,7 @@ ROOT = Path(__file__).resolve().parents[2]
DEPLOY = ROOT / "deploy"
DOCKER = os.environ.get("DOCKER", "docker")
FIXTURE_TOKEN = "local-e2e-mailbox-token"
COMPANY_FIXTURE_TOKEN = "render-only-company-fixture-token-" + "0" * 32
class E2EUserSelectionTest(unittest.TestCase):
@@ -55,6 +56,7 @@ def render_compose(file_names, project, extra_env=None):
"E2E_SPEC_DIR": str(ROOT / "frontend" / "e2e"),
"E2E_ARTIFACTS_DIR": str(ROOT / "frontend" / "test-results" / "e2e"),
"IDENTITY_KEY_SECRET": "render-only-identity-key-secret",
"E2E_COMPANY_FIXTURE_TOKEN": COMPANY_FIXTURE_TOKEN,
}
environment.update(extra_env or {})
command = [DOCKER, "compose", "--env-file", str(ROOT / ".env.example"), "-p", project]
@@ -94,10 +96,12 @@ class ComposeMailFixtureTest(unittest.TestCase):
for rendered in (self.ordinary, self.release):
with self.subTest(project=rendered["name"]):
self.assertNotIn("mail-fixture", rendered["services"])
self.assertNotIn("company-fixture", rendered["services"])
backend = rendered["services"]["backend"]
self.assertEqual(backend["build"]["dockerfile"], "Dockerfile")
self.assertEqual(backend["environment"]["EMAIL_PROVIDER"], "disabled")
self.assertEqual(backend["environment"]["VERIFICATION_MAIL_MIN_INTERVAL"], "1m")
self.assertEqual(backend["environment"]["IDENTITY_CLIENT_HOURLY_LIMIT"], "30")
self.assertNotIn("RESEND_ENDPOINT", backend["environment"])
self.assertNotIn("E2E_CONSENT_FIXTURE", backend["environment"])
self.assertNotIn(
@@ -108,6 +112,11 @@ class ComposeMailFixtureTest(unittest.TestCase):
"E2E_MAIL_FIXTURE",
rendered["services"]["playwright"].get("environment", {}),
)
for name in ("E2E_COMPANY_FIXTURE", "E2E_COMPANY_FIXTURE_URL", "E2E_COMPANY_FIXTURE_TOKEN"):
self.assertNotIn(name, backend["environment"])
self.assertNotIn(name, rendered["services"]["playwright"].get("environment", {}))
self.assertNotIn("E2E_QUESTIONNAIRE_FIXTURE", backend["environment"])
self.assertNotIn("E2E_QUESTIONNAIRE_FIXTURE", rendered["services"]["playwright"].get("environment", {}))
def test_fixture_uses_an_e2e_build_and_fixed_synthetic_credentials(self):
services = self.fixture["services"]
@@ -116,6 +125,7 @@ class ComposeMailFixtureTest(unittest.TestCase):
self.assertEqual(backend["environment"]["EMAIL_PROVIDER"], "resend")
self.assertEqual(backend["environment"]["RESEND_API_KEY"], "re_fixture_key")
self.assertEqual(backend["environment"]["VERIFICATION_MAIL_MIN_INTERVAL"], "1s")
self.assertEqual(backend["environment"]["IDENTITY_CLIENT_HOURLY_LIMIT"], "200")
self.assertEqual(backend["environment"]["E2E_CONSENT_FIXTURE"], "1")
self.assertNotIn("RESEND_ENDPOINT", backend["environment"])
self.assertEqual(
@@ -125,6 +135,9 @@ class ComposeMailFixtureTest(unittest.TestCase):
self.assertEqual(services["playwright"]["environment"]["E2E_MAILBOX_TOKEN"], FIXTURE_TOKEN)
self.assertEqual(services["playwright"]["environment"]["E2E_MAIL_FIXTURE"], "1")
self.assertEqual(services["playwright"]["environment"]["E2E_CONSENT_FIXTURE"], "1")
self.assertEqual(services["playwright"]["environment"]["E2E_QUESTIONNAIRE_FIXTURE"], "1")
self.assertNotIn("E2E_QUESTIONNAIRE_FIXTURE", backend["environment"])
self.assertNotIn("questionnaire-fixture", (ROOT / "backend" / "Dockerfile").read_text())
self.assertNotIn("E2E_MAIL_FIXTURE", services["frontend"].get("environment", {}))
def test_fixture_has_no_host_port_storage_network_or_outbound_route(self):
@@ -142,6 +155,31 @@ class ComposeMailFixtureTest(unittest.TestCase):
self.assertIn("no-new-privileges:true", fixture["security_opt"])
self.assertEqual(fixture["deploy"]["resources"]["limits"]["memory"], str(128 * 1024 * 1024))
def test_company_control_is_private_and_only_built_for_local_e2e(self):
services = self.fixture["services"]
fixture = services["company-fixture"]
self.assertEqual(fixture["build"]["dockerfile"], "Dockerfile.e2e")
self.assertEqual(fixture["entrypoint"], ["/company-fixture"])
self.assertEqual(fixture["environment"]["E2E_COMPANY_FIXTURE"], "1")
self.assertEqual(services["playwright"]["environment"]["E2E_COMPANY_FIXTURE"], "1")
self.assertEqual(fixture["environment"]["E2E_COMPANY_FIXTURE_TOKEN"], COMPANY_FIXTURE_TOKEN)
self.assertEqual(
services["playwright"]["environment"]["E2E_COMPANY_FIXTURE_TOKEN"], COMPANY_FIXTURE_TOKEN
)
self.assertEqual(
services["playwright"]["environment"]["E2E_COMPANY_FIXTURE_URL"],
"http://company-fixture:8081/company/memberships/revoke",
)
self.assertFalse(fixture.get("ports"))
self.assertFalse(fixture.get("volumes"))
self.assertEqual(set(fixture["networks"]), {"default"})
self.assertTrue(self.fixture["networks"]["default"]["internal"])
self.assertTrue(fixture["read_only"])
self.assertEqual(fixture["cap_drop"], ["ALL"])
self.assertIn("no-new-privileges:true", fixture["security_opt"])
self.assertEqual(fixture["deploy"]["resources"]["limits"]["memory"], str(128 * 1024 * 1024))
self.assertNotIn("company-fixture", (ROOT / "backend" / "Dockerfile").read_text())
class E2ERunnerModeTest(unittest.TestCase):
def test_release_tag_cannot_enable_the_local_mail_fixture(self):