Skip to content

Commit 08da449

Browse files
committed
chore(oss): scrub operator-private leaks from public surface
Codex cleanliness sweep flagged personal paths, real trace IDs, and operator-specific deployment vocabulary in code comments and JSDoc. Removing them so the viewer source reads as written for any adopter, not for one specific operator's homelab. ### Component comments - `src/components/Landing.svelte` — top-of-file rationale block cited "Phase 2 A reshape (operator 2026-05-30)" and "Service-ops UI lives in CPA / sub2gpt". Rewritten without internal phase tags; upstream gateway named generically. - `src/components/Settings.svelte` — header cited "Phase R7 narrows the page" and "CPA/sub2gpt already renders" the healthz counters. Same generic rewrite. ### Adapter JSDoc - `src/lib/adapters/chat.ts` — `/tmp/sub2api-samples/details` fixture path → "reference captures". - `src/lib/adapters/gemini.ts` — "no real sub2api samples exist" / "first time a real Gemini trace lands in sub2api" → generic "no real Gemini captures exist yet" / "first time a real trace is captured". ### Prompt-source heuristics - `src/lib/promptSource.ts` — comment example used `/Users/leoyun/.claude/CLAUDE.md`; replaced with `/Users/example/`. "real fixtures captured from sub2api" + "Real codex example (fixture 01KSWPQP0SD6FFX2QT37HCXF8R)" → generic phrasing. - `src/lib/promptSource.test.ts` — fixture inputs embedded `/Volumes/leoyun/.claude/CLAUDE.md` + "Leo's External Drive" as the literal test payload. Replaced with generic `/Users/example/` + `example-project`. The regex contracts the test exercises are unchanged. "see this very task's prompt", "trace 01KSWP4YQD", and "fixture 01KSWPQP0SD6FFX2QT37HCXF8R" references in comments rewritten as generic descriptions. ### Verified - `pnpm check` → 0 errors / 0 warnings / 142 files.
1 parent 21c3a91 commit 08da449

6 files changed

Lines changed: 33 additions & 34 deletions

File tree

src/components/Landing.svelte

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<script lang="ts">
22
// Landing — default home view (#/, #/landing, #/dashboard alias).
33
//
4-
// Phase 2 A reshape (operator 2026-05-30):
4+
// Shape:
55
//
6-
// - Cut NEEDS ATTENTION + INTERNAL · healthz. Service-ops UI lives in
7-
// CPA / sub2gpt; the viewer's job is LLM content, not service ops.
6+
// - Service-ops UI (healthz counter cards, drop/error banners) lives
7+
// in the upstream gateway's own dashboard; this viewer focuses on
8+
// recorded LLM content.
89
// - 5 sections in render order: STATUS, CAPABILITY, ACTIVE CLIENTS,
910
// TOKEN USAGE, VOLUME.
10-
// - Vercel aesthetic: wider whitespace, larger sans display numbers,
11-
// right-aligned numerics, 6px corners, subtle 150ms hover, no
12-
// drop shadows, bordered-only cards.
11+
// - Wide whitespace, larger sans display numbers, right-aligned
12+
// numerics, 6px corners, subtle 150ms hover, no drop shadows,
13+
// bordered-only cards.
1314
// - Single accent (teal-300) is reserved for active state / palette
1415
// selected row / focus ring. NOT used on sparkline fill or block
1516
// left rails — the page reads more monochrome.

src/components/Settings.svelte

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<script lang="ts">
22
// Settings — viewer-side preferences + token surface + about.
33
//
4-
// PHILOSOPHY (viewer/PHILOSOPHY.md + Phase R7):
4+
// Shape:
55
// - "It is not THE frontend; it is A frontend." Composable, not
6-
// authoritative. Plugin/gate/redact config does NOT live here —
7-
// that's a backend YAML concern (principle 6).
8-
// - Operational, not analytics-heavy. Phase R7 narrows the page:
9-
// drop the live healthz counters (uptime/appended/drops/data-dir/
10-
// last-poll) — that surface duplicates what CPA/sub2gpt already
11-
// renders. Keep About → version + healthz endpoint URL only.
6+
// authoritative. Plugin / gate / redact config does NOT live
7+
// here — that's a backend YAML concern.
8+
// - Operational, not analytics-heavy. No live healthz counters
9+
// (uptime / appended / drops / data-dir / last-poll) — that
10+
// surface duplicates what the upstream gateway's own dashboard
11+
// already renders. Keep About → version + healthz endpoint URL.
1212
// - Single accent (--accent, teal-300) reserved for active state,
1313
// selected row, and focus ring ONLY. Toggle on-state uses
14-
// high-contrast var(--fg) per the Vercel-leaning delta, NOT accent.
14+
// high-contrast var(--fg), NOT accent.
1515
// - i18n: every visible string goes through t(). The dictionaries
1616
// (en.ts / zh.ts) are frozen for this phase; on a missing key
1717
// t() returns the key string itself which would surface as

src/lib/adapters/chat.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Adapter for the OpenAI Chat Completions protocol (POST /v1/chat/completions).
33
*
4-
* Real-world shapes (verified against /tmp/sub2api-samples/details):
4+
* Real-world shapes observed in reference captures:
55
* - req.body is almost always a parsed dict with `messages: [...]`.
66
* - resp can arrive in any of these forms:
77
* (a) resp.body = dict -> either a chat.completion OR an error envelope

src/lib/adapters/gemini.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
* Adapter for Google Gemini protocol (/v1beta/models/*:generateContent etc.).
33
*
44
* ============================================================================
5-
* TODO: UNTESTED — no real sub2api samples exist for Gemini at write-time.
5+
* TODO: UNTESTED — no real Gemini captures exist yet.
66
* This adapter is designed from the public Gemini /v1beta docs
77
* (REST `generateContent` + `streamGenerateContent` shapes) and the
8-
* GenerativeAI SDK types. Every code path SHOULD be revisited the first
9-
* time a real Gemini trace lands in sub2api so we can verify part shapes,
10-
* SSE event names, and tool-call ID conventions.
8+
* GenerativeAI SDK types. Every code path SHOULD be revisited the
9+
* first time a real Gemini trace is captured, so part shapes, SSE
10+
* event names, and tool-call ID conventions can be verified.
1111
* ============================================================================
1212
*
1313
* Gemini request shape (cheat sheet):

src/lib/promptSource.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// npx tsx src/lib/promptSource.test.ts
1010
//
1111
// Each case carries a short comment naming the real shape it
12-
// represents (sub2api fixture id or vendor harness style).
12+
// represents (reference fixture shape or vendor harness style).
1313

1414
import {
1515
extractProjectContext,
@@ -48,14 +48,14 @@ function check(name: string, got: unknown, want: unknown): void {
4848

4949
const ctxCases: Case<string, ProjectContext | null>[] = [
5050
{
51-
// Shape: Claude Code user-turn system reminder (the actual
52-
// injection format the harness uses to drop CLAUDE.md content
53-
// into the prompt — see this very task's prompt).
51+
// Shape: Claude Code user-turn system reminder the injection
52+
// format the harness uses to drop CLAUDE.md content into the
53+
// prompt.
5454
name: 'CLAUDE.md path-prefixed ref + heading on next line',
5555
input:
56-
'Contents of /Volumes/leoyun/.claude/CLAUDE.md (project instructions, checked into the codebase):\n\n# Leo\'s External Drive — /Volumes/leoyun/\n\n## 语言',
56+
'Contents of /Users/example/.claude/CLAUDE.md (project instructions, checked into the codebase):\n\n# example-project\n\n## Section',
5757
expect: {
58-
name: "Leo's External Drive — /Volumes/leoyun/",
58+
name: 'example-project',
5959
source: 'claude-md',
6060
},
6161
},
@@ -70,8 +70,8 @@ const ctxCases: Case<string, ProjectContext | null>[] = [
7070
// Restraint check: a *prose* mention of CLAUDE.md must NOT trigger
7171
// the claude-md branch, because the next heading ("# Executing
7272
// actions with care") is part of the vendor harness, not the
73-
// project. Real fixture: trace 01KSWP4YQD where the prompt body
74-
// says "durable instructions like CLAUDE.md files" before vendor
73+
// project. A reference fixture has the prompt body mention
74+
// "durable instructions like CLAUDE.md files" before vendor
7575
// harness headings. Expectation: fall through to first-heading.
7676
name: 'prose mention "like CLAUDE.md" does not trigger claude-md',
7777
input:
@@ -128,8 +128,8 @@ for (const c of ctxCases) {
128128

129129
const skillCases: Case<string, string[]>[] = [
130130
{
131-
// Real codex shape — fixture 01KSWPQP0SD6FFX2QT37HCXF8R has 30+
132-
// <skill><name>X</name>…</skill> blocks under <available_skills>.
131+
// Real codex shape — fixtures with 30+ <skill><name>X</name>…
132+
// </skill> blocks under <available_skills>.
133133
name: 'multi-skill body-name declaration (codex shape)',
134134
input:
135135
'<available_skills>\n <skill>\n <name>ai-search</name>\n <description>...</description>\n </skill>\n <skill>\n <name>gen-image</name>\n <description>...</description>\n </skill>\n</available_skills>',

src/lib/promptSource.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ export function classifyPromptSource(text: string): PromptSourceResult {
124124
// prompt: the project this trace belongs to and the named skills /
125125
// subagents the harness advertised. Both are pure heuristics with no
126126
// XML/markdown parsing dependency — regex + a tiny HTML-entity
127-
// fallback. Patterns are documented against real fixtures captured
128-
// from sub2api.
127+
// fallback. Patterns are documented against reference fixtures.
129128

130129
export interface ProjectContext {
131130
/** Display name, with surrounding backticks stripped. */
@@ -159,7 +158,7 @@ function cleanHeadingText(raw: string): string {
159158

160159
// Match an injection-style file reference for AGENTS.md / CLAUDE.md.
161160
// The real shape Claude Code uses in user-turn system reminders is:
162-
// "Contents of /Users/leoyun/.claude/CLAUDE.md (project instructions…):"
161+
// "Contents of /Users/example/.claude/CLAUDE.md (project instructions…):"
163162
// Codex variants drop "Contents of" and write a bare absolute path.
164163
// We require either the "Contents of" preamble OR a path separator
165164
// immediately before the filename — both rule out the prose-mention
@@ -266,8 +265,7 @@ function decodeHtmlEntities(s: string): string {
266265
}
267266

268267
// Skill / subagent / agent / personality declarations the harness
269-
// advertises in the system prompt. Real codex example (fixture
270-
// 01KSWPQP0SD6FFX2QT37HCXF8R):
268+
// advertises in the system prompt. Real codex example:
271269
// <skill>
272270
// <name>ai-search</name>
273271
// <description>…</description>

0 commit comments

Comments
 (0)