Commit Graph

194 Commits

Author SHA1 Message Date
8d0fc818ef feat(metrics): C3 — Prometheus counters for L0/L1/format-loss/retry
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m30s
2026-07-14 16:53:16 +02:00
13d2f83081 feat(format): B2 — PPTX placeholder filter, SmartArt diagrams, chart XPath matching
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 3m3s
2026-07-14 16:50:06 +02:00
4d466699fd feat(quality): A3 — L1 LLM judge via API (5 chunks, 0.0003 USD/job)
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m26s
L1 quality layer — uses a cheap LLM via the OpenAI-compatible API to
validate translation quality. Designed to be the SECOND line of defense
after L0 (script detection, length, pattern).

Architecture:
  - sampler.py — picks 5 representative chunks per job (longest first,
    skips L0-failed indices, skips too-short or identical pairs)
  - llm_judge.py — OpenAI-compatible client, binary verdict per chunk
    (accurate / fluent / correct_language / no_leaks), JSON output,
    hard timeout, defensive (never raises), cost estimation built in
  - pipeline.py — defensive wrapper that integrates both, never breaks
    a translation job, always logs a structured event

Integration:
  - 5 feature flags in config.py (QUALITY_L1_ENABLED, _LOG_ONLY, etc.)
  - QUALITY_L1_LOG_ONLY=true by default: log-only mode, verdict NEVER
    blocks or retries a job
  - Reuses the chunks extracted by L0 (no double work)
  - Passes the set of L0-failed indices so L1 doesn't re-judge them
  - Wrapped in try/except so a misconfigured L1 NEVER breaks a job

Default config: deepseek-chat via DeepSeek API
  - Cost: ~0.0003 USD per job (5 chunks)
  - Speed: typically 1-2s per call, hard ceiling at 8s
  - Easy to swap: just set L1_JUDGE_BASE_URL and L1_JUDGE_MODEL

LLM judge is intentionally a SEPARATE model from the translator
(self-evaluation bias mitigation — Meta/Stanford papers 2024-2025).

Tests:
  test_sampler.py — 9 tests covering the sampling strategy
  test_llm_judge.py — 22 tests covering init, parsing, mocked API,
    cost estimation, env factory
  test_l1_pipeline.py — 6 tests covering the wrapper
  Total new: 37 tests, all pass
  Grand total quality+format: 264 tests passing (0 regression)

  All 36 new tests + 111 L0 tests + 117 existing translator tests = 264

