Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Updated docs for Cardinal v1.7.1 #814

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ezavada
Copy link
Collaborator

@ezavada ezavada commented Nov 19, 2024

Overview

This pull request improves documentation by adding info on new Options in Cardinal v1.7.1 and by changing references to nonce in the REST API documentation to the new timestamp field.

Summary by CodeRabbit

  • New Features

    • Introduced options for configuring the World object:
      • WithMessageExpiration for message lifespan (default 10 seconds).
      • WithHashCacheSize for setting hash cache size (default 1024 kilobytes).
    • Added new API schemas for enhanced transaction and query handling, including CQLRequest, CQLResponse, and ListTxReceiptsRequest.
  • Updates

    • Renamed nonce to timestamp in transaction request schemas, changing format to "unix millisecond timestamp".

Copy link

graphite-app bot commented Nov 19, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “graphite/merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge.

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

Copy link
Contributor

coderabbitai bot commented Nov 19, 2024

Walkthrough

The changes include updates to the API reference documentation for the World object, introducing two new configuration options: WithMessageExpiration and WithHashCacheSize. Additionally, the OpenAPI specification has been modified, notably renaming the nonce field to timestamp in transaction request schemas, and defining new schemas for handling Cardinal Query Language requests and responses, as well as transaction receipt management. These changes enhance the API's functionality and data handling capabilities.

Changes

File Change Summary
docs/cardinal/game/world/api-reference.mdx Added two new options for the World object: WithMessageExpiration (specifying message lifespan) and WithHashCacheSize (setting hash cache size). Both options include function signatures and parameter descriptions.
docs/cardinal/openapi.json Updated TxRequest and TxRequestWithCreatePersona schemas to rename nonce to timestamp with format change to "unix millisecond timestamp". Added new schemas: CQLRequest, CQLResponse, QueryPersonaSignerRequest, QueryPersonaSignerResponse, ListTxReceiptsRequest, and ListTxReceiptsReply for enhanced API structure and data handling.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant API
    participant Database

    User->>API: Send Transaction Request
    API->>Database: Validate and Process Request
    Database-->>API: Return Transaction Result
    API-->>User: Send Response with Result
Loading

🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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

Copy link

Preview Instructions

To preview these changes locally, checkout this branch and run:

make world-docs

Copy link
Contributor

@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: 2

🧹 Outside diff range comments (4)
docs/cardinal/openapi.json (4)

Line range hint 424-440: Add example values for the timestamp field

The timestamp field has been correctly added to replace nonce in both transaction request schemas. However, it would be helpful to add example values to demonstrate the expected unix millisecond timestamp format.

Add examples like this:

 "timestamp": {
   "type": "integer",
-  "format": "unix millisecond timestamp"
+  "format": "unix millisecond timestamp",
+  "example": 1699564800000
 }

Also applies to: 542-558


Line range hint 424-440: Enhance CQLResponse schema definition

The CQLResponse schema is currently defined as a simple array of objects, but the example response in the /query/game/cql endpoint shows a more specific structure with id and data fields.

Consider updating the schema to match the example response:

 "CQLResponse": {
   "type": "array",
   "items": {
-    "type": "object"
+    "type": "object",
+    "required": ["id", "data"],
+    "properties": {
+      "id": {
+        "type": "integer",
+        "description": "Entity identifier"
+      },
+      "data": {
+        "type": "array",
+        "items": {
+          "type": "object",
+          "description": "Component data"
+        }
+      }
+    }
   }
 }

Line range hint 477-499: Define possible values for the status field

The status field in QueryPersonaSignerResponse should enumerate its possible values to help API consumers understand the expected responses.

Consider updating the schema:

 "status": {
-  "type": "string"
+  "type": "string",
+  "enum": ["active", "inactive", "pending"],
+  "description": "Current status of the persona signer"
 }

Note: Please adjust the enum values according to the actual possible statuses in your implementation.


Line range hint 570-605: Consider adding pagination parameters

The transaction receipts endpoint might return large sets of data when querying across many ticks. Consider adding pagination support to manage response sizes effectively.

Consider updating the request schema:

 "ListTxReceiptsRequest": {
   "required": [
     "startTick"
   ],
   "type": "object",
   "properties": {
     "startTick": {
       "type": "integer",
       "format": "int64"
     },
+    "limit": {
+      "type": "integer",
+      "description": "Maximum number of receipts to return",
+      "default": 100,
+      "minimum": 1,
+      "maximum": 1000
+    }
   }
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Reviewing files that changed from the base of the PR and between c43e0ca and aba2565.

📒 Files selected for processing (2)
  • docs/cardinal/game/world/api-reference.mdx (1 hunks)
  • docs/cardinal/openapi.json (4 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/cardinal/game/world/api-reference.mdx

[uncategorized] ~146-~146: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ... is used. NOTE: this means that the real time clock for the sender and receiver must ...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

docs/cardinal/game/world/api-reference.mdx Show resolved Hide resolved
docs/cardinal/game/world/api-reference.mdx Show resolved Hide resolved
Copy link

github-actions bot commented Dec 4, 2024

Preview Instructions

To preview these changes locally, checkout this branch and run:

make world-docs

@smsunarto
Copy link
Member

@ezavada can you resolve the conflict here

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.

2 participants