Skip to content

Conversation

@Anty0
Copy link
Collaborator

@Anty0 Anty0 commented Dec 16, 2025

Summary by CodeRabbit

  • New Features

    • Android SDK exports now generate a manifest.json file documenting all supported language locales included in the export package.
  • Documentation

    • Backend testing guidelines updated with guidance on running targeted test suites for more efficient test execution.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 16, 2025

📝 Walkthrough

Walkthrough

The changes introduce a new JsonFileExporterWithManifest class that wraps the existing JsonFileExporter and appends a manifest.json file containing sorted distinct language locales. The export factory is updated to use this new exporter for the ANDROID_SDK format, and test helpers are updated accordingly with new assertions validating manifest generation.

Changes

Cohort / File(s) Summary
New Feature: Manifest Exporter
backend/data/src/main/kotlin/io/tolgee/formats/json/out/JsonFileExporterWithManifest.kt
New FileExporter implementation that wraps JsonFileExporter and augments output with manifest.json. Generates manifest by extracting sorted distinct locales from translations, serializing to JSON via ObjectMapper with CustomPrettyPrinter, and returning as InputStream alongside delegated JSON files.
Factory Integration
backend/data/src/main/kotlin/io/tolgee/service/export/FileExporterFactory.kt
Adds import for JsonFileExporterWithManifest and new routing logic for ExportFormat.ANDROID_SDK to use the manifest exporter. Reformats when-expression branches with explicit braces for consistency.
Test Updates
backend/data/src/test/kotlin/io/tolgee/unit/formats/android/out/AndroidSdkFileExporterTest.kt
Updates test helper method return types from JsonFileExporter to JsonFileExporterWithManifest. Adds new test cases validating manifest.json generation and existence of locale-specific translation files under various namespace and locale configurations.
Documentation
AGENTS.md
Adds guidance to Backend Testing section advising against bare test task execution and recommending targeted test suite runs with concrete example commands.

Sequence Diagram

sequenceDiagram
    participant Client
    participant JsonFileExporterWithManifest
    participant JsonFileExporter
    participant ObjectMapper
    participant FileMap as File Map

    Client->>JsonFileExporterWithManifest: produceFiles()
    JsonFileExporterWithManifest->>JsonFileExporter: produceFiles()
    JsonFileExporter->>JsonFileExporter: Generate JSON files
    JsonFileExporter-->>JsonFileExporterWithManifest: JSON files map
    JsonFileExporterWithManifest->>JsonFileExporterWithManifest: Extract locales from translations
    JsonFileExporterWithManifest->>JsonFileExporterWithManifest: Sort & deduplicate locales
    JsonFileExporterWithManifest->>ObjectMapper: Serialize manifest JSON
    ObjectMapper-->>JsonFileExporterWithManifest: Manifest InputStream
    JsonFileExporterWithManifest->>FileMap: Combine JSON files + manifest.json
    FileMap-->>Client: Complete file map
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • JanCizmar

Poem

🐰 A manifest appears, so fresh and new,
Wrapping locales in JSON's gentle brew,
Android SDK now exports with flair,
Sorted languages floating everywhere,
The factory routes them with graceful care!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding a manifest file to the export output for the Android SDK format, which aligns with the introduction of JsonFileExporterWithManifest and its integration into the Android SDK export flow.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 62f4cea and 22b62b7.

📒 Files selected for processing (4)
  • AGENTS.md
  • backend/data/src/main/kotlin/io/tolgee/formats/json/out/JsonFileExporterWithManifest.kt
  • backend/data/src/main/kotlin/io/tolgee/service/export/FileExporterFactory.kt
  • backend/data/src/test/kotlin/io/tolgee/unit/formats/android/out/AndroidSdkFileExporterTest.kt
🧰 Additional context used
📓 Path-based instructions (3)
backend/**/*.kt

📄 CodeRabbit inference engine (AGENTS.md)

backend/**/*.kt: After modifying JPA entities, run ./gradlew diffChangeLog to generate Liquibase changelog entries (add --no-daemon flag if docker command not found)
Run ./gradlew ktlintFormat before committing code

Files:

  • backend/data/src/test/kotlin/io/tolgee/unit/formats/android/out/AndroidSdkFileExporterTest.kt
  • backend/data/src/main/kotlin/io/tolgee/formats/json/out/JsonFileExporterWithManifest.kt
  • backend/data/src/main/kotlin/io/tolgee/service/export/FileExporterFactory.kt
backend/**/*Test.kt

📄 CodeRabbit inference engine (AGENTS.md)

backend/**/*Test.kt: Use TestData classes for test setup with TestDataService for saving and cleaning test data in unit tests
Use .andAssertThatJson for testing API JSON responses in tests

Files:

  • backend/data/src/test/kotlin/io/tolgee/unit/formats/android/out/AndroidSdkFileExporterTest.kt
**/*.{ts,tsx,js,jsx,kt,kts}

⚙️ CodeRabbit configuration file

As part of review, please check if the file follows 'The Stepdown Rule': The most important, high-level concepts should be at the top (like a newspaper headline and opening paragraph). Details should increase as you read downward. Functions should be ordered so that a caller appears before the functions it calls. When working with JavaScript components, we allow the main component to live at the bottom of the file as an exception to the rule.

Files:

  • backend/data/src/test/kotlin/io/tolgee/unit/formats/android/out/AndroidSdkFileExporterTest.kt
  • backend/data/src/main/kotlin/io/tolgee/formats/json/out/JsonFileExporterWithManifest.kt
  • backend/data/src/main/kotlin/io/tolgee/service/export/FileExporterFactory.kt
🧠 Learnings (2)
📚 Learning: 2025-11-28T15:12:44.060Z
Learnt from: CR
Repo: tolgee/tolgee-platform PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T15:12:44.060Z
Learning: Applies to backend/**/*Test.kt : Use TestData classes for test setup with TestDataService for saving and cleaning test data in unit tests

Applied to files:

  • AGENTS.md
📚 Learning: 2025-11-28T15:12:44.060Z
Learnt from: CR
Repo: tolgee/tolgee-platform PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T15:12:44.060Z
Learning: Applies to backend/**/*Test.kt : Use `.andAssertThatJson` for testing API JSON responses in tests

Applied to files:

  • AGENTS.md
  • backend/data/src/test/kotlin/io/tolgee/unit/formats/android/out/AndroidSdkFileExporterTest.kt
🧬 Code graph analysis (1)
backend/data/src/test/kotlin/io/tolgee/unit/formats/android/out/AndroidSdkFileExporterTest.kt (3)
backend/data/src/test/kotlin/io/tolgee/util/exportTestUtil.kt (1)
  • buildExportTranslationList (25-29)
backend/data/src/test/kotlin/io/tolgee/unit/formats/apple/out/AppleSdkFileExporterTest.kt (1)
  • getExporter (139-156)
backend/data/src/test/kotlin/io/tolgee/unit/formats/i18next/out/I18nextFileExporterTest.kt (1)
  • getExporter (127-144)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: BT ‍🔎 (ee-test:test)
🔇 Additional comments (9)
AGENTS.md (1)

26-33: LGTM!

This documentation addition is helpful and directly relevant to this PR. The example using AndroidSdkFileExporterTest demonstrates the correct pattern for running module-specific tests.

backend/data/src/main/kotlin/io/tolgee/formats/json/out/JsonFileExporterWithManifest.kt (2)

11-33: LGTM - Clean delegation pattern.

The wrapper correctly delegates JSON file generation to JsonFileExporter and appends the manifest. The use of + operator for map concatenation is idiomatic Kotlin.


35-48: Clean locale extraction logic.

The map -> distinct -> sorted pipeline efficiently extracts unique locales in sorted order. The use of customPrettyPrinter ensures consistent formatting with the other JSON files.

backend/data/src/main/kotlin/io/tolgee/service/export/FileExporterFactory.kt (1)

53-75: LGTM - Clean separation of SDK export formats.

Good decision to separate ANDROID_SDK from APPLE_SDK. The Android SDK now uses JsonFileExporterWithManifest to include the manifest.json, while Apple SDK continues using JsonFileExporter without it. The braces added to all when-branches improve consistency.

backend/data/src/test/kotlin/io/tolgee/unit/formats/android/out/AndroidSdkFileExporterTest.kt (5)

97-117: Good test coverage for manifest generation.

This test validates the basic manifest structure with a single locale. The expected JSON format is clean and verifiable.


119-141: Good test for sorted locales.

Verifies that locales are correctly sorted alphabetically (de, en, en-US) and deduplicated when multiple translations exist for the same locale.


143-167: Good integration test.

This test verifies that both translation JSON files and the manifest are produced together, ensuring the wrapper correctly combines outputs from the delegated exporter.


169-199: Verify manifest placement behavior is intentional for namespaced exports.

The test verifies that manifest.json stays at the root while translation files go under namespace folders (e.g., common/en.json). This is the current behavior since JsonFileExporterWithManifest hardcodes the manifest path as "manifest.json".

Please confirm this is the intended behavior for Android SDK consumers. If they expect the manifest at the root regardless of file structure template, this is correct. If different behavior is needed for different templates, the implementation would need adjustment.


236-253: LGTM - Updated test helper.

The getExporter helper correctly returns JsonFileExporterWithManifest and follows the same pattern as similar helpers in AppleSdkFileExporterTest and I18nextFileExporterTest, as shown in the relevant code snippets.


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

@Anty0 Anty0 marked this pull request as ready for review January 8, 2026 16:22
@Anty0 Anty0 requested a review from JanCizmar January 8, 2026 16:23
@JanCizmar JanCizmar enabled auto-merge (squash) January 9, 2026 09:54
@JanCizmar JanCizmar disabled auto-merge January 9, 2026 10:00
@JanCizmar JanCizmar merged commit e2d9699 into main Jan 9, 2026
66 of 70 checks passed
@JanCizmar JanCizmar deleted the jirikuchynka/export-format-android-sdk-add-manifest branch January 9, 2026 10:00
TolgeeMachine added a commit that referenced this pull request Jan 9, 2026
# [3.146.0](v3.145.5...v3.146.0) (2026-01-09)

### Features

* add manifest in generated files by exporter for Android SDK ([#3352](#3352)) ([e2d9699](e2d9699))
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.

3 participants