Skip to content

Fix excerpt generator not called when autoGenerate becomes true#10042

Merged
JohnNiang merged 1 commit into
mainfrom
fix/excerpt-cache-auto-generate
May 31, 2026
Merged

Fix excerpt generator not called when autoGenerate becomes true#10042
JohnNiang merged 1 commit into
mainfrom
fix/excerpt-cache-auto-generate

Conversation

@ruibaby

@ruibaby ruibaby commented May 29, 2026

Copy link
Copy Markdown
Member

What type of PR is this?

  • Bug fix

What this PR does / why we need it:

PostReconciler and SinglePageReconciler use content SHA256 checksum alone as the cache key in getExcerpt(). When the article content is unchanged but excerpt.autoGenerate switches from false to true, the cache hits and the old excerpt is returned directly, skipping all ExcerptGenerator calls (including plugin extensions and the DefaultExcerptGenerator fallback).

This PR includes the autoGenerate flag into the cache key so that the excerpt is regenerated whenever the autoGenerate state changes, even if the content itself has not been modified.

Which issue(s) this PR fixes:

Fixes #10039

Special notes for your reviewer:

This change is backward compatible: the old checksum/content annotation stores a pure content checksum (e.g. abc123), while the new cache key format is abc123:true or abc123:false. On the first reconcile after upgrade, the old key will not match, triggering a one-time regeneration and updating the annotation to the new format.

Does this PR introduce a user-facing change?

修复在文章内容未修改时切换「自动生成摘要」设置后摘要未重新生成的问题

PostReconciler and SinglePageReconciler use content checksum alone as cache key in getExcerpt(). When content is unchanged but excerpt.autoGenerate switches from false to true, the cache hits and ExcerptGenerator is skipped.

This commit includes autoGenerate flag into the cache key so that excerpt is regenerated whenever the autoGenerate state changes.

Fixes #10039
@sonarqubecloud

Copy link
Copy Markdown

@JohnNiang JohnNiang left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@JohnNiang JohnNiang merged commit ac3e03c into main May 31, 2026
9 checks passed
@JohnNiang JohnNiang deleted the fix/excerpt-cache-auto-generate branch May 31, 2026 14:22
@ruibaby ruibaby added this to the 2.25.x milestone Jun 3, 2026
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.

Halo PostReconciler 内容校验和缓存导致 ExcerptGenerator 未被调用

2 participants