From d2b08c8687e29436522ac1fd6c30d5ade9ed434f Mon Sep 17 00:00:00 2001 From: enlineawork Date: Thu, 10 Sep 2026 15:54:38 -0300 Subject: [PATCH] chore(F6.1): apply Android Yacimiento root fix --- .../f6-1-android-yacimiento-root.yml | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/f6-1-android-yacimiento-root.yml diff --git a/.github/workflows/f6-1-android-yacimiento-root.yml b/.github/workflows/f6-1-android-yacimiento-root.yml new file mode 100644 index 0000000..54fa6da --- /dev/null +++ b/.github/workflows/f6-1-android-yacimiento-root.yml @@ -0,0 +1,68 @@ +name: F6.1 Android Yacimiento root + +on: + push: + branches: + - 'hotfix/f6-1-inspection-planning-hierarchy' + paths: + - '.github/workflows/f6-1-android-yacimiento-root.yml' + +permissions: + contents: write + +jobs: + apply: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: hotfix/f6-1-inspection-planning-hierarchy + fetch-depth: 0 + + - name: Align Android field root with frozen Yacimiento scope + run: | + python - <<'PY' + from pathlib import Path + + dh = Path('android-app/app/src/main/java/com/korexlabs/dhinspeccion/data/DhMobile.kt') + text = dh.read_text() + before = '''data class VisitDetail(\n val id: String,\n val code: String,\n val objective: String? = null,\n val status: String,\n val operationalArea: AssetSummary? = null,''' + after = '''data class VisitDetail(\n val id: String,\n val code: String,\n val objective: String? = null,\n val status: String,\n val scopeAsset: AssetSummary? = null,\n val operationalArea: AssetSummary? = null,''' + if text.count(before) != 1: + raise SystemExit(f'VisitDetail insertion: {text.count(before)}') + dh.write_text(text.replace(before, after)) + + vm = Path('android-app/app/src/main/java/com/korexlabs/dhinspeccion/MainViewModel.kt') + text = vm.read_text() + replacements = { + 'inventoryParentId = visit?.operationalArea?.id': 'inventoryParentId = visit?.scopeAsset?.id ?: visit?.operationalArea?.id', + 'val effectiveParentId = parentId ?: inventoryParentId ?: currentVisit.operationalArea?.id': 'val effectiveParentId = parentId ?: inventoryParentId ?: currentVisit.scopeAsset?.id ?: currentVisit.operationalArea?.id', + 'val effectiveParentId = parentId ?: currentVisit.operationalArea?.id': 'val effectiveParentId = parentId ?: currentVisit.scopeAsset?.id ?: currentVisit.operationalArea?.id', + 'val effectiveParentId = inventoryParentId ?: visit?.operationalArea?.id': 'val effectiveParentId = inventoryParentId ?: visit?.scopeAsset?.id ?: visit?.operationalArea?.id', + } + for before, after in replacements.items(): + count = text.count(before) + if count < 1: + raise SystemExit(f'MainViewModel root missing: {before}') + text = text.replace(before, after) + vm.write_text(text) + + Path('.github/workflows/f6-1-android-yacimiento-root.yml').unlink() + PY + + - name: Verify Android root contract + run: | + set -Eeuo pipefail + grep -Fq 'val scopeAsset: AssetSummary? = null' android-app/app/src/main/java/com/korexlabs/dhinspeccion/data/DhMobile.kt + grep -Fq 'currentVisit.scopeAsset?.id ?: currentVisit.operationalArea?.id' android-app/app/src/main/java/com/korexlabs/dhinspeccion/MainViewModel.kt + grep -Fq 'visit?.scopeAsset?.id ?: visit?.operationalArea?.id' android-app/app/src/main/java/com/korexlabs/dhinspeccion/MainViewModel.kt + + - name: Commit Android scope fix + run: | + set -Eeuo pipefail + git config user.name 'github-actions[bot]' + git config user.email '41898282+github-actions[bot]@users.noreply.github.com' + git add android-app .github/workflows/f6-1-android-yacimiento-root.yml + git diff --cached --check + git commit -m 'fix(android): root field inventory at inspection Yacimiento' + git push origin HEAD:hotfix/f6-1-inspection-planning-hierarchy