Skip to content

Conversation

@mkh-user
Copy link
Member

@mkh-user mkh-user commented Sep 22, 2025

Type of Change

  • New feature

Description

Add a new NetSuite autoload that will handle network tasks in simpler way. Currently supports HTTP requests with complete options.

Testing

Works fine with all parameters.

Impact

Nothing

Additional Information

Nothing

Checklist

  • My code adheres to the coding and style guidelines of the project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings
  • Changes were added to CHANGELOG

Summary by CodeRabbit

  • New Features

    • Added a global networking helper available at startup to simplify HTTP requests, with support for custom headers/methods, optional file downloads, response callbacks, and automatic cancellation/cleanup of requests.
  • Documentation

    • Changelog updated to list the new networking helper.
  • Chores

    • Project configuration updated to register the new global helper at launch.

@mkh-user mkh-user added this to the Text Forge 0.2 milestone Sep 22, 2025
@mkh-user mkh-user self-assigned this Sep 22, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 22, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds a new NetSuite autoload singleton implementing an HTTP request helper with DEFAULT_HTTP_AUTO_FREE, an http_request(...) API, per-request lifecycle tracking, a _process loop to cancel/free requests, a UID file, and a project.godot autoload registration. CHANGELOG updated.

Changes

Cohort / File(s) Summary
Autoload implementation
core/autoload/net_suite.gd
New Node singleton providing http_request(callback := Callable(), request := {}, downloadfile := "", auto_free_on := DEFAULT_HTTP_AUTO_FREE) -> HTTPRequest. Adds DEFAULT_HTTP_AUTO_FREE constant, http_requests tracking dictionary, request configuration (headers, method, raw/string body, download file), signal connection, and _process(delta) to cancel/remove/free requests when status matches configured auto-free statuses.
Asset UID
core/autoload/net_suite.gd.uid
New UID file containing uid://pcgtarcx4wpe.
Project configuration
project.godot
Adds autoload entry NetSuite = "res://core/autoload/net_suite.gd" in [autoload].
Changelog
CHANGELOG.md
Records the NetSuite autoload under Unreleased → Added.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Caller
  participant NetSuite as NetSuite (Autoload)
  participant Req as HTTPRequest
  participant Client as HTTPClient

  Caller->>NetSuite: http_request(callback, request, downloadfile, auto_free_on)
  activate NetSuite
  NetSuite->>Req: instantiate & configure (method, headers, body, downloadfile)
  NetSuite->>Req: connect "request_completed" -> callback
  NetSuite->>NetSuite: store Req -> http_requests[Req] = auto_free_on
  NetSuite->>Req: add_child, start request
  NetSuite-->>Caller: return Req
  deactivate NetSuite

  loop every frame (_process)
    NetSuite->>Req: inspect Req.get_http_client().get_status()
    alt status in auto_free_on
      NetSuite->>Req: cancel() / remove from parent / queue_free()
      Note right of NetSuite: untrack from http_requests
    else
      Note right of NetSuite: no action
    end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Add NetSuite for network tasks #105 — Appears to add the same NetSuite autoload (core/autoload/net_suite.gd), UID, and http_request API; likely the same or closely related change.

Poem

I hop through nets with ears held high,
A Suite to fetch beneath the sky,
I send the bytes, then tidy trails,
Callbacks sing as data sails.
Clean burrows kept, no loose requests. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Add NetSuite for network tasks" is a concise, single-sentence summary that accurately reflects the primary change—introducing a NetSuite autoload to handle networking/HTTP requests—and avoids unnecessary detail while conveying the main intent. It is clear and specific enough for teammates scanning PR history to understand the primary change. The phrasing is appropriate and directly related to the changes in the diff.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b6efcfd and d659d1f.

📒 Files selected for processing (1)
  • core/autoload/net_suite.gd (1 hunks)

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@mkh-user mkh-user moved this from Needs Review to In Progress in Release: Text Forge 1.0 Sep 22, 2025
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: 3

🧹 Nitpick comments (2)
CHANGELOG.md (1)

