mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 08:03:39 +00:00
fix(codex): require authority for v3 settings baseline
This commit is contained in:
@@ -142,6 +142,29 @@ describe('Codex settings baseline v3 persistence', () => {
|
||||
expect(readCodexSettingsBaseline(runtimeHomePath)).not.toBeNull()
|
||||
})
|
||||
|
||||
it('writes v2 when ordinary tracking is requested without source authority', () => {
|
||||
writeCodexSettingsBaseline(runtimeHomePath, {
|
||||
settings: new Map([
|
||||
['model', '"gpt-5"'],
|
||||
['personality', '"local"']
|
||||
]),
|
||||
conflicts: new Map(),
|
||||
knownPromotedKeys: new Set(['model']),
|
||||
sourceIsAuthoritative: false,
|
||||
tracksAllOrdinarySettings: true
|
||||
})
|
||||
|
||||
expect(readStoredBaseline()).toMatchObject({
|
||||
version: 2,
|
||||
settings: { model: '"gpt-5"', personality: '"local"' }
|
||||
})
|
||||
expect(readStoredBaseline().sourceAuthority).toBeUndefined()
|
||||
expect(readCodexSettingsBaseline(runtimeHomePath)).toMatchObject({
|
||||
tracksAllOrdinarySettings: false,
|
||||
sourceIsAuthoritative: false
|
||||
})
|
||||
})
|
||||
|
||||
it('keeps promoted ancestors when an unlisted value forces v2 fallback', () => {
|
||||
const settings = new Map<string, string | null>([
|
||||
['model', '"gpt-5"'],
|
||||
|
||||
@@ -197,7 +197,9 @@ function isCodexSettingsConflict(value: unknown): value is CodexSettingsConflict
|
||||
|
||||
function buildStoredSettingsBaseline(baseline: CodexSettingsBaseline): StoredSettingsBaseline {
|
||||
const preferred: StoredSettingsBaseline = {
|
||||
version: baseline.tracksAllOrdinarySettings ? 3 : 2,
|
||||
// A complete ordinary-key snapshot is only authoritative when it came
|
||||
// from a readable system mirror; otherwise v2 keeps absence ambiguous.
|
||||
version: baseline.tracksAllOrdinarySettings && baseline.sourceIsAuthoritative ? 3 : 2,
|
||||
settings: Object.fromEntries(baseline.settings)
|
||||
}
|
||||
if (baseline.conflicts.size > 0) {
|
||||
|
||||
Reference in New Issue
Block a user