# Jobbjakt next session handoff

Last updated: 2026-03-23

## What was completed today
- Added attachment-aware AI context selection across job AI tabs.
- Added attachment metadata:
  - purpose
  - AI inclusion toggle
- Added overview strategy snapshot in job details.
- Added AI draft variants for:
  - cover letters
  - recruiter messages
- Added route-level lazy loading/code splitting.
- Added CV section rewrite + replace flow.
- Added CV structure parsing UI and backend parsing endpoint.
- Added persisted structured CV section JSON on user profiles.
- Updated job-tailoring prompts to include structured CV sections.
- Added frontend tests for:
  - attachments metadata controls
  - job details generated drafts
  - profile page CV structure parsing/persistence
- Added `tmp/` to `.gitignore` to protect local/private test files.
- Used local file `tmp/test-data/my-cv.pdf` only for a lightweight private sanity check.

## Deployment / CI fixes made
- Added `profile-page.test.tsx` to frontend CI test command.
- Hardened remote deploy shell with `set -euo pipefail` in workflow.
- Improved `deploy/deploy.sh` to:
  - retry Docker build after cleanup if layer extraction fails
  - prune builder/cache on retry
  - rebuild `ai-service` with `--no-cache` on retry
  - verify both backend and ai-service are running after deploy
  - remove old legacy `app-summarizer-1` container if present

## Important production issue observed
Remote deploy failed with Docker layer extraction error during ai-service image export:
- `unpigz: corrupted -- crc32 mismatch`

Most likely host-side Docker/cache/storage issue, not app code.
Mitigation has been added in deploy script, but if it happens again check:
- available disk space on host
- Docker storage driver health
- `/var/lib/docker` filesystem integrity
- BuildKit cache corruption
- whether Docker daemon needs restart

## Outstanding product/code items
### Highest priority
1. Expand structured CV data from JSON persistence into richer first-class usage:
   - explicit section chooser in tailoring UI
   - section-weighted tailored CV generation
   - section-specific missing-keyword analysis
2. Add more tests:
   - profile CV rebuild/improve endpoints
   - attachment AI filtering defaults
   - strategy snapshot regeneration
   - structured CV influence on tailoring prompts (backend tests if practical)
3. Final UX polish pass on:
   - Profile CV tools
   - Job details AI tabs
   - Attachments table metadata controls

### Medium priority
4. Dashboard polish toward requested SaaS references.
5. System/admin page clarity pass.
6. Translation consistency review across EN + NB.
7. Audit username/full-name/email autofill consistency.

### Lower priority
8. Internal `Summarizer*` → `AiService*` naming cleanup.
9. Broader performance review after latest UI additions.

## Suggested next implementation order
1. Add structured CV section influence visibility in UI:
   - show which sections are being used for tailoring
   - allow picking preferred sections for a job package
2. Add tests for attachment AI defaults + profile persistence edge cases
3. Final UX polish pass on profile/job details/attachments
4. Dashboard + system polish

## Useful skills to apply next time
- `accessibility`
  - use for the final UI polish/a11y pass across dialogs, forms, focus states, contrast, keyboard support, and screen-reader naming
- `agent-browser`
  - use for live verification of local or deployed Jobbjakt flows, screenshots, route checks, admin/system checks, and browser-based a11y smoke testing
- `code-optimizer`
  - use for a targeted performance/code-quality audit after the current feature/polish work stabilizes

## Files most relevant next time
- `JobTrackerApi/Controllers/JobApplicationsController.cs`
- `JobTrackerApi/Controllers/ProfileCvController.cs`
- `JobTrackerApi/Controllers/AuthController.cs`
- `Models/ApplicationUser.cs`
- `Models/Attachments.cs`
- `JobTrackerApi/Program.cs`
- `job-tracker-ui/src/pages/ProfilePage.tsx`
- `job-tracker-ui/src/components/JobDetailsDialog.tsx`
- `job-tracker-ui/src/components/Attachments.tsx`
- `job-tracker-ui/src/profile-page.test.tsx`
- `job-tracker-ui/src/attachments.test.tsx`
- `job-tracker-ui/src/job-details-generated-drafts.test.tsx`
- `.gitea/workflows/ci-deploy.yml`
- `deploy/deploy.sh`

## Local private test asset
- `tmp/test-data/my-cv.pdf`
- Do not commit it.
