feat: complete release readiness work #28

Open
cesnimda wants to merge 110 commits from release-readiness into main
8 changed files with 136 additions and 45 deletions
Showing only changes of commit d424633f95 - Show all commits
+1
View File
@@ -195,3 +195,4 @@ Output was reduced to filenames and commit counts. The token artifact appears un
| V-161 | `UsersControllerTests`; focused theme/confirm/admin-users Jest; production frontend build; native-confirm search; `git diff --check` | Repository root / `job-tracker-ui` | Verify canonical theme persistence, semantic Alert contrast ownership, app-owned destructive dialogs and final-admin safety | PASS — backend 4/4; theme/confirm 8/8; admin UI 3/3; production build/TypeScript pass; no remaining `window.confirm` in frontend. Self-demotion cancel/confirm, other-admin warning, preserved roles and final-admin disabled/API conflict paths are covered | JSDOM/local mocks only; authenticated real-browser refresh and production remain | Repository safety increment verified |
| V-162 | Focused workspace/table/workflow Jest; `ApplicationWorkspaceTests`; production frontend build; standalone TypeScript audit; route/native-popup search | Repository root / `job-tracker-ui` | Verify canonical dedicated job workspace, whole-row navigation, independent controls, list-state return, contextual section routes and richer owner-scoped details | PASS — frontend 8/8 and backend 9/9; optimized build passes; direct `/jobs/:id`, section route, return state, missing job and control isolation pass. Standalone TypeScript found only pre-existing test-prop/target errors, with no new application-source error | JSDOM/InMemory backend only; browser widths/themes/refresh and production remain. Legacy dialog source retained for rollback but is no longer reachable from the list | Repository increment verified |
| V-163 | Focused notification-popover/AppShell/Operations Jest; production frontend build; direct-navigation review | `job-tracker-ui` | Verify the header bell opens notification UI instead of routing to Reminders/Operations, while preserving global activity access | PASS — 3 suites and 6/6 tests; optimized TypeScript build passes. Popover fetch, count exposure, read, dismiss, notification-owned navigation and empty state are covered; Operations remains reachable through explicit “View all activity” | JSDOM/mocked API only; browser positioning/focus/theme and production remain | Repository increment verified |
| V-164 | Career/Profile focused Jest; CV extraction/diff backend tests; AI-sidecar pytest; production frontend build; ingestion execution-path review | Repository root / `job-tracker-ui` / `tools/summarizer` | Reproduce and fix career-field resets while assessing the proposed Ollama accuracy pipeline | PASS — Career 17/17 including active-poll preservation; backend 8/8; sidecar 22/22; build passes. Polling now fetches run status only. Existing pipeline is confirmed as local parser/OCR → Ollama-first normalize/classify → deterministic C# validation/diff/review | Synthetic/JSDOM/fake model only; no real private CV, live Ollama model comparison, provider or production call. Repository `.venv` lacked pytest; global Python passed | Repository correction verified; model benchmark remains external/runtime work |
@@ -1,6 +1,6 @@
# CAREER-001 Career Workspace redesign
Updated: 2026-08-09
Updated: 2026-08-15
Status: `IMPLEMENTED — NOT VERIFIED`. State-focused component tests, the full frontend suite and the production build pass. Browser and production checks remain.
@@ -22,18 +22,26 @@ Status: `IMPLEMENTED — NOT VERIFIED`. State-focused component tests, the full
- Anchor targets use scroll margins; action navigation is native keyboard-focusable links. The grid collapses at small widths.
- Existing profile persistence, extraction diff, low-confidence selection, Apply/Discard approval and version restore behavior are unchanged.
## Edit-persistence correction
- Active CV processing used to poll by calling the full profile loader every four seconds. That replaced `structuredCv` and raw CV text with the last saved API response, so any controlled input could appear editable and then reset.
- Profile/account loading and extraction-run loading are now separate. Initial load and explicit restore/apply still refresh authoritative profile data; background polling, queue, cancel, retry and discard refresh run status only.
- Every career-profile editor mutation now sets a shared unsaved state. The UI shows this state, prevents imported changes from overwriting it, and prevents rebuild/improve actions from using stale server-side profile text.
- The import pipeline already follows the proposed hybrid design: Python/local libraries extract PDF/DOCX/image text, Ollama is the default local normalizer/classifier, then deterministic C# normalization, plausibility checks, diffing and explicit review return validated structured data to the system. An LLM does not replace binary parsing/OCR because that would be slower, less deterministic and less safe.
## Verification
- Focused Career Workspace and Career Profile: 2 suites, 16/16 tests.
- Focused Career Workspace and Career Profile: 2 suites, 17/17 tests.
- State coverage includes first-run, returning/incomplete profile, recent general/job-specific CVs, queued processing, pending review, failure, loading and load error.
- Existing pending-review test proves changes are applied only after the explicit accept request.
- Full frontend: 49/49 suites, 178/178 tests.
- Production frontend build and TypeScript: pass.
- C# extraction/diff regressions: 8/8 pass. AI-sidecar extraction/routing contract: 22/22 pass (global Python environment; the repository `.venv` does not contain pytest).
- `git diff --check`: pass apart from repository line-ending notices.
## Remaining gates
- Browser tooling was finalized earlier in this session, so CAREER-001 was not inspected in a running browser. Required 375/768/1440, Light/Dark, keyboard/focus, Norwegian and rendered error/processing checks remain.
- Required 375/768/1440, Light/Dark, keyboard/focus, Norwegian and rendered error/processing checks remain for this latest correction.
- Synthetic-account production smoke and deployed route/anchor behavior remain unavailable without production access.
- The saved-job path explains where a job-specific CV is managed; the deeper CV Builder/application interaction redesign remains CAREER-002/JOBS-001 scope.
+10
View File
@@ -679,3 +679,13 @@
- **Consequences:** rows/cards and contextual shortcuts open one responsive workspace; internal row controls remain independent; list state survives return; old application links still resolve. The former quick dialog remains in source for rollback until broader regression proves it can be safely deleted.
- **User approval required:** No; explicitly requested.
- **Reversible:** Restore DEC-065 routing/list presentation; no schema or stored data changed.
## DEC-069 — Keep CV ingestion hybrid and isolate status polling
- **Date:** 2026-08-15
- **Decision:** Keep deterministic Python/library text extraction and OCR, pass extracted text through the existing Ollama-first normalization/classification routes, then validate/diff/review in C#. Poll extraction-run status independently from profile content and never replace unsaved editor state during background refresh.
- **Reason/evidence:** the repository already implements the user-proposed Python → Ollama → structured-data flow. Python libraries are the correct boundary for PDF/DOCX/image decoding; Ollama adds value in semantic section recognition, but cannot safely or deterministically replace binary parsing. The observed reset was caused by full-profile polling, not controlled-input behavior.
- **Alternatives considered:** send binary files directly to Ollama; remove deterministic repair/fallback logic; continue full-profile polling; auto-save on every poll. These reduce format coverage, factuality, review safety or user control.
- **Consequences:** all career fields retain unsaved edits while processing status changes. AI reconstruction remains explicit, local-first and review-gated; accuracy work can be benchmarked per model without changing the ingestion boundary.
- **User approval required:** No; this implements the requested behavior within the existing approved local-AI architecture.
- **Reversible:** Rejoin run/profile loads, though that would restore the confirmed data-loss UX defect; no schema/config/data migration changed.
+2 -2
View File
@@ -3,7 +3,7 @@
Updated: 2026-08-15
- **Overall programme status:** Active. Seven packages are locally verified; twenty-two packages through UX-003 are implemented with automated/runtime evidence but blocked from applicable live/provider/production gates; JOBS-002 is now in progress. Gitea run 609 passes the prior complete pull-request CI; DEP-001 awaits approved merge-to-main and production verification.
- **Current work package:** `JOBS-002`dedicated application workspace and scan-friendly applications table (`IN PROGRESS`). Canonical `/jobs/:id`, compact whole-row navigation, sidebar cleanup, richer details and anchored notification popover are locally verified; browser regression is next.
- **Current work package:** `CAREER-002`professional CV Builder and robust rendering (`IN PROGRESS`). JOBS-002 repository scope and the Career edit-persistence correction are locally verified; CV editor/rendering rework is next.
- **Completed work packages:** None are `DONE`; all repository security/AI packages still have applicable browser, provider and/or production gates.
- **Locally verified work:** SEC-001, SEC-002, SEC-003, SEC-005A, CORE-001, PROD-002 and DEP-001 (`VERIFIED LOCALLY`).
- **Implemented, verification incomplete:** SEC-004, SEC-005B, SEC-008, CORE-002, BG-001, OPS-001A/B/C, POL-001/002, AI-001/002/003/004, UX-001/002/003, QA-001, CAREER-001/002, MAIL-001 and JOBS-001 (`IMPLEMENTED — NOT VERIFIED`). UX-003 safe local/browser scope is implemented; production/native-device gates remain.
@@ -12,7 +12,7 @@ Updated: 2026-08-15
- **Deferred work:** None. Conditional multi-replica coordination, model deletion, realtime operation delivery and unrelated production changes remain outside current packages.
- **Next five work packages:** JOBS-002 applications/workspace; PRODUCT-001 homepage/Pro claims; VER-001 action matrix; production-blocked SEC-006/007 when package-index permission is available; REL-001 after prerequisites.
- **Status counts:** 7 `VERIFIED LOCALLY`; 22 `IMPLEMENTED — NOT VERIFIED`; 1 `IN PROGRESS`; 5 `NOT STARTED`; 5 `BLOCKED`; 0 `DONE`; 0 `DEFERRED`.
- **Test status:** backend baseline 631/631 plus admin safety 4/4 and workspace 9/9; frontend baseline 51/51 suites and 207/207 plus theme/confirm/admin focused 11/11, JOBS-002 focused 8/8 and notification focused 6/6; Playwright 6/6; npm audit 0 vulnerabilities; production build passes. Historical JT-019 and Jest force-exit/open-handle behavior remain recorded.
- **Test status:** backend baseline 631/631 plus admin safety 4/4, workspace 9/9 and CV extraction/diff 8/8; frontend baseline 51/51 suites and 207/207 plus theme/confirm/admin 11/11, JOBS-002 8/8, notifications 6/6 and Career 17/17; AI sidecar 22/22; Playwright 6/6; npm audit 0 vulnerabilities; production build passes. Historical JT-019 and Jest force-exit/open-handle behavior remain recorded.
- **Deployment status:** Gitea pull-request run 609 passed the complete CI job in 4m20s. Deploy was intentionally skipped because the workflow deploys only a `push` to `main`; live remains unchanged. No merge/deployment was performed directly, no production migrations were run and the AI operation worker remains disabled by default.
- **Production status:** Unchanged and unverified. No provider/model call, model pull, external request or paid API occurred.
- **Known regressions:** None found by automated/local browser checks. Jest still needs `--forceExit` and reports its existing open-handle notice. Email-provider/send tests are fake/local only; real delivery is not claimed. Current MAIL browser evidence is 1280×720 only because the browser surface could not resize or perform native Tab traversal. Interrupted attempts are aged after 15 minutes and notified without retry; the five-minute scan is unmeasured on a large ledger. Direct clean EF-only SQLite migration still hits the pre-existing historical blank-chain defect before later migrations; normal startup owns reconciliation. Cross-feature monthly AI usage accounting remains a rollout gap.
+3 -3
View File
@@ -615,9 +615,9 @@ Ordering differences from the suggested list:
- **Required production verification:** synthetic account smoke.
- **Status:** `IMPLEMENTED — NOT VERIFIED`.
- **Blocker:** browser session was already finalized; three-width/theme/keyboard/Norwegian checks and production synthetic-account smoke remain.
- **Evidence:** `docs/verification/career-001-career-workspace.md`; V-117V-119; focused 16/16, full frontend 49/49 suites and 178/178 tests, production build. State-aware actions/recent CVs are implemented and the Apply/Discard gate is unchanged.
- **Commit:** `268b3a0` (`feat(career): clarify workspace actions`).
- **Remaining work:** browser and production gates only; deeper builder/job-specific interaction belongs to CAREER-002/JOBS-001.
- **Evidence:** `docs/verification/career-001-career-workspace.md`; V-117V-119 and V-164; focused Career/Profile 17/17, extraction backend 8/8, sidecar 22/22 and production build. State-aware actions/recent CVs are implemented, extraction polling no longer overwrites unsaved form state, and the Apply/Discard gate is unchanged.
- **Commit:** `268b3a0` (`feat(career): clarify workspace actions`) plus the CAREER-002 polling checkpoint recorded in V-164.
- **Remaining work:** browser and production gates only; live model-quality benchmarking and deeper builder interaction belong to CAREER-002.
### CAREER-002 — CV Builder interaction redesign and external research
+7 -7
View File
@@ -2,17 +2,17 @@
Updated: 2026-08-15
- **Exact current task:** continue JOBS-002 with real-browser workspace/table/theme/keyboard/history/error/long-content regression.
- **Last completed step:** the header bell now opens a reusable anchored notification panel with read/dismiss/link/empty/error behavior; it no longer routes directly to Operations.
- **Files currently modified:** notification model/popover/AppShell/App integration/tests/translations, Operations reuse and JOBS tracking.
- **Commands already run:** notification/AppShell/Operations Jest 6/6 and production frontend build.
- **Test results:** focused notification 6/6; focused JOBS frontend 8/8 and backend 9/9; production build passes. Repository-wide standalone TypeScript still reports pre-existing React Router test `future` props, one Testing Library option and ES target errors; application source added no error.
- **Exact current task:** continue CAREER-002 with CV Builder editing and multi-page rendering rework, then run combined browser regression.
- **Last completed step:** separated extraction-run polling from profile loading, added unsaved-state safety, and verified the existing Python/Ollama/C# hybrid ingestion contract.
- **Files currently modified:** CareerProfilePage, its focused test and Career/tracking evidence.
- **Commands already run:** Career Jest 17/17; CV extraction/diff backend 8/8; AI sidecar 22/22; production frontend build.
- **Test results:** Career 17/17, extraction/diff 8/8, sidecar 22/22 and build pass. The first `.venv` pytest attempt failed environmentally because pytest is absent; `py -m pytest` passed. Repository-wide standalone TypeScript baseline remains as previously recorded.
- **Services currently running:** none on task-owned ports 3000/5202. Playwright stopped its disposable API/Next servers. Pre-existing Docker services were not changed.
- **Temporary files or processes:** no task-owned process is running and the failed disposable migration database was removed. Existing synthetic browser evidence/account and startup-created local backup remain documented. No provider account, real email, private content, paid service or production service was accessed.
- **Production changes currently active:** none. No deployment, migration, provider connection/sync/send or production payload occurred.
- **Rollback status:** downgrade `20260810080858_AddEmailDraftClientRequestId`, then `20260810075206_AddEmailDrafts`, before reverting draft commits; then follow the existing MAIL rollback order (`ee5ef7e`, `449faeb`, `123fc55`/`e9937ac`, ledger downgrade before `653f011`). No production migration/deploy/provider grant occurred.
- **Uncommitted changes:** V-163 notification popover and tracking; no dependency/schema/config change.
- **Uncommitted changes:** V-164 Career polling/edit safety and tracking; no dependency/schema/config change.
- **Known failures:** live deployment is not verified because PR deploy is intentionally skipped and the active branch is not approved for merge. Draft export/API/UI, full thread/category actions and non-Gmail review remain; existing accounts need re-consent and IMAP stays read-only. A clean full-chain SQLite apply fails in the pre-existing JT-019 migration before the new draft migration. Browser/provider/MariaDB/production unavailable or unverified; recovery scan performance is unmeasured at large ledger scale; Jest open handles; SEC-006 parser dependency work is still separately gated; parser isolation remains SEC-007.
- **Exact next action:** commit/push V-163; run the JOBS-002 browser matrix and address evidence-backed defects.
- **Exact next action:** commit/push V-164; implement CAREER-002 renderer overflow/page-boundary and editor workflow corrections.
- **Work that can continue independently:** JOBS-002, PRODUCT-001 and VER-001. UX/JOBS production, MAIL provider mutations, SEC-006/007 and PROD packages retain their recorded external gates.
- **Decisions still required from the user:** none for synthetic/code-inspected repository work. Any provider connection or send test, internet/package upgrades, private data, external/paid providers and production actions retain explicit approval/safety gates; SEC-009 retention/legal policy remains unresolved.
+50 -1
View File
@@ -1,6 +1,6 @@
import React from 'react';
import '@testing-library/jest-dom';
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
import { ToastProvider } from './toast';
import { I18nProvider } from './i18n/I18nProvider';
import ProfilePage from './views/ProfilePage';
@@ -284,6 +284,55 @@ test('profile page can reprocess from stored artifact history', async () => {
});
});
test('active extraction polling refreshes run status without resetting unsaved career fields', async () => {
extractionRunsResponse = [{
id: 15,
trigger: 'upload',
status: 'queued',
artifactFileName: 'active-cv.pdf',
startedAtUtc: '2026-03-28T12:00:00Z',
parserVersion: 'm005-s01',
normalizerVersion: 'm005-s01',
llmPromptVersion: 'm005-s01',
operation: {
id: '00000000-0000-0000-0000-000000000015',
taskType: 'cv.process',
status: 'queued',
createdAtUtc: '2026-03-28T12:00:00Z',
canCancel: true,
canRetry: false,
},
}];
let poll: (() => void) | undefined;
const interval = jest.spyOn(window, 'setInterval').mockImplementation((handler: TimerHandler, timeout?: number) => {
if (timeout === 4000 && typeof handler === 'function') poll = handler as () => void;
return 1 as any;
});
renderPage();
const nameField = await screen.findByLabelText(/full name/i);
await waitFor(() => expect(poll).toBeDefined());
fireEvent.change(nameField, { target: { value: 'Unsaved Poll-Safe Name' } });
extractionRunsResponse = [{ ...extractionRunsResponse[0], status: 'running', operation: { ...extractionRunsResponse[0].operation, status: 'running' } }];
await act(async () => {
poll?.();
await Promise.resolve();
await Promise.resolve();
});
await waitFor(() => expect(mockedApi.get.mock.calls.filter(([url]) => url === '/profile-cv/runs').length).toBeGreaterThanOrEqual(2));
expect(mockedApi.get.mock.calls.filter(([url]) => url === '/career/profile')).toHaveLength(1);
expect(nameField).toHaveValue('Unsaved Poll-Safe Name');
expect(screen.getByText('Unsaved changes')).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: /save changes/i }));
await waitFor(() => expect(mockedApi.put).toHaveBeenCalledWith('/career/profile', expect.objectContaining({
profile: expect.objectContaining({ contact: expect.objectContaining({ fullName: 'Unsaved Poll-Safe Name' }) }),
})));
interval.mockRestore();
});
test('profile page shows durable CV operation state and retries a failed run', async () => {
extractionRunsResponse = [{
id: 14,
+52 -29
View File
@@ -163,6 +163,7 @@ export default function CareerProfilePage() {
const [parsingCvSections, setParsingCvSections] = useState(false);
const [reprocessingCv, setReprocessingCv] = useState(false);
const [structuredCv, setStructuredCv] = useState<StructuredCvProfile>(emptyStructuredCv());
const [profileDirty, setProfileDirty] = useState(false);
const [completeness, setCompleteness] = useState<CareerCompleteness | null>(null);
const [versions, setVersions] = useState<CareerVersion[]>([]);
// The raw import/section parser remains available as an advanced recovery tool.
@@ -183,6 +184,7 @@ export default function CareerProfilePage() {
const r = await api.post<CareerProfileResponse>(`/career/profile/versions/${version}/restore`);
setStructuredCv(normalizeStructuredCv(r.data?.profile ?? emptyStructuredCv()));
setCompleteness(r.data?.completeness ?? null);
setProfileDirty(false);
await loadVersions();
toast(t("profileUpdated"), "success");
} catch (e: any) {
@@ -197,26 +199,38 @@ export default function CareerProfilePage() {
const [acceptedLowConfidenceIds, setAcceptedLowConfidenceIds] = useState<Record<number, string[]>>({});
const runStatusRef = useRef<Record<number, string>>({});
const editStructuredCv = useCallback((next: React.SetStateAction<StructuredCvProfile>) => {
setStructuredCv(next);
setProfileDirty(true);
}, []);
const loadExtractionRuns = useCallback(async () => {
try {
const response = await api.get<ExtractionRun[]>("/profile-cv/runs");
setExtractionRuns(response.data ?? []);
} catch {
// Polling failure must not clear existing run state or touch unsaved profile edits.
}
}, []);
const loadProfile = useCallback(async () => {
setLoading(true);
try {
// /career reads the structured profile from the relational source of truth (/career/profile);
// /auth/me still provides the account row (avatar, provider chips) shown in the header.
const [careerResponse, meResponse, runsResponse] = await Promise.all([
const [careerResponse, meResponse] = await Promise.all([
api.get<CareerProfileResponse>("/career/profile"),
api.get<MeResponse>("/auth/me"),
api.get<ExtractionRun[]>("/profile-cv/runs").catch(() => ({ data: [] as ExtractionRun[] } as any)),
]);
setMe(meResponse.data);
setProfileCvText(careerResponse.data?.cvText ?? "");
setStructuredCv(normalizeStructuredCv(careerResponse.data?.profile ?? emptyStructuredCv()));
setCompleteness(careerResponse.data?.completeness ?? null);
setExtractionRuns(runsResponse.data ?? []);
setProfileDirty(false);
setHeadline(window.localStorage.getItem("profileHeadline") ?? "");
setLoadError(null);
} catch (error: any) {
setMe(null);
setExtractionRuns([]);
setLoadError(String(error?.response?.data || error?.message || "Unable to load profile right now."));
} finally {
setLoading(false);
@@ -225,8 +239,9 @@ export default function CareerProfilePage() {
useEffect(() => {
void loadProfile();
void loadExtractionRuns();
void loadVersions();
}, [loadProfile, loadVersions]);
}, [loadExtractionRuns, loadProfile, loadVersions]);
useEffect(() => {
const activeRuns = extractionRuns.filter((run) => run.operation
@@ -235,11 +250,11 @@ export default function CareerProfilePage() {
if (activeRuns.length === 0) return;
const timer = window.setInterval(() => {
void loadProfile();
void loadExtractionRuns();
}, 4000);
return () => window.clearInterval(timer);
}, [extractionRuns, loadProfile]);
}, [extractionRuns, loadExtractionRuns]);
useEffect(() => {
const pending = extractionRuns.filter((run) => run.status === "pending_review" && !runDiffs[run.id]);
@@ -397,6 +412,7 @@ export default function CareerProfilePage() {
<Box id="career-cv-import" sx={{ gridColumn: "1 / -1", p: { xs: 1.5, sm: 2 }, borderRadius: 3, border: "1px solid", borderColor: "divider", backgroundColor: "background.default", display: careerOnly ? "block" : "none", scrollMarginTop: 96 }}>
{!canUseAi && <Alert severity="info" sx={{ mb: 2 }} action={<Button href="/settings" size="small">View Pro</Button>}>AI CV import, rebuilding, improvement, and reprocessing require Pro. Manual profile editing remains available.</Alert>}
{profileDirty ? <Alert severity="warning" sx={{ mb: 2 }}>You have unsaved career edits. Save them before running actions that use the stored profile.</Alert> : null}
<Box sx={{ display: "flex", justifyContent: "space-between", gap: 2, flexWrap: "wrap", alignItems: "center", mb: 1.5 }}>
<Box>
<Typography variant="h6">{t("profileMasterCv")}</Typography>
@@ -419,7 +435,7 @@ export default function CareerProfilePage() {
setUploadingCv(true);
try {
const res = await api.post<QueuedCvRunResponse>("/profile-cv/upload", formData, { headers: { "Content-Type": "multipart/form-data" } });
await loadProfile();
await loadExtractionRuns();
toast(`Queued CV upload (run ${res.data.extractionRunId}).`, "info");
} catch (e: any) {
toast(String(e?.response?.data || e?.message || t("profileCvUploadFailed")), "error");
@@ -433,12 +449,12 @@ export default function CareerProfilePage() {
</Button>
<Button
variant="outlined"
disabled={!canUseAi || !isLocal || !profileCvText.trim() || uploadingCv || improvingCv || rebuildingCv}
disabled={!canUseAi || !isLocal || profileDirty || !profileCvText.trim() || uploadingCv || improvingCv || rebuildingCv}
onClick={async () => {
setRebuildingCv(true);
try {
const res = await api.post<QueuedCvRunResponse>("/profile-cv/rebuild");
await loadProfile();
await loadExtractionRuns();
toast(`Queued CV rebuild (run ${res.data.extractionRunId}).`, "info");
} catch (e: any) {
toast(String(e?.response?.data || e?.message || t("profileCvRebuildFailed")), "error");
@@ -451,12 +467,12 @@ export default function CareerProfilePage() {
</Button>
<Button
variant="outlined"
disabled={!canUseAi || !isLocal || !profileCvText.trim() || uploadingCv || improvingCv || rebuildingCv}
disabled={!canUseAi || !isLocal || profileDirty || !profileCvText.trim() || uploadingCv || improvingCv || rebuildingCv}
onClick={async () => {
setImprovingCv(true);
try {
const res = await api.post<QueuedCvRunResponse>("/profile-cv/improve");
await loadProfile();
await loadExtractionRuns();
toast(`Queued CV improve run (run ${res.data.extractionRunId}).`, "info");
} catch (e: any) {
toast(String(e?.response?.data || e?.message || t("profileCvImproveFailed")), "error");
@@ -474,7 +490,7 @@ export default function CareerProfilePage() {
setReprocessingCv(true);
try {
const res = await api.post<QueuedCvRunResponse>("/profile-cv/reprocess");
await loadProfile();
await loadExtractionRuns();
toast(`Queued CV reprocess run (run ${res.data.extractionRunId}).`, "info");
} catch (e: any) {
toast(String(e?.response?.data || e?.message || t("profileCvReprocessFailed")), "error");
@@ -505,7 +521,7 @@ export default function CareerProfilePage() {
<TextField
label={t("profileCvTextLabel")}
value={profileCvText}
onChange={(e) => setProfileCvText(e.target.value)}
onChange={(e) => { setProfileCvText(e.target.value); setProfileDirty(true); }}
helperText={t("profileCvTextHelp")}
multiline
minRows={12}
@@ -551,7 +567,7 @@ export default function CareerProfilePage() {
<Button size="small" color="inherit" sx={{ mt: 0.75 }} onClick={async () => {
try {
await api.post(`/operations/${run.operation!.id}/cancel`);
await loadProfile();
await loadExtractionRuns();
toast("CV processing cancellation requested.", "info");
} catch (error) {
toast(getApiErrorMessage(error, "Could not cancel CV processing."), "error");
@@ -562,7 +578,7 @@ export default function CareerProfilePage() {
<Button size="small" color="inherit" sx={{ mt: 0.75 }} onClick={async () => {
try {
await api.post(`/operations/${run.operation!.id}/retry`);
await loadProfile();
await loadExtractionRuns();
toast("CV processing queued again.", "info");
} catch (error) {
toast(getApiErrorMessage(error, "Could not retry CV processing."), "error");
@@ -598,13 +614,18 @@ export default function CareerProfilePage() {
label={`Include low-confidence ${change.category}: ${change.label}`}
/>
))}
{profileDirty ? (
<Alert severity="warning" sx={{ mt: 1 }}>
Save your current career-profile edits before applying imported changes.
</Alert>
) : null}
<Box sx={{ display: "flex", gap: 1, mt: 1, flexWrap: "wrap" }}>
<Button size="small" variant="contained" disabled={!runDiffs[run.id] || reviewingRunId !== null} onClick={async () => {
<Button size="small" variant="contained" disabled={!runDiffs[run.id] || reviewingRunId !== null || profileDirty} onClick={async () => {
setReviewingRunId(run.id);
try {
await api.post(`/profile-cv/runs/${run.id}/accept`, { acceptedLowConfidenceIds: acceptedLowConfidenceIds[run.id] ?? [] });
setRunDiffs((current) => { const next = { ...current }; delete next[run.id]; return next; });
await Promise.all([loadProfile(), loadVersions()]);
await Promise.all([loadProfile(), loadExtractionRuns(), loadVersions()]);
toast("CV changes merged into your career profile.", "success");
} catch (error) {
toast(getApiErrorMessage(error, "Could not apply CV changes."), "error");
@@ -615,7 +636,7 @@ export default function CareerProfilePage() {
try {
await api.post(`/profile-cv/runs/${run.id}/discard`);
setRunDiffs((current) => { const next = { ...current }; delete next[run.id]; return next; });
await loadProfile();
await loadExtractionRuns();
toast("CV extraction discarded.", "info");
} catch (error) {
toast(getApiErrorMessage(error, "Could not discard CV extraction."), "error");
@@ -649,7 +670,7 @@ export default function CareerProfilePage() {
setParsingCvSections(true);
try {
const res = await api.post<{ structuredCv?: StructuredCvProfile }>("/profile-cv/parse", { text: profileCvText });
setStructuredCv(normalizeStructuredCv(res.data?.structuredCv));
editStructuredCv(normalizeStructuredCv(res.data?.structuredCv));
toast(t("profileCvStructureParsed"), "success");
} catch (e: any) {
toast(String(e?.response?.data || e?.message || t("profileCvStructureParseFailed")), "error");
@@ -689,25 +710,25 @@ export default function CareerProfilePage() {
<PersonalInformationSection
value={structuredCv.contact}
onChange={(next) => setStructuredCv((prev) => ({ ...prev, contact: next }))}
onChange={(next) => editStructuredCv((prev) => ({ ...prev, contact: next }))}
getMetadata={metaFor}
/>
<Box sx={{ mt: 2, display: "grid", gridTemplateColumns: { xs: "1fr", md: "1fr 1fr" }, gap: 1.5 }}>
<ProfessionalSummarySection value={structuredCv.summary} onChange={(next) => setStructuredCv((prev) => ({ ...prev, summary: next }))} getMetadata={metaFor} />
<SkillsSection value={structuredCv.skills} onChange={(next) => setStructuredCv((prev) => ({ ...prev, skills: next }))} getMetadata={metaFor} />
<InterestsSection value={structuredCv.interests} onChange={(next) => setStructuredCv((prev) => ({ ...prev, interests: next }))} getMetadata={metaFor} />
<ProfessionalSummarySection value={structuredCv.summary} onChange={(next) => editStructuredCv((prev) => ({ ...prev, summary: next }))} getMetadata={metaFor} />
<SkillsSection value={structuredCv.skills} onChange={(next) => editStructuredCv((prev) => ({ ...prev, skills: next }))} getMetadata={metaFor} />
<InterestsSection value={structuredCv.interests} onChange={(next) => editStructuredCv((prev) => ({ ...prev, interests: next }))} getMetadata={metaFor} />
</Box>
<LongTailSections values={{ awards: structuredCv.awards, publications: structuredCv.publications, organisations: structuredCv.organisations, references: structuredCv.references }} onChange={(key, next) => setStructuredCv((prev) => ({ ...prev, [key]: next }))} />
<LongTailSections values={{ awards: structuredCv.awards, publications: structuredCv.publications, organisations: structuredCv.organisations, references: structuredCv.references }} onChange={(key, next) => editStructuredCv((prev) => ({ ...prev, [key]: next }))} />
<LanguagesSection value={structuredCv.languages} onChange={(next) => setStructuredCv((prev) => ({ ...prev, languages: next }))} getMetadata={metaFor} />
<LanguagesSection value={structuredCv.languages} onChange={(next) => editStructuredCv((prev) => ({ ...prev, languages: next }))} getMetadata={metaFor} />
<WorkExperienceSection value={structuredCv.jobs} onChange={(next) => setStructuredCv((prev) => ({ ...prev, jobs: next }))} />
<WorkExperienceSection value={structuredCv.jobs} onChange={(next) => editStructuredCv((prev) => ({ ...prev, jobs: next }))} />
<EducationSection value={structuredCv.education} onChange={(next) => setStructuredCv((prev) => ({ ...prev, education: next }))} />
<EducationSection value={structuredCv.education} onChange={(next) => editStructuredCv((prev) => ({ ...prev, education: next }))} />
<OtherSectionsSection value={structuredCv.otherSections} onChange={(next) => setStructuredCv((prev) => ({ ...prev, otherSections: next }))} />
<OtherSectionsSection value={structuredCv.otherSections} onChange={(next) => editStructuredCv((prev) => ({ ...prev, otherSections: next }))} />
</Box>
<Box sx={{ mt: 1, display: "flex", justifyContent: "space-between", gap: 1, flexWrap: "wrap" }}>
<Typography variant="caption" sx={{ color: "text.secondary" }}>
@@ -720,6 +741,7 @@ export default function CareerProfilePage() {
</Box>
<Box sx={{ gridColumn: "1 / -1", display: "flex", justifyContent: "flex-end", gap: 2, flexWrap: "wrap", alignItems: "center" }}>
{profileDirty ? <Chip size="small" color="warning" variant="outlined" label="Unsaved changes" /> : null}
<Button
variant="contained"
disabled={!isLocal || loading}
@@ -732,6 +754,7 @@ export default function CareerProfilePage() {
const saved = await api.put<CareerProfileResponse>("/career/profile", { profile: structuredCv, cvText: profileCvText });
setStructuredCv(normalizeStructuredCv(saved.data?.profile ?? structuredCv));
setCompleteness(saved.data?.completeness ?? null);
setProfileDirty(false);
toast(t("profileUpdated"), "success");
} catch (e: any) {
const msg = e?.response?.data || e?.message || t("profileUpdateFailed");