Skip to content

Conversation

@AlexSkrypnyk
Copy link
Member

@AlexSkrypnyk AlexSkrypnyk commented Jul 26, 2025

Summary by CodeRabbit

  • New Features
    • The site provisioning process now displays the total duration taken, showing minutes and seconds upon completion.

@coderabbitai
Copy link

coderabbitai bot commented Jul 26, 2025

Walkthrough

The provisioning script was updated to track and log the total elapsed time of the site provisioning process. It records the start time at the beginning and, upon completion or early exit, calculates and displays the duration in minutes and seconds alongside the completion message. Corresponding tests were adjusted to match the updated finish message format by removing a trailing period.

Changes

File Change Summary
scripts/vortex/provision.sh Added start time tracking, elapsed time calculation, and enhanced finish logging with duration.
.vortex/tests/bats/unit/provision.bats Removed trailing period from "Finished site provisioning" message in multiple test assertions.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

The script begins, the clock now ticks,
Provisioning magic, no more tricks.
Minutes and seconds, rabbits delight,
Timing our work from morning to night.
With logs that sparkle, bunnies cheer—
"Provision complete! The end is near!" 🕰️🐇

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/add-timing-provision

🪧 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 generate unit tests to generate unit tests for 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.

@github-actions github-actions bot temporarily deployed to commit July 26, 2025 09:15 Inactive
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: 2

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between fd252d9 and 4a78db5.

📒 Files selected for processing (1)
  • scripts/vortex/provision.sh (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
  • GitHub Check: build (0)
  • GitHub Check: build (1)
  • GitHub Check: vortex-test-deployment (0)
  • GitHub Check: vortex-test-workflow (2)
  • GitHub Check: vortex-test-workflow (3)
  • GitHub Check: vortex-test-deployment (1)
  • GitHub Check: vortex-test-workflow (1)
  • GitHub Check: vortex-test-common
  • GitHub Check: vortex-test-workflow (0)
  • GitHub Check: vortex-test-installer (8.3)
  • GitHub Check: vortex-test-installer (8.4)
  • GitHub Check: vortex-test-installer (8.2)
  • GitHub Check: vortex-test-docs

Comment on lines +81 to +82
start_time=$(date +%s)

Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Leverage built-in SECONDS or an EXIT trap for simpler, fail-safe timing

Storing start_time=$(date +%s) works, but Bash already exposes the SECONDS counter (seconds since shell start). Using it, or a one-liner trap, eliminates an external date call and guarantees the duration is printed even on unexpected exits:

- start_time=$(date +%s)
+trap 'duration=$SECONDS; info "Finished site provisioning ($((duration / 60))m $((duration % 60))s)."' EXIT

Benefits:
• No subshell; one less external dependency
• Timing is emitted for every exit path without duplicating code
• Removes the risk of missing the finish log on future early-return branches

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
start_time=$(date +%s)
trap 'duration=$SECONDS; info "Finished site provisioning ($((duration / 60))m $((duration % 60))s)."' EXIT
🤖 Prompt for AI Agents
In scripts/vortex/provision.sh around lines 81 to 82, replace the manual
start_time assignment using date with the built-in Bash SECONDS variable to
track elapsed time. Remove the external date call and instead use SECONDS to
measure duration. Additionally, add an EXIT trap function that prints the
elapsed time on script exit to ensure timing is logged regardless of how the
script terminates, avoiding duplicated timing code and improving reliability.

@codecov
Copy link

codecov bot commented Jul 26, 2025

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.11%. Comparing base (fd252d9) to head (68e20f3).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
scripts/vortex/provision.sh 60.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1850      +/-   ##
===========================================
- Coverage    75.11%   75.11%   -0.01%     
===========================================
  Files           84       84              
  Lines         4835     4838       +3     
  Branches        35       35              
===========================================
+ Hits          3632     3634       +2     
- Misses        1203     1204       +1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/add-timing-provision branch from 4a78db5 to 68e20f3 Compare July 26, 2025 09:25
@github-actions github-actions bot temporarily deployed to commit July 26, 2025 09:27 Inactive
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: 2

🔭 Outside diff range comments (1)
scripts/vortex/provision.sh (1)

83-87: Early-return path omits elapsed-time information

The “skip provisioning” branch still prints the old plain message (and with a trailing period) while the other paths show the timed variant. This breaks log consistency and may mislead tooling that parses the new format.

Either:

  1. Move the common “print duration” logic to an EXIT trap (see previous comment), or
  2. Call a shared print_duration helper here before exit 0.
-  info "Finished site provisioning."
+  print_duration   # unified helper
+  exit 0
♻️ Duplicate comments (1)
scripts/vortex/provision.sh (1)

81-82: Prefer SECONDS + single EXIT trap over a manual start_time variable

Using an external date +%s here means:
• an extra subshell every time the duration is computed,
• duplicated bookkeeping further down the script,
• the risk that a future exit path forgets to compute the duration.

Bash already exposes the running timer via $SECONDS, and a one-liner trap guarantees the message is printed on all exits:

-# Record start time
-start_time=$(date +%s)
+
+# Emit provisioning duration on any exit
+trap 'info "Finished site provisioning ($((SECONDS/60))m $((SECONDS%60))s)."' EXIT

This removes two later blocks (lines 245-247 & 330-331) and the early-return inconsistency at lines 83-87.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4a78db5 and 68e20f3.

📒 Files selected for processing (2)
  • .vortex/tests/bats/unit/provision.bats (8 hunks)
  • scripts/vortex/provision.sh (3 hunks)
🧰 Additional context used
🧠 Learnings (2)
scripts/vortex/provision.sh (2)

Learnt from: AlexSkrypnyk
PR: #1714
File: scripts/vortex/doctor.sh:69-70
Timestamp: 2025-06-03T03:15:29.849Z
Learning: In the Vortex project, logging functions (task(), info(), note(), pass(), fail(), warn()) are intentionally duplicated across all script files to make each script self-contained and independent, rather than sharing them through a common library. This design choice prioritizes script independence over reducing code duplication.

Learnt from: AlexSkrypnyk
PR: #1714
File: scripts/vortex/doctor.sh:69-70
Timestamp: 2025-06-03T03:15:29.849Z
Learning: In the Vortex project, logging functions (task(), info(), note(), pass(), fail(), warn()) are intentionally duplicated across all script files to make each script self-contained and independent, rather than sharing them through a common library. This design choice prioritizes script independence over reducing code duplication.

.vortex/tests/bats/unit/provision.bats (2)

Learnt from: AlexSkrypnyk
PR: drevops/vortex#0
File: :0-0
Timestamp: 2025-05-29T12:15:32.188Z
Learning: Do not review files in .vortex/installer/tests/Fixtures/install directory as they are test fixtures.

Learnt from: AlexSkrypnyk
PR: #1697
File: .vortex/installer/tests/Fixtures/install/provision_database_lagoon/docs/onboarding.md:16-17
Timestamp: 2025-06-02T00:41:36.321Z
Learning: DO NOT EVER REVIEW FILES IN .vortex/installer/tests/Fixtures/ directory - these are test fixtures and should not be reviewed under any circumstances.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
  • GitHub Check: build (0)
  • GitHub Check: build (1)
  • GitHub Check: vortex-test-workflow (3)
  • GitHub Check: vortex-test-workflow (0)
  • GitHub Check: vortex-test-deployment (0)
  • GitHub Check: vortex-test-deployment (1)
  • GitHub Check: vortex-test-workflow (1)
  • GitHub Check: vortex-test-workflow (2)
  • GitHub Check: vortex-test-common
  • GitHub Check: vortex-test-installer (8.3)
  • GitHub Check: vortex-test-installer (8.4)
  • GitHub Check: vortex-test-installer (8.2)
  • GitHub Check: vortex-test-docs

Comment on lines +167 to 168
"Finished site provisioning"
)
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Test expectations no longer cover the new “(Xm Ys)” suffix

