---
name: ng-serverless-oncall-sync
description: Sync next-gen and serverless O11Y alerts plus TiDB X TCOC work items into the FY26 Data Service Oncall Feishu bitable. Supports daily sync for yesterday and backfill sync from a specified date to today with dedupe and update-by-Link behavior.
---

# NG Serverless Oncall Sync Skill

Use this skill when you want to sync next-gen and serverless O11Y alert records plus TiDB X TCOC records into the Feishu bitable:

- Daily sync for yesterday only
- Backfill sync from a specified date to today
- Dedupe by `Link`
- Update existing records when mapped fields changed

## Entry Point

Run:

```bash
python3 skills/team-workflow/ng-serverless-oncall-sync/run.py daily
python3 skills/team-workflow/ng-serverless-oncall-sync/run.py backfill 2026-01-01
python3 skills/team-workflow/ng-serverless-oncall-sync/run.py range 2026-01-01 2026-03-23
```

Dry-run preview:

```bash
python3 skills/team-workflow/ng-serverless-oncall-sync/run.py daily --dry-run --preview-limit 5
```

Actual write:

```bash
python3 skills/team-workflow/ng-serverless-oncall-sync/run.py daily --apply
```

## Required Environment

Set:

- `FEISHU_APP_ID`
- `FEISHU_APP_SECRET`
- `JIRA_EMAIL`
- `JIRA_TOKEN`

Optional:

- `JIRA_BASE_URL`
- `FEISHU_WIKI_TOKEN`
- `FEISHU_TABLE_ID`
- `FEISHU_VIEW_ID`

Defaults are already baked in for:

- Feishu wiki token
- Feishu table id
- Feishu view id
- Jira base url

## Data Source

This skill uses three JQL templates:

1. next-gen critical alerts with `description ~ "next-gen"`
2. serverless critical alerts with `description ~ "serverless" OR description ~ "free-tier"`
3. TCOC issues for `Tier[Dropdown] = TiDB X` and components `BR`, `Cloud DM`, `Cloud Import`, `TiCDC`, `TiDB Lightning`

Both queries are date-bounded by the selected sync window.

## Write Behavior

- Creates Feishu records when `Link` does not exist
- Updates Feishu records when `Link` exists and mapped fields changed
- Skips unchanged records

## Feishu Mapping

Current mapping writes:

- `Title`
- `Link`
- `CreatedAt`
- `Alert Name`
- `Cluster Type`
- `Category`
- `Scope`
- `Sub-Category`
- `Status`
- `Oncall Confirmed`

## Notes

- This skill syncs both O11Y alerts and the TiDB X TCOC slice
- Default mode is dry-run unless `--apply` is passed
