proposal-llm-hosted-prefs.test.mjs
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd
feat(calendar): enforce agent context tiers in retrieval AP…
Human
minor
⚠ breaking
1 day 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
2 commits
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd
feat(calendar): enforce agent context tiers in retrieval AP…
Human
minor
⚠
1 day ago
sha256:9103f98c89257ed2b01c237cea895dabb3e85ea337dccb1161c175e4422355b6
docs: accept Calendar Events v0 spec with Phase 0 security …
Human
1 day ago