Repository navigation
feat(demo): serve Demo Insight in production for the demo organization only (M4-S2) - #17
Merged
Merged
Conversation
…n only (M4-S2) ADR-048 records the Learner Lab seed guard and the production Demo Insight allowlist. The reader now runs in the production runtime only when the configured organization id is the deterministic demo organization; unset means off everywhere.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Planner decision (2026-11-17): ADR-048 + Demo Insight in the production runtime for the demo organization only.
docs/decisions/0048-...md(accepted, owner decision 2026-11-17): amends ADR-042 for (a) the Learner Lab seed guard (verifyLearnerLabSeedTarget,STOCKWISE_DEMO_SEED_TARGET=learner-lab-ops, empty-or-demo-only DB,stockwise_demoschema pre-created byroles.sql) and (b) Demo Insight in production.demo-insight.ts: the dev/test-only gate is replaced by: in production the reader serves only when the configuredSTOCKWISE_DEMO_INSIGHT_ORGANIZATION_IDequals the deterministic demo org (DEMO_INSIGHT_PRODUCTION_ORGANIZATION_ID). Unset = off everywhere. Labelข้อมูลตัวอย่าง, no provider call, ordinary authorization first.environment.ts: removed the "disabled in production" validation (UUID format still validated); test updated.demo-insight-production.integration.test.ts): on for the allowlisted org in production (th/en labels, 0 provider calls); off when unset; off for another org (variable names another org, or request targets another org); env accepts/omits the variable.Deterministic demo organization UUID (for Worker C)
ce295c46-a4a1-5930-ba4f-75739461072d(demoId("organization","UAT Demo Siam Mart"); equals the organization created bydemo:seed:90d). SetSTOCKWISE_DEMO_INSIGHT_ORGANIZATION_IDto it in the API task. Noinfra/file is touched here.Caveats (infra follow-ups, not in this PR)
stockwise_demo.seed_runs;stockwise_appcurrently has no access to that schema (roles.sql grants it nothing). Without e.g.GRANT USAGE ON SCHEMA stockwise_demo+SELECTonseed_runs(default privileges for the migrator), production Demo Insight returns 404. Worker C owns roles.sql.Verification
pnpm verify: 201 test files passed, 1 skipped; 2274 tests passed, 2 skipped.