Skip to content

refactor: centralize non-sensitive config into per-app modules#714

Merged
Aliiiu merged 4 commits into
mainfrom
feat/centralize-nonsensitive-config
Jun 26, 2026
Merged

refactor: centralize non-sensitive config into per-app modules#714
Aliiiu merged 4 commits into
mainfrom
feat/centralize-nonsensitive-config

Conversation

@Aliiiu

@Aliiiu Aliiiu commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Closes #715

Summary

Centralizes scattered non-sensitive config into one source-of-truth module per app, with zero behavior change. Each module reads from process.env only where the env var is a documented user knob; otherwise it holds a plain constant.

  • docs — new apps/docs/config/posthog.mjs (plain ESM, so both the client init and next.config.mjs can import it). instrumentation-client.ts and the /ingest rewrites now both build from it, so the proxy path and hosts are defined once. Rendered rewrites verified byte-identical.
  • shade-agentNEXT_PUBLIC_contractId added to the existing Zod env.ts as z.string().optional() and read via env in both routes. Optional (not required) deliberately preserves today's graceful runtime handling instead of failing at boot; route guards retained.
  • examples — new apps/examples/src/config.ts exporting DEFAULT_MODEL / DEFAULT_MODEL_STABLE, replacing 13 inline process.env.LLM_MODEL || "<literal>" fallbacks. Both defaults preserved; || kept (not ??) so an empty LLM_MODEL= still falls back.

Sensitive keys/tokens are intentionally untouched — they are secrets, not config constants.

Test Plan

  • docs: rendered /ingest rewrites byte-identical to before (sources + destinations)
  • docs: instrumentation-client.ts type-checks (defaults kept as the posthog-js ConfigDefaults literal type)
  • shade-agent: tsc --noEmit clean; contract-id reads route through validated env
  • examples: 9 files → DEFAULT_MODEL, 4 → DEFAULT_MODEL_STABLE; all 13 imports resolve; no inline model literals remain
  • biome check clean on all edited files
  • core @iqai/adk suite unaffected (554/554 pass)

Out of scope (noted, not changed)

  • Model names in JSDoc/comments left as-is (illustrative prose).
  • apps/docs/app/robots.ts /ingest/ literal and shade-agent/src/index.ts PORT default not centralized (not part of this change's surface).

Aliiiu added 3 commits June 25, 2026 16:16
Single source of truth for hosts + proxy path, consumed by the client
init and the next.config rewrites (sources and destinations). No
behavior change: rendered /ingest rewrites are byte-identical.
Add NEXT_PUBLIC_contractId as an optional field on the existing Zod env
schema and route both reads through it. Optional (not required) so a
missing value stays a graceful runtime 500, not a fail-at-boot throw.
Replace 13 inline LLM_MODEL fallback literals with DEFAULT_MODEL /
DEFAULT_MODEL_STABLE. Keeps || so an empty LLM_MODEL still falls back;
both defaults preserved, no example changes behavior.
@changeset-bot

changeset-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5876362

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel

vercel Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
adk-typescript-docs Ready Ready Preview Jun 25, 2026 4:12pm
adk-web Ready Ready Preview Jun 25, 2026 4:12pm

Request Review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request centralizes configuration settings across multiple applications, specifically introducing a shared PostHog configuration in the docs app and default LLM model constants in the examples app. Additionally, it integrates the optional NEXT_PUBLIC_contractId environment variable into the validated env schema for the shade-agent starter template. The feedback highlights a potential runtime issue in ethAccount.ts where the optional contractId is used without a safety check, recommending a guard clause similar to the one implemented in transaction.ts.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread apps/starter-templates/shade-agent/src/routes/ethAccount.ts
Match transaction.ts: return a 500 'Contract ID not configured' when
NEXT_PUBLIC_contractId is unset, instead of relying on the downstream
try/catch. Addresses PR review feedback.

@Adebesin-Cell Adebesin-Cell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LG

@Aliiiu Aliiiu added enhancement New feature or request ADK-TS Issues relating to the ADK framework labels Jun 26, 2026
@Aliiiu
Aliiiu merged commit f93632d into main Jun 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ADK-TS Issues relating to the ADK framework enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Centralize non-sensitive config into per-app modules

2 participants