Skip to content

Conversation

@galligan
Copy link
Contributor

@galligan galligan commented Jan 23, 2026

Summary

  • Refactor error types to avoid TaggedError extends warnings.
  • Align error typing across config, contracts, daemon, and MCP.

Changes

  • packages/contracts/src/errors.ts
  • packages/config/src/index.ts
  • packages/daemon/src/errors.ts
  • packages/daemon/src/types.ts
  • packages/mcp/src/types.ts

Testing

  • Not run (not requested).

Copy link
Contributor Author

galligan commented Jan 23, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@greptile-apps
Copy link

greptile-apps bot commented Jan 23, 2026

Greptile Summary

  • Refactors error type definitions across 5 packages to resolve TypeScript TS9021 warnings when extending TaggedError factory functions directly
  • Introduces intermediate base class pattern using TaggedErrorClass typing to maintain identical runtime behavior while eliminating compiler warnings
  • Adds type-only export for TaggedErrorClass in packages/contracts/src/index.ts to centralize error typing utilities for other packages

Important Files Changed

Filename Overview
packages/contracts/src/errors.ts Refactored 3 error classes (ValidationError, AssertionError, NotFoundError) to use intermediate base classes instead of extending TaggedError expressions directly
packages/daemon/src/errors.ts Refactored 5 daemon-specific error classes to use base class pattern, avoiding TypeScript warnings while preserving API

Confidence score: 5/5

  • This PR is extremely safe to merge with virtually no risk of production issues
  • Score reflects a purely structural TypeScript refactoring that maintains identical runtime behavior and API compatibility while fixing compiler warnings
  • No files require special attention as all changes follow the same safe pattern of extracting TaggedError factory calls into typed base classes

Sequence Diagram

sequenceDiagram
    participant User
    participant Config as "@outfitter/config"
    participant FileSystem as "File System"
    participant Parser as "Config Parser"
    participant Validator as "Schema Validator"
    
    User->>+Config: "loadConfig(appName, schema)"
    Config->>+FileSystem: "Search XDG config paths"
    FileSystem-->>-Config: "Return first matching config file"
    Config->>+FileSystem: "readFileSync(configPath)"
    FileSystem-->>-Config: "Raw config content"
    Config->>+Parser: "parseConfigFile(content, filename)"
    Parser-->>-Config: "Parsed config object"
    Config->>+Validator: "schema.safeParse(config)"
    Validator-->>-Config: "Validated config"
    Config-->>-User: "Result<T, Error>"
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

6 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +68 to +77
> = TaggedError("ParseError")<{
/** Human-readable error message describing the parse failure */
message: string;
/** Name of the file that failed to parse */
filename: string;
/** Line number where the error occurred (if available) */
line?: number;
/** Column number where the error occurred (if available) */
column?: number;
}>();
Copy link

Choose a reason for hiding this comment

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

style: redundant type annotation duplicates the exact same properties that are already specified in the TaggedErrorClass type parameter above

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/config/src/index.ts
Line: 68:77

Comment:
**style:** redundant type annotation duplicates the exact same properties that are already specified in the TaggedErrorClass type parameter above

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

@galligan galligan changed the base branch from chore-release-align-package-versions-to-0.1.0 to graphite-base/106 January 23, 2026 23:27
@galligan galligan force-pushed the fix-errors-avoid-taggederror-extends-warnings branch from 9ebfbbb to bf5a55c Compare January 23, 2026 23:28
@galligan galligan changed the base branch from graphite-base/106 to chore-release-align-package-versions-to-0.1.0 January 23, 2026 23:28
@galligan
Copy link
Contributor Author

Restacked and resubmitted; no additional changes in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants