Skip to content

fix(planning): serialize data-rights export queries - #215

Closed
seonghobae wants to merge 4 commits into
mainfrom
fix/planning-data-rights-serial-export-v1
Closed

fix(planning): serialize data-rights export queries#215
seonghobae wants to merge 4 commits into
mainfrom
fix/planning-data-rights-serial-export-v1

Conversation

@seonghobae

@seonghobae seonghobae commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Why

The current Planning data-rights export opens one repeatable-read transaction and then launches five client.query() streams concurrently through Promise.all. The PostgreSQL driver already emits a deprecation warning when client.query() is called while that same client is executing another query, and pg 9 is expected to reject that usage.

Change

  • add a regression double that rejects overlapping queries on a transaction-owned SQL client
  • execute the five Planning-owned export reads sequentially inside the same repeatable-read transaction
  • retain existing bounded pagination, deterministic ordering, snapshot isolation, tenant scoping, export schema, and digest behavior

RCA / acceptance

First failing boundary: transaction-owned PostgreSQL client query scheduling, not SQL formatting, coverage, permissions, or database readiness.

Falsifiable acceptance: the new regression must pass without overlapping queries, and the repository CI must complete without the prior Calling client.query() when the client is already executing a query is deprecated warning from Planning data-rights export.

This PR does not change the shared data-rights contract or claim completion of #55.


Devin Review

Summary by CodeRabbit

  • 버그 수정
    • 워크스페이스 데이터 내보내기 작업에서 트랜잭션 처리 중 쿼리가 충돌하지 않도록 내보내기 항목을 순차적으로 처리합니다.
    • 내보내기 작업이 안정적으로 완료되고 결과 건수가 정확하게 반환됩니다.

@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 53 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 8a6160ce-5667-4049-b722-b074872f15e5

📥 Commits

Reviewing files that changed from the base of the PR and between a683be2 and dc23e62.

📒 Files selected for processing (2)
  • apps/planning-service/package.json
  • apps/planning-service/tsconfig.json

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 3a0e8702-3942-4116-99ff-75c82609662c

📥 Commits

Reviewing files that changed from the base of the PR and between f8559bf and a683be2.

📒 Files selected for processing (2)
  • apps/planning-service/src/planning-data-rights-concurrency.test.ts
  • apps/planning-service/src/planning-data-rights.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

exportWorkspace의 다섯 내보내기 쿼리를 순차 실행으로 변경했습니다. 단일 트랜잭션 클라이언트에서 겹치는 쿼리를 거부하는 테스트를 추가했습니다.

Changes

내보내기 쿼리 직렬화

Layer / File(s) Summary
내보내기 쿼리 순차 실행
apps/planning-service/src/planning-data-rights.ts
goals, projects, tasks, todayAggregates, todayIdempotency 조회를 개별 await로 실행합니다. SQL, 정렬, 페이지네이션은 유지합니다.
단일 클라이언트 동시성 테스트
apps/planning-service/src/planning-data-rights-concurrency.test.ts
겹치는 쿼리를 거부하는 테스트 클라이언트를 추가하고, export 결과가 성공하는지 검증합니다.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to a683b

The Planning data-rights export now executes its existing reads sequentially within the same transaction, avoiding unsupported overlapping queries while preserving export behavior. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 Planning data-rights export 쿼리를 순차 실행하도록 변경한 핵심 내용을 정확하고 간결하게 설명합니다.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/planning-data-rights-serial-export-v1

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.

@devin-ai-integration devin-ai-integration 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.

Note

This report is out of date. Scroll down for Devin Review's latest report on this PR.

Devin Review found 2 potential issues.

Devin Review

Comment thread apps/planning-service/src/planning-data-rights.ts
Comment thread apps/planning-service/src/planning-data-rights-concurrency.test.ts
devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor Author

Superseded by #219 after exact diff comparison against current main@f8559bf31dc098bdd58473747805a229bf860cc7. Both PRs address the same node-postgres single-connection overlap defect, but #219 fixes the causal boundary in ConnectionSqlClient so every concurrent transaction caller is explicitly serialized without rewriting Planning export orchestration or adding unrelated formatting/lint changes. #215's unique changes are either incidental formatting/lint expansion or a narrower call-site serialization of the same defect. Preserve #215 as historical RED/review evidence only; continue validation on #219 exact head 532774dc61f9defabb81d50773c6265dddff4b6e.

@seonghobae seonghobae closed this Sep 1, 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.

1 participant