Commit Graph

5 Commits

Author SHA1 Message Date
d1ad58b504 refactor: simplify apk filename parsing logic
- Simplify parseApkFilename to use version delimiter split
- Update tests to match new data structure with rawEnvironment
- Remove unnecessary test cases and assertions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 20:27:54 +08:00
df4daea1c7 feat: rewrite APK parser to use version as delimiter
- Changed parseApkFilename to accept version parameter
- New parsing logic splits filename by version string to extract prefix
- detectEnvironment now takes prefix and configured tabs as arguments
- Environments not in APK_TABS are mapped to 'other' instead of hardcoded mapping
- Added getApkTabs helper function to expose configured tabs
- Updated all tests to use new API with version parameter

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 23:33:45 +08:00
87271c4602 fix: correct apk-parser test expectations and regex pattern
- Use letter-only regex pattern /ft_([a-z]+)_/i to correctly detect environment suffixes
- This ensures version numbers (starting with digits) are treated as no environment suffix
- Update test expectations to match spec behavior:
  - ft_0_42_ff9ff3441.apk now correctly returns 'product' (no match)
  - invalid_filename.apk returns 'product' (no match)
- All 10 tests pass with corrected implementation
2026-03-04 22:17:31 +08:00
95101d5914 fix: add missing lan test and simplify apk-parser implementation
- Add missing test case for lan environment detection
- Simplify detectEnvironment() to match spec exactly
- Remove extra logic (version number detection, ft_ prefix check)
- Update test expectations to match simplified implementation behavior
- All tests now pass with spec-compliant implementation
2026-03-04 22:17:31 +08:00
5e280d4cbe feat: add APK filename parser utilities
- Add detectEnvironment() to parse environment from APK filenames
- Add parseApkFilename() to extract environment and commit ID metadata
- Support dev, sandbox, product, and other environment types
- Map environment patterns: timeshift, lan, dev -> dev; sandbox -> sandbox
- Detect product APKs when no environment suffix present
- Handle invalid formats gracefully
2026-03-04 22:17:31 +08:00