# Mobile task creation

**Fixed and verified locally, including native create/reopen/restart on 24 September.** New tasks now send a create request instead of failing before a request with “Item must have sk field.” Existing task IDs retain the update path.

`TaskFormScreen` already submits Title, Note, status, and optional due date through `DataProvider.saveData`. New tasks have no `sk`; `RepositoryService.saveData` previously rejected them. The [before regression](assets/mobile-task-creation/before-test.txt) reproduces that exact error and zero requests through the real form/provider/service path.

[RepositoryService.saveData](/Users/imzee/projects/appmint_go/appmint_mobile/lib/services/repository_service.dart:47) now posts ID-less records to `/repository/create` with `isNew:true`. Records with an ID still use `/repository/update/:id`. The backend controller supports create with `datatype`/`data`; its Mongo provider requires `isNew` and generates the record ID. Those implementations were inspected directly. No client-generated ID or unsupported endpoint was introduced.

Four [Flutter regressions](/Users/imzee/projects/appmint_go/appmint_mobile/test/task_creation_test.dart:1) cover new-task Title/Note persistence and server-generated ID readback, existing-task update routing, failed-create recovery preserving entered text, and empty-title validation. Tests execute the real widget, DataProvider, RepositoryService, AppengineHttpClient, and model decoding. A zone-scoped MockClient is the only HTTP boundary, including a synthetic create contract requiring `isNew:true` and UTF-8 JSON responses.

The final combined run passes **all 21 tests**: four task-creation regressions, eight lead-preservation regressions, and nine recovery regressions. [Full output](assets/mobile-task-creation/after-test.txt).

```sh
flutter test --no-pub --reporter expanded test/task_creation_test.dart test/lead_form_preservation_test.dart test/password_recovery_test.dart
```

The tests ran in the isolated source copy prepared for password recovery, using installed dependencies and fake records. No real backend, tasks, accounts, provider, or email sends were used. This completes the local repair; it is not a claim of device installation or remote persistence testing. Because `saveData` is shared, other ID-less callers now also reach the existing create API and its normal server validation. Lead edits retain their verified partial-update path.

[Patch](assets/mobile-task-creation/appmint-mobile.patch), [source hashes](assets/mobile-task-creation/source-sha256.json). No course or central index edits were made.

## Subsequent live acceptance

24 September: the preserved Android training build submitted the real task form to the isolated local API. Save returned `Not found: /repository/create` and retained the form. The source-level regression remains valid within its mocked HTTP boundary, but end-to-end creation is not verified. Track diagnosis and retest in [MOB01-006](../learner-review/appmint-mobile-welcome.md). [Native error capture](assets/mobile-local/17-task-create-error.png).

The reopened acceptance failure is now fixed by [separate POST and PUT backend routes](repository-create-route.md). The real task saved and survived a full native restart; source regression results are no longer the sole evidence.
