sync: update from private repo (8ed98ab)
CI / build-and-test (push) Has been cancelled

This commit is contained in:
oss-sync
2026-06-09 00:46:41 +00:00
parent ef44e1a5d9
commit d6d8e83867
20 changed files with 452 additions and 12 deletions
+30
View File
@@ -5,6 +5,8 @@ import { describe, it, expect } from 'vitest';
import { Registry } from 'prom-client';
import { normalizeToolNameForMetric, BUILTIN_TOOL_NAMES } from './tool-name-allowlist.js';
import { createWorkerMetrics } from './worker-metrics.js';
import { TOOL_DEFS as SLIDE_DEFS } from '../engine/tools/slide.js';
import { TOOL_DEFS as MSLEARN_DEFS } from '../engine/tools/ms-learn.js';
describe('normalizeToolNameForMetric', () => {
it('passes built-in tool names through verbatim', () => {
@@ -59,3 +61,31 @@ describe('normalizeToolNameForMetric', () => {
expect(dump).not.toMatch(/tool_name="mcp__/);
});
});
// Audit 2026-06-08 (P1, metrics): the allowlist carried GHOST names
// (CreateSlide, MsLearn{Fetch,Read,Search,Summarize}) that no tool emits, while
// the REAL slide (SetTheme/AddSlide/BuildPptx/ResetSlides) and ms-learn
// (Search/Fetch/SearchCache/RefreshMicrosoftLearn[Cache]) tools were missing —
// so every real call collapsed to 'unknown' in metrics. Pin the allowlist to
// the actual TOOL_DEFS so it can't drift again.
describe('metrics allowlist ↔ real tool definitions (audit regression)', () => {
const realNames = [...Object.keys(SLIDE_DEFS), ...Object.keys(MSLEARN_DEFS)];
it('every real slide/ms-learn tool normalizes to itself (not "unknown")', () => {
for (const name of realNames) {
expect(normalizeToolNameForMetric(name)).toBe(name);
}
});
it('every real slide/ms-learn tool is present in BUILTIN_TOOL_NAMES', () => {
for (const name of realNames) {
expect(BUILTIN_TOOL_NAMES.has(name)).toBe(true);
}
});
it('carries no ghost names that no real tool emits', () => {
for (const ghost of ['CreateSlide', 'MsLearnFetch', 'MsLearnRead', 'MsLearnSearch', 'MsLearnSummarize']) {
expect(BUILTIN_TOOL_NAMES.has(ghost)).toBe(false);
}
});
});
+9 -6
View File
@@ -50,14 +50,14 @@ const BUILTIN_TOOL_NAMES_LIST: ReadonlyArray<string> = [
// review.ts
'BatchReviewTextWithLLM', 'MergeReviewedResults',
// browser.ts
'BrowseWeb',
'BrowseWeb', 'BrowseWithSession', 'InteractiveBrowse',
// knowledge.ts
'IngestDocument', 'IngestStatus', 'ListDocuments', 'ListNamespaces',
'SearchKnowledge',
// orchestration.ts
'SpawnSubTask',
// x.ts
'XPostDetail', 'XSearch', 'XTimeline', 'XUserPosts',
'XFetchCardMedia', 'XPostDetail', 'XSearch', 'XTimeline', 'XUserPosts',
// maps.ts
'GetDirections', 'ReverseGeocode', 'SearchPlaces',
// youtube.ts
@@ -75,7 +75,8 @@ const BUILTIN_TOOL_NAMES_LIST: ReadonlyArray<string> = [
// mission.ts
'MissionUpdate',
// user-folder.ts
'ListUserAssets', 'ReadUserTemplate', 'RenderUserTemplate', 'RunUserScript',
'ListUserAssets', 'ReadUserMemory', 'ReadUserTemplate', 'RenderUserTemplate',
'RunUserScript', 'UpdateUserMemory', 'WriteUserScript', 'WriteUserTemplate',
// brainstorm.ts
'Brainstorm',
// app-docs.ts
@@ -88,10 +89,12 @@ const BUILTIN_TOOL_NAMES_LIST: ReadonlyArray<string> = [
'ReadNote', 'SearchNotes', 'WriteNote',
// dashboard.ts
'UpdateDashboardWidget',
// skills.ts
'InstallSkill', 'ListSkills', 'ReadSkill',
// ms-learn.ts (Microsoft Learn search)
'MsLearnFetch', 'MsLearnRead', 'MsLearnSearch', 'MsLearnSummarize',
// slide.ts
'CreateSlide',
'FetchMicrosoftLearn', 'RefreshMicrosoftLearnCache', 'SearchMicrosoftLearn', 'SearchMicrosoftLearnCache',
// slide.ts (pptxgenjs)
'AddSlide', 'BuildPptx', 'ResetSlides', 'SetTheme',
];
export const BUILTIN_TOOL_NAMES: ReadonlySet<string> = new Set<string>([