Skip to content

Fix Facebook video analytics ID resolution#87

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

Fix Facebook video analytics ID resolution#87
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-87 June 24, 2026 13:53 Destroyed

@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: df90b0515e

ℹ️ 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 providers/facebook.py
Comment on lines +581 to +584
except Exception as exc:
errors_by_post_id[post_id] = str(exc)
logger.warning("Facebook post insights failed at %s: %s", endpoint, exc)
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Do not swallow transient insight failures

When scheduled analytics hits a Facebook 429, transport error, or malformed JSON while fetching /insights, this broad catch handles RateLimitError/httpx/parse failures as if the candidate simply had no insights edge and eventually returns empty insight values. _sync_post_metrics relies on get_post_metrics raising for transient failures so it can skip the snapshot; returning a PostMetrics object instead can persist zero/partial reactions/engagement for that day instead of retrying later.

Useful? React with 👍 / 👎.

Comment thread providers/facebook.py
Comment on lines +613 to +615
except Exception as exc:
last_error = exc
break

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Do not zero counts on transient field failures

When the object field lookup is rate-limited or fails at the transport/JSON layer, this new catch-all returns {} instead of propagating the transient error. In the analytics sync path that means comments, shares, and the reactions fallback are treated as zero (or omitted) while any successful insights can still be written, corrupting the post snapshot; only the Meta APIError cases used for unsupported fields should be handled here.

Useful? React with 👍 / 👎.

@heshanlk heshanlk force-pushed the fix/facebook-video-analytics-ids branch from df90b05 to 4065d5c Compare June 24, 2026 13:56
@heshanlk heshanlk merged commit 83722be into main Jun 24, 2026
2 of 4 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