Skip to content

feat(telegram): digest → Notion 파이프라인 통합#591

Closed
thxforall wants to merge 26 commits into
devfrom
feature/notion-smoke-474
Closed

feat(telegram): digest → Notion 파이프라인 통합#591
thxforall wants to merge 26 commits into
devfrom
feature/notion-smoke-474

Conversation

@thxforall
Copy link
Copy Markdown
Contributor

Summary

Telegram digest → Notion 파이프라인 구축. 23 commits로 webhook front door, raw event 저장, digest 분류, Notion write-back을 통합한다.

  • 범위: 31 files / +5057 insertions
  • 신규 모듈: packages/web/lib/telegram/*, packages/web/lib/notion/write-back.ts
  • 신규 API: app/api/telegram/webhook/route.ts
  • 신규 마이그레이션: supabase/migrations/20260507090000_telegram_raw_events.sql
  • 운영 도구: scripts/telegram-*, scripts/notion-*-smoke.ts

주요 변경 그룹

Telegram 수집 layer

  • lib/telegram/webhook.ts — webhook front door + payload validation + update type 제한
  • lib/telegram/raw-event-store.ts — raw event 저장 (telegram_raw_events 테이블)
  • lib/telegram/ingest.ts — polling raw ingest + replay 지원
  • lib/telegram/access.ts — chat 접근 정책

Digest 처리

  • lib/telegram/digest.ts — topic별 grouping + label, trace ID 안정화, JSON preview
  • scripts/telegram-digest-write.ts — digest 추출 candidates

Notion write-back

  • lib/notion/write-back.ts — schema, page body block 채우기, trace ID guard
  • lib/telegram/notion-write.ts — digest → Notion bridge

운영 / 문서

  • docs/agent/telegram-ingest.md — Telegram digest Notion smoke 문서
  • .planning/plans/2026-05-07-telegram-digest-phase-2a.md, 2026-05-07-telegram-digest-preview.md — phase 2a 디자인
  • .planning/2026-05-07-telegram-digest-phase-2a-design.md, 2026-05-07-telegram-topic-digest-notion-schema-design.md — schema/design notes

Linked

Closes #590 (신규 epic)

Supersedes #473, #474 (이미 close됨).
Related #554 (telegram-bot-vault-integration deprecated).

Test plan

  • Telegram webhook smoke: bun run scripts/telegram-access-smoke.ts
  • Raw event ingest: bun run scripts/telegram-poll-ingest.ts / telegram-replay-ingest.ts
  • Digest 분류 검증: bun run scripts/telegram-digest-write.ts
  • Notion write-back: bun run scripts/notion-write-pilot.ts, notion-access-smoke.ts
  • Trace ID 기반 dedup 동작 확인 (Notion 페이지 중복 생성 없음)
  • 유닛 테스트: webhook.test.ts, digest.test.ts, ingest.test.ts, raw-event-store.test.ts, notion-write.test.ts, write-back.test.ts

마이그레이션

  • DB 변경: supabase/migrations/20260507090000_telegram_raw_events.sql
    • 신규 테이블: telegram_raw_events (payload 저장 + dedup용)
  • Notion 데이터 소스 schema는 write-back.ts에 정의 — 운영 환경 적용 시 Notion DB 사전 셋업 필요

Breaking changes

없음 (신규 기능, 기존 API 영향 없음).

위험 / 후속

  • Telegram webhook 시크릿 / Notion API token은 별도 secret 관리 필요 (env 가이드 후속 작업)
  • Notion API rate limit 대응은 현재 trace ID guard 수준, 운영 단계에서 backoff 강화 검토

🤖 Generated with Claude Code

@vercel
Copy link
Copy Markdown

vercel Bot commented May 28, 2026

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

Project Deployment Actions Updated (UTC)
decoded-app Error Error May 28, 2026 11:47am

Conflicts resolved:
- AGENTS.md: take origin/dev base (new structure/sections), preserve HEAD's
  "## Commit discipline" section, bump Last Updated to 2026-05-28
- packages/web/package.json: take both
  - scripts: notion:*/telegram:* (HEAD) + content-studio:video:local (dev)
  - deps: @notionhq/client (HEAD) + @next/third-parties (dev)
