Skip to content

feat: establish versioned UI translation ledger foundation - #929

Open
seonghobae wants to merge 188 commits into
mainfrom
feat/i18n-versioned-translation-ledger
Open

feat: establish versioned UI translation ledger foundation#929
seonghobae wants to merge 188 commits into
mainfrom
feat/i18n-versioned-translation-ledger

Conversation

@seonghobae

@seonghobae seonghobae commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Scope / owner boundary

PostgreSQL-authoritative versioned UI translation ledger for #922 plus the first authenticated translation API slice. LineageWeave owns product UI copy/presentation read-model behavior only; ontology/concept labels and semantic truth remain with canonical owners. Product contract: ko/en/ja/zh/vi/es/de/fr, exact screen-key completeness, immutable published versions, no cross-locale fallback, product/screen/version/locale cache identity.

Current product lineage

Ledger rollback/publication/TRUNCATE, immutable projection, cache-integrity, typed validation, optional-cache timeout, independent real-wire recursion evidence, and exact-version cache query-budget repairs remain adopted. The valid-hit path uses PostgreSQL digest/key-set admission without transferring the full localized projection; true cache misses use one complete authoritative PostgreSQL projection after bounded Valkey I/O. Synthetic RecursionError injection remains supplemental only.

Current exact head is 0f4fd26a5f0fcf26932d0945188aefb2143d6605. Concurrent commit 0f4fd26... is docs-only on docs/product-technical-gap-baseline.md, directly after previously validated 2a8ed5d02f4a3082b346d923d754c1ff37ebff52; it refreshed the dated live queue snapshot and did not change ledger/API/DB semantics. Exact-head evidence is evaluated independently rather than inherited.

Protected main remains the direct base line for this PR. Ready is validation admission only.

Fresh exact-head validation

Exact-head Tests 34102663992, PROV-O 34102663856, Ontology Pages 34102664095, and SAST Semgrep 34102663989 are now terminal GREEN on 0f4fd26....

Security 34102663880 is terminal fail-closed, not a product vulnerability finding. Scorecard, OSV, and Trivy all completed GREEN. Dependency Review job 101708140170 checked out exact head 0f4fd26... and failed its support preflight because GitHub returned HTTP 403 for dependency-graph/compare/83eba56149eb802cd63642c507c324c9976ec78e...0f4fd26a5f0fcf26932d0945188aefb2143d6605; the dependency-review action itself was therefore skipped. This reproduces the canonical support incident already tracked by ContextualWisdomLab/.github#810; do not add a LineageWeave-local shim or substitute the successful scanners.

CodeQL PR 34102664003 is also terminal fail-closed. Language detection succeeded; actions/javascript-typescript/python compatibility jobs found no authenticated current-head dispatch verdict and failed at Release runner or enforce current-head CodeQL verdict. The later dispatch job completed successfully, but the exact commit still has no codeql-dispatch/* terminal status; the only combined commit status currently present is CodeRabbit. Treat this as canonical dispatcher/receipt owner work, not as source GREEN or a reason for leaf head churn.

No qualifying independent exact-head approval exists. Do not synthesize status/review evidence, self-approve, weaken required gates, or transfer the older 2a8ed5d... results.

Remaining #922 buyer work

This ledger/API is foundation, not completion of the material UI. After normal landing, a real material screen must consume a published eight-locale resource with reviewed product copy. Acceptance still requires normal/loading/empty/error/permission/responsive states, keyboard/focus/screen-reader behavior, CJK/text expansion/font fallback, and fresh desktop/mobile browser evidence on one exact head. PRD/TRD/ARCHITECTURE/UX/OPERABILITY/TEST_STRATEGY/CHANGELOG and docs/product-technical-gap-baseline.md must converge with that cutover.

Direct descendant #932 remains Draft and must converge on exact #929@0f4fd26a5f0fcf26932d0945188aefb2143d6605. Its current product head c01e3109c987115c65bcbc74cd6f6247527387b8 still contains the earlier #929 parent and therefore cannot inherit this parent movement implicitly. #932's secondary-auth repair and prior isolated/browser evidence remain child-only evidence and do not transfer to this parent.

@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

8개 로케일 번역 원장과 읽기 경로를 추가했습니다. 인증된 HTTP 조회, 캐시 검증과 폴백, 게시 후 변경 차단, TRUNCATE 가드, 롤백 경로, 기준선 문서와 검증 테스트도 갱신했습니다.

Changes

UI 번역 원장

Layer / File(s) Summary
원장 스키마와 게시 계약
docs/adr/0362-versioned-ui-translation-ledger.md, migrations/0246_ui_translation_ledger.sql, tests/test_translation_ledger_contract.py, tests/test_translation_ledger_postgres.py, tests/test_translation_ledger_unicode_whitespace.py
8개 로케일, 리소스 identity, 번역 완전성, Unicode 공백 검증, 게시 timestamp와 게시 후 불변성을 정의하고 검증합니다.
번역 읽기 모델과 캐시 검증
backend/app/translation_ledger.py, tests/test_translation_ledger_read_model.py, tests/test_translation_screen_value_object.py, tests/test_translation_ledger_cache_*.py, tests/test_translation_cache_timeout.py, tests/test_translation_exact_version_query_budget.py
캐시 후보가 없으면 단일 PostgreSQL projection을 조회합니다. 후보가 있으면 키와 digest만 검증하고, 실패 시 authoritative projection으로 폴백합니다.
인증된 번역 조회 API
backend/app/main.py, tests/test_translation_api_http.py, tests/test_translation_api_driver_boundary.py
인증이 필요한 GET /api/translations/{screen_key}를 제공합니다. 입력 오류는 분리된 422 응답으로, 리소스 없음과 불완전한 번역은 404와 409로 변환합니다.
TRUNCATE 보호와 롤백 검증
migrations/0247_ui_translation_truncate_guard.sql, migrations/rollback/*.sql, tests/test_translation_ledger_rollback*.py, tests/test_translation_ledger_truncate*.py
게시된 원장의 TRUNCATE를 잠금으로 보호합니다. 리소스 존재, 회원 로케일, 롤백 재실행과 동시성 동작을 검증합니다.
기술 기준선과 런타임 지원
docs/product-technical-gap-baseline.md, docs/product-technical-gap-baseline-history-2026-09-04.md, docs/product-technical-gap-baseline-history-2026-09-04.raw.txt, lineageweave/observability.py, pyproject.toml, tests/test_translation_documentation_alignment.py, tests/test_translation_wire_evidence_contract.py
ADR와 기술 기준선을 갱신합니다. 로깅 계측 의존성과 JSON 재귀 소진 증거 검증을 갱신합니다.

Estimated code review effort: 5 (Critical) | ~120 minutes

Merge Risk: 🔵 Low · up to 9a189

This change adds a versioned translation ledger and authenticated read API. Runtime behavior is covered by the supplied contract evidence, but release-status documentation checks can still miss contradictory status text and should be tightened before relying on them for readiness claims.

Sequence Diagram(s)

sequenceDiagram
  participant AuthenticatedClient
  participant FastAPI
  participant translation_ledger
  participant PostgreSQL
  participant Valkey

  AuthenticatedClient->>FastAPI: GET /api/translations/{screen_key}
  FastAPI->>translation_ledger: read_ui_translations(...)
  translation_ledger->>Valkey: exact-version cache candidate
  Valkey-->>translation_ledger: cache payload or miss
  translation_ledger->>PostgreSQL: validate digest / fetch projection
  PostgreSQL-->>translation_ledger: TranslationScreen
  translation_ledger-->>FastAPI: immutable translations
  FastAPI-->>AuthenticatedClient: 200 / 404 / 409 / 422
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 80.56% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 216 functions across 27 files. (1 skipped: …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 버전 관리 UI 번역 원장 기반 구축이라는 주요 변경을 정확하고 간결하게 설명합니다.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/i18n-versioned-translation-ledger

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Valid finding: the explicit-version Valkey fast path can make a structurally valid but incomplete cache payload authoritative. _decode_cached_screen() validates identity and nonblank values, but it has no independent knowledge of the published resource's required key set. A payload for the exact product/screen/version/locale containing only title therefore bypasses PostgreSQL and returns an incomplete screen, contradicting this PR's fail-closed completeness contract and its statement that PostgreSQL remains authoritative. Add a realistic RED for a correct-identity/partial-key cache payload, then make cache acceptance depend on authoritative published key-set evidence (without cross-locale fallback).

Copy link
Copy Markdown
Contributor Author

Review finding on current head 7df347874ae26b95947be14b0cb97d7789b8d07a: application reads canonicalize product_key and screen_key with .strip(), but migration 0246 only checks btrim(key) <> ''; it does not require btrim(key) = key. PostgreSQL can persist lineageweave and lineageweave as distinct resource identities while the reader/cache boundary collapses both inputs to lineageweave, leaving a padded published resource unreachable through the canonical reader. Repair should make the DB reject leading/trailing whitespace so aggregate, API, and cache identities agree.

Copy link
Copy Markdown
Contributor Author

Review finding on 0e307531d97e71346835dc059f6c3db46956abbc: publication provenance is caller-controlled. guard_ui_translation_resource_mutation() currently does new.published_at := coalesce(new.published_at, now()), so a caller can submit an arbitrary non-null published_at while transitioning a draft to published; the trigger preserves that value and the row becomes immutable. Because publication time is release/audit evidence, the state transition must stamp database time itself rather than admit a caller-supplied timestamp. Add RED coverage for server-owned publication time, then assign now() unconditionally on the publish transition.

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Application/DB identity semantics are not actually aligned yet. ADR 0362 says leading/trailing-whitespace product_key and screen_key forms are rejected consistently at PostgreSQL and the application boundary, and migration 0246 rejects them with btrim equality. _validate_identity_segment() instead strips caller input and accepts it, so lineageweave aliases lineageweave before DB/cache lookup. That silently normalizes an ambiguous external identity while the persisted aggregate forbids that spelling. Add a RED covering padded product/screen inputs failing before I/O, then make the application boundary reject rather than normalize.

This was referenced Sep 7, 2026
Record current protected main, ready/draft split, pending hosted
jobs, and the leftover-pair a11y single-writer wait without
claiming independent review or terminal GREEN.
@opencode-agent
opencode-agent Bot disabled auto-merge September 7, 2026 10:25

@opencode-agent opencode-agent Bot 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

OpenCode reviewed the current-head product diff. Coverage is a separate gate.

Changed files

  • backend/app/main.py — API and service runtime
  • backend/app/translation_ledger.py — API and service runtime
  • docs/adr/0362-versioned-ui-translation-ledger.md — operator or user guidance
  • docs/product-technical-gap-baseline-history-2026-09-04.md — operator or user guidance
  • docs/product-technical-gap-baseline-history-2026-09-04.raw.txt — operator or user guidance
  • docs/product-technical-gap-baseline.md — operator or user guidance
  • lineageweave/observability.py — Python module behavior
  • migrations/0246_ui_translation_ledger.sql — repository behavior
  • migrations/0247_ui_translation_truncate_guard.sql — repository behavior
  • migrations/rollback/0246_ui_translation_ledger.sql — repository behavior
  • migrations/rollback/0247_ui_translation_truncate_guard.sql — repository behavior
  • pyproject.toml — repository behavior
  • tests/test_translation_api_driver_boundary.py — regression suite
  • tests/test_translation_api_http.py — regression suite
  • tests/test_translation_cache_recursion_real_payload.py — regression suite
  • tests/test_translation_cache_timeout.py — regression suite
  • tests/test_translation_documentation_alignment.py — regression suite
  • tests/test_translation_exact_version_query_budget.py — regression suite
  • tests/test_translation_ledger_cache_duplicate_members.py — regression suite
  • tests/test_translation_ledger_cache_recursion.py — regression suite
  • tests/test_translation_ledger_cache_surrogate.py — regression suite
  • tests/test_translation_ledger_cache_version_type.py — regression suite
  • tests/test_translation_ledger_contract.py — regression suite
  • tests/test_translation_ledger_identity_type.py — regression suite
  • tests/test_translation_ledger_postgres.py — regression suite
  • tests/test_translation_ledger_read_model.py — regression suite
  • tests/test_translation_ledger_resource_version.py — regression suite
  • tests/test_translation_ledger_rollback.py — regression suite
  • tests/test_translation_ledger_rollback_locale_guard.py — regression suite
  • tests/test_translation_ledger_rollback_lock_contract.py — regression suite
  • tests/test_translation_ledger_truncate_guard.py — regression suite
  • tests/test_translation_ledger_truncate_publication_lock_contract.py — regression suite
  • tests/test_translation_ledger_truncate_publication_race.py — regression suite
  • tests/test_translation_ledger_unicode_whitespace.py — regression suite
  • tests/test_translation_screen_value_object.py — regression suite
  • tests/test_translation_wire_evidence_contract.py — regression suite
  • uv.lock — repository behavior

Changed behavior

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Backend: main.py (2 files)"]
  S1 --> I1["API and service runtime"]
  I1 --> R1["Review risk: Backend: main.py (2 files)"]
  R1 --> V1["backend tests"]
  Evidence --> S2["Docs: 0362-versioned-ui-translation-ledger.md (4 files)"]
  S2 --> I2["operator or user guidance"]
  I2 --> R2["Review risk: Docs: 0362-versioned-ui-translation-ledger.md (4 files)"]
  R2 --> V2["docs review"]
  Evidence --> S3["Python: observability.py"]
  S3 --> I3["Python module behavior"]
  I3 --> R3["Review risk: Python: observability.py"]
  R3 --> V3["pytest plus coverage"]
  Evidence --> S4["Repository file: 0246_ui_translation_ledger.sql"]
  S4 --> I4["repository behavior"]
  I4 --> R4["Review risk: Repository file: 0246_ui_translation_ledger.sql"]
  R4 --> V4["required checks"]
  Evidence --> S5["Repository file: 0247_ui_translation_truncate_guard.sql"]
  S5 --> I5["repository behavior"]
  I5 --> R5["Review risk: Repository file: 0247_ui_translation_truncate_guard.sql"]
  R5 --> V5["required checks"]
  Evidence --> S6["Repository file: 0246_ui_translation_ledger.sql"]
  S6 --> I6["repository behavior"]
  I6 --> R6["Review risk: Repository file: 0246_ui_translation_ledger.sql"]
  R6 --> V6["required checks"]
  Evidence --> S7["Repository file: 0247_ui_translation_truncate_guard.sql"]
  S7 --> I7["repository behavior"]
  I7 --> R7["Review risk: Repository file: 0247_ui_translation_truncate_guard.sql"]
  R7 --> V7["required checks"]
  Evidence --> S8["Repository file: pyproject.toml"]
  S8 --> I8["repository behavior"]
  I8 --> R8["Review risk: Repository file: pyproject.toml"]
  R8 --> V8["required checks"]
  Evidence --> S9["Test: test_translation_api_driver_boundary.py (24 files)"]
  S9 --> I9["regression suite"]
  I9 --> R9["Review risk: Test: test_translation_api_driver_boundary.py (24 files)"]
  R9 --> V9["targeted test run"]
  Evidence --> S10["Repository file: uv.lock"]
  S10 --> I10["repository behavior"]
  I10 --> R10["Review risk: Repository file: uv.lock"]
  R10 --> V10["required checks"]
Loading

Findings

No source-backed product finding is synthesized from the coverage gate. A coverage miss belongs in the status comment.

  • Head SHA: 0f4fd26a5f0fcf26932d0945188aefb2143d6605
  • Workflow run: 34124343793
  • Workflow attempt: 1
  • Coverage gate: failure

Review outcome

Coverage is a gate, not the review. This body reviews the changed product files.

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Backend: main.py (2 files)"]
  S1 --> I1["API and service runtime"]
  I1 --> R1["Review risk: Backend: main.py (2 files)"]
  R1 --> V1["backend tests"]
  Evidence --> S2["Docs: 0362-versioned-ui-translation-ledger.md (4 files)"]
  S2 --> I2["operator or user guidance"]
  I2 --> R2["Review risk: Docs: 0362-versioned-ui-translation-ledger.md (4 files)"]
  R2 --> V2["docs review"]
  Evidence --> S3["Python: observability.py"]
  S3 --> I3["Python module behavior"]
  I3 --> R3["Review risk: Python: observability.py"]
  R3 --> V3["pytest plus coverage"]
  Evidence --> S4["Repository file: 0246_ui_translation_ledger.sql"]
  S4 --> I4["repository behavior"]
  I4 --> R4["Review risk: Repository file: 0246_ui_translation_ledger.sql"]
  R4 --> V4["required checks"]
  Evidence --> S5["Repository file: 0247_ui_translation_truncate_guard.sql"]
  S5 --> I5["repository behavior"]
  I5 --> R5["Review risk: Repository file: 0247_ui_translation_truncate_guard.sql"]
  R5 --> V5["required checks"]
  Evidence --> S6["Repository file: 0246_ui_translation_ledger.sql"]
  S6 --> I6["repository behavior"]
  I6 --> R6["Review risk: Repository file: 0246_ui_translation_ledger.sql"]
  R6 --> V6["required checks"]
  Evidence --> S7["Repository file: 0247_ui_translation_truncate_guard.sql"]
  S7 --> I7["repository behavior"]
  I7 --> R7["Review risk: Repository file: 0247_ui_translation_truncate_guard.sql"]
  R7 --> V7["required checks"]
  Evidence --> S8["Repository file: pyproject.toml"]
  S8 --> I8["repository behavior"]
  I8 --> R8["Review risk: Repository file: pyproject.toml"]
  R8 --> V8["required checks"]
  Evidence --> S9["Test: test_translation_api_driver_boundary.py (24 files)"]
  S9 --> I9["regression suite"]
  I9 --> R9["Review risk: Test: test_translation_api_driver_boundary.py (24 files)"]
  R9 --> V9["targeted test run"]
  Evidence --> S10["Repository file: uv.lock"]
  S10 --> I10["repository behavior"]
  I10 --> R10["Review risk: Repository file: uv.lock"]
  R10 --> V10["required checks"]
Loading

@opencode-agent

opencode-agent Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

OpenCode Review Overview

Coverage evidence did not pass, so approval is blocked. The formal pull-request review is the source-backed diff review, not this status comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant