Skip to content

Conversation

@withinboredom
Copy link
Member

@withinboredom withinboredom commented Aug 28, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a new command-line option --typesense-url for specifying the Typesense server URL.
    • Enhanced configuration capabilities by allowing the specification of a Typesense URL in the configuration settings.
    • Improved logging and tracking by capturing the client's IP address in API requests.
  • Bug Fixes

    • Updated time handling in the event queue system for better clarity and type safety.
  • Documentation

    • Enhanced readability and maintainability of code through various formatting adjustments.

@coderabbitai
Copy link

coderabbitai bot commented Aug 28, 2024

Walkthrough

The changes involve modifications to various components of the project, including the CI/CD pipeline configuration, Dockerfile syntax, command-line interface options, configuration handling, and event queue management. Notable updates include the removal of specific performance tests, the introduction of a Typesense URL option in the CLI, and enhancements to time handling in the event queue. Overall, these changes aim to improve functionality and code clarity across the codebase.

Changes

File Change Summary
.github/workflows/build-cli.yaml Removed lines for executing performance tests related to "seq test".
Dockerfile Updated ENV command syntax for setting the PATH environment variable.
cli/cli.go, cli/config/config.go Added --typesense-url command-line option; updated ApplyOptions to set Search.Url based on this new option.
cli/glue/glue.go, cli/lib/consumer.go Enhanced logging by capturing the client's IP address through the RemoteAddr field and storing it in the env map.
cli/go.mod Updated Go module version from go 1.22 to go 1.23.
src/Events/EventQueue.php Modified enqueue method to use as(TimeUnit::Seconds) for delay; changed return type of getDelay from Seconds to Time.
src/Glue/glue.php Improved code readability through formatting adjustments and streamlined logic for checking provenance and error handling.

Sequence Diagram(s)

sequenceDiagram
    participant CLI
    participant Config
    participant EventQueue

    CLI->>Config: Set typesense-url
    Config->>EventQueue: Apply options
    EventQueue->>EventQueue: Calculate delay using as(TimeUnit::Seconds)
    EventQueue-->>CLI: Return updated configuration
Loading

🐇 In the code, I hop and play,
With typesense URLs now in sway.
From Docker to events, changes abound,
Clarity and function, joyfully found!
So let’s celebrate with a leap and a cheer,
For every tweak brings us closer, my dear! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

@bottledcode bottledcode deleted a comment from coderabbitai bot Aug 28, 2024
@withinboredom withinboredom enabled auto-merge (squash) August 28, 2024 22:47
@codecov
Copy link

codecov bot commented Aug 28, 2024

Codecov Report

Attention: Patch coverage is 0% with 22 lines in your changes missing coverage. Please review.

Project coverage is 44.82%. Comparing base (d0e7e18) to head (279c2e5).
Report is 1 commits behind head on v2.

Files with missing lines Patch % Lines
src/Glue/glue.php 0.00% 17 Missing ⚠️
src/Events/EventQueue.php 0.00% 5 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                 v2      #74      +/-   ##
============================================
- Coverage     44.89%   44.82%   -0.07%     
  Complexity     1098     1098              
============================================
  Files            94       94              
  Lines          3212     3219       +7     
============================================
+ Hits           1442     1443       +1     
- Misses         1770     1776       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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: 8

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d0e7e18 and 279c2e5.

Files selected for processing (9)
  • .github/workflows/build-cli.yaml (1 hunks)
  • Dockerfile (1 hunks)
  • cli/cli.go (1 hunks)
  • cli/config/config.go (1 hunks)
  • cli/glue/glue.go (2 hunks)
  • cli/go.mod (1 hunks)
  • cli/lib/consumer.go (1 hunks)
  • src/Events/EventQueue.php (3 hunks)
  • src/Glue/glue.php (4 hunks)
Files skipped from review due to trivial changes (3)
  • .github/workflows/build-cli.yaml
  • Dockerfile
  • cli/go.mod
Additional context used
GitHub Check: codecov/patch
src/Events/EventQueue.php

[warning] 104-105: src/Events/EventQueue.php#L104-L105
Added lines #L104 - L105 were not covered by tests


