[PR #4950] [CLOSED] fix(apktool): resolve numeric regions to BCP 47 directories #6688

Closed
opened 2026-11-01 21:42:18 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4950
Author: @djpjronline-netizen
Created: 10/18/2026
Status: ❌ Closed

Base: main ← Head: codex/fix-apktool-numeric-region-locale


📝 Commits (1)

  • e52aae6 fix(apktool): resolve numeric regions to BCP 47 directories

📊 Changes

5 files changed (+93 additions, -7 deletions)

View changed files

📝 docs/apktool-resource-analysis.md (+3 -2)
📝 src/apktool/ApktoolStringTables.test.ts (+27 -0)
📝 src/domain/apktool/apktoolResourceAnalysis.test.ts (+36 -2)
📝 src/domain/apktool/apktoolResourceAnalysis.ts (+9 -3)
📝 tests/boundary/cli/apktoolLocaleOption.test.ts (+18 -0)

📄 Description

Summary

Fixes #4916. es-419 previously selected values-es-r419, so it missed Apktool's values-b+es+419 table. Numeric-region aliases now select the b+ directory; es-419 and b+es+419 share one physical read while retaining both caller labels. Invalid es-r419 is rejected.

Checked upstream main and existing open PR #4918 before implementation. This draft follows that PR's owner-level fix and adds explicit request-schema coverage and rejection through both CLI locale options. Local verification used main 18aa9af2b plus commit e52aae6ae.

Problem and expected behavior

rea decode-android-resources <apk> --locale es-419 --json should select res/values-b+es+419/strings.xml. Both valid spellings must resolve to that table; the unsupported es-r419 form must fail validation.

Change and scope

The shared locale owner maps <lang>-<DDD> to b+<lang>+<DDD> and excludes <lang>-r<DDD> from the grammar. Alphabetic regions retain their existing mapping. Documentation explains the numeric-region alias.

Contribution scope: ordinary fix within the existing resource decoding boundary; additional maintainer scope decision not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: shared locale grammar and directory normalization in src/domain/apktool/apktoolResourceAnalysis.ts.
  • Contribution scope fit and linked maintainer decision: existing read-only decoding capability; not applicable.
  • CLI and MCP/tool-catalog contract: both request fields reject r-prefixed numeric regions; valid request spellings are preserved. CLI options consume the shared schema.
  • Provider, bridge, target-format, or platform compatibility: aligns table selection with Apktool numeric-region directory spelling.
  • Evidence, artifact, provenance, or reconstruction contract: aliases share physical facts while retaining their labels; result shape unchanged.
  • Target selection, authority, upstream behavior, and cleanup details: directory selection under the existing decoded workspace; no lifecycle changes.
  • Generated metadata, package, or installation impact: no tracked generated outputs or package changes.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Request tests admit and preserve es-419 and b+es+419 in locale and locales, and reject es-r419 in either field.
  • Projection regression asserts exactly one read of values-b+es+419/strings.xml and both aliases reported present.
  • CLI regressions forward valid aliases and reject es-r419 via --locale and --locales before provider execution.
  • Base evidence: inspected main's normalization mapping numeric regions to -rDDD; no tests-only baseline execution was performed locally.
  • User-visible outcome: an existing numeric-region table is selected rather than reported missing; invalid legacy spelling fails validation.
  • Remaining proof gap: no real APK decode performed; provider/boundary tests use controlled fixtures or stubs.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

Executed with Node 24.18.0 and npm 11.16.0:

  • npm run test:local -- src/domain/apktool/apktoolResourceAnalysis.test.ts src/apktool/ApktoolStringTables.test.ts src/apktool/ApktoolProvider.test.ts src/apktool/ApktoolDecodeOutput.test.ts src/application/apktool/ApktoolResourceAnalysisService.test.ts — 152 tests passed across 5 files.
  • npm run test:focused -- tests/boundary/cli/apktoolLocaleOption.test.ts tests/boundary/cli/apktoolCli.test.ts tests/boundary/mcp/apktoolMcp.test.ts — 11 tests passed across 3 files; required runtime build passed.
  • npm run check:fast — typecheck and lint passed.
  • npm run docs:check — generated-document checks passed; 5 README consistency tests passed. Initial invocation encountered the artifact-writer lock; rerun after the build passed.
  • npx oxfmt --check src/domain/apktool/apktoolResourceAnalysis.ts src/domain/apktool/apktoolResourceAnalysis.test.ts src/apktool/ApktoolStringTables.test.ts tests/boundary/cli/apktoolLocaleOption.test.ts — passed.
  • git diff --check — passed. Commit formatting/lint hooks passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: invalid <lang>-r<DDD> inputs now fail rather than return missing tables. Use <lang>-<DDD> or b+<lang>+<DDD>.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable; no real APK decode tested.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: locale character/length bounds remain enforced; path normalization stays under the existing workspace.

Author readiness

Human owner: @djpjronline-netizen (declarations pending).

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/4950 **Author:** [@djpjronline-netizen](https://github.com/djpjronline-netizen) **Created:** 10/18/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `codex/fix-apktool-numeric-region-locale` --- ### 📝 Commits (1) - [`e52aae6`](https://github.com/morluto/rea/commit/e52aae6ae6df13c84a69ebac9e24df8372ad68dc) fix(apktool): resolve numeric regions to BCP 47 directories ### 📊 Changes **5 files changed** (+93 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `docs/apktool-resource-analysis.md` (+3 -2) 📝 `src/apktool/ApktoolStringTables.test.ts` (+27 -0) 📝 `src/domain/apktool/apktoolResourceAnalysis.test.ts` (+36 -2) 📝 `src/domain/apktool/apktoolResourceAnalysis.ts` (+9 -3) 📝 `tests/boundary/cli/apktoolLocaleOption.test.ts` (+18 -0) </details> ### 📄 Description ## Summary Fixes #4916. `es-419` previously selected `values-es-r419`, so it missed Apktool's `values-b+es+419` table. Numeric-region aliases now select the `b+` directory; `es-419` and `b+es+419` share one physical read while retaining both caller labels. Invalid `es-r419` is rejected. Checked upstream main and existing open PR #4918 before implementation. This draft follows that PR's owner-level fix and adds explicit request-schema coverage and rejection through both CLI locale options. Local verification used main `18aa9af2b` plus commit `e52aae6ae`. ## Problem and expected behavior `rea decode-android-resources <apk> --locale es-419 --json` should select `res/values-b+es+419/strings.xml`. Both valid spellings must resolve to that table; the unsupported `es-r419` form must fail validation. ## Change and scope The shared locale owner maps `<lang>-<DDD>` to `b+<lang>+<DDD>` and excludes `<lang>-r<DDD>` from the grammar. Alphabetic regions retain their existing mapping. Documentation explains the numeric-region alias. Contribution scope: ordinary fix within the existing resource decoding boundary; additional maintainer scope decision not applicable. ## Contract and boundary impact - Semantic owner and earliest changed stage: shared locale grammar and directory normalization in `src/domain/apktool/apktoolResourceAnalysis.ts`. - Contribution scope fit and linked maintainer decision: existing read-only decoding capability; not applicable. - CLI and MCP/tool-catalog contract: both request fields reject r-prefixed numeric regions; valid request spellings are preserved. CLI options consume the shared schema. - Provider, bridge, target-format, or platform compatibility: aligns table selection with Apktool numeric-region directory spelling. - Evidence, artifact, provenance, or reconstruction contract: aliases share physical facts while retaining their labels; result shape unchanged. - Target selection, authority, upstream behavior, and cleanup details: directory selection under the existing decoded workspace; no lifecycle changes. - Generated metadata, package, or installation impact: no tracked generated outputs or package changes. Expected effects: - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Request tests admit and preserve `es-419` and `b+es+419` in `locale` and `locales`, and reject `es-r419` in either field. - Projection regression asserts exactly one read of `values-b+es+419/strings.xml` and both aliases reported `present`. - CLI regressions forward valid aliases and reject `es-r419` via `--locale` and `--locales` before provider execution. - Base evidence: inspected main's normalization mapping numeric regions to `-rDDD`; no tests-only baseline execution was performed locally. - User-visible outcome: an existing numeric-region table is selected rather than reported missing; invalid legacy spelling fails validation. - Remaining proof gap: no real APK decode performed; provider/boundary tests use controlled fixtures or stubs. For evidence-bearing changes: - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed Executed with Node 24.18.0 and npm 11.16.0: - `npm run test:local -- src/domain/apktool/apktoolResourceAnalysis.test.ts src/apktool/ApktoolStringTables.test.ts src/apktool/ApktoolProvider.test.ts src/apktool/ApktoolDecodeOutput.test.ts src/application/apktool/ApktoolResourceAnalysisService.test.ts` — 152 tests passed across 5 files. - `npm run test:focused -- tests/boundary/cli/apktoolLocaleOption.test.ts tests/boundary/cli/apktoolCli.test.ts tests/boundary/mcp/apktoolMcp.test.ts` — 11 tests passed across 3 files; required runtime build passed. - `npm run check:fast` — typecheck and lint passed. - `npm run docs:check` — generated-document checks passed; 5 README consistency tests passed. Initial invocation encountered the artifact-writer lock; rerun after the build passed. - `npx oxfmt --check src/domain/apktool/apktoolResourceAnalysis.ts src/domain/apktool/apktoolResourceAnalysis.test.ts src/apktool/ApktoolStringTables.test.ts tests/boundary/cli/apktoolLocaleOption.test.ts` — passed. - `git diff --check` — passed. Commit formatting/lint hooks passed. ## Compatibility, safety, and release - Breaking changes or migration steps: invalid `<lang>-r<DDD>` inputs now fail rather than return missing tables. Use `<lang>-<DDD>` or `b+<lang>+<DDD>`. - Real Hopper/Ghidra, browser, or OS coverage: not applicable; no real APK decode tested. - Package or release metadata impact: none. - Security, privacy, process, or containment review: locale character/length bounds remain enforced; path normalization stays under the existing workspace. ## Author readiness Human owner: @djpjronline-netizen (declarations pending). - [ ] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [ ] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [ ] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:42:18 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#6688
No description provided.