Skip to content

fix(reflection): per-section legacy filtering prevents resolved items from being revived (P1+P2) [CLEAN]#595

Open
jlin53882 wants to merge 1 commit intoCortexReach:masterfrom
jlin53882:fix/p2-clean-fix
Open

fix(reflection): per-section legacy filtering prevents resolved items from being revived (P1+P2) [CLEAN]#595
jlin53882 wants to merge 1 commit intoCortexReach:masterfrom
jlin53882:fix/p2-clean-fix

Conversation

@jlin53882
Copy link
Copy Markdown
Contributor

@jlin53882 jlin53882 commented Apr 12, 2026

Summary

問題背景 (Issue #447, #483)

當 reflection items 被標記為「已解決」(resolved)後,它們仍然會透過 legacy fallback mechanism 被重新喚醒,導致resolved advice 反復出現。

修復內容

P1 修復:過濾已解決的 items

  • 新增
    esolvedAt、
    esolvedBy、
    esolutionNote 欄位到 ReflectionItemMetadata
  • 在載入 reflection 時,过滤掉
    esolvedAt !== undefined 的 items

P2 修復:Per-section legacy filtering

  • 區分「已解決的 invariant items」和「已解決的 derived items」
  • 只有當 legacy rows 包含「還沒被解決的內容」時,才會傳遞給候選人列表
  • 防止 section A 的 resolved items 被 section B 的 legacy rows 意外喚醒

變更

檔案 行數 說明
src/reflection-item-store.ts +6 新增 resolvedAt, resolvedBy, resolutionNote 欄位
src/reflection-store.ts +66/-2 Per-section legacy filtering 邏輯

測試

所有原有測試通過。

… from being revived (P1+P2)

- Add resolvedAt/resolvedBy/resolutionNote metadata to ReflectionItemMetadata
- Filter out resolved items from reflection loading (P1 fix)
- Per-section legacy filtering to prevent cross-section revival (P2 fix)
@jlin53882 jlin53882 changed the title fix(reflection): per-section legacy filtering prevents resolved items from being revived (P1+P2) fix(reflection): per-section legacy filtering prevents resolved items from being revived (P1+P2) [CLEAN] Apr 12, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

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: 2f5a32201d

ℹ️ 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 on lines +306 to +309
const invariantLegacyRows = legacyRows.filter(({ metadata }) =>
toStringArray(metadata.invariants).some(
(line) => !resolvedInvariantTexts.has(normalizeReflectionLineForAggregation(line))
)
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 Exclude resolved legacy lines before fallback ranking

When unresolvedItemRows is empty, this row-level filter lets any legacy row through if it has at least one unique invariant, but buildInvariantCandidates later emits all invariant lines from that row. In the common case where one legacy row contains both a resolved line and a still-unique line, the resolved line is revived again, which defeats the resolved-item suppression this patch is adding (same pattern exists for derived rows below).

Useful? React with 👍 / 👎.

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