Skip to content

confluence-mdx: renderer strategy를 typed decision으로 분리합니다#1041

Merged
jk-kim0 merged 3 commits into
mainfrom
jk/refactor-reverse-sync-renderer-strategies
Jul 27, 2026
Merged

confluence-mdx: renderer strategy를 typed decision으로 분리합니다#1041
jk-kim0 merged 3 commits into
mainfrom
jk/refactor-reverse-sync-renderer-strategies

Conversation

@jk-kim0

@jk-kim0 jk-kim0 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

renderer category 선택을 typed decision으로 통합하여 patch_builder.py의 heuristic fallback 경계를 명시합니다.

  • RendererStrategyStrategyDecision으로 text block, list, preserved anchor, container, table, blocked category를 정의합니다.
  • exact mapping과 roundtrip sidecar 증거를 확인한 뒤 한 곳에서 renderer strategy를 선택합니다.
  • raw HTML table 처리를 generic text block에서 분리하고 preserved anchor와 공통 template rewrite helper를 사용합니다.
  • MDX emitter가 소유한 link와 미소유 Confluence preservation unit을 구분합니다.
  • 계약이 없는 ac:/ri: unit은 unknown_macro_mutation capability로 fail-closed 처리합니다.

기존 문제

문자열 strategy와 분산된 tag heuristic 때문에 raw HTML table, MDX-owned link, unknown macro가 generic text path에서 서로 다른 의미로 처리될 수 있었습니다. 특히 미지원 preservation unit도 inner XHTML 재생성으로 흘러 Confluence 전용 구조를 손실할 가능성이 있었습니다.

Impact

  • offline fixture의 기존 link/table 보존 동작을 유지합니다.
  • strict planner는 unknown macro 변경에 executable operation을 만들지 않습니다.
  • capability 판별과 strategy handler의 모듈 추출은 후속 P1 task로 유지합니다.
  • remote PUT이나 production batch 활성화는 포함하지 않습니다.

OpenSpec

  • complete-reverse-sync의 renderer strategy 분리 task를 완료 처리합니다.
  • typed decision, raw table 경계, unknown preservation fail-closed 계약과 검증 결과를 기록합니다.

Test plan

  • make test-reverse-sync — golden 16 passed, regression 43 passed
  • ../venv/bin/python3 -m pytest -q test_reverse_sync*.py — 779 passed
  • make test-convert — 21 passed
  • make test-byte-verify — fast/splice 각각 21/21 passed
  • ../venv/bin/python3 -m pytest -q — 1132 passed, 2 skipped
  • openspec validate complete-reverse-sync --strict
  • git diff --check

Stack

🤖 Generated with Codex

@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
querypie-docs Canceled Canceled Comment Jul 27, 2026 7:42am

Request Review

@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: 91f4cff432

ℹ️ 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 +1490 to +1493
if (
'<ac:link' in mapping.xhtml_text
or '<ri:attachment' in mapping.xhtml_text
):

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 Block mixed preservation units before rewriting

When a PRESERVED_ANCHOR fragment contains a supported link or attachment plus any unsupported ac:/ri: unit (for example an unknown structured macro that wraps an ac:link), this branch emits a template rewrite before reaching the unknown_preservation_unit skip below. In strict planning that patch is classified as preserved_anchor_template_rewrite rather than unknown_macro_mutation, so unsupported macro internals can still become executable instead of fail-closed; only take this rewrite path after proving the fragment contains no other preservation units.

Useful? React with 👍 / 👎.

@jk-kim0
jk-kim0 force-pushed the jk/fix-reverse-sync-strict-renderer branch from 7aa8365 to 67ccd5d Compare July 27, 2026 06:14
jk-kim0 added a commit that referenced this pull request Jul 27, 2026
## Summary
지원하는 link 또는 attachment와 unknown Confluence unit이 섞인 fragment를 fail-closed 처리합니다.

- template rewrite 전에 preservation tag 전체가 지원 목록 안에 있는지 확인합니다.
- unknown macro가 link를 감싼 mixed fragment 회귀 테스트를 추가합니다.

## Test plan
- [x] planner 및 patch builder 테스트 147개 통과
- [x] git diff --check

🤖 Generated with Codex
@jk-kim0
jk-kim0 force-pushed the jk/refactor-reverse-sync-renderer-strategies branch from 91f4cff to e6cf77d Compare July 27, 2026 06:16
jk-kim0 added a commit that referenced this pull request Jul 27, 2026
## Summary
RendererStrategy enum 전환 후에도 strict stale-list guard가 실행되도록 비교식을 정정합니다.

## Test plan
- [x] stale preserved list mapping 회귀 테스트 통과
- [x] git diff --check

🤖 Generated with Codex
@jk-kim0
jk-kim0 force-pushed the jk/fix-reverse-sync-strict-renderer branch from 67ccd5d to b0725c1 Compare July 27, 2026 07:33
Base automatically changed from jk/fix-reverse-sync-strict-renderer to main July 27, 2026 07:37
jk-kim0 and others added 3 commits July 27, 2026 16:37
## Summary
renderer category 선택을 typed decision으로 통합하여 heuristic fallback 경계를 명시합니다.

- text block, list, preserved anchor, container, table 전략을 enum으로 분리합니다.
- MDX-owned link와 unknown Confluence preservation unit을 구분하여 후자는 fail-closed 처리합니다.
- raw HTML table과 preserved anchor가 공통 template rewrite helper를 사용하도록 정리합니다.
- 전략 선택과 capability 차단 회귀 테스트 및 OpenSpec 실행 기록을 갱신합니다.

🤖 Generated with Codex

Co-Authored-By: Atlas <atlas@jk.agent>
## Summary
지원하는 link 또는 attachment와 unknown Confluence unit이 섞인 fragment를 fail-closed 처리합니다.

- template rewrite 전에 preservation tag 전체가 지원 목록 안에 있는지 확인합니다.
- unknown macro가 link를 감싼 mixed fragment 회귀 테스트를 추가합니다.

## Test plan
- [x] planner 및 patch builder 테스트 147개 통과
- [x] git diff --check

🤖 Generated with Codex
## Summary
RendererStrategy enum 전환 후에도 strict stale-list guard가 실행되도록 비교식을 정정합니다.

## Test plan
- [x] stale preserved list mapping 회귀 테스트 통과
- [x] git diff --check

🤖 Generated with Codex
@jk-kim0
jk-kim0 force-pushed the jk/refactor-reverse-sync-renderer-strategies branch from 13245a3 to e56e0b9 Compare July 27, 2026 07:38
@jk-kim0
jk-kim0 merged commit 66934c5 into main Jul 27, 2026
6 of 7 checks passed
@jk-kim0
jk-kim0 deleted the jk/refactor-reverse-sync-renderer-strategies branch July 27, 2026 07:41
jk-kim0 added a commit that referenced this pull request Jul 27, 2026
## Summary
capability 분류를 raw renderer payload의 구조가 아니라 typed renderer strategy와
MDX intent에 결합합니다.

- `classify_capability()`이 canonical operation action,
`StrategyDecision`, MDX block type을 입력으로 사용합니다.
- planner가 operation에 대응하는 `ChangeIntent` ordinal별 capability를 계산합니다.
- 하나의 operation에 서로 다른 capability가 대응하면 `unknown_macro_mutation`으로
fail-closed합니다.
- legacy renderer skip reason의 blocked capability 대응을 `capabilities.py`로
이동합니다.
- MDX-owned link가 `preserved_anchor_template_rewrite`로 오분류되던 경계를
`paragraph_visible_edit`로 바로잡습니다.

## 기존 문제
기존 planner는 renderer가 raw patch를 만든 뒤 action, mapping type, source type과
raw HTML 포함 여부를 다시 조합해 capability를 추론했습니다. 이 방식은 실제 renderer strategy와
capability가 어긋날 수 있고 legacy skip reason 대응표도 planner 내부에 중복시켰습니다.

## Impact
- capability ID와 support level을 renderer payload body와 독립적으로 결정합니다.
- preserved list/link/attachment와 unknown macro의 fail-closed 경계를
registry 테스트로 고정합니다.
- renderer strategy handler의 `reverse_sync/strategies/**` 모듈 추출은 다음 P1
task로 분리합니다.
- remote PUT이나 production batch 활성화는 포함하지 않습니다.

## OpenSpec
- `complete-reverse-sync`의 capability 판별 추출 task를 완료 처리합니다.
- strategy handler 모듈 추출을 별도 P1 task로 명시합니다.

## Test plan
- [x] focused capability/planner/patch builder — 152 passed
- [x] `../venv/bin/python3 -m pytest -q test_reverse_sync*.py` — 789
passed
- [x] `make test-reverse-sync` — golden 16 passed, regression 43 passed
- [x] `make test-convert` — 21 passed
- [x] `make test-byte-verify` — fast/splice 각각 21/21 passed
- [x] `../venv/bin/python3 -m pytest -q` — 1142 passed, 2 skipped
- [x] `openspec validate complete-reverse-sync --strict`
- [x] `git diff --check`

## Stack
- Base: #1041

🤖 Generated with Codex

---------

Co-authored-by: Atlas <atlas@jk.agent>
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