From 3458deebfe4f074859936f024b9ad85135d1f0f8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 27 Mar 2026 07:55:14 +0000 Subject: [PATCH] =?UTF-8?q?=C2=A71=20=E4=BF=AE=E5=A4=8D=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=AE=A1=E6=9F=A5=E5=8F=8D=E9=A6=88:=20generateSignalId/TraceI?= =?UTF-8?q?d=20=E6=8C=89=E5=BD=93=E6=97=A5=E6=97=A5=E6=9C=9F=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E9=A1=BA=E5=BA=8F=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/933f67dd-56b2-417f-8162-a5f3d70ce797 Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> --- scripts/sync-snapshot-to-notion.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/sync-snapshot-to-notion.js b/scripts/sync-snapshot-to-notion.js index ef1389d2..ebe428a1 100644 --- a/scripts/sync-snapshot-to-notion.js +++ b/scripts/sync-snapshot-to-notion.js @@ -104,14 +104,15 @@ function generateSignalId() { const now = new Date(); const date = now.toISOString().split('T')[0].replace(/-/g, ''); - // 读取现有 index.json 获取最大顺序号,生成下一个顺序ID + // 读取现有 index.json,仅统计当日信号的最大顺序号 let nextSeq = 1; try { const indexPath = path.join(SIGNAL_LOG_DIR, 'index.json'); const raw = JSON.parse(fs.readFileSync(indexPath, 'utf8')); const signals = Array.isArray(raw) ? raw : (raw.signals || []); + const pattern = new RegExp(`^SIG-${date}-(\\d{3})$`); for (const sig of signals) { - const match = (sig.signal_id || '').match(/^SIG-\d{8}-(\d{3})$/); + const match = (sig.signal_id || '').match(pattern); if (match) { const seq = parseInt(match[1], 10); if (seq >= nextSeq) nextSeq = seq + 1; @@ -126,14 +127,15 @@ function generateTraceId() { const now = new Date(); const date = now.toISOString().split('T')[0].replace(/-/g, ''); - // 读取现有 index.json 获取最大 trace 顺序号 + // 读取现有 index.json,仅统计当日 trace 的最大顺序号 let nextSeq = 1; try { const indexPath = path.join(SIGNAL_LOG_DIR, 'index.json'); const raw = JSON.parse(fs.readFileSync(indexPath, 'utf8')); const signals = Array.isArray(raw) ? raw : (raw.signals || []); + const pattern = new RegExp(`^TRC-${date}-(\\d{3})$`); for (const sig of signals) { - const match = (sig.trace_id || '').match(/^TRC-\d{8}-(\d{3})$/); + const match = (sig.trace_id || '').match(pattern); if (match) { const seq = parseInt(match[1], 10); if (seq >= nextSeq) nextSeq = seq + 1;