Skip to content

fix(finai): clean abandoned uploads and harden imports - #291

Open
NeerajCodz wants to merge 3 commits into
mainfrom
fix/finai-import-issues
Open

NeerajCodz wants to merge 3 commits into
mainfrom
fix/finai-import-issues

Conversation

@NeerajCodz

Copy link
Copy Markdown
Owner

Changes

  • Expire upload tickets and remove only unreferenced Convex storage after a 24-hour grace period.
  • Harden spreadsheet extraction, import planning, and HEIC receipt handling.

Issues

Fixes #256
Fixes #257
Fixes #258
Fixes #259
Fixes #260
Fixes #261
Fixes #262
Fixes #263

- Expire upload tickets and prune only unreferenced storage after the upload grace period.
- Harden spreadsheet extraction and HEIC receipt handling.
- Fixes #256, #257, #258, #259, #260, #261, #262, and #263.
@vercel

vercel Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
finapp Ready Ready Preview Nov 27, 2026 2:45am UTC

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-27T02:42:24.932904Z
We couldn’t complete this review. Comment @codex review to try again.
c84974f Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@NeerajCodz

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f8f0fac362

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread convex/ai/spreadsheet.ts
}
} else if (char === '"' && fieldStart) quoted = true;
else if (char === '\n' || char === '\r') {
for (const delimiter of candidates) records.get(delimiter)!.push(counts.get(delimiter)! + 1);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bound delimiter detection before collecting every row

For newline-heavy CSV attachments, this loop stores four numbers per physical line and scans the entire file before the parser's 5,000-row limit is applied. Since uploads may be 10 MB, a file containing millions of short lines can allocate tens of millions of array entries and exhaust the Convex action's memory instead of being safely truncated; sample only a bounded number of records or aggregate the width frequencies online.

Useful? React with 👍 / 👎.

Comment thread convex/ai/attachments.ts
!upload ||
upload.userId !== user._id ||
upload.storageId !== undefined ||
now - upload.createdAt > finaiAttachmentLimits.registerWindowMs ||

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Start the registration window when the upload finishes

On a slow connection, a valid attachment is rejected once 15 minutes have elapsed since the upload URL was requested, even if the object only just reached storage. A 10 MB upload can exceed that interval on a constrained mobile network, and this check now uses the ticket creation time rather than the stored file's _creationTime, contrary to the registration window's intended post-upload grace period.

Useful? React with 👍 / 👎.

Comment thread convex/ai/actions.ts
Comment on lines +311 to +312
status: claimed.kind === 'transaction.import' ? 'running' : 'failed',
errorCode,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Stop showing failed imports as still running

When an import fails with a known error—such as a deleted account/category or an invalid row—the action has already returned { status: 'failed' }, but this patch persists it as running. actionViews therefore renders the card as “Saving…” until staleRunningMs elapses and then makes it retryable without cancellation; permanent failures repeat this cycle indefinitely instead of displaying the stored error as a terminal failure. Reserve the stale-running retry path for genuinely interrupted executions or introduce an explicit retryable failure state.

Useful? React with 👍 / 👎.

- Load workbook date styles before parsing worksheets.
- Report omitted sheets without materializing every worksheet declaration.
@NeerajCodz

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

- Create server-issued tickets before storing fixture files.
- Import spreadsheet parsing helpers in their consumer tests.
@NeerajCodz

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

This branch was successfully deployed

1 active deployment
Preview — c84974f3 Deployed Nov 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment