proposal-llm-hosted-prefs.test.mjs
52 lines 2.2 KB
Raw
sha256:87f84653ce4706be8c65b0c4494ed6fb891213cca82db2b1824772cddc41a752 feat(auth): durable MCP OAuth refresh via shared strong sto… Agent minor 57 days ago
1 import test from 'node:test';
2 import assert from 'node:assert/strict';
3 import {
4 effectiveHostedReviewHints,
5 effectiveHostedEnrich,
6 } from '../hub/gateway/proposal-llm-store.mjs';
7
8 /**
9 * Settings → Backup "Save proposal policy" persists review_hints_enabled / enrich_enabled
10 * in Netlify Blob; effective*() reads that object. These tests cover env override vs stored prefs
11 * (not emptyPrefs() — that only supplies defaults when no blob/local file exists yet).
12 */
13 test('effectiveHostedReviewHints / Enrich: use stored true when env unset', async (t) => {
14 const prevH = process.env.KNOWTATION_HUB_PROPOSAL_REVIEW_HINTS;
15 const prevE = process.env.KNOWTATION_HUB_PROPOSAL_ENRICH;
16 t.after(() => {
17 if (prevH === undefined) delete process.env.KNOWTATION_HUB_PROPOSAL_REVIEW_HINTS;
18 else process.env.KNOWTATION_HUB_PROPOSAL_REVIEW_HINTS = prevH;
19 if (prevE === undefined) delete process.env.KNOWTATION_HUB_PROPOSAL_ENRICH;
20 else process.env.KNOWTATION_HUB_PROPOSAL_ENRICH = prevE;
21 });
22 delete process.env.KNOWTATION_HUB_PROPOSAL_REVIEW_HINTS;
23 delete process.env.KNOWTATION_HUB_PROPOSAL_ENRICH;
24
25 const storedOn = {
26 proposal_evaluation_required: true,
27 review_hints_enabled: true,
28 enrich_enabled: true,
29 };
30 assert.equal(effectiveHostedReviewHints(storedOn), true);
31 assert.equal(effectiveHostedEnrich(storedOn), true);
32 });
33
34 test('explicit env 0 disables even when stored prefs are true', async (t) => {
35 const prevH = process.env.KNOWTATION_HUB_PROPOSAL_REVIEW_HINTS;
36 const prevE = process.env.KNOWTATION_HUB_PROPOSAL_ENRICH;
37 t.after(() => {
38 if (prevH === undefined) delete process.env.KNOWTATION_HUB_PROPOSAL_REVIEW_HINTS;
39 else process.env.KNOWTATION_HUB_PROPOSAL_REVIEW_HINTS = prevH;
40 if (prevE === undefined) delete process.env.KNOWTATION_HUB_PROPOSAL_ENRICH;
41 else process.env.KNOWTATION_HUB_PROPOSAL_ENRICH = prevE;
42 });
43 process.env.KNOWTATION_HUB_PROPOSAL_REVIEW_HINTS = '0';
44 process.env.KNOWTATION_HUB_PROPOSAL_ENRICH = '0';
45 const onPrefs = {
46 proposal_evaluation_required: false,
47 review_hints_enabled: true,
48 enrich_enabled: true,
49 };
50 assert.equal(effectiveHostedReviewHints(onPrefs), false);
51 assert.equal(effectiveHostedEnrich(onPrefs), false);
52 });
File History 5 commits
sha256:87f84653ce4706be8c65b0c4494ed6fb891213cca82db2b1824772cddc41a752 feat(auth): durable MCP OAuth refresh via shared strong sto… Agent minor 57 days ago
sha256:873e30b7fafe601346295f8f4289f388f21d8f715f28584d5481899ba2b714fc Merge pull request #249 from aaronrene/muse-mirror Agent 74 days ago
sha256:d8c648b20a4d53b2673c5c082ee7edfa7b2fc9b11080832da1f38807b6bf940b fix(7C-L1b): route hosted delegation proposals through cani… Human minor 77 days ago
sha256:2827ba9e7632a4b141c50caf1e8f7d77abbc3515be20e7465f2bccb0ac4edf91 fix: repair endpoint now sets has_active_subscription when … Human minor 97 days ago