feat(work-status): add opt-in turn statistics (#3177)
Add optional completed-turn statistics without changing the existing panel layout. Separate final text delivery speed from whole-turn throughput, preserve scope and opt-in settings, and explain each metric with localized delayed tooltips. Validated focused telemetry, lifecycle, sync and persistence tests, all-workspace type-check and lint, web builds, the 12-locale narrow layout, and full GitHub CI.
This commit is contained in:
@@ -203,6 +203,9 @@ export const createSettingsHelpers = (dependencies) => {
|
||||
...new Set(candidate.workStatusHiddenSections.filter((entry) => typeof entry === 'string' && entry.length > 0)),
|
||||
];
|
||||
}
|
||||
if (typeof candidate.workStatusHiddenSectionsExplicit === 'boolean') {
|
||||
result.workStatusHiddenSectionsExplicit = candidate.workStatusHiddenSectionsExplicit;
|
||||
}
|
||||
if (typeof candidate.desktopLanAccessEnabled === 'boolean') {
|
||||
result.desktopLanAccessEnabled = candidate.desktopLanAccessEnabled;
|
||||
}
|
||||
|
||||
@@ -69,6 +69,19 @@ const createTestHelpersWithRealSanitizers = () => {
|
||||
};
|
||||
|
||||
describe('settings helpers', () => {
|
||||
it('round-trips telemetry opt-in with the hidden list and preserves it across unrelated writes', () => {
|
||||
const helpers = createTestHelpers();
|
||||
const legacy = helpers.sanitizeSettingsUpdate({ workStatusHiddenSections: [] });
|
||||
expect(legacy.workStatusHiddenSectionsExplicit).toBeUndefined();
|
||||
const changes = helpers.sanitizeSettingsUpdate({ workStatusHiddenSections: [], workStatusHiddenSectionsExplicit: true });
|
||||
const saved = helpers.mergePersistedSettings(legacy, changes);
|
||||
const reloaded = helpers.formatSettingsResponse(JSON.parse(JSON.stringify(saved)));
|
||||
expect(reloaded.workStatusHiddenSections).toEqual([]);
|
||||
expect(reloaded.workStatusHiddenSectionsExplicit).toBe(true);
|
||||
const next = helpers.mergePersistedSettings(reloaded, helpers.sanitizeSettingsUpdate({ workStatusPanelEnabled: false }));
|
||||
expect(helpers.formatSettingsResponse(next).workStatusHiddenSectionsExplicit).toBe(true);
|
||||
expect(helpers.sanitizeSettingsUpdate({ workStatusHiddenSectionsExplicit: 'true' }).workStatusHiddenSectionsExplicit).toBeUndefined();
|
||||
});
|
||||
it('imports from the packed @openchamber/web tarball without escaping the published package', async () => {
|
||||
const tempRoot = mkdtempSync(join(tmpdir(), 'settings-helpers-pack-'));
|
||||
const packDir = join(tempRoot, 'pack');
|
||||
|
||||
Reference in New Issue
Block a user