[warning] 124-124: src/Events/EventQueue.php#L124
Added line #L124 was not covered by tests


[warning] 129-129: src/Events/EventQueue.php#L129
Added line #L129 was not covered by tests


[warning] 131-131: src/Events/EventQueue.php#L131
Added line #L131 was not covered by tests

src/Glue/glue.php

[warning] 89-89: src/Glue/glue.php#L89
Added line #L89 was not covered by tests


[warning] 96-98: src/Glue/glue.php#L96-L98
Added lines #L96 - L98 were not covered by tests


[warning] 103-103: src/Glue/glue.php#L103
Added line #L103 was not covered by tests


[warning] 193-198: src/Glue/glue.php#L193-L198
Added lines #L193 - L198 were not covered by tests


[warning] 205-206: src/Glue/glue.php#L205-L206
Added lines #L205 - L206 were not covered by tests


[warning] 314-314: src/Glue/glue.php#L314
Added line #L314 was not covered by tests


[warning] 318-318: src/Glue/glue.php#L318
Added line #L318 was not covered by tests


[warning] 322-323: src/Glue/glue.php#L322-L323
Added lines #L322 - L323 were not covered by tests

Additional comments not posted (8)
cli/config/config.go (1)

117-119: LGTM!

The new option typesense-url enhances the configurability of the Config object and is correctly implemented.

The code changes are approved.

src/Events/EventQueue.php (2)

104-105: LGTM!

The change to use as(TimeUnit::Seconds) enhances clarity and improves type safety.

The code changes are approved.

Tools
GitHub Check: codecov/patch

[warning] 104-105: src/Events/EventQueue.php#L104-L105
Added lines #L104 - L105 were not covered by tests


124-131: LGTM!

The change to use Time as the return type reflects a broader representation of time and aligns with the new type system.

The code changes are approved.

Tools
GitHub Check: codecov/patch

[warning] 124-124: src/Events/EventQueue.php#L124
Added line #L124 was not covered by tests


[warning] 129-129: src/Events/EventQueue.php#L129
Added line #L129 was not covered by tests


[warning] 131-131: src/Events/EventQueue.php#L131
Added line #L131 was not covered by tests

cli/lib/consumer.go (1)

292-292: LGTM!

The new entry enhances the functionality of the processMsg function by capturing and storing the remote address of the sender.

The code changes are approved.

cli/glue/glue.go (2)

102-103: LGTM!

The function correctly extracts the client's IP address and includes it in the env map and message headers.

The code changes are approved.


107-109: LGTM!

The function correctly adds the client's IP address to the message headers.

The code changes are approved.

src/Glue/glue.php (1)

193-199: LGTM!

The function correctly handles entity signal events.

The code changes are approved.

Tools
GitHub Check: codecov/patch

[warning] 193-198: src/Glue/glue.php#L193-L198
Added lines #L193 - L198 were not covered by tests

cli/cli.go (1)

568-568: LGTM!

The function correctly adds the new command-line option for Typesense URL.

The code changes are approved.