Phase 1 (observation) for 2 weeks. Then QUALITY_L1_LOG_ONLY=false
to enable auto-retry via the fallback chain.
2026-07-14 16:39:47 +02:00
5ae1587428 feat(format): B1 — Word/Excel quick wins for format preservation
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m35s
Word fixes:
  W1 — Fix hyperlink double-collect: a run inside <w:hyperlink> was
       previously collected twice (once via paragraph.runs, once via
       the manual hyperlink iter). Now uses a dedup set of element
       ids to collect each run exactly once.

       NB: python-docx 1.x's paragraph.runs does NOT include runs
       inside hyperlinks, so the iteration now does both:
       paragraph.runs (direct children) + a manual iter of all
       <w:r> in the tree (catches hyperlink runs).

  W2 — Fix footnotes import: used document.part.package.part_related_by
       which doesn't exist in python-docx 1.x, so footnotes were never
       collected. Now uses document.part.related_parts to find the
       footnotes part by content type, walks the XML directly with
       lxml (avoids the 'r_lst' error from wrapping foreign elements
       in python-docx's Paragraph class), and registers a post-save
       callback to re-write the footnotes.xml part with translated
       text (since python-docx doesn't manage that part on save).
       Same fix applied to endnotes.

  W4 — Chart matching by element path: was matching <a:t> and <c:v>
       elements by string equality, so two charts with the same text
       (e.g. two 'Revenue' series) would only have the first one
       translated. Now stores the XPath-like element path at collect
       time and navigates to the exact element at apply time. Falls
       back to string matching for legacy entries without a path.

Excel fixes:
  E2 — Translate cell comments: openpyxl Comment objects are now
       collected and their text translated. The Comment object is
       replaced in place after translation.

  E3 — Translate cell hyperlink display labels: cell.hyperlink.display
       (or .target if no display) is collected and translated. The
       URL itself is never sent for translation, so it remains
       intact. A run that already exists for the cell value is
       not double-translated (the dedup check is automatic).

  E4 — Chart matching by element path: same fix as W4 but for
       Excel. Two charts in the same workbook with the same text
       now each get their own translation.

Tests:
  Added tests/test_translators/test_b1_format_fixes.py with 11 tests
  covering all the fixes. All 11 pass. Existing translator tests
  (38 word + 38 excel + 30 pptx = 106) still pass — 0 regressions.

  Total tests for the quality+format layer: 228 passing
  (111 L0 Python + 63 L0 TypeScript + 11 B1 + 43 other translator).

All fixes are surgical: existing translation flow is preserved.
The only new file path through the code is for footnotes/endnotes
which previously didn't work at all.
2026-07-14 16:28:17 +02:00
f403b2851d feat(quality): add L0 quality layer (Track A1 + A2 of dev plan)
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 3m5s
L0 quality detection layer to catch translation failures BEFORE they
reach users. Pure Python/TypeScript, zero new dependencies, no API calls.

Backend (Python — services/quality/):
  - Script detection: 145 langs mapped to 23 scripts (Latin, Cyrillic,
    Greek, Arabic, Hebrew, CJK, Hangul, Kana, Devanagari, Bengali, etc.)
  - Language confusion detection (e.g. Arabic text for French target)
  - Arabic-script variant discrimination (Persian/Urdu/Pashto/Kurdish
    confusion — e.g. Persian text returned when Arabic was requested)
  - Length sanity check (with numeric/short-source exemptions)
  - Prompt leak detection (Translation: / Voici la traduction: / 翻译:)
  - Repetition hallucination detection (token + character level)
  - File text extraction for .docx/.xlsx/.pptx/.pdf (no translator
    changes needed)
  - Defensive pipeline that never raises (L0 must NEVER break a job)

Frontend (TypeScript — wordly.art---traduction-de-documents/src/utils/):
  - Exact 1:1 mirror of the Python module
  - Zero dependencies, works in browser AND Node.js
  - Native Unicode regex (\\p{L}/u) and codePoint iteration
  - 63 tests using Node's built-in test runner

Integration:
  - Feature-flagged: QUALITY_L0_ENABLED=false (default)
  - Observation only: logs structured events, never modifies files
  - try/except wrapped: impossible to break a translation job
  - Lazy imports: only loaded when flag is on
  - Zero impact on existing tests / behavior

Tests:
  - 111 Python tests covering all paths (config, script, length, leak,
    pipeline, file_extractor) — 100% pass
  - 63 TypeScript tests (Node --test) — 100% pass
  - 174/174 total tests for the L0 layer

Bug fixes in script mapping:
  - yi (Yiddish) -> hebrew (was incorrectly mapped to arabic)
  - dv (Maldivian) -> thaana (was incorrectly mapped to arabic)
  - ja (Japanese) -> hiragana_katakana (distinguishes from Chinese CJK)

Phase 1 (backend) + Phase 2 (frontend) of Track A complete.
Next: Track B1 (Word/Excel format preservation quick wins).

Closes Track A phase 1+2 of the dev plan.
2026-07-14 16:17:43 +02:00
ebb2537fda feat(glossaries): implement a 3-step wizard for CSV/file imports with custom source/target language selection
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m21s
2026-06-28 11:38:18 +02:00
36aeac2c5e fix(glossaries): prevent translation data destruction on language selector change for multi glossaries
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m53s
2026-06-28 11:03:31 +02:00
de9407f974 revert(docker): remove automated database glossary translation from startup sequence
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m0s
2026-06-28 10:55:19 +02:00
5e3fb0098b feat(docker): run glossary translation script automatically on backend container startup
Some checks failed
Deploy to Production / Build and Deploy (push) Has been cancelled
2026-06-28 10:53:58 +02:00
a57b8a8e4d fix(glossaries): normalize language code casing when retrieving display translations 2026-06-28 10:52:08 +02:00
dde80f6bc3 feat(glossaries): update script to translate missing terms in any glossary, even if target_language is already 'multi'
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m43s
2026-06-28 10:46:48 +02:00
7398cae359 feat(glossaries): add script to translate non-multilingual database glossaries using Google Translate adapter
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m25s
2026-06-28 10:42:41 +02:00
030950c962 feat(glossaries): option C - page management + wizard /new 2-step creation
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 3m6s
2026-06-28 09:55:14 +02:00
5d6afd2dad fix(contrast): replace all opacity-based colors with concrete hex values meeting WCAG 4.5:1 ratio
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m44s
2026-06-21 10:54:17 +02:00
07c50151cb fix(contrast): increase text contrast on glossary page for light mode readability
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m24s
2026-06-20 19:39:33 +02:00
299173fff7 ux(glossary): clarify selection flow - compact banner, Utiliser button, hide create section by default
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m27s
2026-06-20 19:18:46 +02:00
9b354befe3 fix(glossary): hide create section by default when glossaries exist - only shown on demand via toggle button
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 3m11s
2026-06-20 19:07:30 +02:00
4a8f33d36f fix(glossary): eliminate all redundant elements - filter imported templates, remove duplicate buttons and links
Some checks failed
Deploy to Production / Build and Deploy (push) Has been cancelled
2026-06-20 19:03:44 +02:00
489df66c0f fix(i18n): add missing translation keys for tabs and presets 2026-06-20 19:01:09 +02:00
96bac2e792 style(glossary): remove redundant buttons and links, filter already imported presets
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m26s
2026-06-20 18:46:38 +02:00
d78f08e24f feat(glossary): restructure page with tabs, direct translate redirects and dynamic mapping
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m39s
2026-06-20 18:43:02 +02:00
c17dd2c6e1 fix(glossary): resolve data loss for non-FR/EN languages, fix prompt injection reference notes, and classic mode label wording
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m25s
2026-06-20 18:09:13 +02:00
1fe714aa1a ux(glossaries): simplify dialog, auto-save detail import, show templates and upload zone directly on main page
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m6s
2026-06-20 12:27:07 +02:00
d505b479cd refactor(glossaries): align CreateGlossaryDialog with editorial design system
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m56s
2026-06-20 09:36:39 +02:00
81cb4e09b7 fix(tests): update PDF format test to use truly unsupported format (.txt)
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m8s
2026-06-14 19:50:44 +02:00
a20ebe2295 fix(tests): update glossary service tests for dict return type
Some checks failed
Deploy to Production / Build and Deploy (push) Has been cancelled
2026-06-14 19:49:21 +02:00
233a054e34 fix(tests): isolate test DB and sync tier=pro in Pro user fixtures
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m34s
2026-06-14 19:44:25 +02:00
f85e5eef9b fix(tests): escape Windows paths in cleanup Redis mock
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m40s
2026-06-14 19:34:01 +02:00
b9446f166d fix(translate): French error messages and update mock users for quota checks
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m52s
2026-06-14 19:20:44 +02:00
adc3583358 fix(db): make migrations and glossary index SQLite-compatible
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m57s
2026-06-14 19:01:07 +02:00
cb8ce697d2 fix(translate): enforce Pro feature gating for glossary, custom_prompt and prompt_id
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m40s
2026-06-14 18:40:45 +02:00
f05399aeba fix(i18n): return French error messages in auth, register, download endpoints
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m44s
2026-06-14 18:13:41 +02:00
45e44dd7b2 fix(billing): unify quota counters, fix Stripe webhooks, tier/plan sync
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 3m16s
2026-06-14 17:39:34 +02:00
fa637abff0 perf+security: fix build, secure downloads, dedupe translations, refactor i18n
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m49s
Frontend:
- Fix Framer Motion / motion-dom build error by pinning framer-motion to
  11.18.2 (compatible with React 19 and Next.js 16).
- Add cross-env and build:local script to bypass standalone symlink errors
  on Windows without Developer Mode.
- Allow NEXT_OUTPUT=default to disable standalone output for local builds.
- Refactor i18n: split 14,177-line src/lib/i18n.tsx into per-locale,
  per-namespace JSON files under src/lib/i18n/messages/.
- Load English synchronously; other locales loaded on demand via dynamic
  imports (reduces initial bundle, improves maintainability).
- Remove unused next-intl message files src/messages/en.json and fr.json.

Backend:
- Remove insecure legacy /api/v1/download/{filename} and /api/v1/cleanup/{filename}
  endpoints. The job-based /api/v1/download/{job_id} already enforces ownership.
- Deduplicate texts in TranslationService.translate_batch before sending them
  to the provider, reducing API calls for repeated strings.
- Pin httpx to <0.28 to fix TestClient incompatibility with starlette 0.35.1.
- Add pytest-cov and ruff dev dependencies/config.

DevOps:
- Remove hardcoded Grafana password from docker-compose.yml and
  docker-compose.monitoring.yml; use GRAFANA_PASSWORD env var.
- Change default TRANSLATION_SERVICE from ollama to google in
  docker-compose.yml (Ollama is an optional profile).
- Add GRAFANA_PASSWORD to .env.example.
- Add .coverage and frontend/pnpm-workspace.yaml to .gitignore.

Tests:
- Update API versioning tests for removed legacy endpoints.
- Add tests/test_translation_service.py for deduplication behavior.

Verified:
- pnpm run build:local passes.
- uv run pytest tests/test_providers/* tests/test_translation_service.py
  tests/test_story_3_5_api_versioning.py tests/test_download_endpoint.py
  tests/test_translators/test_excel_translator.py: provider/translator tests
  pass; one pre-existing French error-message test still fails (message is
  returned in English, unrelated to this change).
2026-06-14 16:44:18 +02:00
eda6821632 i18n: fix missing keys and translate all non-admin frontend strings
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m43s
- Add 12 missing i18n keys (t() was returning the literal key string) to
  all 13 locales: dashboard.topbar.premiumAccess,
  dashboard.translate.complete.toastOkDesc,
  dashboard.translate.progress.{connectionLost,processingFallback},
  glossaries.card.{term,created}, glossaries.termEditor.{addTerm,maxReached},
  login.google.{connecting,errorFailed,errorGeneric}, login.orContinueWith
- Add 6 FR-drift keys (landing.pricing.{free,enterprise}.{name,desc,cta})
- Add ~120 new i18n keys covering site header/footer, file-uploader,
  checkout success, dashboard pages, translate page, provider selector
  themes, language selector, translation complete, api-keys, services,
  settings, pricing (~1800 new key/locale pairs)
- Wrap hardcoded French/English in components with t() calls
- Convert LLM_THEMES/CLASSIC_THEMES/FALLBACK_PROVIDERS maps from
  hardcoded constants to t()-driven factories
- Admin pages intentionally left untouched per request

Files: 15 components/pages + src/lib/i18n.tsx
Typecheck: passes (tsc --noEmit exit 0)
2026-06-14 12:45:12 +02:00
9b0b2ae6f9 docs: remove remaining Claude 3.5 references and display page credit costs in translation provider selector
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m11s
2026-06-14 11:41:47 +02:00
c7506e6aca fix: resolve critical security and UI session mismatch by clearing React Query cache on login/logout and invalidating on subscription updates
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m24s
2026-06-14 11:15:09 +02:00
136d40c7d8 feat: update to June 2026 models (Claude Sonnet 4.6, Gemini 3.5 Flash), add glossary button, and implement cost factor quota & vision fallback
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m4s
2026-06-14 11:05:53 +02:00
5fd087979b feat: unify multimodels translation providers, remove self-hosting (Ollama/LibreTranslate), and fix local SQLite configuration
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m21s
2026-06-14 10:44:46 +02:00
feea02033b fix: resolve Google login hydration mismatch and dynamic env load
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m42s
2026-06-07 12:21:06 +02:00
5b8c29dae6 feat: enable passing NEXT_PUBLIC_GOOGLE_CLIENT_ID at docker compose build time
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m30s
2026-06-07 11:41:04 +02:00
29753881a6 feat: add Telegram notifications for user signup and Stripe events
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m34s
2026-06-07 11:37:01 +02:00
8659b6761f docs: update README.md to act as central documentation portal with French links
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m46s
2026-06-07 11:21:06 +02:00
fa19f33ab0 docs: add French restore procedure guide PROCEDURE_RESTAURATION.md
Some checks failed
Deploy to Production / Build and Deploy (push) Has been cancelled
2026-06-07 11:20:04 +02:00
9bb02927c3 fix: redirect logs to stderr and reduce size thresholds in backup/verify scripts
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m42s
2026-06-07 11:16:45 +02:00
ddf6b8f6bc fix: ignore unbound variables when sourcing .env in all backup/DR scripts
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m35s
2026-06-07 11:14:04 +02:00
3f980ad537 feat: add NAS backup, verification, and DR scripts
Some checks failed
Deploy to Production / Build and Deploy (push) Has been cancelled
2026-06-07 11:12:01 +02:00
Sepehr
fb6740f333 fix(glossaries): correct source/target display mapping (FR=source, EN=target, others=translations[lang])
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m55s
Avant : getDisplaySource(term, 'en') lisait term.translations.en
(qui n'existe pas) puis fallback sur term.source = francais.
C'est ce qui affichait du francais et du néerlandais au mauvais endroit.

Apres : le mapping reflete la structure reelle des donnees :
- FR (lang='fr') → term.source
- EN (lang='en') → term.target
- autres (de, es, it, pt, nl, ru, ja, ko, zh, ar, fa)
  → term.translations[lang]
- si manquant → '' (placeholder, JAMAIS une autre langue en fallback)

Memes regles pour getDisplayTarget, inversees (defaut = target).

Edition (handleTermChange) ecrit au bon endroit :
- FR → term.source
- EN (ou multi) → term.target
- autres → translations[lang]

Le remap automatique de term.target au changement de targetLanguage
est supprime (lecture a la volee maintenant, plus besoin de modifier
l'etat des termes).

Aucun changement de donnees, aucun changement backend, aucun
changement de schema. Fix purement frontend.
2026-06-07 10:59:57 +02:00
Sepehr
79848230c0 fix(glossaries): restore selectable source language (data was already there)
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m37s
Revert du commit e11a6b1 : la langue source doit etre selectionnable
(car l'utilisateur peut vouloir traduire depuis n'importe quelle
des 12 langues supportees, pas seulement le francais).

Le data modele support deja le cas : chaque terme a un champ
\	ranslations\ (dict de 11 langues) qui contient la traduction du
terme source. Donc pour traduire depuis l'italien, on lit
\	erm.translations.it\ comme source, et \	erm.translations.es\
comme cible si la cible est l'espagnol.

Changements :
- Le combobox 'Langue source' est restaure (12 langues)
- Nouvelle fonction \getDisplaySource(term, lang)\ :
  * 'fr' ou 'multi' → term.source (le francais original)
  * autre → term.translations[lang] (la traduction dans la langue)
  * fallback → term.source si la traduction manque
- handleTermChange ecrit au bon endroit selon la langue :
  * source FR → term.source
  * autre source → term.translations[sourceLanguage]
  * target 'multi'/'en' → term.target
  * autre target → term.translations[targetLanguage]
- hasUnsavedChanges compare aussi le dict translations (avant
  il ne comparait que source|target, donc un edit dans une autre
  langue ne declenchait pas l'alerte 'non enregistre')
- Note sous le combobox source explique la regle
  (FR = source originale, autre = champ translations)
- i18n : nouvelle cle \glossaries.detail.sourceLangNote\
  ajoutee aux 13 locales (FR + EN traduit)

L'utilisateur peut maintenant choisir 'Italien' comme source et
'Espagnol' comme cible, et voir les termes correspondants.
2026-06-07 10:11:19 +02:00
Sepehr
e11a6b16a0 fix(glossaries): source language combobox was a lie — replace with fixed FR label
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m32s
Les templates data/glossaires/*.json ne stockent les termes sources
qu'en francais. Le combobox 'Langue source' laissait l'utilisateur
croire qu'il pouvait traduire depuis une autre langue, mais le
backend renverrait toujours des termes en francais.

Fix : remplacer le select par un label fixe 'Francais' avec un badge
'fixe' et une note explicative indiquant que le multilingue source
est sur la roadmap.

Le select 'Langue cible' reste : il determine quelle traduction du
terme est affichee dans la colonne 'Cible' (FR+10 langues via le
champ translations).
2026-06-07 09:58:16 +02:00