test(config,core): cover env loading, validation, and core helpers#88
Merged
Conversation
… helpers The original session-start audit flagged @skytwin/config and the top-level helpers in @skytwin/core as having zero test coverage. Both are dependency roots — config gates bootstrap, core hosts comparison helpers used across decision/policy/risk paths. Silent regressions here cascade everywhere. Adds: - packages/config/src/__tests__/config.test.ts (18 tests) loadConfig defaults, env reads, fallback parsing, GATEWAY_AUTH_TOKEN legacy alias, IRONCLAW_CHANNEL legacy alias. validate() field-by-field rejection (empty/invalid databaseUrl, malformed URL, missing webhook secret, port range, NaN). loadValidatedConfig success + aggregated error message. - packages/core/src/__tests__/index.test.ts (20 tests) generateId UUID shape + uniqueness. compareRiskTiers eq/gt/lt/unknown. riskExceeds strict-greater behavior. trustMeetsOrExceeds gte semantics + unknown handling. Tier ordering tables. createLogger level routing, format (level + namespace + message + ISO timestamp), meta JSON serialization. Net new tests: 38. core: 30 → 50 (+20). config: 0 → 18. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds unit test coverage for two dependency-root packages (@skytwin/config and @skytwin/core) to prevent silent regressions in environment-driven bootstrapping and shared core helpers used broadly across the system.
Changes:
- Adds
@skytwin/coretests covering ID generation, tier comparison helpers/order tables, and console logger formatting/routing. - Adds
@skytwin/configtests covering env loading defaults/overrides, legacy env aliases, validation errors, and aggregated validation failures.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/core/src/tests/index.test.ts | New tests for generateId, tier helpers/order maps, and createLogger output/level routing. |
| packages/config/src/tests/config.test.ts | New tests for loadConfig, validate, and loadValidatedConfig including alias handling and aggregated error messaging. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2 tasks
jayzalowitz
added a commit
that referenced
this pull request
Apr 27, 2026
Captures the second half of the audit cleanup work that landed after #87: - #88 config/core test coverage (was 0/missing helpers) - #89 connectors gmail + calendar pure-logic tests (8 → 43) - #90 llm-client URL validation hardening (zone IDs, trailing dots, CGNAT) - #91 adapter-discovery factory shape check + manifest defaultConfig - #92 preference-archaeologist coverage (action keys, multi-group, expiry) - #93 worker SignalDeduper extraction + 11 tests Pure docs. Co-authored-by: Claude Opus 4.7 <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
The session-start audit flagged `@skytwin/config` and the top-level helpers in `@skytwin/core` as having zero test coverage. Both are dependency roots — config gates bootstrap, core hosts comparison helpers used across decision/policy/risk paths. Silent regressions here cascade everywhere.
`@skytwin/config` — 0 → 18 tests
`@skytwin/core` — 30 → 50 tests (+20)
Test plan
🤖 Generated with Claude Code