try {
$provenance = json_decode($_SERVER['HTTP_DPHP_PROVENANCE'] ?? 'null', true, 32, JSON_THROW_ON_ERROR);
if (! $provenance || $provenance === ['userId' => '', 'roles' => null]) {
if (!$provenance || $provenance === ['userId' => '', 'roles' => null]) {
Copy link

Choose a reason for hiding this comment

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

Reminder: Add tests for provenance handling.

The provenance handling logic is not covered by tests.

Do you want me to generate the unit testing code or open a GitHub issue to track this task?

Tools
GitHub Check: codecov/patch

[warning] 89-89: src/Glue/glue.php#L89
Added line #L89 was not covered by tests

Comment on lines +96 to +98
$this->logger->alert(
'Failed to capture provenance',
['provenance' => $_SERVER['HTTP_DPHP_PROVENANCE'] ?? null],
Copy link

Choose a reason for hiding this comment

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

Reminder: Add tests for JSON decoding error handling.

The JSON decoding error handling logic is not covered by tests.

Do you want me to generate the unit testing code or open a GitHub issue to track this task?

Tools
GitHub Check: codecov/patch

[warning] 96-98: src/Glue/glue.php#L96-L98
Added lines #L96 - L98 were not covered by tests

}

if (! file_exists($_SERVER['HTTP_DPHP_PAYLOAD'])) {
if (!file_exists($_SERVER['HTTP_DPHP_PAYLOAD'])) {
Copy link

Choose a reason for hiding this comment

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

Reminder: Add tests for payload file existence check.

The payload file existence check logic is not covered by tests.

Do you want me to generate the unit testing code or open a GitHub issue to track this task?

Tools
GitHub Check: codecov/patch

[warning] 103-103: src/Glue/glue.php#L103
Added line #L103 was not covered by tests

Comment on lines +193 to +198
if (!$this->target->toOrchestrationInstance()->executionId) {
$this->target = StateId::fromInstance(
new OrchestrationInstance(
$this->target->toOrchestrationInstance()->instanceId,
Uuid::uuid7()->toString(),
),
Copy link

Choose a reason for hiding this comment

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

Reminder: Add tests for orchestration instance creation.

The orchestration instance creation logic is not covered by tests.

Do you want me to generate the unit testing code or open a GitHub issue to track this task?

Tools
GitHub Check: codecov/patch

[warning] 193-198: src/Glue/glue.php#L193-L198
Added lines #L193 - L198 were not covered by tests

Comment on lines +205 to +206
$event =
WithOrchestration::forInstance($this->target, StartExecution::asParent($input, []/* todo: scheduling */));
Copy link

Choose a reason for hiding this comment

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

Reminder: Add tests for event creation.

The event creation logic is not covered by tests.

Do you want me to generate the unit testing code or open a GitHub issue to track this task?

Tools
GitHub Check: codecov/patch

[warning] 205-206: src/Glue/glue.php#L205-L206
Added lines #L205 - L206 were not covered by tests

case $attribute->getName() === AllowCreateForRole::class:
/** @var AllowCreateForRole $attribute */
$attribute = $attribute->newInstance();
/** @var AllowCreateForRole $attribute */ $attribute = $attribute->newInstance();
Copy link

Choose a reason for hiding this comment

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

Reminder: Add tests for role permissions.

The role permissions logic is not covered by tests.

Do you want me to generate the unit testing code or open a GitHub issue to track this task?

Tools
GitHub Check: codecov/patch

[warning] 314-314: src/Glue/glue.php#L314
Added line #L314 was not covered by tests

case $attribute->getName() === AllowCreateForUser::class:
/** @var AllowCreateForUser $attribute */
$attribute = $attribute->newInstance();
/** @var AllowCreateForUser $attribute */ $attribute = $attribute->newInstance();
Copy link

Choose a reason for hiding this comment

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

Reminder: Add tests for user permissions.

The user permissions logic is not covered by tests.

Do you want me to generate the unit testing code or open a GitHub issue to track this task?

Tools
GitHub Check: codecov/patch

[warning] 318-318: src/Glue/glue.php#L318
Added line #L318 was not covered by tests

Comment on lines +322 to +323
/** @var TimeToLive $attribute */ $attribute = $attribute->newInstance();
$permissions['ttl'] = $attribute->timeToLive()->as(TimeUnit::Nanoseconds);
Copy link

Choose a reason for hiding this comment

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

Reminder: Add tests for time-to-live attribute.

The time-to-live attribute logic is not covered by tests.

Do you want me to generate the unit testing code or open a GitHub issue to track this task?

Tools
GitHub Check: codecov/patch

[warning] 322-323: src/Glue/glue.php#L322-L323
Added lines #L322 - L323 were not covered by tests

@github-actions
Copy link

Performance Metrics

test time (s) memory usage
perf 17.41 116
Fan out/in 60.06 8

@withinboredom withinboredom merged commit 065dc78 into v2 Aug 29, 2024
@withinboredom withinboredom deleted the withinboredom/bot-60-update-time-library branch August 29, 2024 07:07
@coderabbitai coderabbitai bot mentioned this pull request Jul 28, 2025
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