Reconcile @Upsert annotation usage with AGENTS.md and docs #13
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
AGENTS.md:302says "Use@UpsertRoom annotation for insert-or-update operations" anddocs/03-function-todos.md:26says the upsert path "Uses Room@Upsert". But:RecurringExpenseDaodefines only@Insert(onConflict = REPLACE)+@Update(app/src/main/java/dev/achmad/ledgerr/data/local/dao/RecurringExpenseDao.kt:37-41)ExpenseDaodefines only@Insert(onConflict = REPLACE)+@Update(app/src/main/java/dev/achmad/ledgerr/data/local/dao/ExpenseDao.kt:57-61)So the interactors —
UpsertExpense(PR #2),UpsertRecurringExpenseandProcessDueRecurringExpenses(PR #10) — all use a manualif (id == 0L) insert else updatepattern instead of@Upsert. Both PRs shipped with this pattern; neither can calldao.upsert(...)because the method does not exist.This is a pre-existing docs-vs-code mismatch. Pick a direction and converge.
What to do
Option A — align code with the docs (recommended):
@Upsertmethods to bothExpenseDaoandRecurringExpenseDao:UpsertExpense.awaitandUpsertRecurringExpense.awaitto calldao.upsert(entity)and return the new id.ProcessDueRecurringExpensescan keep its per-row loop (it needs the per-row new id and the post-insert template update) but can callexpenseDao.upsert(...)for the insert step.Option B — relax the docs:
@Upsertline inAGENTS.md:302.docs/03-function-todos.md:26to describe the actualinsert/updatepattern.Acceptance
./gradlew assembleDebugsucceedsImplementation rule
Per
AGENTS.md— do not start implementation without explicit user sign-off on this issue. When working, check for related issues in the remote repo first.Closing — addressed as a review comment on PR #10 (#10) instead of a separate issue.