Skip to content

[codex] Implement stable OGP metadata refresh - #210

Merged
big-mon merged 5 commits into
mainfrom
codex/issue-200-ogp-strategy
Jun 23, 2026
Merged

[codex] Implement stable OGP metadata refresh#210
big-mon merged 5 commits into
mainfrom
codex/issue-200-ogp-strategy

Conversation

@big-mon

@big-mon big-mon commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add OGP processing modes so normal builds can use cache-only metadata instead of live network fetches.
  • Add content/ogp-metadata.json as the central OGP metadata store and wire Astro to read it by default.
  • Add pnpm ogp:refresh plus a scheduled GitHub Actions workflow that refreshes the metadata store and opens an update PR when it changes.

Why

Fixes #200 by separating build-time rendering from external-site OGP fetching while still giving the metadata store a clear refresh and invalidation path.

Validation

  • pnpm exec prettier --write ...
  • pnpm --filter @estrivault/content-processor build
  • pnpm --filter astro-blog check
  • pnpm ogp:refresh -- --dry-run --url=not-a-url --concurrency=1
  • pnpm --filter astro-blog build
  • pnpm lint
  • git diff --find-renames -- content/blog showed no blog Markdown changes
  • OGP メタデータの集約管理: content/ogp-metadata.json を centralized store として新設し、build-time rendering と external-site OGP fetching を分離して build 安定性を向上
  • 環境に応じたモード切り替え: OgpModecache-only/fetch/disabled)を導入し、環境変数 OGP_MODE でキャッシュ優先 vs. ネットワーク取得を制御可能に
  • 手動・自動リフレッシュ機構: pnpm ogp:refresh コマンドと GitHub Actions ワークフロー (refresh-ogp-metadata.yml) を追加し、スケジュール実行または手動トリガーでメタデータを更新・PR を自動生成
  • メタデータ store の拡張 API: fetchFreshOgpMetadataOgpMetadataStore などを公開 API として追加し、TTL・取得タイムスタンプ・エラー記録に対応

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6abd4ce4-31b9-42c1-91ac-513acaa99615

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
📝 Walkthrough

Walkthrough

OGPメタデータのキャッシュ・更新戦略を全面実装した。content-processorOgpModeOgpMetadataStore 等の型定義を追加し、ogp-fetcher をモード(disabled/cache-only/fetch)駆動に再設計。fetchFreshOgpMetadatacreateFallbackMetadata を公開APIに追加し、パイプラインおよびremark共通リンク埋め込みプラグインにOGPオプションを配線。scripts/refresh-ogp-metadata.mjs としてCLIリフレッシュスクリプトを実装し、Astroブログ側では ogp-metadata.json をeager読み込みして defaultProcessorOptions に注入。GitHub Actionsワークフローで定期的に自動更新・PR作成する仕組みも追加した。

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed プルリクエストのタイトルは、OGPメタデータ安定リフレッシュの実装という主要な変更を明確に示しており、変更セット全体と一致している。
Linked Issues check ✅ Passed 実装が#200の受け入れ条件をすべて満たしている。OGP取得の改善方針(キャッシュ先行戦略)が確定し、メタデータストア更新/無効化の方法が明確で、ビルドが外部サイト状態に依存しない設計になっている。
Out of Scope Changes check ✅ Passed すべての変更が#200の受け入れ条件に直結している。OGPの安定化・更新戦略・ビルド独立性のいずれかに関連し、スコープ外の変更は検出されない。

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/issue-200-ogp-strategy

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.

@big-mon

big-mon commented Jun 23, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 23, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
estrilda 65a72bf Commit Preview URL

Branch Preview URL
Jun 23 2026, 12:42 PM

@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: 36f23e82dc

ℹ️ 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 apps/astro-blog/src/lib/content.ts Outdated
Comment thread scripts/refresh-ogp-metadata.mjs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/refresh-ogp-metadata.yml:
- Around line 42-56: The GitHub Actions workflow has supply chain security
vulnerabilities. First, pin all three GitHub Actions to specific commit SHAs
instead of version tags: replace actions/checkout@v4, pnpm/action-setup@v4, and
actions/setup-node@v4 with their respective commit hash pinned versions. Second,
add persist-credentials: false to the actions/checkout step to prevent
credentials from persisting during dependency installation and build operations
in subsequent steps. This ensures authentication tokens are only available when
explicitly needed during push operations, limiting exposure if dependencies are
compromised.

In `@scripts/refresh-ogp-metadata.mjs`:
- Around line 4-8: The import statement in the refresh-ogp-metadata.mjs file
directly references the build artifact at dist/index.js from the
content-processor package, which will fail in clean environments before the
package is built. Either add a preogp:refresh script task that builds the
content-processor package before the ogp:refresh command runs, or change the
import path from '../packages/content-processor/dist/index.js' to use the public
entry point of the package (typically the main export defined in package.json)
instead of directly importing from the dist folder to avoid depending on
pre-built artifacts.
- Around line 152-159: In the fallback handling branch within the condition
checking if result status is 'fallback' (around line 152-159), the returned
object from the existingEntry spread is missing updates to the `expiresAt` field
and status tracking. When a fetch fails and an existing entry is returned, add
an `expiresAt` property to the returned object that sets a new expiration time
(using a shorter TTL appropriate for failed entries) and include any status
field that tracks the failed state, so that failed URLs are not immediately
retried on the next run and the job avoids unnecessary processing of
consistently failing URLs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: df711854-4777-48e2-9196-0003f4bb3976

📥 Commits

Reviewing files that changed from the base of the PR and between 9e41e30 and 36f23e8.

📒 Files selected for processing (10)
  • .github/workflows/refresh-ogp-metadata.yml
  • apps/astro-blog/src/lib/content.ts
  • content/ogp-metadata.json
  • package.json
  • packages/content-processor/src/index.ts
  • packages/content-processor/src/pipeline.ts
  • packages/content-processor/src/plugins/embeds/common-link-embed.ts
  • packages/content-processor/src/types.ts
  • packages/content-processor/src/utils/ogp-fetcher.ts
  • scripts/refresh-ogp-metadata.mjs

Comment thread .github/workflows/refresh-ogp-metadata.yml
Comment thread scripts/refresh-ogp-metadata.mjs
Comment thread scripts/refresh-ogp-metadata.mjs

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

ℹ️ 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 scripts/refresh-ogp-metadata.mjs Outdated

@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: 47008f0bbc

ℹ️ 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 scripts/refresh-ogp-metadata.mjs Outdated

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

ℹ️ 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 apps/astro-blog/src/lib/content.ts Outdated
@big-mon
big-mon merged commit 70bccfd into main Jun 23, 2026
3 checks passed
@big-mon
big-mon deleted the codex/issue-200-ogp-strategy branch June 23, 2026 12:48
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.

content-processor: OGP取得の安定性と更新戦略を設計する

1 participant