- bun.lock: take origin/dev, then `bun install` to regen with both sets of deps
  (added ts-morph@24.0.0 from #588 merge)
thxforall added 2 commits May 28, 2026 18:25
wiki:lint MISSING_FRONTMATTER. feature/notion-smoke-474 이 도입한
docs/agent/telegram-ingest.md 에 표준 frontmatter (title, owner, status,
updated, tags) 추가.
dev 에 누적된 wiki:lint 5건을 #591 머지 차단 해소를 위해 흡수.
모두 feature/notion-smoke-474 scope 외 — 별도 chore PR 로 분리가 정석이지만
머지 일정 우선시.

- docs/agent/design-system-llm.md: H1_TITLE_MISMATCH 해소
  title 을 H1 "Design System — LLM Reference (v2.2.0)" 에 맞춤 (#589 의도 보존)
- docs/superpowers/specs/.../notion-schema-design.md: UNKNOWN_TAG 3건 (notion, digest, schema)
  tags vocabulary 미등록 항목 제거 → [telegram, ops]. 어휘 확장 PR 은 별도 권장.
- docs/superpowers/specs/.../phase-2a-design.md: MISSING_FRONTMATTER 표준 추가
@thxforall thxforall added the bump:patch Bug fixes / internal refactor label May 28, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 28, 2026

Schema drift report (#373 v2)

OK — 1 SOT entries match.

SOT Status Detail
post_magazines.status OK draft, generating, pending, published, rejected

SOT mapping: docs/database/schema-drift-sot.md · Bypass via drift-bypass label.

thxforall added a commit that referenced this pull request May 28, 2026
PR #605 의 wiki:lint fail 2건 해소.

1. `docs/wiki/schema/tags.md` (+1)
   - `codex` tag 추가 (tools 분류). 본 PR의 `codex-cli.md` 가 사용
2. `docs/agent/design-system-llm.md` (frontmatter)
   - title 에 `(v2.2.0)` 추가하여 H1 ("Design System — LLM Reference (v2.2.0)") 와 정합
   - dev 누적 violation (df31b3f #589 v2.2.0 sync 도입분).
     #591 도 동일 fix 보유 → 머지 순서에 따라 trivial conflict 가능

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
thxforall added a commit that referenced this pull request May 28, 2026
…#605)

* chore(harness): Hybrid harness scaffolding (Claude × Codex 2.5-layer)

`chore/session-3-codex-harness-leftovers` 의 harness scaffolding 부분만
cherry-pick 으로 분리 (skill pack/playbook 은 별도 PR).

## 도입 산출물

- `.harness/CODEX_CANARY.md`, `.harness/routing.md` — 라우팅 정책
- `.tasks/TASK-CODEX-CANARY.md` — TASK card scaffolding
- `AGENTS.md` (+2 lines) — cross-tool 진입 규칙 reference
- `CONTEXT.md` — repo-level context entry
- `docs/wiki/wiki/harness/codex-cli.md` — Codex CLI 운영 가이드
- `docs/wiki/schema/ownership-matrix.md` — routing SSOT 갱신
- `.gitignore` (+2 lines) — `.tasks/locks/`, `.handoff/`

## 정책 요약

Layer 1 (Claude): plan/route, 직접 product code 쓰지 않음
Layer 2 (Codex fast): single-file 실행
Layer 2.5 (Codex strict): read-only review
Layer 3 (Claude): `.handoff/*.review.json` 읽고 accept/reject

## 함의

`AGENTS.md` 가 cross-tool entry point 로 격상. Claude Code 용 보강은
별도 `CLAUDE.md` overlay (이미 존재). Codex 가 사용하는 skill 은
별도 PR `chore(harness): codex/gstack skill pack` 에서 도입.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore(wiki): add codex tag + fix design-system-llm H1/title mismatch

PR #605 의 wiki:lint fail 2건 해소.

1. `docs/wiki/schema/tags.md` (+1)
   - `codex` tag 추가 (tools 분류). 본 PR의 `codex-cli.md` 가 사용
2. `docs/agent/design-system-llm.md` (frontmatter)
   - title 에 `(v2.2.0)` 추가하여 H1 ("Design System — LLM Reference (v2.2.0)") 와 정합
   - dev 누적 violation (df31b3f #589 v2.2.0 sync 도입분).
     #591 도 동일 fix 보유 → 머지 순서에 따라 trivial conflict 가능

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@thxforall
Copy link
Copy Markdown
Contributor Author

Notion 파이프라인 작업 폐기 결정 — 브랜치 삭제 예정

@thxforall thxforall closed this May 28, 2026
@github-project-automation github-project-automation Bot moved this from Todo to Done in decoded-monorepo May 28, 2026
@thxforall thxforall deleted the feature/notion-smoke-474 branch May 28, 2026 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bump:patch Bug fixes / internal refactor

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant