Skip to content

feat(phase-8): envFile config loading + smoke-tests moved into prescient-sdk-ts#51

Open
ms280690 wants to merge 2 commits into
jsii-migrationfrom
phase-8-integration-tests
Open

feat(phase-8): envFile config loading + smoke-tests moved into prescient-sdk-ts#51
ms280690 wants to merge 2 commits into
jsii-migrationfrom
phase-8-integration-tests

Conversation

@ms280690

Copy link
Copy Markdown

Summary

  • Adds envFile?: string to PrescientClientOptions so all 5 jsii language targets can load a config.env file — file is read in the shared Node.js runtime, no per-language dotenv library needed
  • Priority chain: explicit opts > process.env > envFile values > built-in defaults
  • PRESCIENT_GOOGLE_CLIENT_SECRET from file flows to _googleClientSecret only — never surfaces in any public struct
  • Makes endpointUrl/clientId/authUrl optional in the interface (required values still enforced at runtime in Settings.validate)
  • Moves smoke-tests/ into prescient-sdk-ts/smoke-tests/; all 5 smoke tests now use envFile instead of inline options

Changes

SDK (prescient-sdk-ts/src/)

  • types.ts: add envFile field; relax required fields to optional
  • settings.ts: parseEnvFile() pure-TS KEY=VALUE parser; constructor overlays file values at lowest priority; resolveAuthProvider/resolvePort accept fromFile fallback
  • __tests__/settings.test.ts: 16 new tests — load, override order, Google secret from file, quoted values, comments, missing file error (80 total, all passing)

Docs

  • README.md: configuration section with file/env/explicit examples for all 5 languages
  • JSII_MIGRATION_PLAN.md: Phase 7 marked done with real impl details; Phase 8 added; directory structure updated

Smoke tests (moved + updated)

  • smoke-tests/prescient-sdk-ts/smoke-tests/
  • justfile: compose path updated
  • docker-compose.yml: host-side volume paths updated (../prescient-sdk-ts/X../X); config.env mounted into all 5 containers
  • smoke-tests/config.env: fake-value config file tracked via .gitignore negation
  • All 5 language smoke tests use envFile path; Python import fixed (prescient_sdk flat kwargs API)

Test plan

  • pnpm test — 80 tests, all passing
  • pnpm run build — jsii compiles clean, no errors
  • pnpm run package — all 5 language targets generated
  • just docker — all 5 language smoke tests pass

🤖 Generated with Claude Code

…nt-sdk-ts

envFile support (all 5 jsii language targets):
- src/types.ts: add envFile?: string to PrescientClientOptions; relax
  endpointUrl/clientId/authUrl to optional (runtime validation unchanged)
- src/settings.ts: parseEnvFile() pure-TS KEY=VALUE parser; constructor
  overlays fileEnv at lowest priority (opts > process.env > file > defaults);
  resolveAuthProvider/resolvePort accept fromFile fallback;
  PRESCIENT_GOOGLE_CLIENT_SECRET from file → _googleClientSecret only
- src/__tests__/settings.test.ts: 16 new tests (load, override order,
  Google secret from file, quoted values, comments, missing file error)
- README.md: configuration section with examples for all 5 languages
- JSII_MIGRATION_PLAN.md: Phase 7 marked done; Phase 8 added

Smoke test relocation (smoke-tests/ → prescient-sdk-ts/smoke-tests/):
- justfile: compose path updated (/../smoke-tests → /smoke-tests)
- docker-compose.yml: host-side volume paths updated (../prescient-sdk-ts/X → ../X)
- .gitignore: dotnet build artifact paths updated automatically by git mv
- smoke-tests/config.env: fake-value config tracked via .gitignore negation
- All 5 containers mount config.env; smoke tests use envFile instead of inline opts
- smoke-tests/python/smoke.py: fix import (prescient_sdk); use flat kwarg API

All 5 language smoke tests confirmed passing from new location.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a cross-language envFile configuration option to the jsii SDK so consumers in all five target languages can load a config.env file through the shared TypeScript runtime (no per-language dotenv dependency). Relocates the multi-language Docker smoke tests under prescient-sdk-ts/smoke-tests/ and rewrites each one to use the new envFile option.

Changes:

  • Add envFile?: string to PrescientClientOptions, relax endpointUrl/clientId/authUrl to optional at the type level, and implement a pure-TS parseEnvFile() overlay in Settings at the lowest priority (explicit opts > process.env > file > defaults). Google client secret continues to be sourced only from env/file, never from public options.
  • Move smoke-tests/ into prescient-sdk-ts/smoke-tests/, mount config.env into all five containers, rewrite each language smoke test to use envFile, and update justfile/docker-compose.yml/.gitignore paths accordingly.
  • Add 16 new Jest tests for envFile behavior and refresh README.md / JSII_MIGRATION_PLAN.md (Phase 7 marked done, Phase 8 described).

Reviewed changes

Copilot reviewed 15 out of 25 changed files in this pull request and generated no comments.

Show a summary per file
File Description
prescient-sdk-ts/src/types.ts Make required URL/client fields optional and add documented envFile field.
prescient-sdk-ts/src/settings.ts Add file parser, overlay file values at lowest priority, extend resolveAuthProvider/resolvePort with fromFile.
prescient-sdk-ts/src/tests/settings.test.ts 16 new tests covering load, precedence, secrets, comments, quotes, missing file, port.
prescient-sdk-ts/smoke-tests/{js,python,go,dotnet,java}/* Rewrite each smoke test to use envFile, plus build files for each language.
prescient-sdk-ts/smoke-tests/docker-compose.yml Update host-side paths after move; mount config.env into each service.
prescient-sdk-ts/smoke-tests/docker/Dockerfile.* Copy Node binary into each non-JS language image.
prescient-sdk-ts/smoke-tests/config.env, .gitignore Tracked fake-value config and gitignore negation.
prescient-sdk-ts/justfile Point compose at the new in-tree location.
prescient-sdk-ts/README.md, JSII_MIGRATION_PLAN.md Document config flow, Phase 7 done, Phase 8 added.
.gitignore Re-anchor smoke-test build artefact ignore paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: ms280690 <mehul@sparkgeo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants