Skip to content

Conversation

flc1125
Copy link
Member

@flc1125 flc1125 commented Jun 16, 2025

Summary by CodeRabbit

  • New Features
    • Improved status handling for stories with a more robust set of predefined status options.
  • Refactor
    • Updated task and iteration identifiers in task-related requests to use numeric IDs for improved consistency and reliability.

Copy link

coderabbitai bot commented Jun 16, 2025

Walkthrough

The changes update the types of several struct fields: the Status field in the Story struct is now a custom StoryStatus type, and the StoryID and IterationID fields in task-related request structs are changed from string-based types to int64-based types. JSON tags remain unchanged.

Changes

File(s) Change Summary
api_story.go Changed Status field in Story struct from string to custom StoryStatus type.
api_task.go Changed StoryID and IterationID fields in GetTasksRequest and GetTasksCountRequest structs from string-based types to int64-based types; added a blank line after a struct declaration.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant API
    participant DB

    Client->>API: Send GetTasksRequest (StoryID, IterationID as int64)
    API->>DB: Query tasks using int64 IDs
    DB-->>API: Return tasks data
    API-->>Client: Respond with tasks

    Client->>API: Send/Receive Story (Status as StoryStatus)
    API-->>Client: Respond with Story (Status as StoryStatus)
Loading

Possibly related PRs

Suggested labels

go, size:M, breaking-change

Poem

Hopping through fields of types anew,
StoryStatus now shines in view!
IDs grow strong, from string to int,
Tasks and stories with purpose are sent.
With every hop, our code refines—
🐇 Cheers to changes and cleaner lines!

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (1.64.8)

Error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2
Failed executing command with error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 16, 2025
Copy link

codecov bot commented Jun 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
api_story.go 45.11% <ø> (ø)
api_task.go 66.16% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dosubot dosubot bot added the go Pull requests that update Go code label Jun 16, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
api_story.go (1)

8-23: Good move toward strong typing, but consider adding (Un)Marshal helpers

Using a dedicated StoryStatus enum improves type-safety and discoverability—nice 🎉.
If other packages (e.g. encoding/json, database/sql) must round-trip this value, you may want to add MarshalText / UnmarshalText (or MarshalJSON / UnmarshalJSON) methods so that invalid values fail fast and custom validation is centralized.

func (s StoryStatus) MarshalText() ([]byte, error) {
	switch s { // whitelist
	case StoryStatusAudited, StoryStatusDeveloping, StoryStatusForTest,
		StoryStatusInProgress, StoryStatusPlanning, StoryStatusRejected,
		StoryStatusResolved, StoryStatusTesting:
		return []byte(s), nil
	default:
		return nil, fmt.Errorf("unknown StoryStatus %q", s)
	}
}
api_task.go (1)

277-278: Mirror the change in GetTasksCountRequest comments/docstrings

The same ID fields were updated here—good.
Minor nit: the inline comments still say “ID 支持多ID查询” without mentioning they are numeric IDs now. Updating the comment would prevent confusion for SDK users skimming the source.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cab4b46 and 03b60e2.

📒 Files selected for processing (2)
  • api_story.go (1 hunks)
  • api_task.go (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
api_task.go (1)
api_types.go (2)
  • Multi (19-19)
  • Enum (66-66)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: go test (1.24.x, windows-latest)
  • GitHub Check: go test (1.23.x, windows-latest)
🔇 Additional comments (3)
api_story.go (2)

60-60: Inconsistent status types across request/response structs

Story.Status is now StoryStatus, but UpdateStoryRequest.Status and GetStoriesCountRequest.Status remain *string.
That asymmetry forces manual casts in client code and re-opens the door to typo errors when updating stories or counting them.

Consider aligning those request structs to *StoryStatus (or *Enum[StoryStatus] where applicable) for a fully type-safe API surface.


317-318: URL encoding of generic Enum[StoryStatus] may need special handling

Swapping from Enum[string] to Enum[StoryStatus] means the URL encoder now receives a slice of custom types.
If the encoder relies on fmt.Sprint it will still work, but if it expects []string you’ll get an empty parameter list or a compile error.

Please verify that urlencoder.Encode(...) (or whichever helper lives in this repo) correctly serializes Enum[StoryStatus] to the comma-separated strings the TAPD API expects.

api_task.go (1)

197-199: Type change improves safety but double-check URL marshalling

StoryID and IterationID in GetTasksRequest are now *Multi[int64] / *Enum[int64].
👍 for matching the server’s numeric IDs, but ensure your query encoder still joins them with commas (e.g. 123,456) instead of producing repeated parameters or [123 456].
A quick unit test around encodeURL(GetTasksRequest{StoryID: &Multi[int64]{123,456}}) would catch regressions.

@flc1125 flc1125 merged commit 9bd8b52 into master Jun 16, 2025
10 checks passed
@flc1125 flc1125 deleted the types branch June 16, 2025 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant