[Bug]: Settings inheritance popover shows raw slugs for branch naming, default permissions and response streaming

オープン 初心者向け
#35,357 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
84/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
react, typescript, vite
領域
frontend, web-dev

調査の方向性

apps/web/src/components/settings/SettingInheritance.tsxを読み、特にformatValueとsettingInheritanceLayersを確認してから、既存のラベル処理をBranchNamingSettings.tsx、runtimeModeConfig.ts、SettingsPanels.tsxのコントロールと比較してください。Issueには、出発点となる再現スクリプトとSettingInheritance.test.tsの関連テストが記載されています。3つの設定について、すべての継承レイヤーに対応するラベルが表示され、既存のラベルケースと自由入力のテキストが変更されない状態が完了条件です。

索引モデルが issue の本文から書いたものです。

説明

Before submitting
  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.
Area

apps/web

Steps to reproduce

From the top-level checkout of the commit under Version or commit, with its locked dependencies installed, run the script below with env -u NODE_ENV sh repro.sh. It writes a temporary vitest file beside SettingInheritance.tsx, calls the exported settingInheritanceLayers (the function the popover renders) with an environment value and a project override for each key, records each layer's displayed value, and deletes the temporary file on exit. It asserts that the fixed keys show labels and that the three mode keys show slugs, so it exits 0 while the defect is present. In the app: open Settings, find Worktree branch naming (or Default permissions, or Response streaming), and open the row's inheritance popover.

Reproduction script: repro.sh
#!/bin/sh
# Run from the top-level checkout with locked dependencies installed: env -u NODE_ENV sh repro.sh
set -eu
checkout=$PWD
tmp=$(mktemp -d)
test_file="$checkout/apps/web/src/components/settings/inheritanceLabelsRepro.tmp.test.ts"
trap 'rm -f "$test_file"; rm -rf "$tmp"' EXIT HUP INT TERM
cat > "$test_file" <<'TS'
import { writeFileSync } from "node:fs";
import { DEFAULT_SERVER_SETTINGS, EnvironmentId, ProjectId } from "@t3tools/contracts";
import { resolveProjectSettings } from "@t3tools/shared/projectSettings";
import { expect, it } from "vite-plus/test";

import { settingInheritanceLayers } from "./SettingInheritance";

const environmentId = EnvironmentId.make("laptop");
const projectId = ProjectId.make("project");

function layers(key: string, environment: Record<string, unknown>, project: Record<string, unknown>) {
  const settings = {
    ...DEFAULT_SERVER_SETTINGS,
    ...environment,
    projectSettingsOverrides: { [projectId]: project },
  } as never;
  return Object.fromEntries(
    settingInheritanceLayers(
      { environmentId, label: "Laptop", projectId, ...resolveProjectSettings(settings, projectId) },
      settings,
      key as never,
    ).map((layer) => [layer.key, layer.value]),
  );
}

it("records the popover's layer values", () => {
  const rows = {
    // Keys whose popover values are not labelled.
    branchNamingMode: layers("branchNamingMode", { branchNamingMode: "semantic" }, { branchNamingMode: "custom" }),
    defaultRuntimeMode: layers("defaultRuntimeMode", { defaultRuntimeMode: "auto-accept-edits" }, { defaultRuntimeMode: "approval-required" }),
    responseStreamingMode: layers("responseStreamingMode", { responseStreamingMode: "turn" }, { responseStreamingMode: "paragraph" }),
    // Controls: keys whose labels #23450 and #23678 fixed, and a key formatValue already labels.
    worktreeCleanup: layers("worktreeCleanup", { worktreeCleanup: { mode: "custom", rules: DEFAULT_SERVER_SETTINGS.storageCleanup } }, { worktreeCleanup: { mode: "off" } }),
    backgroundActivity: layers("backgroundActivity", { backgroundActivity: { schemaVersion: 1, profile: "performance", overrides: {} } }, {}),
    worktreeSubmodules: layers("worktreeSubmodules", { worktreeSubmodules: "recursive" }, {}),
  };
  writeFileSync(process.env.REPRO_RESULT!, JSON.stringify(rows, null, 2));
  // Controls show labels.
  expect(rows.worktreeCleanup).toMatchObject({ project: "Off", environment: "Custom" });
  expect(rows.backgroundActivity).toMatchObject({ environment: "Performance", "built-in": "Balanced" });
  expect(rows.worktreeSubmodules).toMatchObject({ environment: "Recursive" });
  // Current defect: the three mode settings show storage slugs on every layer.
  expect(rows.branchNamingMode).toEqual({ project: "custom", environment: "semantic", "built-in": "static" });
  expect(rows.defaultRuntimeMode).toEqual({ project: "approval-required", environment: "auto-accept-edits", "built-in": "full-access" });
  expect(rows.responseStreamingMode).toEqual({ project: "paragraph", environment: "turn", "built-in": "paragraph" });
});
TS
cd "$checkout/apps/web"
if env -u NODE_ENV REPRO_RESULT="$tmp/result.json" ./node_modules/.bin/vp test run \
  src/components/settings/inheritanceLabelsRepro.tmp.test.ts >"$tmp/log" 2>&1; then
  cat "$tmp/result.json"; echo; echo "DEFECT PRESENT: controls are labelled, the three mode settings show raw slugs"
else
  cat "$tmp/log"; [ -f "$tmp/result.json" ] && cat "$tmp/result.json"; echo "assertions did not match the recorded defect"; exit 1
fi
Expected behavior

Each popover layer should show the same label the setting's own control shows for that value, as it already does for the other enumerated settings in this popover. #23450 established this for background activity profiles (its test expects Performance and Balanced) and #23678 for worktree cleanup modes (its test expects Off and Custom). The labels already exist in the app: MODES in apps/web/src/components/settings/BranchNamingSettings.tsx (static → Static prefix, semantic → Semantic prefix, custom → Custom instructions), runtimeModeConfig in apps/web/src/components/chat/runtimeModeConfig.ts (approval-required → Supervised, auto-accept-edits → Auto-accept edits, auto → Auto, full-access → Full access) and RESPONSE_STREAMING_MODE_LABELS in apps/web/src/components/settings/SettingsPanels.tsx (turn → Wait for the full response, paragraph → Show finished paragraphs). Each of these rows renders the popover through SettingsRow with serverScoped and settingKeys, and all three keys are in PROJECT_SCOPED_SERVER_SETTING_KEYS, so the popover can show project, environment and built-in layers for each.

Actual behavior

The inheritance popover that settings rows open to show where a value comes from (project override, environment, t3.json, built-in default) prints the stored slug instead of the human label for three mode settings: Worktree branch naming (branchNamingMode), Default permissions (defaultRuntimeMode) and Response streaming (responseStreamingMode). The popover shows semantic, auto-accept-edits and turn while the same row's own select shows Semantic prefix, Auto-accept edits and Wait for the full response. The built-in layer is affected too, so the popover shows static, full-access and paragraph even with untouched defaults. Other keys in the same popover already render labels: formatValue maps defaultThreadEnvMode, worktreeSubmodules, pullRequestMergeMethod and sourceControlWritingStyle, and #23450 and #23678 added labels for backgroundActivity and worktreeCleanup. The popover's choice of winning layer is correct; only its displayed text is wrong.

The script passed on the baseline commit from a clean checkout and left git status with no changes of its own. Its full output is under Logs or stack traces. The controls show labels (Off, Custom, Performance, Balanced, Recursive); branchNamingMode, defaultRuntimeMode and responseStreamingMode show slugs on every layer, including the built-in default:

branchNamingMode       project=custom             environment=semantic           built-in=static
defaultRuntimeMode     project=approval-required  environment=auto-accept-edits  built-in=full-access
responseStreamingMode  project=paragraph          environment=turn               built-in=paragraph
Evidence
  • Expected source: the label assertions added by #23450 and #23678 in apps/web/src/components/settings/SettingInheritance.test.ts, the existing label branches in formatValue (apps/web/src/components/settings/SettingInheritance.tsx lines 47-97), and each row's own select labels (BranchNamingSettings.tsx lines 16-20 and 64-66, ProjectDefaultsSettings.tsx lines 369-372, SettingsPanels.tsx lines 120-123 and 1990-1994).
  • Failure source: the reproduction output under Logs or stack traces, produced by the exported settingInheritanceLayers; formatValue returns the raw string at line 81 for any string key without a label branch, and settingInheritanceLayers uses it for the project, environment, t3.json and built-in layers (lines 110-145) that the popover renders at line 305.
  • Evidence provenance: observed
  • Local verification: reproduced
  • Reproduction completeness: complete

An earlier, separate run of a similar probe on the same baseline, with only environment overrides, showed the same slugs and the same Recursive control. The rendered popover in a running app was not captured; the reproduction calls the function whose value the popover prints verbatim.

Related

Open PR #28842 (part of a settings redesign stack marked as not ready to merge) adds a runtimeModeConfig label branch for defaultRuntimeMode in formatValue; it does not label branchNamingMode or responseStreamingMode. Merged #23450 (background activity profiles) and #23678 (worktree cleanup modes) fixed the same display problem for those two settings in this function.

Restoration check

With the script's input, the popover layers show Custom instructions, Semantic prefix and Static prefix for branchNamingMode; Supervised, Auto-accept edits and Full access for defaultRuntimeMode; and Show finished paragraphs, Wait for the full response and Show finished paragraphs for responseStreamingMode (project, environment and built-in layers respectively), matching each row's select. The script's slug assertions encode the current defect and fail once it is fixed. The controls keep passing: worktreeCleanup stays Off/Custom, backgroundActivity stays Performance/Balanced, worktreeSubmodules stays Recursive, and free-text project settings such as branchNamePrefix and threadTitleInstructions keep showing their text verbatim.

Impact

Cosmetic issue

Version or commit

T3 Code 0.1.9 at d9805b2ca667be7caec8c9035950564ab96704c3, rerun from a clean checkout. Upstream main at 4fd40e1a16e3800418b8f6a32932b68179098c8d has a byte-identical apps/web/src/components/settings/SettingInheritance.tsx; the script was not rerun there.

Environment

macOS on arm64, Node v26.12.1, vp test run from apps/web; no running app, server or provider needed.

Logs or stack traces

The script's output:

{
  "branchNamingMode": {
    "project": "custom",
    "environment": "semantic",
    "built-in": "static"
  },
  "defaultRuntimeMode": {
    "project": "approval-required",
    "environment": "auto-accept-edits",
    "built-in": "full-access"
  },
  "responseStreamingMode": {
    "project": "paragraph",
    "environment": "turn",
    "built-in": "paragraph"
  },
  "worktreeCleanup": {
    "project": "Off",
    "environment": "Custom",
    "built-in": "Not set"
  },
  "backgroundActivity": {
    "environment": "Performance",
    "built-in": "Balanced"
  },
  "worktreeSubmodules": {
    "project": "Inherits",
    "environment": "Recursive",
    "t3.json": "Inherits",
    "built-in": "Recursive"
  }
}
DEFECT PRESENT: controls are labelled, the three mode settings show raw slugs
Screenshots, recordings, or supporting files

No response

Workaround

Switching the settings scope to the project or environment shows that layer's value as a label in the row's own select, and the slugs map one-to-one onto the labels listed under Expected behavior.

主要言語
TypeScript
スター
24.8k
フォーク
6.4k
平均マージ
4時間 16分
マージ済み PR(30日)
352

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pingdotgg/t3code のほかの issue

pingdotgg/t3code の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。