feat: NLDS mandatory-quiz-completion export#608
Draft
nicholasjjlim wants to merge 8 commits into
Draft
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…oping Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
🚀 Summary
Adds a daily batch export that ships two curated datasets from the Onward DB to the NLDS-owned S3 data lake as NDJSON with mandatory SSE-KMS, so NLDS can track mandatory quiz completion (which users have / have not completed the mandatory modules). Invoked by the scheduled ECS task via
pnpm run export:nlds; runs to completion and exits0on full success, non-zero on any failure.Design docs land as the first commit:
docs/decisions/0006-package-nlds-export-as-bundled-script-in-app-image.mddocs/superpowers/specs/2026-07-01-nlds-export-design.mddocs/superpowers/plans/2026-07-01-nlds-export.md✏️ Changes
scripts/export-nlds.ts— standalone export script: env-config loader (fail-loud on any missing var), two datasets (users;mandatory_quiz_outcomes= journeys whereLearningUnit.is_required = true), NDJSON serializer, SSE-KMS S3 uploader, and a sequential orchestrator with an entry guard. Read-onlyselect-only queries, explicit columns (noSELECT *), keys scoped underNLDS_PREFIX.build/export-nlds.js(generated Prisma client inlined; AWS SDK / Prisma runtime /pgkept external). Addsesbuildas a devDependency (build-stage only), two npm scripts (export:nlds,export:nlds:bundle), and oneRUN pnpm export:nlds:bundlestep in theDockerfile(afterpnpm build, before the prod prune). No new runtime dependencies; no newCOPY.pnpm checkclean.Datasets
${NLDS_PREFIX}users/<UTC-date>.ndjsonid,name,email(PII — scoped to exactly these),created_at${NLDS_PREFIX}mandatory_quiz_outcomes/<UTC-date>.ndjsonuser_id,learning_unit_id,learning_unit_title,due_date,is_completed,is_quiz_attempted,is_quiz_passed,number_of_attempts,updated_atFull daily snapshot (overwrites the day's key; idempotent).
These couldn't run in the dev sandbox (no Docker network, no dev DB/KMS) — please run in CI/staging before merging:
docker buildof the image, then in-containernode build/export-nlds.jsto confirm the three externals resolve in the pruned--prodimage..ndjsonobjects + exit0; force a missingNLDS_KMS_KEY_ID→ expect non-zero.The bundle load was smoke-tested locally (loads cleanly, exits non-zero on missing env), but only a real container + KMS-scoped
PutObjectconfirms the operational path.🤖 Generated with Claude Code