feat(frontend): edit projects and show semantic match evidence

This commit is contained in:
shira committed 2026-10-11 14:03:31 +03:00
1 parent 5a731c25b7
commit bc00d6901f
52 files changed
+2992 -111

No files matched your search

+84
View File
@@ -489,6 +489,25 @@ const noContext = {
salary_compatibility: null,
};
const semanticEvidence = [
{
requirement_kind: "task",
requirement_text: "Разработать сервис сверки платежей",
item_kind: "project",
project_title: "Платежный шлюз",
repository_verified: true,
similarity: "high",
},
{
requirement_kind: "required_skill",
requirement_text: "Проектирование схем PostgreSQL",
item_kind: "stack",
project_title: null,
repository_verified: false,
similarity: "medium",
},
];
function confirmedEntry(handle: string, grade: string, coverage: number, overrides = {}) {
return {
candidate_handle: handle,
@@ -899,6 +918,71 @@ test.describe("employer candidate search with a stubbed API", () => {
await expect(network.getByText("Пробел: подтверждения нет")).toBeVisible();
});
test("explains the matches by meaning without a repository address", async ({ page }) => {
const entry = confirmedEntry(handleA, "middle", 0.853333, {
semantic_evidence: semanticEvidence,
unknown_flags: [{ component: "percentile", reason: "cohort_below_30" }],
});
const card = {
pseudonym: handleA,
categories: null,
stack: ["go"],
self_assessment: null,
experience_band: null,
work_formats: null,
salary_compatibility: null,
projects: [
{
title: "Платежный шлюз",
description: "Проводки и сверки платежей.",
stack: ["Go", "PostgreSQL"],
repository_verified: true,
},
],
};
await installFakeApi(page, {
searches: [threeGroups({ groups: { main: [entry], near: [], unconfirmed: [] } })],
card,
});
await openSearch(page);
await runSearch(page);
const confirmed = groupSection(page, "Подтвержденные").getByRole("article");
const why = confirmed.getByRole("region", { name: "Почему в подборке" });
await expect(why.getByRole("heading", { name: "Совпадения по смыслу" })).toBeVisible();
const rows = why.getByRole("listitem").filter({ hasText: "сходство" });
await expect(rows).toHaveCount(2);
await expect(rows.nth(0)).toContainText("Разработать сервис сверки платежей");
await expect(rows.nth(0)).toContainText("Проект");
await expect(rows.nth(0)).toContainText("Платежный шлюз");
await expect(rows.nth(0)).toContainText("Высокое сходство");
await expect(rows.nth(0)).toContainText("Публичный репозиторий");
await expect(rows.nth(1)).toContainText("Стек");
await expect(rows.nth(1)).toContainText("Среднее сходство");
await expect(rows.nth(1)).not.toContainText("Публичный репозиторий");
await expect(why.getByText("смысловой анализ недоступен")).toHaveCount(0);
await expect(confirmed.locator('a[href*="github"]')).toHaveCount(0);
await expectNoHorizontalOverflow(page);
await confirmed.getByRole("button", { name: /Открыть карточку/ }).click();
const panel = confirmed.getByRole("region", { name: "Карточка кандидата" });
await expect(panel.getByRole("heading", { name: "Проекты" })).toBeVisible();
await expect(panel.getByText("Подтвержден публичным репозиторием")).toBeVisible();
expect(await panel.innerText()).not.toMatch(/github\.com/);
await captureReview(page, "match-semantic-evidence");
});
test("keeps the unavailable wording in the meaning block when ML was down", async ({ page }) => {
await installFakeApi(page);
await openSearch(page);
await runSearch(page);
const why = groupSection(page, "Подтвержденные")
.getByRole("article")
.getByRole("region", { name: "Почему в подборке" });
await expect(why.getByText("Совпадения по смыслу: смысловой анализ недоступен.")).toBeVisible();
});
test("explains a partial output without a count", async ({ page }) => {
await installFakeApi(page, { searches: [threeGroups({ truncated: true })] });
await openSearch(page);