Skip to content

Fix Facebook video analytics ID resolution#88

Merged
heshanlk merged 1 commit into
mainfrom
fix/facebook-video-analytics-ids
Jun 24, 2026
Merged

Fix Facebook video analytics ID resolution#88
heshanlk merged 1 commit into
mainfrom
fix/facebook-video-analytics-ids

Conversation

@heshanlk

Copy link
Copy Markdown
Member

What does this PR do?

Why?

How to test

Checklist

  • Tests pass (pytest)
  • Lint passes (ruff check . and ruff format --check .)
  • Documentation updated (if applicable)

@railway-app railway-app Bot temporarily deployed to brightbean-studio / brightbean-studio-pr-88 June 24, 2026 14:06 Destroyed
@heshanlk heshanlk force-pushed the fix/facebook-video-analytics-ids branch from f3fec70 to 12e046f Compare June 24, 2026 14:08
@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

except Exception as exc:
errors_by_post_id[post_id] = str(exc)
logger.warning("Facebook post insights failed at %s: %s", endpoint, exc)
continue

P2 Badge Let transient insight failures abort the snapshot

When the insights request fails for a transient reason that is not an APIError (for example _request raises RateLimitError on a 429 or resp.json() raises), this catch-all converts the failure into empty insight data and get_post_metrics still returns a successful PostMetrics. The analytics task then writes at least zero-valued derived rows such as reactions/engagement and resets the post cadence instead of skipping the snapshot and retrying later, so temporary Facebook outages can pollute daily analytics.


except Exception as exc:
last_error = exc
break

P2 Badge Let transient field fetch failures abort the sync

This new broad handler also swallows non-API failures from the post fields request, such as rate limits, connection errors, or malformed JSON, and returns {} as if the engagement fields were simply unavailable. If the insights call succeeds afterward, the sync records a partial snapshot without comments/shares or the object-level reaction fallback and advances the cadence; unexpected request failures should propagate to _sync_post_metrics so the failed fetch is skipped rather than saved as incomplete analytics.

ℹ️ 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".

@heshanlk heshanlk merged commit 0f824c5 into main Jun 24, 2026
3 of 5 checks passed
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