14-14: Clarify the new API in the changelog entry.

Briefly mention the public function signature to help integrators discover usage, e.g., “NetSuite.http_request(callback := Callable(), request := {}, downloadfile := "", auto_free_on := DEFAULT_HTTP_AUTO_FREE)”.

core/autoload/net_suite.gd (1)

2-2: Fix typos and misleading docs (“works/optioanl/intiailize/insted/rquest”; ‘when "url" is true/false’).

Clean up wording to prevent misuse.

Apply:

-## Helper class for network works.
+## Helper for network tasks.
@@
-## Creates new [HTTPRequest] and intiailize it with this optioanl parameters:[br]
-## َ    - [param callback]: [Callable] to connect to [signal HTTPRequest.request_completed].[br]
-## َ    - [param request]: Optional request to send, with these keys:[br]
-## َ        - [code]"url"[/code]: URL to send request.[br]
-## َ        - [code]"raw"[/code] (Optional, default is [code]false[/code]): Uses [method HTTPRequest.request_raw] insted of [method HTTPRequest.request] if [code]true[/code].[br]
-## َ        - [code]"custom_headers"[/code] (Optional, default is empty [PackedStringArray]): Custom headers to send request.[br]
-## َ        - [code]"method"[/code] (Optional, default is [constant HTTPClient.METHOD_GET]): Request method.[br]
-## َ        - [code]"request_data_raw"[/code] (Optional, default is empty [PackedByteArray]): Data to send in rquest when [code]"url"[/code] is [code]true[/code].[br]
-## َ        - [code]"request_data"[/code] (Optional, default is empty [String]): Data to send in rquest when [code]"url"[/code] is [code]false[/code] (default).[br]
-## َ    - [param downloadfile]: The file to download into.[br]
-## َ    - [param auto_free_on]: An [Array] of [enum HTTPClient.Status]es that will free this request.[br][br]
+## Creates a new [HTTPRequest] and initializes it with these optional parameters:[br]
+##  - [param callback]: [Callable] to connect to [signal HTTPRequest.request_completed].[br]
+##  - [param request]: Optional request data with keys:[br]
+##      - [code]"url"[/code]: URL to request.[br]
+##      - [code]"raw"[/code] (Optional, default [code]false[/code]): Use [method HTTPRequest.request_raw] instead of [method HTTPRequest.request] when [code]true[/code].[br]
+##      - [code]"custom_headers"[/code] (Optional, default empty [PackedStringArray]): Custom headers.[br]
+##      - [code]"method"[/code] (Optional, default [constant HTTPClient.METHOD_GET]): Request method.[br]
+##      - [code]"request_data_raw"[/code] (Optional, default empty [PackedByteArray]): Binary body when using [code]"raw"[/code].[br]
+##      - [code]"request_data"[/code] (Optional, default empty [String]): String body when not using [code]"raw"[/code].[br]
+##  - [param downloadfile]: Target file path for downloads.[br]
+##  - [param auto_free_on]: [Array] of [enum HTTPClient.Status] values; when matched, the request is canceled and freed.[br][br]

Also applies to: 27-38

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b5d71ef and b6efcfd.

📒 Files selected for processing (4)
  • CHANGELOG.md (1 hunks)
  • core/autoload/net_suite.gd (1 hunks)
  • core/autoload/net_suite.gd.uid (1 hunks)
  • project.godot (1 hunks)
🔇 Additional comments (2)
core/autoload/net_suite.gd.uid (1)

1-1: UID file looks fine.

No issues.

project.godot (1)

40-40: Autoload registration LGTM; confirm ordering assumptions.

If NetSuite ever depends on other autoloads, ensure it’s listed after them.

@mkh-user mkh-user merged commit 730549d into Main Sep 22, 2025
1 of 2 checks passed
@mkh-user mkh-user deleted the net-suite branch September 22, 2025 12:51
@github-project-automation github-project-automation bot moved this from In Progress to Completed in Release: Text Forge 1.0 Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

2 participants