[Duplicate Code] assertGithubCapabilityLifetime duplicated across host-enclave modules
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 75/100
- issue の種類
- リファクタリング
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
src/cloud-hypervisor/host-enclave-executor-policy.ts と src/cloud-hypervisor/host-enclave-workload-profile.ts を読み、その後 assertGithubCapabilityLifetime の既存テストを確認してください。重複した検証を単一の実装にまとめ、必要なエクスポートは維持してください。関連するテストを実行してください。両方のモジュールが共通のチェックを使い、既存の有効期間テストが成功すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Duplicate Code Opportunity
Summary
- Pattern:
assertGithubCapabilityLifetime(policy, timeoutMs)(GitHub credential/capability lifetime validation for host enclave executors) is defined in two files with identical signature and leading logic (if (!policy) return; const hasCredentials = policy.githubAgentId !== undefined || policy.githubBearer !== undefined;). - Locations: see below. jscpd reports a 58-line clone.
- Impact: ~58 duplicated lines removed. This is a security-critical credential-lifetime check, so the two copies can drift. One copy could then enforce a weaker bound than the other.
Evidence
src/cloud-hypervisor/host-enclave-executor-policy.ts: lines 29-86src/cloud-hypervisor/host-enclave-workload-profile.ts: lines 20-77
Both contain:
export function assertGithubCapabilityLifetime(
policy: HostExecutorAgentPolicy | undefined,
timeoutMs: number,
): void {
if (!policy) return;
const hasCredentials = policy.githubAgentId !== undefined || policy.githubBearer !== undefined;
...
Suggested Refactoring
Keep a single exported assertGithubCapabilityLifetime in host-enclave-executor-policy.ts, or in a small shared module such as host-enclave-github-lifetime.ts. Have host-enclave-workload-profile.ts import it, and re-export it if needed to preserve the public API. Keep the existing tests pointed at the single implementation.
Affected Files
src/cloud-hypervisor/host-enclave-executor-policy.ts— lines 29-86src/cloud-hypervisor/host-enclave-workload-profile.ts— lines 20-77
Effort Estimate
Low
Detected by Duplicate Code Detector workflow.
Generated by Duplicate Code Detector · copilot · auto (Claude Sonnet 5.5) · ~20 AIC · ⊞ 23.6K · ◷
- expires on Dec 18, 2026, 9:50 PM UTC
- 主要言語
- TypeScript
- スター
- 165
- フォーク
- 84
- 平均マージ
- 5時間 57分
- マージ済み PR(30日)
- 390
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
github/gh-aw-firewall のほかの issue
-
awf-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
github/gh-aw-firewall#11612 ·
メンテナーはふだん 1 日以内に返信
-
agentic-workflows automated dependencies
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
github/gh-aw-firewall#3837 ·
メンテナーはふだん 1 日以内に返信
-
agentic-workflows
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
github/gh-aw-firewall#11802 ·
メンテナーはふだん 1 日以内に返信
-
automation otel smoke-test tracing
難易度 1/5 1時間未満 初心者へのやさしさ 1/100
github/gh-aw-firewall#11801 ·
メンテナーはふだん 1 日以内に返信
-
automation otel smoke-test tracing
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
github/gh-aw-firewall#11800 ·
メンテナーはふだん 1 日以内に返信
github/gh-aw-firewall の issue をすべて見る
似ている issue
-
bug documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
Potential Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Comfy-Org/ComfyUI_frontend#23773 ·
メンテナーはふだん 1 日以内に返信
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
lingdojo/kana-dojo#34301 · コメント 1 件 · リアクション 5 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
code-yeongyu/senpi#7007 ·
メンテナーはふだん 1 日以内に返信
-
area/renderer bug plugin/echarts priority/P3
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信