local-auth-feature-flag.mjs
sha256:b5f647cb9c409f563d4671fe3fc05ddea01fabfed9b41fc11cb923588e1c1baf
mirror: GitHub Phase A durable MCP OAuth (#270)
Human
minor
⚠ breaking
11 days ago
| 1 | /** |
| 2 | * Phase 8 P1b-b — compile-time feature flag for offline-locked auth code paths. |
| 3 | * Double-lock with KNOWTATION_OFFLINE_LOCKED_AUTH env gate (§11). |
| 4 | * Remains `false` until a separate Tier 3 authorization flips it after tests green. |
| 5 | */ |
| 6 | |
| 7 | /** @type {boolean} Flipped true in P1b-c after seven-tier tests green (Tier 3). */ |
| 8 | export const OFFLINE_LOCKED_AUTH_CODE_SHIPPED = true; |
| 9 | |
| 10 | /** |
| 11 | * Whether offline-locked auth is fully active (env gate + compile-time flag). |
| 12 | * Tests may set KNOWTATION_OFFLINE_LOCKED_AUTH_TEST_SHIPPED=1 to exercise gate-on paths |
| 13 | * without changing the shipped constant. |
| 14 | * @param {boolean} envGateEnabled - cached boot-time env gate boolean |
| 15 | * @returns {boolean} |
| 16 | */ |
| 17 | export function isOfflineLockedAuthActive(envGateEnabled) { |
| 18 | if (!envGateEnabled) return false; |
| 19 | if (OFFLINE_LOCKED_AUTH_CODE_SHIPPED) return true; |
| 20 | if ( |
| 21 | process.env.NODE_ENV === 'test' && |
| 22 | process.env.KNOWTATION_OFFLINE_LOCKED_AUTH_TEST_SHIPPED === '1' |
| 23 | ) { |
| 24 | return true; |
| 25 | } |
| 26 | return false; |
| 27 | } |
File History
1 commit
sha256:b5f647cb9c409f563d4671fe3fc05ddea01fabfed9b41fc11cb923588e1c1baf
mirror: GitHub Phase A durable MCP OAuth (#270)
Human
minor
⚠
11 days ago