test: bus events + dbt profiles parser — registry payloads and env_var defaults#483
test: bus events + dbt profiles parser — registry payloads and env_var defaults#483anandgupta42 wants to merge 1 commit intomainfrom
Conversation
…r defaults Add 8 new tests covering two previously untested areas: - BusEvent.define/payloads: validates event registry, discriminated union generation, and duplicate-type overwrite behavior (5 tests) - dbt profiles parser: env_var default fallback, config key skip, and multi-profile naming convention (3 tests) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> https://claude.ai/code/session_01XZqioFNF2eYPkr9X6USeth
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review.
Tip: disable this comment in your organization's Code Review settings.
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What does this PR do?
Adds 8 new tests covering two previously untested areas discovered during proactive test discovery.
1.
BusEvent.define+BusEvent.payloads—src/bus/bus-event.ts(5 new tests)This module is the core pub/sub event registry used by 20+ modules across the codebase (sessions, files, permissions, VCS, questions, LSP, server).
BusEvent.define()registers event types in a global registry, andBusEvent.payloads()builds a Zod discriminated union used in the server's SSE/HTTP API schema. Zero tests existed. New coverage includes:define()contract: returns{ type, properties }shape correctlypayloads()discriminated unionpayloads()rejects events with unregistered typespayloads()rejects events with wrong property shapesdefine()call wins when same type is registered twice (documents Map.set behavior)Tests use
__test_prefixed type strings to avoid colliding with production events in the shared registry.2.
parseDbtProfiles—src/altimate/native/connections/dbt-profiles.ts(3 new tests)The dbt profiles parser converts
~/.dbt/profiles.ymlinto warehouse connections. Existing tests covered basic parsing, env_var resolution, and adapter mapping, but missed three real-world edge cases:env_vardefault fallback: dbt users commonly write{{ env_var('DB_HOST', 'localhost') }}with a default value. The regex at line 58 captures the optional second argument, but this path was never tested. If the capture group broke, users would silently get empty strings instead of their configured defaults.configkey skip: Real dbtprofiles.ymlfiles include a top-levelconfig:key for global settings (e.g.,send_anonymous_usage_stats: false). The parser has a guard on line 148 to skip it, but this was untested. Without it,configcould be parsed as a phantom connection.${profileName}_${outputName}naming convention with >1 profile, ensuring downstream code that depends on connection identity works correctly.Type of change
Issue for this PR
N/A — proactive test coverage
How did you verify your code works?
Marker check passes:
bun run script/upstream/analyze.ts --markers --base main --strictChecklist
https://claude.ai/code/session_01XZqioFNF2eYPkr9X6USeth