Skip to content

Pulizia pre-2.0: debito legacy scoperto durante l'audit#318

Merged
nikazzio merged 8 commits into
mainfrom
fix/pre-2.0-cleanup-sweep
Jul 10, 2026
Merged

Pulizia pre-2.0: debito legacy scoperto durante l'audit#318
nikazzio merged 8 commits into
mainfrom
fix/pre-2.0-cleanup-sweep

Conversation

@nikazzio

@nikazzio nikazzio commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Sommario

Chiude il giro di pulizia pre-2.0 avviato dall'audit legacy di questa sessione (#299 verificato/chiuso, nessun codice necessario).

  • fix: etichetta @deprecated sbagliata sulla formattazione note a piè pagina in stile superscript (ancora usata per import non-markdown); suggerimento termine glossario ora propone la frase intera invece di un troncamento a 3 parole a caso — nessuna chiamata AI nascosta aggiunta.
  • refactor: rimossi i rami di rendering morti di PipelineSidebarRunSection (residuo della vecchia barra dashboard, già cancellata il 3 luglio in Migrare la dashboard / workspace-home alla shell nuova #294); aggiornato ARCHITECTURE.md che descriveva ancora il sistema pre-Migrazione shell sinistra (barra/tab/drawer/resize) a base strutturata #291.
  • chore: consolidato lo schema del database — tutte le colonne aggiunte nel tempo via patch incrementali (ensureColumn) sono ora nella definizione iniziale delle tabelle. Bump della versione schema per un reset pulito una tantum (c'è già un backup automatico pre-reset).
  • refactor: rimossa la funzionalità di anteprima/dry-run della modalità Test, rimasta scollegata dal pulsante Play dopo un fix del 3 luglio che l'aveva bypassata silenziosamente. Decisione presa con l'utente: tenere il comportamento reale attuale (esecuzione vera, solo su meno blocchi) invece di far rivivere l'anteprima — il confronto tra configurazioni diverse resta un'idea separata già in backlog (feat: Confronto parallelo tra provider/modelli #6).

Test plan

  • tsc --noEmit pulito
  • Suite Vitest: 63 file / 560 test verdi
  • Verificato manualmente npm run tauri:dev (DB init, nessun errore di schema)
  • Verifica visiva della UI (bloccata da un problema di rendering grafico locale WSL/WSLg non correlato al codice — da riverificare dopo riavvio WSL)

nikazzio added 4 commits July 10, 2026 00:45
highlightSuperscriptMarkersHtml was marked @deprecated but is still
actively used for non-markdown imports with superscript footnote
markers — the label was wrong, not the function.

extractTermFromPhrase suggested the term by naively slicing the first
three words. Replaced with the full selected phrase (user trims to the
exact term), avoiding a hidden extra LLM call per glossary quick-add.
Both live call sites always passed playFirst=true, making the
collapsed-non-playFirst and default (non-collapsed-non-playFirst)
branches unreachable — leftovers from the old dashboard sidebar,
already deleted as dead code on 2026-07-03 (#294). Collapsed the
component to its two actually-reachable render paths and dropped the
now-vestigial playFirst/showAuditOnly/onRunAuditOnly props.

Updated ARCHITECTURE.md, which still described the dashboard as using
the pre-#291 PipelineSidebar/useEdgeResize system.
Every column previously added via ensureColumn() after table creation
is now part of the initial CREATE TABLE statement. Most of those
ensureColumn calls were already no-ops (the column was already in the
CREATE TABLE from a prior consolidation), and the rest — the true
incremental migrations — are folded in directly since this is a
private, pre-release project with no installed base to preserve
compatibility with. The automatic beta-schema-reset-and-backup
mechanism already in place handles the one-time migration safely.

Bumped CURRENT_SCHEMA_VERSION to trigger that reset once. Emptied the
now-unused ALLOWED_MIGRATIONS whitelist (kept the ensureColumn/
validateColumnDefinition machinery for future schema changes).
Test mode's copy promised a discardable preview ("produces a preview,
configuration stays editable") with its own badge, clear/reset
actions, and toasts. In practice nothing wired the Play button to the
dry-run function anymore — a July 3rd fix routed it through the same
real/committing execution path used by Production mode (just limited
to N chunks), leaving the whole preview machinery orphaned: unreachable
function, dead props threaded through three components, unused i18n
strings, a chunk status with no writer.

Decided with the user to keep today's actual behavior (Test mode runs
for real, just fewer chunks — redundant with per-chunk re-run anyway)
and remove the leftover preview concept entirely rather than resurrect
it. A genuine "compare different configs side by side" feature is a
separate, already-tracked backlog idea (#6), not this.

Removed: runDryRun, the 'preview' ChunkStatus/FinalChunkStatus states,
resetPreviewChunks, the preview badge/minimap dot/stats row, and the
dryRun*/clearPreview/resetPreview/chunkPreviewBadge i18n strings (IT+EN).
Updated modeTestHint to describe what Test mode actually does now.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Questo PR completa una “pulizia pre-2.0” eliminando residui legacy emersi durante l’audit: rimuove la vecchia semantica di “preview/dry-run” della modalità Test (lasciando l’esecuzione reale su un numero limitato di chunk), consolida lo schema SQLite direttamente nelle CREATE TABLE, e aggiorna UI/test/docs conseguenti.

Changes:

  • Rimossa la gestione di chunk status: 'preview' e tutta la workflow dry-run associata (hook pipeline, store, UI, i18n, test).
  • Consolidato lo schema DB: colonne precedentemente aggiunte via ensureColumn() ora sono incluse nelle definizioni iniziali + bump CURRENT_SCHEMA_VERSION.
  • Ritocchi di pulizia/documentazione: footnote superscript helper non più marcato deprecated, suggerimento termine glossario restituisce la frase intera, aggiornato ARCHITECTURE.md.

Reviewed changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/utils/footnoteExtractor.ts Aggiorna il commento/contratto della funzione per marker superscript non-markdown.
src/types.ts Rimuove preview da ChunkStatus.
src/stores/chunksStore.ts Elimina resetPreviewChunks e rimuove handling speciale per status === 'preview'.
src/stores/chunksStore.test.ts Aggiorna i test dopo la rimozione del workflow preview.
src/services/llmService.ts extractTermFromPhrase ora propone l’intera frase selezionata (senza AI).
src/services/dbService.ts Consolidamento schema nelle CREATE TABLE, schema version bump, ALLOWED_MIGRATIONS svuotato.
src/services/dbService.test.ts Aggiorna le aspettative dei test su reset/versione e su colonne “baked in”.
src/i18n/it.json Rimuove stringhe UI per preview/dry-run e aggiorna hint modalità Test.
src/i18n/en.json Rimuove stringhe UI per preview/dry-run e aggiorna hint modalità Test.
src/hooks/usePipeline.ts Rimuove runDryRun e la nozione di FinalChunkStatus per run singolo.
src/hooks/usePipeline.test.ts Elimina test per dry-run/finalStatus preview; aggiorna suite.
src/hooks/pipeline/blobContext.ts Rimuove FinalChunkStatus.
src/components/layout/shell-next/ProjectRailNext.tsx Rimuove props/rami legati a dry-run/audit-only legacy.
src/components/layout/PipelineSidebarSections/PipelineSidebarRunSection.tsx Semplifica UI run section, rimuove controlli preview/test-run legacy.
src/components/document/tabs/StatsTab.tsx Rimuove conteggio “preview” dagli stats e aggiorna UI.
src/components/document/tabs/IndexTab.tsx Rimuove icona/stato “preview” nell’indice chunk.
src/components/document/ExtractTermDialog.tsx Rimuove fallback a 3 parole, usa direttamente extractTermFromPhrase.
src/components/document/DocumentView.tsx Rimuove styling/badge “preview” nella vista documento.
src/App.tsx Rimuove wiring onDryRun e logica “preview in test mode” per retraduzione singolo chunk.
src-tauri/Cargo.lock Bump versione pacchetto glossa nel lockfile.
docs-dev/ARCHITECTURE.md Aggiorna descrizione architettura post-migrazione dashboard/shell.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

</IconButton>
) : (
<IconButton size="md" tone="charcoal" onClick={pipelineMode === 'test' ? onDryRun : onRunPipeline} disabled={isProcessing || !hasDocument} title={`${t('pipeline.beginPipeline')} (Ctrl+↵)`} ariaLabel={t('pipeline.beginPipeline')} tooltipSide="right" className="h-9 w-9 border-editorial-charcoal bg-editorial-charcoal text-white hover:bg-editorial-charcoal/85">
<IconButton size="md" tone="charcoal" onClick={onRunPipeline} disabled={!hasDocument} title={t('pipeline.executeAll')} tooltipSide="right" className="h-10 w-10">

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Risolto in beaa507: in modalità Test il pulsante ora mostra "Esegui test (N blocchi)" (tooltip + aria-label, IT/EN).

Comment on lines +215 to 218
{workMode === 'all' && hasDocument && (
<span className="text-[11px] font-bold tabular-nums tracking-[0.1em] text-editorial-muted">
{completedCount}/{pipelineMode === 'test' ? runChunkCount : totalChunks}
{completedCount}/{totalChunks}
</span>

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Risolto in beaa507: il contatore ora usa min(pipelineTestChunkCount, totalChunks) come denominatore in Test mode e conta i completati solo dentro quella finestra.

Comment thread src/components/document/tabs/StatsTab.tsx Outdated
nikazzio added 2 commits July 10, 2026 02:06
Separate local schema compatibility from calendar dates.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 21 out of 22 changed files in this pull request and generated 1 comment.

Comment thread src/components/document/tabs/StatsTab.tsx Outdated
nikazzio added 2 commits July 10, 2026 02:45
In Test mode the pipeline only processes the first N chunks, but the
run button still said "Run all" and the progress counter compared
against the whole document, making a finished test run look stuck.
The label now announces the test scope and the counter tracks only
the chunks the run will actually touch. Also fix a missing space
after && in StatsTab JSX.
@nikazzio nikazzio merged commit 44662a7 into main Jul 10, 2026
7 checks passed
@nikazzio nikazzio deleted the fix/pre-2.0-cleanup-sweep branch July 10, 2026 00:52
nikazzio added a commit that referenced this pull request Jul 10, 2026
Release trigger: PR #318 was squash-merged with a non-conventional
title, so release-please considered 0 commits. This empty commit
carries the releasable type so 1.1.2 picks up the merged work.
@nikazzio nikazzio mentioned this pull request Jul 10, 2026
2 tasks
nikazzio added a commit that referenced this pull request Jul 10, 2026
Squash merges use the PR title as the commit subject on main;
a non-conventional title makes release-please skip the release
bump (happened with #318, missing 1.1.2). Block merge until the
title carries a conventional type.

Co-authored-by: nikazzio <nikazzio@users.noreply.github.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