The assertions were trimmed to "Finished site provisioning" (without the period) but the production script now appends timing info like (0m 03s)..
While substring matching will still pass, we lose coverage that the timing text is present and correctly formatted.

Consider tightening the check, e.g.:

assert_output_contains_regex 'Finished site provisioning \([0-9]\+m [0-9]\+s\)\.'

(or equivalent helper) so the tests fail if the timing output is accidentally removed in the future.

Also applies to: 298-299, 438-439, 583-584, 723-724, 857-858, 998-999, 1117-1118

🤖 Prompt for AI Agents
In .vortex/tests/bats/unit/provision.bats around lines 167 to 168, the test
assertion only checks for the substring "Finished site provisioning" but does
not verify the appended timing suffix like "(Xm Ys).". Update the assertion to
use a regex that matches the full string including the timing format, for
example using assert_output_contains_regex with a pattern like 'Finished site
provisioning \([0-9]\+m [0-9]\+s\)\.'. Apply similar regex-based assertions to
the other specified line ranges to ensure the timing output is validated in all
relevant tests.

Comment on lines +245 to 247
duration=$(($(date +%s) - start_time))
info "Finished site provisioning ($((duration / 60))m $((duration % 60))s)."
exit 0
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Three copies of the same duration maths – extract once

The identical block

duration=$(($(date +%s) - start_time))
info "Finished site provisioning ($((duration / 60))m $((duration % 60))s)."

appears twice (lines 245-247 & 330-331) and would need a third copy for the early-return path. Duplicate snippets are error-prone and already violate DRY.

If you don’t adopt the trap solution, at least factor this into a small helper:

print_duration() {
  local duration=$(( $(date +%s) - start_time ))
  info "Finished site provisioning ($((duration/60))m $((duration%60))s)."
}

and call print_duration in all three places.

Also applies to: 330-331

🤖 Prompt for AI Agents
In scripts/vortex/provision.sh around lines 245-247 and 330-331, the duration
calculation and logging code is duplicated. To fix this, extract the repeated
code into a helper function named print_duration that calculates the duration
and logs the message. Then replace all occurrences of the duplicated code with
calls to this new function, including the early-return path, to adhere to DRY
principles and reduce error-prone duplication.

@AlexSkrypnyk AlexSkrypnyk merged commit abb0d2d into develop Jul 26, 2025
29 of 30 checks passed
@AlexSkrypnyk AlexSkrypnyk deleted the feature/add-timing-provision branch July 26, 2025 09:51
@github-project-automation github-project-automation bot moved this from BACKLOG to Release queue in Vortex Jul 26, 2025
@AlexSkrypnyk AlexSkrypnyk added this to the 25.7.0 milestone Jul 26, 2025
@AlexSkrypnyk AlexSkrypnyk moved this from Release queue to Released in 25.7.0 in Vortex Jul 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants