Skip to content

fix(backend): make company research notes per user - #169

Merged
CMaintz merged 2 commits into
mainfrom
fix/per-user-company-notes
Oct 1, 2026
Merged

CMaintz merged 2 commits into
mainfrom
fix/per-user-company-notes

Conversation

@CMaintz

@CMaintz CMaintz commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Company research notes were stored on the shared companies row, so every user read and overwrote the same notes. Worse, CompanyGroundingService fed those notes into cover-letter prompts, so my notes could end up grounding someone else's letter.

Stacked on #160 because the Testcontainers base only exists there so far.

  • V036 adds user_company_notes, keyed by (user_id, company_id), and drops the two columns from companies.
  • Existing notes have no author, so I give a note to a user only when exactly one user has an application or a tracked outreach for that company. If several users do, or nobody does, the note is dropped. Copying it to everyone involved would just keep the leak. In practice that's only been me so far, so nothing real should get lost.
  • New CompanyResearchRepositoryPort + adapter. The use case, controller and grounding service all take the current user's id now.
  • Tests: two-user cases in CompanyServiceTest and a new CompanyGroundingServiceTest, Postgres tests for the adapter, and a migration test that runs V035, seeds old-style notes, then applies V036 and checks where each one ended up.
  • PostgresIntegrationTest now shares one container across the run. With one container per class, the second class with the same Spring config got the cached context pointing at a stopped database. The new migration test hit that.

The API and frontend are unchanged. 571 backend tests pass locally with Docker.

Notes lived on the shared companies row, so every user read and overwrote the
same text, and it also grounded everyone else's cover letters. They now live in
user_company_notes keyed by (user_id, company_id).
Base automatically changed from fix/postgres-query-bugs to main October 1, 2026 09:40
@CMaintz
CMaintz merged commit 1ca7871 into main Oct 1, 2026
19 checks passed
@CMaintz
CMaintz deleted the fix/per-user-company-notes branch October 1, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant