Skip to content

refactor: reorganize API imports and enable error reporting#132

Merged
graphite-app[bot] merged 1 commit intomasterfrom
theerapakg/refactor-handler-imports-and-error-reporting
Jan 31, 2026
Merged

refactor: reorganize API imports and enable error reporting#132
graphite-app[bot] merged 1 commit intomasterfrom
theerapakg/refactor-handler-imports-and-error-reporting

Conversation

@TheerapakG
Copy link
Copy Markdown
Collaborator

@TheerapakG TheerapakG commented Jan 31, 2026

TL;DR

Reorganized API handler imports and enabled error reporting in runtime configurations.

What changed?

  • Updated import paths for all API handlers to follow a more structured pattern (e.g., from ./handlers/calc to ./handlers/calc/api)
  • Removed the disableErrorReporting: true flag from runtime configurations in:
    • packages/sheet-apis/src/index.ts
    • packages/sheet-bot/src/index.ts
    • packages/sheet-db-server/src/index.ts

How to test?

  1. Verify that all imports resolve correctly by building the project
  2. Check that error reporting is now properly enabled by triggering a test error in each service
  3. Confirm that the application functionality remains unchanged

Why make this change?

  • The restructured imports provide better organization of API handlers, making the codebase more maintainable
  • Enabling error reporting will improve debugging capabilities by ensuring errors are properly captured and reported in production environments

Greptile Overview

Greptile Summary

This PR reorganizes API handler imports in sheet-apis to use explicit /api paths and enables error reporting across three services (sheet-apis, sheet-bot, sheet-db-server).

Key Changes:

  • Updated all handler imports in packages/sheet-apis/src/api.ts from ./handlers/calc to ./handlers/calc/api for better code organization
  • Removed disableErrorReporting: true flag from NodeRuntime.runMain() calls in three service entry points
  • All changes are backward compatible due to existing index.ts re-exports in handler directories

Impact:

  • Import path changes are purely organizational and don't affect functionality
  • Enabling error reporting will improve debugging by allowing Effect's runtime to capture and report unhandled errors
  • The services already have OpenTelemetry observability configured (traces and metrics), so error reporting complements existing monitoring

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk
  • The changes are straightforward refactoring with no logical changes. Import path updates work correctly due to existing re-exports. Enabling error reporting is a safe configuration change that improves observability. Minor style inconsistency noted but doesn't affect functionality.
  • No files require special attention - all changes are low-risk refactoring and configuration updates

Important Files Changed

Filename Overview
packages/sheet-apis/src/api.ts Updated import paths from ./handlers/calc to ./handlers/calc/api for better organization
packages/sheet-apis/src/index.ts Removed disableErrorReporting: true flag to enable error reporting
packages/sheet-bot/src/index.ts Removed disableErrorReporting: true flag to enable error reporting
packages/sheet-db-server/src/index.ts Removed disableErrorReporting: true flag to enable error reporting

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant API as api.ts
    participant Handlers as Handler Modules
    participant Runtime as NodeRuntime
    participant Observability as Error Reporting System

    Note over Dev,Handlers: Import Path Reorganization
    Dev->>API: Update imports to use /api suffix
    API->>Handlers: Import from ./handlers/calc/api
    Handlers-->>API: Return CalcApi, HealthApi, etc.
    
    Note over Dev,Observability: Error Reporting Enablement
    Dev->>Runtime: Remove disableErrorReporting flag
    Runtime->>Runtime: Enable error reporting (default behavior)
    
    Note over Runtime,Observability: Runtime Execution with Error Reporting
    Runtime->>Observability: Capture and report errors
    Observability-->>Runtime: Error tracking active
    
    Note over API,Handlers: Both import patterns supported
    API->>Handlers: New: ./handlers/calc/api
    API->>Handlers: Old: ./handlers/calc (via index.ts)
    Handlers-->>API: Both resolve correctly
Loading

Copy link
Copy Markdown
Collaborator Author


How to use the Graphite Merge Queue

Add the label to merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

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

@TheerapakG TheerapakG changed the title refactor(sheet-apis): update handler imports to use api.ts paths refactor: reorganize API imports and enable error reporting Jan 31, 2026
@TheerapakG TheerapakG marked this pull request as ready for review January 31, 2026 15:55
Copy link
Copy Markdown

@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.

4 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +2 to +12
import { CalcApi } from "./handlers/calc/api";
import { HealthApi } from "./handlers/health/api";
import { GuildConfigApi } from "./handlers/guildConfig/api";
import { MessageCheckinApi } from "./handlers/messageCheckin/api";
import { MessageRoomOrderApi } from "./handlers/messageRoomOrder/api";
import { MessageSlotApi } from "./handlers/messageSlot/api";
import { SheetApi } from "./handlers/sheet/api";
import { MonitorApi } from "./handlers/monitor/api";
import { PlayerApi } from "./handlers/player/api";
import { ScreenshotApi } from "./handlers/screenshot/api";
import { ScheduleApi } from "./handlers/schedule/api";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Import paths updated to use /api suffix, but http.ts still uses old pattern (importing from handler directories without suffix). Consider updating http.ts for consistency.

Suggested change
import { CalcApi } from "./handlers/calc/api";
import { HealthApi } from "./handlers/health/api";
import { GuildConfigApi } from "./handlers/guildConfig/api";
import { MessageCheckinApi } from "./handlers/messageCheckin/api";
import { MessageRoomOrderApi } from "./handlers/messageRoomOrder/api";
import { MessageSlotApi } from "./handlers/messageSlot/api";
import { SheetApi } from "./handlers/sheet/api";
import { MonitorApi } from "./handlers/monitor/api";
import { PlayerApi } from "./handlers/player/api";
import { ScreenshotApi } from "./handlers/screenshot/api";
import { ScheduleApi } from "./handlers/schedule/api";
import { CalcApi } from "./handlers/calc/api";
import { HealthApi } from "./handlers/health/api";
import { GuildConfigApi } from "./handlers/guildConfig/api";
import { MessageCheckinApi } from "./handlers/messageCheckin/api";
import { MessageRoomOrderApi } from "./handlers/messageRoomOrder/api";
import { MessageSlotApi } from "./handlers/messageSlot/api";
import { SheetApi } from "./handlers/sheet/api";
import { MonitorApi } from "./handlers/monitor/api";
import { PlayerApi } from "./handlers/player/api";
import { ScreenshotApi } from "./handlers/screenshot/api";
import { ScheduleApi } from "./handlers/schedule/api";

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/sheet-apis/src/api.ts
Line: 2:12

Comment:
Import paths updated to use `/api` suffix, but `http.ts` still uses old pattern (importing from handler directories without suffix). Consider updating `http.ts` for consistency.

```suggestion
import { CalcApi } from "./handlers/calc/api";
import { HealthApi } from "./handlers/health/api";
import { GuildConfigApi } from "./handlers/guildConfig/api";
import { MessageCheckinApi } from "./handlers/messageCheckin/api";
import { MessageRoomOrderApi } from "./handlers/messageRoomOrder/api";
import { MessageSlotApi } from "./handlers/messageSlot/api";
import { SheetApi } from "./handlers/sheet/api";
import { MonitorApi } from "./handlers/monitor/api";
import { PlayerApi } from "./handlers/player/api";
import { ScreenshotApi } from "./handlers/screenshot/api";
import { ScheduleApi } from "./handlers/schedule/api";
```

<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.

@graphite-app
Copy link
Copy Markdown

graphite-app bot commented Jan 31, 2026

Merge activity

### TL;DR

Reorganized API handler imports and enabled error reporting in runtime configurations.

### What changed?

- Updated import paths for all API handlers to follow a more structured pattern (e.g., from `./handlers/calc` to `./handlers/calc/api`)
- Removed the `disableErrorReporting: true` flag from runtime configurations in:
    - `packages/sheet-apis/src/index.ts`
    - `packages/sheet-bot/src/index.ts`
    - `packages/sheet-db-server/src/index.ts`

