Skip to content

fix(status): convert Ghosting over closing statuses and restore expired-draft dates - #121

Merged
hugoalves-dev merged 26 commits into
mainfrom
hugo/intelligent-wozniak-krhlwh
Dec 3, 2026
Merged

hugoalves-dev merged 26 commits into
mainfrom
hugo/intelligent-wozniak-krhlwh

Conversation

@hugoalves-dev

@hugoalves-dev hugoalves-dev commented Dec 3, 2026 •

Copy link
Copy Markdown
Owner

Corrige a conversão de status legado do #117.

Problema

Em produção ficaram 24 registros sem data no formato antigo ("Ghosting" em itálico na lista):

  • 12 Ghosting sobre TARDE_DEMAIS: posts do LinkedIn salvos só com o link e com o prazo perdido;
  • 12 Ghosting sobre Rejected: rascunhos que o job noturno antigo marcou como Rejected e depois como Ghosting.

A tabela de conversão do design (§3) diz que Ghosting sobre um encerramento aplica a regra do encerramento. O LegacyStatusMapper.ghosting checava "sem data" antes e desistia.

Correção

  • A regra do encerramento passa a ser avaliada antes da exigência de data:
    • Tarde demais sem data → Rascunho + Desisti;
    • Rejected sem data → Rascunho.
  • V41: limpa o marcador legacy_status só dos registros não convertidos (stage IS NULL), para o backfill tentar de novo no startup. Os que continuarem sem conversão (13 Ghosting sobre GHOSTING, de abril) voltam a ter o valor legado. Registros convertidos não são tocados.

Reparo de datas (V42), aprovado pelo mantenedor

Antes da virada, candidaturas criadas sem status eram gravadas como rascunho e a API apagava a data de candidatura. Depois, o job noturno antigo as marcava como Rejected e, mais tarde, como Ghosting.

A V42 trata só as linhas com essa assinatura:

  • Rejected sem status anterior, ou Ghosting sobre Rejected;
  • sem data, sem resultado e ainda em rascunho ou sem etapa.

Para cada uma:

  • application_date recebe created_at::date, o dia em que o registro foi criado;
  • a etapa vira APPLIED, aguardando COMPANY;
  • updated_at não é tocado, para o cálculo de ghosting continuar correto.

Tarde demais (prazo perdido) e os demais registros legados ficam como estão. Em produção são esperadas 18 linhas.

Backup e rollback: o estado anterior de cada linha fica em application_date_repair_backup_20261203.

UPDATE job_applications j
SET application_date = b.application_date, stage = b.stage, outcome = b.outcome,
    waiting_on = b.waiting_on, to_send_later = b.to_send_later, legacy_status = b.legacy_status
FROM application_date_repair_backup_20261203 b
WHERE b.id = j.id;

Teste: ExpiredDraftDateRepairIT executa o script da migration contra Postgres com linhas de cada formato encontrado em produção. Verifica:

  • que só as linhas-alvo mudam;
  • que updated_at fica intacto;
  • que o backup é gravado;
  • que rodar o script duas vezes não altera nada a mais.

Verificação

  • Teste novo com os três grupos reais de produção, RED → GREEN.
  • Suíte unitária 508/508.

https://claude.ai/code/session_01GfjfbQseka7Y3pN4sK32Pe


Generated by Claude Code

…acy status

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GfjfbQseka7Y3pN4sK32Pe
The nightly job turned week-old drafts into Rejected and any record untouched
for a month (Rejected, Approved and archived included) into Ghosting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GfjfbQseka7Y3pN4sK32Pe
…pose them in responses

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GfjfbQseka7Y3pN4sK32Pe
…r status values

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GfjfbQseka7Y3pN4sK32Pe
…s from main

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GfjfbQseka7Y3pN4sK32Pe
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GfjfbQseka7Y3pN4sK32Pe
… a stage to be saved

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GfjfbQseka7Y3pN4sK32Pe
…d the stage model

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GfjfbQseka7Y3pN4sK32Pe
…acy status filters are translated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GfjfbQseka7Y3pN4sK32Pe
… and calculated ghosting

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GfjfbQseka7Y3pN4sK32Pe
…ols, analytics and rules

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GfjfbQseka7Y3pN4sK32Pe
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GfjfbQseka7Y3pN4sK32Pe
…record; phase readers ignore the frozen column

- An unchanged legacy status sent back by a client keeps the current stage/outcome.
- Stage writes leave a display-only legacy label the previous frontend can echo.
- PUT with outcome/waitingOn but no stage keeps the current stage (400 on create).
- Assistant get and organization summary report the phase, not the legacy column.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GfjfbQseka7Y3pN4sK32Pe
…ontrollerIT

Passkey ITs can leave challenge rows behind; depending on test order the
user cleanup then hit the webauthn_challenges foreign key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GfjfbQseka7Y3pN4sK32Pe
Production had 24 rows (Ghosting over Tarde demais / Rejected, no application
date) left in the legacy format because the date check ran before the closing
rule. V41 makes the startup backfill retry unconverted rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GfjfbQseka7Y3pN4sK32Pe
…pired

V42 gives rows shaped like 'Rejected without previous status' or 'Ghosting over
Rejected', with no application date, their creation day as application date and
opens them as APPLIED waiting on the company. Previous values are backed up in
application_date_repair_backup_20261203; updated_at is untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GfjfbQseka7Y3pN4sK32Pe
@hugoalves-dev hugoalves-dev changed the title fix(status): convert Ghosting over a closing status without a date fix(status): convert Ghosting over closing statuses and restore expired-draft dates Dec 3, 2026
@hugoalves-dev
hugoalves-dev marked this pull request as ready for review December 3, 2026 00:59
@hugoalves-dev
hugoalves-dev merged commit 180a835 into main Dec 3, 2026
1 of 2 checks passed
@hugoalves-dev
hugoalves-dev deleted the hugo/intelligent-wozniak-krhlwh branch December 3, 2026 00:59
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown

Qodana for JVM

11 new problems were found

Inspection name Severity Problems
Constant values 🔶 Warning 5
Nullability and data flow problems 🔶 Warning 4
Non-atomic operation on 'volatile' field 🔶 Warning 2
View the detailed Qodana report

To be able to view the detailed Qodana report, you can either:

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true,
so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/qodana-action@v2025.3.2
        with:
          upload-result: true
Contact Qodana team

Contact us at qodana-support@jetbrains.com

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.

2 participants