Skip to content

fix(expenses): recover attempts with string actors - #1115

Merged
khaira777 merged 3 commits into
mainfrom
fm/flocafe-issue-1055-r1
Oct 13, 2026
Merged

khaira777 merged 3 commits into
mainfrom
fm/flocafe-issue-1055-r1

Conversation

@khaira777

@khaira777 khaira777 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1055

Intent

Implement the surgical fix for FreeOpenSourcePOS/FloCafe issue #1055 ("Expense attempt recovery rejects string actor IDs"): update frontend/src/lib/expense-attempt.ts so actorId is typed and validated as a non-empty string (while keeping tenantId numeric), and pass String(user.id) at the boundary in frontend/src/components/expenses/ExpenseWorkflow.tsx so persisted unresolved expense attempts for string user IDs can be read, replayed, and cleared properly. Deliver via the no-mistakes pipeline as its own PR (Fixes #1055).

What Changed

  • Updated frontend/src/lib/expense-attempt.ts so actorId in ExpenseAttemptSnapshot, expenseAttemptStorageKey, newExpenseAttempt, readExpenseAttempt, and clearExpenseAttempt is typed and validated as a non-empty string while keeping tenantId numeric.
  • Converted user.id to String(user.id) at the storage boundary in frontend/src/components/expenses/ExpenseWorkflow.tsx when reading and creating persisted expense attempts.
  • Added unit coverage in tests/expense-attempt.test.ts (wired into npm run test:expenses) and E2E coverage in frontend/e2e/expenses.spec.ts for string-actor expense attempt persistence, recovery, replay, and cleanup.

Risk Assessment

✅ Low: The change is a small, well-bounded fix that updates expense-attempt actorId typing and validation to non-empty string while keeping tenantId numeric, passes String(user.id) at the ExpenseWorkflow boundary, and adds unit and E2E regression tests.

Testing

The Test agent exceeded its invocation budget before live validation completed; no evidence was gathered for this head.

  • Outcome: ⚠️ 1 warning across 1 run (35m9s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

⚠️ **Test** - 1 warning
  • ⚠️ The Test agent did not finish within its invocation budget. Reported: agent run tests timed out after 30m0s: agent last produced output 4m34s ago (58 observed); agent reported: antigravity parse events: context deadline exceeded. This is a budget or provider-slowness cut, not a code failure. Re-running the same request costs another full budget, so no further attempt is made automatically. If this repository's targeted tests or evidence gathering routinely approach the default 30m0s, raise test_agent_timeout in global config. Respond with fix to spend another budget: a repair turn runs only for selected findings other than this budget cut, then validation re-runs. Or abort and retry after raising the budget.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Validate expense attempt actorId as a non-empty string while keeping tenantId numeric, and pass String(user.id) at the ExpenseWorkflow boundary so unresolved attempts from string user IDs can be read, replayed, and cleared.

Fixes #1055
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: FreeOpenSourcePOS/FloCafe/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8e952845-3aa3-4232-8e08-a40f499ac14a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@khaira777 khaira777 changed the title fix(frontend): recover expense attempts for string actor IDs fix(expenses): recover attempts with string actors Oct 13, 2026
@khaira777

Copy link
Copy Markdown
Contributor Author

@greptile review

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium impact] Changes how expense attempt state is stored and recovered.

The string-actor fix appears sound, but the test header must satisfy the repository’s comment rule before merging.

Findings

  1. P2 Header breaks comment rule ▶

Summary

This PR lets expense attempts saved with string user IDs be recovered and retried.

  • Expense attempts can be recovered for users with string IDs.

Static review only. Tests, builds, and browser flows were not run.

Diagram

sequenceDiagram
  participant UI as Expense workflow
  participant Storage as Local storage
  participant API as Expense API
  UI->>Storage: Read attempt for string actor and numeric tenant
  Storage-->>UI: Saved request, body, and key
  UI->>API: Retry saved request with original key
  API-->>UI: Return saved result
  UI->>Storage: Clear matching attempt
  UI->>UI: Refresh expense details
Loading

Reviews (1) · Last reviewed commit: "fix(expenses): recover attempts with str..." · Reviewed by Greptile

Comment thread tests/expense-attempt.test.ts Resolved
khaira777 and others added 2 commits October 13, 2026 15:33
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@khaira777
khaira777 enabled auto-merge (squash) October 13, 2026 20:21
@khaira777
khaira777 merged commit 2b089a6 into main Oct 13, 2026
23 checks passed
@khaira777
khaira777 deleted the fm/flocafe-issue-1055-r1 branch October 13, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(expenses): expense attempt persistence type mismatch permanently locks user submissions

1 participant