Skip to content

[#186] fix: wire --config through dispatch path for update and install#192

Merged
rucka merged 3 commits intomainfrom
feature/#186-update-config-forwarding
Apr 11, 2026
Merged

[#186] fix: wire --config through dispatch path for update and install#192
rucka merged 3 commits intomainfrom
feature/#186-update-config-forwarding

Conversation

@rucka
Copy link
Copy Markdown
Collaborator

@rucka rucka commented Apr 11, 2026

PR Information

PR Title: [#186] fix: wire --config through dispatch path for update and install
Story/Epic: #186
Type: Bug Fix
Priority: P0
Labels: bug

Summary

What Changed

Wired the -c/--config CLI option through the dispatch path so it reaches handleUpdateCommand and handleInstallCommand. The handlers already supported options.config but the dispatcher silently dropped it.

Why This Change

pair update -c ./pair.config.json ignored the custom config — registries always resolved from the packaged base config. The same bug affected pair install. Users could not override registry behavior (e.g. skills.flatten=false) per-project.

Story Context

User Story: As a CLI user running pair update in a consumer repo, I want pair update to honor -c/--config <path> and auto-load project pair.config.json so that I can override registry behavior per-project.

Acceptance Criteria:

  • AC-1: project config auto-load
  • AC-2: explicit -c flag
  • AC-3: custom config registry targets
  • AC-4: backward compat (no config = base config)
  • AC-5: missing config file error

Changes Made

Implementation Details

  • DispatchContext interface: added config?: string
  • resolveOptions: spread config to handler options
  • cli.ts registerCommandFromMetadata: extract normalizedOptions['config'] and pass to dispatch context
  • ParseUpdateOptions: added config?: string for interface completeness
  • ParseInstallOptions: added config?: string for interface completeness

Files Changed

  • Modified: apps/pair-cli/src/commands/dispatcher.ts — DispatchContext + resolveOptions
  • Modified: apps/pair-cli/src/cli.ts — config passthrough in registerCommandFromMetadata
  • Modified: apps/pair-cli/src/commands/update/parser.ts — ParseUpdateOptions
  • Modified: apps/pair-cli/src/commands/install/parser.ts — ParseInstallOptions
  • Modified: apps/pair-cli/src/commands/dispatcher.test.ts — config forwarding tests (update + install)
  • Modified: apps/pair-cli/src/commands/update/handler.test.ts — config override tests
  • Modified: apps/pair-cli/src/commands/install/handler.test.ts — config override tests

Testing

Test Coverage

  • Unit Tests: Dispatcher config forwarding (update + install), handler custom config, backward compat, missing config error
  • Integration Tests: End-to-end dispatcher → handler with custom registry target verification

Test Results

Test Suite: ✅ 65 files passed
Tests: ✅ 742 passed
Quality Gate: ✅ All gates passing (ts:check, test, lint, prettier)
Config Parity: ✅ update handler matches install handler exactly

Testing Strategy

  • Happy Path: custom config overrides registry targets; output lands at custom target
  • Edge Cases: missing config file produces clear error; empty config = base config
  • Error Handling: loadConfigWithOverrides error propagation verified
  • Regression: all 742 existing tests pass unchanged

Quality Assurance

Code Quality Checklist

  • Code follows established style guides and conventions
  • Error handling implemented for edge cases
  • Security best practices followed (config path is user-provided; loadConfigWithOverrides already validates)
  • No debugging code or console logs left behind

Deployment Information

Deployment Notes

  • Configuration Changes: None
  • Dependencies: None — no new packages
  • Feature Flags: None needed
  • Rollback Plan: Revert PR

Risk Assessment

Technical Risks

Risk Impact Probability Mitigation
Breaking existing update/install tests Medium Low Full test suite passes (742 tests)
Config merge order surprise Low Low Same loadConfigWithOverrides semantics as install/package

Reviewer Guide

Review Focus Areas

  1. Dispatch path: dispatcher.ts — verify config is spread correctly in resolveOptions
  2. CLI entry point: cli.ts — verify normalizedOptions['config'] extraction and forwarding
  3. Test coverage: dispatcher + handler tests cover both update and install commands

Testing the Changes

git checkout feature/#186-update-config-forwarding
pnpm install
pnpm --filter pair-cli test
pnpm quality-gate

Closes #186

rucka added 3 commits April 11, 2026 19:34
- dispatcher.test.ts: test.fails for update + install config forwarding
- update/handler.test.ts: custom config, backward compat, missing config
- install/handler.test.ts: custom config, backward compat, missing config

Refs: #186
- DispatchContext: add config?: string
- resolveOptions: spread config to handler options
- cli.ts: pass normalizedOptions.config to dispatch context
- dispatcher tests: test.fails → test (bug fixed)

Refs: #186
- update/parser.ts: add config?: string to ParseUpdateOptions
- install/parser.ts: add config?: string to ParseInstallOptions

Refs: #186
@rucka rucka marked this pull request as ready for review April 11, 2026 17:48
Copy link
Copy Markdown
Collaborator Author

@rucka rucka left a comment

Choose a reason for hiding this comment

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

Code Review: [#192] fix: wire --config through dispatch path for update and install

Review Information

PR Number: #192
Author: rucka
Reviewer: AI (pair-process-review)
Review Date: 2026-04-11
Story: #186 — Bug: pair update ignores --config
Review Type: Bug Fix

Review Summary

Overall Assessment

  • Approved — Ready to merge

Key Changes Summary

Wires the -c/--config CLI option through the dispatch path (DispatchContextresolveOptions → handler options) so it reaches handleUpdateCommand and handleInstallCommand. The handlers already supported options.config but the dispatcher silently dropped it.

Business Value Validation

Users can now override registry behavior per-project via pair update -c ./pair.config.json. Config resolution matches pair install and pair package exactly.

Code Review Checklist

Functionality Review

  • Requirements Met — All 5 AC implemented and tested
  • Business Logic — Config forwarding follows same conditional-spread pattern as existing fields
  • Integration — Handlers already had loadConfigWithOverrides wiring; dispatch path was the only gap
  • Error Handling — Missing config file error propagates from loadConfigWithOverrides (no new error handling needed)
  • Performance — No impact; one additional field spread

Code Quality Assessment

  • Readability — Changes are minimal and self-documenting
  • Maintainability — Follows exact same pattern as httpClient, cliVersion, baseTarget in resolveOptions
  • NamingconfigPath in cli.ts, config in DispatchContext — clear and consistent
  • Complexity — Trivial; 4 one-line additions in production code

Technical Standards Compliance

  • Style Guide — Matches existing conditional-spread pattern
  • Architecture — No architectural changes
  • Dependencies — No new dependencies

Testing Review

Test Coverage Assessment

  • Dispatcher tests — Config forwarding for both update and install commands
  • Handler tests (update) — Custom config override, base config fallback, missing config error
  • Handler tests (install) — Custom config override, base config fallback, missing config error
  • Integration — End-to-end dispatcher → handler with custom registry target verification
  • Backward compat — No-config path unchanged; all 742 existing tests pass

Test Quality

  • Tests are well-structured with clear #186 annotations
  • Each test verifies observable behavior (file at custom target path) not implementation details
  • Error case uses .rejects.toThrow(/Failed to load custom config/) — appropriate regex match

Security Review

  • Config path is user-provided CLI input; loadConfigWithOverrides already validates
  • No new attack surface

Risk Assessment

Risk Impact Probability Mitigation
Breaking existing tests Medium None 742 tests pass unchanged
Config merge order surprise Low Low Same loadConfigWithOverrides semantics as install/package

Positive Feedback

  • Test-first approach: Failing tests created before fix (T-2 → T-1 → T-3 → T-4) — follows bug-fix workflow correctly
  • Minimal change: 4 production lines changed, comprehensive test coverage
  • Parity: Update and install config paths are now symmetrical
  • PR description: Excellent — clear story context, AC mapping, and reviewer guide

Issues

Critical: 0 | Major: 0 | Minor: 0


REVIEW COMPLETE:
├── PR:         #192: [#186] fix: wire --config through dispatch path
├── Story:      #186: Bug: pair update ignores --config
├── Decision:   APPROVED
├── Issues:     critical: 0 | major: 0 | minor: 0
├── Quality:    PASS — all gates
├── DoD:        5/5 AC met
├── Adoption:   Level 4 — no concerns
├── Debt:       0 items flagged
└── Report:     Posted as PR comment

Note: PR is currently marked as draft. Mark as ready for review before merging.

@rucka rucka merged commit ccd437f into main Apr 11, 2026
1 check passed
@rucka rucka deleted the feature/#186-update-config-forwarding branch April 11, 2026 17:50
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.

Bug: pair update ignores --config (always uses base config, can’t disable skills flatten)

1 participant