Skip to content

docs: add translation image stabilization specification for issue #137#140

Draft
luandro wants to merge 3 commits intomainfrom
feat/translation-image-stabilization-spec
Draft

docs: add translation image stabilization specification for issue #137#140
luandro wants to merge 3 commits intomainfrom
feat/translation-image-stabilization-spec

Conversation

@luandro
Copy link
Contributor

@luandro luandro commented Feb 13, 2026

Summary

This PR adds a comprehensive technical specification document for addressing issue #137 - replacing expiring Notion/S3 image URLs in translated documentation with stable canonical /images/... paths.

Problem

The Notion translation workflow (scripts/notion-translate/index.ts) produces translated Markdown with expiring Notion/S3 image URLs that break over time (~1 hour expiration). Meanwhile, the English fetch pipeline already handles this correctly by downloading images to static/images/ and rewriting URLs.

Solution Overview

The specification proposes integrating the existing image processing pipeline into the translation flow:

  1. Pre-translation: Call processAndReplaceImages() to stabilize image URLs before sending to OpenAI
  2. Post-translation: Call validateAndFixRemainingImages() as a safety net to catch any remaining S3 URLs

This approach reuses existing, tested code rather than creating new image handling logic.

What's Included

📄 TRANSLATION_IMAGE_STABILIZATION_SPEC.md containing:

Implementation Plan Summary

Phase Description Time
Phase 1 Core Integration - Add image processing to translation pipeline 2-3h
Phase 2 Prompt Enhancement - Update OpenAI prompt to preserve /images/ paths 30m
Phase 3 Testing - Create comprehensive test suite 2-3h
Phase 4 Validation - Lint, format, regression tests 1h
Phase 5 PR Creation 30m

Acceptance Criteria (from issue #137)

After implementation, translated markdown will contain:

  • ✅ Zero URLs matching secure.notion-static.com, notion-static.com, amazonaws.com, X-Amz-*, or www.notion.so/image/
  • ✅ Stable /images/<filename> references that resolve at build time
  • ✅ Shared images (no duplication per language)
  • ✅ Support for both ![alt](...) and <img src="..."> syntax
  • ✅ Idempotent behavior (re-running doesn't cause churn)

Testing

This PR only adds documentation (specification). Testing will be part of the implementation PR.


Closes #137

@luandro can click here to continue refining the PR

openhands-agent and others added 3 commits February 13, 2026 01:00
This specification document addresses the problem of expiring Notion/S3 image
URLs in translated documentation. It provides:

- Technical analysis of the current translation pipeline
- Proposed solution integrating existing image processing infrastructure
- Detailed 5-phase implementation plan with time estimates
- Testing requirements and acceptance criteria
- Risk analysis and rollback strategy

The solution reuses the existing processAndReplaceImages() and
validateAndFixRemainingImages() functions from the notion-fetch pipeline
to stabilize image URLs before and after translation.

Closes #137

Co-authored-by: openhands <openhands@all-hands.dev>
Updates to TRANSLATION_IMAGE_STABILIZATION_SPEC.md:

Per-language image overrides:
- Add section explaining default vs override behavior
- Document how translators can use localized screenshots
- Define precedence rules (language page wins, EN fallback)
- Add how-to snippet with before/after example

Pipeline improvements:
- Add language-aware source selection step in pipeline flow
- Update acceptance criteria for localized images

Technical clarifications:
- Add function contracts section with exact input/output types
- Fix line number typo (858-518 → 858-890)
- Add invariants section with grep verification commands
- Make failure policy explicit (fail page, no placeholders)
- Clarify validation catches mutated canonical paths

Testing:
- Add per-language override test case
- Require mocked network/filesystem in tests

Cleanup:
- Remove time estimates from phases
- Reuse existing slug logic (no new implementation)
- Expand out-of-scope section (no migration, no new storage)

Co-authored-by: openhands <openhands@all-hands.dev>
- Add detailed review of original spec with 17 issues identified
- Add simplified spec that's easier to understand (ELI5 style)
- Key changes: removed redundant items, fixed fallback behavior,
  clarified edge cases, added implementation details

🤖 Generated with [Qoder][https://qoder.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.

Notion translation pipeline: replace expiring Notion/S3 image URLs with canonical /images/... paths (reuse EN images)

2 participants