Skip to content

Commit 4ae3a46

Browse files
author
IM.codes
committed
Explain shared context project policy options
1 parent 8555584 commit 4ae3a46

9 files changed

Lines changed: 87 additions & 3 deletions

File tree

web/src/components/SharedContextManagementPanel.tsx

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,18 @@ const checkboxRowStyle = {
110110
alignItems: 'flex-start',
111111
} as const;
112112

113+
const policyOptionStyle = {
114+
flex: '1 1 260px',
115+
minWidth: 240,
116+
padding: '10px 12px',
117+
borderRadius: 10,
118+
border: '1px solid #334155',
119+
background: '#0f172a',
120+
display: 'flex',
121+
flexDirection: 'column',
122+
gap: 6,
123+
} as const;
124+
113125
const fieldLabelStyle = {
114126
display: 'flex',
115127
flexDirection: 'column',
@@ -640,16 +652,41 @@ export function SharedContextManagementPanel({ enterpriseId: initialEnterpriseId
640652
<strong>{t('sharedContext.management.policyTitle')}</strong>
641653
{policyLoading && <span style={{ color: '#94a3b8' }}>{t('sharedContext.management.policyLoading')}</span>}
642654
</div>
655+
<InfoCard title={t('sharedContext.management.policyExplainTitle')}>
656+
<div>{t('sharedContext.management.policyExplainLine1')}</div>
657+
<div>{t('sharedContext.management.policyExplainLine2')}</div>
658+
</InfoCard>
643659
<div style={rowStyle}>
644660
<select value={selectedEnrollmentId} onChange={(e) => setSelectedEnrollmentId((e.currentTarget as HTMLSelectElement).value)} style={inputStyle}>
645661
<option value="">{t('sharedContext.management.selectProject')}</option>
646662
{projects.map((project) => <option key={project.id} value={project.id}>{project.displayName ?? project.canonicalRepoId}</option>)}
647663
</select>
648664
</div>
649665
<div style={checkboxRowStyle}>
650-
<label><input type="checkbox" checked={policy.allowDegradedProviderSupport} onChange={(e) => setPolicy((prev) => ({ ...prev, allowDegradedProviderSupport: (e.currentTarget as HTMLInputElement).checked }))} /> {t('sharedContext.management.allowDegraded')}</label>
651-
<label><input type="checkbox" checked={policy.allowLocalFallback} onChange={(e) => setPolicy((prev) => ({ ...prev, allowLocalFallback: (e.currentTarget as HTMLInputElement).checked }))} /> {t('sharedContext.management.allowLocalFallback')}</label>
652-
<label><input type="checkbox" checked={policy.requireFullProviderSupport} onChange={(e) => setPolicy((prev) => ({ ...prev, requireFullProviderSupport: (e.currentTarget as HTMLInputElement).checked }))} /> {t('sharedContext.management.requireFullSupport')}</label>
666+
<label style={policyOptionStyle}>
667+
<span>
668+
<input type="checkbox" checked={policy.allowDegradedProviderSupport} onChange={(e) => setPolicy((prev) => ({ ...prev, allowDegradedProviderSupport: (e.currentTarget as HTMLInputElement).checked }))} />
669+
{' '}
670+
{t('sharedContext.management.allowDegraded')}
671+
</span>
672+
<span style={{ color: '#94a3b8', fontSize: 13 }}>{t('sharedContext.management.allowDegradedHelp')}</span>
673+
</label>
674+
<label style={policyOptionStyle}>
675+
<span>
676+
<input type="checkbox" checked={policy.allowLocalFallback} onChange={(e) => setPolicy((prev) => ({ ...prev, allowLocalFallback: (e.currentTarget as HTMLInputElement).checked }))} />
677+
{' '}
678+
{t('sharedContext.management.allowLocalFallback')}
679+
</span>
680+
<span style={{ color: '#94a3b8', fontSize: 13 }}>{t('sharedContext.management.allowLocalFallbackHelp')}</span>
681+
</label>
682+
<label style={policyOptionStyle}>
683+
<span>
684+
<input type="checkbox" checked={policy.requireFullProviderSupport} onChange={(e) => setPolicy((prev) => ({ ...prev, requireFullProviderSupport: (e.currentTarget as HTMLInputElement).checked }))} />
685+
{' '}
686+
{t('sharedContext.management.requireFullSupport')}
687+
</span>
688+
<span style={{ color: '#94a3b8', fontSize: 13 }}>{t('sharedContext.management.requireFullSupportHelp')}</span>
689+
</label>
653690
</div>
654691
<button
655692
style={buttonStyle}

web/src/i18n/locales/en.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,12 @@
900900
},
901901
"policyTitle": "Project policy",
902902
"policyLoading": "Loading saved policy…",
903+
"policyExplainTitle": "What this policy controls",
904+
"policyExplainLine1": "These settings control how this shared project behaves when a provider cannot fully support shared context or when the remote shared state is unavailable.",
905+
"policyExplainLine2": "Use the stricter options for team-owned codebases. Use the more permissive options only when you need continuity over strict consistency.",
906+
"allowDegradedHelp": "Allow providers that can only inject shared context in a reduced or message-side form. Turn this off if the team requires consistent behavior across providers.",
907+
"allowLocalFallbackHelp": "Allow this machine to keep using its local processed context when shared remote context is stale or temporarily unavailable.",
908+
"requireFullProviderSupportHelp": "Only allow providers that fully support normalized shared-context injection. This is the strictest setting.",
903909
"processingSummaryTitle": "Processing flow",
904910
"processingSummaryLine1": "Raw activity is staged locally, then materialized into processed local context on delayed jobs.",
905911
"processingSummaryLine2": "Shared projects can replicate processed context to the remote shared store after local materialization succeeds.",

web/src/i18n/locales/es.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,12 @@
899899
},
900900
"policyTitle": "Project policy",
901901
"policyLoading": "Loading saved policy…",
902+
"policyExplainTitle": "What this policy controls",
903+
"policyExplainLine1": "These settings control how this shared project behaves when a provider cannot fully support shared context or when the remote shared state is unavailable.",
904+
"policyExplainLine2": "Use the stricter options for team-owned codebases. Use the more permissive options only when you need continuity over strict consistency.",
905+
"allowDegradedHelp": "Allow providers that can only inject shared context in a reduced or message-side form. Turn this off if the team requires consistent behavior across providers.",
906+
"allowLocalFallbackHelp": "Allow this machine to keep using its local processed context when shared remote context is stale or temporarily unavailable.",
907+
"requireFullProviderSupportHelp": "Only allow providers that fully support normalized shared-context injection. This is the strictest setting.",
902908
"processingSummaryTitle": "Processing flow",
903909
"processingSummaryLine1": "Raw activity is staged locally, then materialized into processed local context on delayed jobs.",
904910
"processingSummaryLine2": "Shared projects can replicate processed context to the remote shared store after local materialization succeeds.",

web/src/i18n/locales/ja.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,12 @@
899899
},
900900
"policyTitle": "Project policy",
901901
"policyLoading": "Loading saved policy…",
902+
"policyExplainTitle": "What this policy controls",
903+
"policyExplainLine1": "These settings control how this shared project behaves when a provider cannot fully support shared context or when the remote shared state is unavailable.",
904+
"policyExplainLine2": "Use the stricter options for team-owned codebases. Use the more permissive options only when you need continuity over strict consistency.",
905+
"allowDegradedHelp": "Allow providers that can only inject shared context in a reduced or message-side form. Turn this off if the team requires consistent behavior across providers.",
906+
"allowLocalFallbackHelp": "Allow this machine to keep using its local processed context when shared remote context is stale or temporarily unavailable.",
907+
"requireFullProviderSupportHelp": "Only allow providers that fully support normalized shared-context injection. This is the strictest setting.",
902908
"processingSummaryTitle": "Processing flow",
903909
"processingSummaryLine1": "Raw activity is staged locally, then materialized into processed local context on delayed jobs.",
904910
"processingSummaryLine2": "Shared projects can replicate processed context to the remote shared store after local materialization succeeds.",

web/src/i18n/locales/ko.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,12 @@
899899
},
900900
"policyTitle": "Project policy",
901901
"policyLoading": "Loading saved policy…",
902+
"policyExplainTitle": "What this policy controls",
903+
"policyExplainLine1": "These settings control how this shared project behaves when a provider cannot fully support shared context or when the remote shared state is unavailable.",
904+
"policyExplainLine2": "Use the stricter options for team-owned codebases. Use the more permissive options only when you need continuity over strict consistency.",
905+
"allowDegradedHelp": "Allow providers that can only inject shared context in a reduced or message-side form. Turn this off if the team requires consistent behavior across providers.",
906+
"allowLocalFallbackHelp": "Allow this machine to keep using its local processed context when shared remote context is stale or temporarily unavailable.",
907+
"requireFullProviderSupportHelp": "Only allow providers that fully support normalized shared-context injection. This is the strictest setting.",
902908
"processingSummaryTitle": "Processing flow",
903909
"processingSummaryLine1": "Raw activity is staged locally, then materialized into processed local context on delayed jobs.",
904910
"processingSummaryLine2": "Shared projects can replicate processed context to the remote shared store after local materialization succeeds.",

web/src/i18n/locales/ru.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,12 @@
899899
},
900900
"policyTitle": "Project policy",
901901
"policyLoading": "Loading saved policy…",
902+
"policyExplainTitle": "What this policy controls",
903+
"policyExplainLine1": "These settings control how this shared project behaves when a provider cannot fully support shared context or when the remote shared state is unavailable.",
904+
"policyExplainLine2": "Use the stricter options for team-owned codebases. Use the more permissive options only when you need continuity over strict consistency.",
905+
"allowDegradedHelp": "Allow providers that can only inject shared context in a reduced or message-side form. Turn this off if the team requires consistent behavior across providers.",
906+
"allowLocalFallbackHelp": "Allow this machine to keep using its local processed context when shared remote context is stale or temporarily unavailable.",
907+
"requireFullProviderSupportHelp": "Only allow providers that fully support normalized shared-context injection. This is the strictest setting.",
902908
"processingSummaryTitle": "Processing flow",
903909
"processingSummaryLine1": "Raw activity is staged locally, then materialized into processed local context on delayed jobs.",
904910
"processingSummaryLine2": "Shared projects can replicate processed context to the remote shared store after local materialization succeeds.",

