[codex] Implement stable OGP metadata refresh - #210
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughOGPメタデータのキャッシュ・更新戦略を全面実装した。 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
@codex review |
Deploying with
|
| 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 |
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
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
📒 Files selected for processing (10)
.github/workflows/refresh-ogp-metadata.ymlapps/astro-blog/src/lib/content.tscontent/ogp-metadata.jsonpackage.jsonpackages/content-processor/src/index.tspackages/content-processor/src/pipeline.tspackages/content-processor/src/plugins/embeds/common-link-embed.tspackages/content-processor/src/types.tspackages/content-processor/src/utils/ogp-fetcher.tsscripts/refresh-ogp-metadata.mjs
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
Summary
content/ogp-metadata.jsonas the central OGP metadata store and wire Astro to read it by default.pnpm ogp:refreshplus 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 buildpnpm --filter astro-blog checkpnpm ogp:refresh -- --dry-run --url=not-a-url --concurrency=1pnpm --filter astro-blog buildpnpm lintgit diff --find-renames -- content/blogshowed no blog Markdown changescontent/ogp-metadata.jsonを centralized store として新設し、build-time rendering と external-site OGP fetching を分離して build 安定性を向上OgpMode(cache-only/fetch/disabled)を導入し、環境変数OGP_MODEでキャッシュ優先 vs. ネットワーク取得を制御可能にpnpm ogp:refreshコマンドと GitHub Actions ワークフロー (refresh-ogp-metadata.yml) を追加し、スケジュール実行または手動トリガーでメタデータを更新・PR を自動生成fetchFreshOgpMetadata、OgpMetadataStoreなどを公開 API として追加し、TTL・取得タイムスタンプ・エラー記録に対応