### How to test?

1. Verify that all imports resolve correctly by building the project
2. Check that error reporting is now properly enabled by triggering a test error in each service
3. Confirm that the application functionality remains unchanged

### Why make this change?

- The restructured imports provide better organization of API handlers, making the codebase more maintainable
- Enabling error reporting will improve debugging capabilities by ensuring errors are properly captured and reported in production environments

<!-- greptile_comment -->

<h2>Greptile Overview</h2>

<h3>Greptile Summary</h3>

This PR reorganizes API handler imports in `sheet-apis` to use explicit `/api` paths and enables error reporting across three services (`sheet-apis`, `sheet-bot`, `sheet-db-server`).

**Key Changes:**
- Updated all handler imports in `packages/sheet-apis/src/api.ts` from `./handlers/calc` to `./handlers/calc/api` for better code organization
- Removed `disableErrorReporting: true` flag from `NodeRuntime.runMain()` calls in three service entry points
- All changes are backward compatible due to existing `index.ts` re-exports in handler directories

**Impact:**
- Import path changes are purely organizational and don't affect functionality
- Enabling error reporting will improve debugging by allowing Effect's runtime to capture and report unhandled errors
- The services already have OpenTelemetry observability configured (traces and metrics), so error reporting complements existing monitoring

<h3>Confidence Score: 4/5</h3>

- This PR is safe to merge with minimal risk
- The changes are straightforward refactoring with no logical changes. Import path updates work correctly due to existing re-exports. Enabling error reporting is a safe configuration change that improves observability. Minor style inconsistency noted but doesn't affect functionality.
- No files require special attention - all changes are low-risk refactoring and configuration updates

<h3>Important Files Changed</h3>

| Filename | Overview |
|----------|----------|
| packages/sheet-apis/src/api.ts | Updated import paths from `./handlers/calc` to `./handlers/calc/api` for better organization |
| packages/sheet-apis/src/index.ts | Removed `disableErrorReporting: true` flag to enable error reporting |
| packages/sheet-bot/src/index.ts | Removed `disableErrorReporting: true` flag to enable error reporting |
| packages/sheet-db-server/src/index.ts | Removed `disableErrorReporting: true` flag to enable error reporting |

</details>

<h3>Sequence Diagram</h3>

```mermaid
sequenceDiagram
    participant Dev as Developer
    participant API as api.ts
    participant Handlers as Handler Modules
    participant Runtime as NodeRuntime
    participant Observability as Error Reporting System

    Note over Dev,Handlers: Import Path Reorganization
    Dev->>API: Update imports to use /api suffix
    API->>Handlers: Import from ./handlers/calc/api
    Handlers-->>API: Return CalcApi, HealthApi, etc.

    Note over Dev,Observability: Error Reporting Enablement
    Dev->>Runtime: Remove disableErrorReporting flag
    Runtime->>Runtime: Enable error reporting (default behavior)

    Note over Runtime,Observability: Runtime Execution with Error Reporting
    Runtime->>Observability: Capture and report errors
    Observability-->>Runtime: Error tracking active

    Note over API,Handlers: Both import patterns supported
    API->>Handlers: New: ./handlers/calc/api
    API->>Handlers: Old: ./handlers/calc (via index.ts)
    Handlers-->>API: Both resolve correctly
```

<!-- greptile_other_comments_section -->

<!-- /greptile_comment -->
@graphite-app graphite-app bot force-pushed the theerapakg/refactor-handler-imports-and-error-reporting branch from 7e458eb to 3200efd Compare January 31, 2026 16:00
@graphite-app graphite-app bot merged commit 3200efd into master Jan 31, 2026
5 checks passed
@TheerapakG TheerapakG deleted the theerapakg/refactor-handler-imports-and-error-reporting branch January 31, 2026 16:36
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.

1 participant