web/src/i18n/locales/zh-CN.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,12 @@
900900
},
901901
"policyTitle": "Project policy",
902902
"policyLoading": "Loading saved policy…",
903+
"policyExplainTitle": "这个策略控制什么",
904+
"policyExplainLine1": "这些设置决定了:当 provider 不能完整支持共享上下文,或者远端共享状态暂时不可用时,这个共享项目应该怎么处理。",
905+
"policyExplainLine2": "团队核心项目建议用更严格的选项。只有在你更看重连续性而不是强一致性时,才开启更宽松的选项。",
906+
"allowDegradedHelp": "允许只能以降级方式注入共享上下文的 provider 继续工作。若团队要求不同 provider 行为尽量一致,就关闭它。",
907+
"allowLocalFallbackHelp": "当远端共享上下文过期或暂时不可用时,允许当前机器继续使用本地处理后的上下文。",
908+
"requireFullProviderSupportHelp": "只允许完整支持标准化共享上下文注入的 provider。这是最严格的设置。",
903909
"processingSummaryTitle": "Processing flow",
904910
"processingSummaryLine1": "Raw activity is staged locally, then materialized into processed local context on delayed jobs.",
905911
"processingSummaryLine2": "Shared projects can replicate processed context to the remote shared store after local materialization succeeds.",

web/src/i18n/locales/zh-TW.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,12 @@
900900
},
901901
"policyTitle": "Project policy",
902902
"policyLoading": "Loading saved policy…",
903+
"policyExplainTitle": "這個策略控制什麼",
904+
"policyExplainLine1": "這些設定決定了:當 provider 不能完整支援共享上下文,或遠端共享狀態暫時不可用時,這個共享專案應該怎麼處理。",
905+
"policyExplainLine2": "團隊核心專案建議使用更嚴格的選項。只有在你更重視連續性而不是強一致性時,才開啟較寬鬆的選項。",
906+
"allowDegradedHelp": "允許只能以降級方式注入共享上下文的 provider 繼續工作。若團隊要求不同 provider 的行為儘量一致,就關閉它。",
907+
"allowLocalFallbackHelp": "當遠端共享上下文過期或暫時不可用時,允許目前這台機器繼續使用本地處理後的上下文。",
908+
"requireFullProviderSupportHelp": "只允許完整支援標準化共享上下文注入的 provider。這是最嚴格的設定。",
903909
"processingSummaryTitle": "Processing flow",
904910
"processingSummaryLine1": "Raw activity is staged locally, then materialized into processed local context on delayed jobs.",
905911
"processingSummaryLine2": "Shared projects can replicate processed context to the remote shared store after local materialization succeeds.",

web/test/components/SharedContextManagementPanel.test.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ describe('SharedContextManagementPanel', () => {
235235

236236
await waitFor(() => expect(getSharedProjectPolicyMock).toHaveBeenCalledWith('enr-1'));
237237

238+
expect(await screen.findByText('sharedContext.management.policyExplainTitle')).toBeDefined();
239+
expect(await screen.findByText('sharedContext.management.allowDegradedHelp')).toBeDefined();
240+
expect(await screen.findByText('sharedContext.management.allowLocalFallbackHelp')).toBeDefined();
241+
expect(await screen.findByText('sharedContext.management.requireFullSupportHelp')).toBeDefined();
242+
238243
await waitFor(() => {
239244
const degraded = screen.getByLabelText(/sharedContext.management.allowDegraded/i) as HTMLInputElement;
240245
const localFallback = screen.getByLabelText(/sharedContext.management.allowLocalFallback/i) as HTMLInputElement;

0 commit comments

Comments
 (0)