Skip to content

fix(stats): reuse deleted unknown placeholder#2267

Merged
riderx merged 1 commit into
mainfrom
codex/stats-deleted-unknown-placeholder
May 14, 2026
Merged

fix(stats): reuse deleted unknown placeholder#2267
riderx merged 1 commit into
mainfrom
codex/stats-deleted-unknown-placeholder

Conversation

@riderx
Copy link
Copy Markdown
Member

@riderx riderx commented May 14, 2026

Summary (AI generated)

  • Reuse an existing deleted unknown placeholder version when /stats falls back after a missing version.
  • Add a regression test covering the deleted placeholder fallback path.

Motivation (AI generated)

The stats endpoint could fail to find a deleted unknown placeholder when the reported version was missing, causing repeated placeholder insert scheduling instead of accepting the existing placeholder.

Business Impact (AI generated)

This keeps plugin stats ingestion stable for apps that already have a deleted unknown placeholder, reducing noisy retries and avoiding unnecessary backend work on a hot plugin path.

Test Plan (AI generated)

  • bun lint
  • bun lint:backend
  • bun run supabase:with-env -- bunx vitest run tests/stats.test.ts

Generated with AI

Summary by CodeRabbit

  • Bug Fixes

    • Refined the fallback logic for retrieving app version information when standard lookups don't return results, improving the system's handling of edge cases.
  • Tests

    • Added test coverage verifying proper stats API behavior when processing requests with deleted version records and incomplete version identification data.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a8a21a18-0b05-4fb7-a6af-d0708b5cf928

📥 Commits

Reviewing files that changed from the base of the PR and between e99c9b5 and 644c6dd.

📒 Files selected for processing (2)
  • supabase/functions/_backend/plugins/stats.ts
  • tests/stats.test.ts

📝 Walkthrough

Walkthrough

This PR adjusts the stats plugin's app version fallback logic to allow deleted "unknown" version records. When an initial version lookup fails, the second lookup now forces allowedDeleted to true when querying for the "unknown" version. A test validates POST succeeds when such a deleted unknown version exists.

Changes

Stats deleted unknown version handling

Layer / File(s) Summary
Fallback version lookup with test validation
supabase/functions/_backend/plugins/stats.ts, tests/stats.test.ts
Stats plugin fallback now passes allowedDeleted=true when querying getAppVersionPostgres for 'unknown' version. Test seeds a deleted unknown version, submits a stats payload with missing version_build, and validates { status: 'ok' } response with cleanup.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A fallback that bends to the will,
Allows the unknown to have its thrill,
Deleted records now can be found,
Where stats flow freely all around,
The rabbit approves of this clever bind!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: reusing an existing deleted 'unknown' placeholder in the stats endpoint fallback logic.
Description check ✅ Passed The description includes a summary and motivation, with a test plan section confirming manual testing was performed. However, the PR description format differs from the repository template structure.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/stats-deleted-unknown-placeholder

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.


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

@codspeed-hq
Copy link
Copy Markdown
Contributor

codspeed-hq Bot commented May 14, 2026

Merging this PR will not alter performance

✅ 43 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing codex/stats-deleted-unknown-placeholder (644c6dd) with main (224445e)2

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (e99c9b5) during the generation of this report, so 224445e was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@sonarqubecloud
Copy link
Copy Markdown

@riderx riderx marked this pull request as ready for review May 14, 2026 12:36
@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.

@riderx
Copy link
Copy Markdown
Member Author

riderx commented May 14, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@riderx riderx merged commit 09a2d64 into main May 14, 2026
40 checks passed
@riderx riderx deleted the codex/stats-deleted-unknown-placeholder branch May 14, 2026 13:52
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.

1 participant