mirror of
https://github.com/garrytan/gbrain.git
synced 2026-07-30 19:49:14 +00:00
* fix(calibration): resolve owner holder via config (default 'self'), fixes #2464 Takeover of #2467 (rebased onto master). consolidate writes owner takes with holder='self' while calibration-profile, calibration CLI/op, think's calibration block, emotional-weight, and doctor's calibration_freshness all defaulted to a hardcoded 'garry' — so getScorecard returned 0 resolved and the calibration profile never built on non-upstream brains. New src/core/owner-holder.ts is the single source of truth: resolveOwnerHolder({override, configValue}) = override > emotional_weight.user_holder config > 'self'. All six call sites route through it; doctor's freshness SQL is parameterized (). Upgrade note: upstream-owner brains with historical holder='garry' profiles should `gbrain config set emotional_weight.user_holder garry` to keep reading them. Co-authored-by: devty <devty@users.noreply.github.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test(calibration): replace real-name holder fixture with charlie-example placeholder Privacy iron rule: no real people's names in checked-in code. The sanctioned placeholder mapping uses people/charlie-example. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Sinabina <sinabina@Sinabinas-MacBook-Pro-4.local> Co-authored-by: devty <devty@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Garry Tan <garrytan@gmail.com>
28 lines
952 B
TypeScript
28 lines
952 B
TypeScript
import { describe, test, expect } from 'bun:test';
|
|
import { resolveOwnerHolder, DEFAULT_OWNER_HOLDER } from '../src/core/owner-holder.ts';
|
|
|
|
describe('owner-holder', () => {
|
|
test('DEFAULT_OWNER_HOLDER is self', () => {
|
|
expect(DEFAULT_OWNER_HOLDER).toBe('self');
|
|
});
|
|
|
|
test('defaults to self when nothing provided', () => {
|
|
expect(resolveOwnerHolder({})).toBe('self');
|
|
});
|
|
|
|
test('null/undefined config falls back to self', () => {
|
|
expect(resolveOwnerHolder({ configValue: null })).toBe('self');
|
|
expect(resolveOwnerHolder({ configValue: undefined })).toBe('self');
|
|
});
|
|
|
|
test('uses config value when set and no override', () => {
|
|
expect(resolveOwnerHolder({ configValue: 'people/charlie-example' }))
|
|
.toBe('people/charlie-example');
|
|
});
|
|
|
|
test('override beats config and default', () => {
|
|
expect(resolveOwnerHolder({ override: 'world', configValue: 'people/charlie-example' }))
|
|
.toBe('world');
|
|
});
|
|
});
|