Changeset 0.10.3 (#59)

This commit is contained in:
2026-02-24 21:32:07 +00:00
parent 4061e4a145
commit ba2cd42428
17 changed files with 5723 additions and 2458 deletions

View File

@@ -22,13 +22,17 @@ const SRC = path.join(__dirname, '..');
// wiring exists. If someone removes a policy check, CI breaks.
describe('Policy wiring audit — source code', () => {
const uiSrc = fs.readFileSync(path.join(SRC, 'ui.js'), 'utf-8');
const appSrc = fs.readFileSync(path.join(SRC, 'app.js'), 'utf-8');
// Read all UI files (ui-core.js + ui-settings.js + ui-admin.js replace old ui.js)
const uiSrc = ['ui-core.js', 'ui-settings.js', 'ui-admin.js', 'ui-format.js']
.map(f => fs.readFileSync(path.join(SRC, f), 'utf-8')).join('\n');
// Read all app-side files (app.js + extracted handler files replace old monolith app.js)
const appSrc = ['app.js', 'settings-handlers.js', 'admin-handlers.js', 'chat.js', 'tokens.js', 'notes.js']
.map(f => fs.readFileSync(path.join(SRC, f), 'utf-8')).join('\n');
const indexSrc = fs.readFileSync(path.join(SRC, '..', 'index.html'), 'utf-8');
// ── allow_user_byok ──
it('ui.js has checkUserProvidersAllowed function', () => {
it('UI has checkUserProvidersAllowed function', () => {
assert.ok(uiSrc.includes('checkUserProvidersAllowed'),
'MISSING: checkUserProvidersAllowed — provider tab will show when policy is off');
});
@@ -40,7 +44,7 @@ describe('Policy wiring audit — source code', () => {
// ── allow_user_personas ──
it('ui.js has checkUserPresetsAllowed function', () => {
it('UI has checkUserPresetsAllowed function', () => {
assert.ok(uiSrc.includes('checkUserPresetsAllowed'),
'MISSING: checkUserPresetsAllowed — preset button will show when policy is off');
});
@@ -206,7 +210,9 @@ describe('Admin settings field mapping', () => {
'adminBannerEnabled': 'banner',
};
const appSrc = fs.readFileSync(path.join(SRC, 'app.js'), 'utf-8');
// Read all app-side files (handleSaveAdminSettings is in settings-handlers.js)
const appSrc = ['app.js', 'settings-handlers.js', 'admin-handlers.js']
.map(f => fs.readFileSync(path.join(SRC, f), 'utf-8')).join('\n');
const indexSrc = fs.readFileSync(path.join(SRC, '..', 'index.html'), 'utf-8');
for (const [elementId, settingKey] of Object.entries(settingsFieldMap)) {
@@ -215,7 +221,7 @@ describe('Admin settings field mapping', () => {
`MISSING: #${elementId} in index.html — admin settings incomplete`);
});
it(`app.js writes setting "${settingKey}"`, () => {
it(`frontend writes setting "${settingKey}"`, () => {
assert.ok(appSrc.includes(settingKey),
`MISSING: "${settingKey}" in handleSaveAdminSettings`);
});