LifeMate — Personal, Family & Learning Companion

feat/local-signing-preflight
chore/phase1-repository-cleanup deploy/stable-web-apk deployment-static design/mobile-accessibility-v2 design/mobile-navigation-review docs/child-education-access-decision docs/offline-data-rescue-options docs/owner-guide-and-delivery-plan docs/phase1-policy-options docs/public-review-live-2026-10-15 feat/aparat-learning-library feat/child-device-safety feat/child-identity-schema feat/flutter-mobile-navigation feat/learning-content-operations feat/local-signing-preflight feat/online-family-stage0 feat/personal-encrypted-recovery feat/private-planner-series-api feat/public-review-page feat/standalone-weekly-planner feat/weekly-planner-android final-feature-1/iran-family-school fix/auth-abuse-expiry-safety fix/auth-expiry-after-lock fix/backend-request-safety fix/lifeguide-bootstrap-naming-ci fix/lifeguide-pages-qa-base-preflight fix/lifeguide-qa-pages-env-deployment fix/local-task-persistence fix/managed-child-session-boundary fix/personal-jalali-dates fix/personal-notification-controls fix/personal-upgrade-delivery-guard fix/sms-approval-gates fix/study-duration-display infra/cloudflare-neon-migration infra/lifeguide-cloudflare-qa infra/lifeguide-github-pages-qa infra/lifeguide-supabase-qa main phase-1/foundation-completion phase-2/product-foundation-identity phase-3/planner-school-family-core phase-4/ai-learning-wellbeing phase-5/hardening-observability-release test/android-reminder-acceptance test/personal-notification-settings test/personal-recovery-acceptance test/role-entry-apk
md 5.8 KB

Local signing preflight implementation plan

Spec: local signing preflight. Base: PR45 5f0c4da; branch feat/local-signing-preflight. Owner/coordinator: root; Java helper owner: signing inspector implementer; independent review: separate reviewer. No owner key/device/data actions.

Task 1 — JDK inspector and synthetic integration tests

Files owned: scripts/java/LifeGuideKeyInspector.java, scripts/tests/test_signing_java.py, scripts/tests/signing_test_support.py. Use the exact binary protocol and helper JSON schema in the spec. Success: schemaVersion: 1, status: INSPECTED, four public fields named there; exit0. Failure: schemaVersion:1,status:REFUSED,reason:<fixed code>; exit2. Reason enum: invalid_request, keystore_unreadable, private_key_unavailable, unsupported_key_algorithm, key_proof_failed, inspection_failed. Reject trailing bytes and unsupported entry types. Sanitize all exceptions. Remove password byte/char arrays best-effort. No dependencies beyond JDK17.

First write/run tests against absent helper (RED), then implementation (GREEN). Actual keytool fixture generation is test-only in TemporaryDirectory; use per-process random credentials via keytool :env flags and capture its output. Never print test credentials or raw subprocess errors; no artifact upload. Run python3 -m unittest scripts.tests.test_signing_java -v. Expected: all tests pass with real JDK; fixture source hash unchanged.

Task 2 — Python CLI and read-only/error guards

Files owned: scripts/signing_preflight.py, scripts/tests/test_signing_preflight.py. Root implements independently of Java files, consuming the exact protocol. Load baseline via existing verifier. Reuse read_bounded for encrypted key file. check is default; inspect --keystore PATH --alias ALIAS --acknowledge-owner-local-inspection is explicit/TTY-only. Errors are JSON with safe fixed codes, never argparse argument interpolation. No password env/CLI support, no key generation, no input searching, no file writes. Java child options in env stripped, captured stdout strictly validated, stderr discarded, timeout enforced. Tool report always delivery BLOCKED.

First write/run tests before implementation. Run python3 -m unittest scripts.tests.test_signing_preflight -v. Expected: safety gates fail closed, real inspector integration uses only fixtures.

Task 3 — CI, guide, regression and independent review

Add .github/workflows/signing-preflight-qa.yml: paths-limited ubuntu/windows, Python3.11/JDK17, contents read, no secrets/APK/device/network-dependent tests, no test-key/report artifacts. Add Persian guide with check command and future owner-only inspect command clearly gated by separate authorization. Explain matching/different/debug results, no uninstall or sharing keys/passwords, limits. Run new suites + existing Python tool/recovery suites; inspect every output. Independent whole-packet review for secret leakage/file mutation/gate bypass. Record actual commands/output and CI results in evidence JSON; record unrun platforms/owner operations as UNVERIFIED. Update PROJECT_STATE. Open small PR on PR45; no merge/release/deploy. Stop after handover.

Execution ledger

  • Setup: clean isolated worktree at 5f0c4da; inherited AGENTS/state read.
  • Preflight: Java→Python exact protocol/JSON shared; no overlapping implementation files. Tests and docs use baseline reader without alternative baseline input.
  • Ruling: no new key-generation/transfer feature; read-only inspection is the smallest prep dependency. A wrong scope choice costs deferred usable transfer, not a change to installed data or approved policy.
  • Task1: 79e1211, 11 Java tests PASS on actual Temurin17; absent-helper RED and deliberately removed-proof mutation RED observed (synthetic mismatched cert).
  • Task2: 24 Python tests PASS, including real synthetic CLI→JDK→keypair proof; missing-module RED, source17 capability RED, pre-prompt guard RED recorded.
  • Ruling: check compiler module and empty-input source17 probe, not javac binary presence — system21 has compiler but lacks ct.sym/source17; false capability acceptance would delay inspection failure until after credentials. No key read during the probe. Downloaded temporary official checksum-verified JDK17 only.
  • Ruling: inherited 82 host guards run on Ubuntu only because they invoke POSIX shell/FIFO operations; new signing suites run on both CI systems. Wrong scope costs missing Windows legacy-guard coverage, not weaker Android release gates.
  • Local full regression: 90 tests in32.576s OK (55 recovery +35 signing), inherited host82 in0.197s OK; source compile and git diff --check exit0.
  • Task3: independent review ran signing35/27.656s OK. It reproduced one Minor multi-valued-RDN CN false-negative. Coordinator re-graded Important for accurate owner-facing key facts, fixed all CN-value enumeration; actual synthetic test RED1failure→GREEN1test/3subjects (positive multi-RDN/lowercase, negative OU). No deferred review findings. Full-suite result recorded in final evidence.
  • CI initial 39941563602: signing35 PASS on Ubuntu and Windows (Windows one POSIX skip); Ubuntu inherited guard import failed missing cryptography. Added existing pinned requirement; 39941815472 then both jobs SUCCESS on 9df0c92. Final CN-correction 39942133341 SUCCESS on 62741da: Ubuntu signing36+host82, Windows36 including1POSIXskip; exact outputs read via official job-log connector. Local final91/40.187s OK. Generic CI initial run superseded/cancelled by normal branch concurrency; not treated as test success.
  • No owner key/device/data inspection, signing/configuration, personal APK delivery, merge/deploy/DNS performed. Generic CI may build existing debug test artifacts; they are not an approved update to the installed personal APK.