Skip to content

Conversation

@hahn-kev
Copy link
Collaborator

@hahn-kev hahn-kev commented Sep 9, 2025

It turns out that windows doesn't have a gracefull shutdown of a process outside of Ctrl+C which you can't just send to a process you've spawned. Hence this fix.

  • Introduces a dedicated shutdownFwLite function for graceful termination, replacing direct process killing.
  • Updates FwLiteWeb to properly handle shutdown commands via stdin.
  • Refines process stdio configuration for consistency.

* Replace direct process killing with a dedicated `shutdownFwLite` function for graceful termination.
* Update FwLiteWeb to properly handle `shutdown` commands via stdin.
* Adjust process stdio configuration for consistency.
@coderabbitai
Copy link

coderabbitai bot commented Sep 9, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

Adds a console-driven shutdown path: the web app listens for "shutdown" on stdin and stops asynchronously. The extension adjusts process launch to enable stdin and introduces a helper to send "shutdown\n", await clean exit, and force-kill after 10 seconds if needed. Cleanup now uses the graceful shutdown helper.

Changes

Cohort / File(s) Summary
Web app stdin shutdown listener
backend/FwLite/FwLiteWeb/Program.cs
Starts a background Task to read stdin and, on exact "shutdown", calls app.StopAsync(). Leaves startup and app.WaitForShutdownAsync() flow intact. No public API changes.
Extension process management and graceful shutdown
platform.bible-extension/src/main.ts
Adds shutdownFwLite(...) to send "shutdown\n" via stdin, wait for exit, reject on non-zero, and hard-kill after 10s. Changes spawn stdio to enable stdin. Replaces direct kill() in cleanup with the new graceful shutdown. No exported signature changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title “Improve shutdown for FwLiteWeb in Paratext” clearly and concisely summarizes the primary objective of the changeset by highlighting the enhancement of the shutdown mechanism for the FwLiteWeb process within Paratext.
Description Check ✅ Passed The description accurately outlines the motivation behind the changes—Windows’ inability to programmatically send Ctrl+C—and details the implementation of a graceful shutdown function along with related updates, directly reflecting the modifications in the pull request.

Poem

A bunny taps the console key,
“shutdown,” whispers quietly.
The server bows, the logs grow light,
No thumps, no bumps—just gentle night.
If stalls persist, a firm goodbye—
I twitch my nose, then swiftly fly.
Hop safe, sweet threads. 🌙🐇

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title “Improve shutdown for FwLiteWeb in Paratext” clearly and concisely summarizes the primary objective of the changeset by highlighting the enhancement of the shutdown mechanism for the FwLiteWeb process within Paratext.
Description Check ✅ Passed The description accurately outlines the motivation behind the changes—Windows’ inability to programmatically send Ctrl+C—and details the implementation of a graceful shutdown function along with related updates, directly reflecting the modifications in the pull request.

Poem

A bunny taps the console key,
“shutdown,” whispers quietly.
The server bows, the logs grow light,
No thumps, no bumps—just gentle night.
If stalls persist, a firm goodbye—
I twitch my nose, then swiftly fly.
Hop safe, sweet threads. 🌙🐇

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title “Improve shutdown for FwLiteWeb in Paratext” clearly and concisely summarizes the primary objective of the changeset by highlighting the enhancement of the shutdown mechanism for the FwLiteWeb process within Paratext.
Description Check ✅ Passed The description accurately outlines the motivation behind the changes—Windows’ inability to programmatically send Ctrl+C—and details the implementation of a graceful shutdown function along with related updates, directly reflecting the modifications in the pull request.

Poem

A bunny taps the console key,
“shutdown,” whispers quietly.
The server bows, the logs grow light,
No thumps, no bumps—just gentle night.
If stalls persist, a firm goodbye—
I twitch my nose, then swiftly fly.
Hop safe, sweet threads. 🌙🐇

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title “Improve shutdown for FwLiteWeb in Paratext” clearly and concisely summarizes the primary objective of the changeset by highlighting the enhancement of the shutdown mechanism for the FwLiteWeb process within Paratext.
Description Check ✅ Passed The description accurately outlines the motivation behind the changes—Windows’ inability to programmatically send Ctrl+C—and details the implementation of a graceful shutdown function along with related updates, directly reflecting the modifications in the pull request.

Poem

A bunny taps the console key,
“shutdown,” whispers quietly.
The server bows, the logs grow light,
No thumps, no bumps—just gentle night.
If stalls persist, a firm goodbye—
I twitch my nose, then swiftly fly.
Hop safe, sweet threads. 🌙🐇

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title “Improve shutdown for FwLiteWeb in Paratext” clearly and concisely summarizes the primary objective of the changeset by highlighting the enhancement of the shutdown mechanism for the FwLiteWeb process within Paratext.
Description Check ✅ Passed The description accurately outlines the motivation behind the changes—Windows’ inability to programmatically send Ctrl+C—and details the implementation of a graceful shutdown function along with related updates, directly reflecting the modifications in the pull request.

Poem

A bunny taps the console key,
“shutdown,” whispers quietly.
The server bows, the logs grow light,
No thumps, no bumps—just gentle night.
If stalls persist, a firm goodbye—
I twitch my nose, then swiftly fly.
Hop safe, sweet threads. 🌙🐇

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title “Improve shutdown for FwLiteWeb in Paratext” clearly and concisely summarizes the primary objective of the changeset by highlighting the enhancement of the shutdown mechanism for the FwLiteWeb process within Paratext.
Description Check ✅ Passed The description accurately outlines the motivation behind the changes—Windows’ inability to programmatically send Ctrl+C—and details the implementation of a graceful shutdown function along with related updates, directly reflecting the modifications in the pull request.

Poem

A bunny taps the console key,
“shutdown,” whispers quietly.
The server bows, the logs grow light,
No thumps, no bumps—just gentle night.
If stalls persist, a firm goodbye—
I twitch my nose, then swiftly fly.
Hop safe, sweet threads. 🌙🐇

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title “Improve shutdown for FwLiteWeb in Paratext” clearly and concisely summarizes the primary objective of the changeset by highlighting the enhancement of the shutdown mechanism for the FwLiteWeb process within Paratext.
Description Check ✅ Passed The description accurately outlines the motivation behind the changes—Windows’ inability to programmatically send Ctrl+C—and details the implementation of a graceful shutdown function along with related updates, directly reflecting the modifications in the pull request.

Poem

A bunny taps the console key,
“shutdown,” whispers quietly.
The server bows, the logs grow light,
No thumps, no bumps—just gentle night.
If stalls persist, a firm goodbye—
I twitch my nose, then swiftly fly.
Hop safe, sweet threads. 🌙🐇

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title “Improve shutdown for FwLiteWeb in Paratext” clearly and concisely summarizes the primary objective of the changeset by highlighting the enhancement of the shutdown mechanism for the FwLiteWeb process within Paratext.
Description Check ✅ Passed The description accurately outlines the motivation behind the changes—Windows’ inability to programmatically send Ctrl+C—and details the implementation of a graceful shutdown function along with related updates, directly reflecting the modifications in the pull request.

Poem

A bunny taps the console key,
“shutdown,” whispers quietly.
The server bows, the logs grow light,
No thumps, no bumps—just gentle night.
If stalls persist, a firm goodbye—
I twitch my nose, then swiftly fly.
Hop safe, sweet threads. 🌙🐇

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title “Improve shutdown for FwLiteWeb in Paratext” clearly and concisely summarizes the primary objective of the changeset by highlighting the enhancement of the shutdown mechanism for the FwLiteWeb process within Paratext.
Description Check ✅ Passed The description accurately outlines the motivation behind the changes—Windows’ inability to programmatically send Ctrl+C—and details the implementation of a graceful shutdown function along with related updates, directly reflecting the modifications in the pull request.

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.

@github-actions github-actions bot added 💻 FW Lite issues related to the fw lite application, not miniLcm or crdt related 📙 Platform.Bible labels Sep 9, 2025
@github-actions
Copy link

github-actions bot commented Sep 9, 2025

UI unit Tests

  1 files  ±0   45 suites  ±0   20s ⏱️ -1s
111 tests ±0  111 ✅ ±0  0 💤 ±0  0 ❌ ±0 
160 runs  ±0  160 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 893804a. ± Comparison against base commit c0957ed.

♻️ This comment has been updated with latest results.

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

🧹 Nitpick comments (2)
backend/FwLite/FwLiteWeb/Program.cs (1)

18-25: Optional: guard against unexpected read errors and log.

Wrap the loop in try/catch so unexpected I/O failures don’t tear down the background task silently. If you have logging on the host, log and call StopAsync().

platform.bible-extension/src/main.ts (1)

296-315: Optional: kill the process tree on Windows if FwLiteWeb spawns children.

If FwLiteWeb ever spawns child processes, consider terminating the whole tree (e.g., taskkill /T /F or a library like tree-kill) in the fallback, otherwise stdout/stderr handles may keep the parent alive.

(stackoverflow.com)

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 31cea4c and 525d58c.

📒 Files selected for processing (2)
  • backend/FwLite/FwLiteWeb/Program.cs (1 hunks)
  • platform.bible-extension/src/main.ts (3 hunks)
🧰 Additional context used
🪛 GitHub Actions: Platform.Bible extension CI/CD
platform.bible-extension/src/main.ts

[warning] 1-1: Code style issues found in 'src/main.ts'. Run 'prettier --write .' to fix.

⏰ 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). (4)
  • GitHub Check: frontend
  • GitHub Check: frontend-component-unit-tests
  • GitHub Check: Build FW Lite and run tests
  • GitHub Check: Analyze (csharp)
🔇 Additional comments (3)
platform.bible-extension/src/main.ts (3)

252-252: Good: register graceful cleanup instead of hard kill.

Hooking cleanup to a shutdown function is the right direction. Verify the activation host treats a rejected Promise from a disposer as a non-fatal deactivation; otherwise prefer resolving false instead of rejecting.


279-279: Stdin pipe is required here—LGTM.

Switching stdio to ['pipe','pipe','pipe'] is necessary so the backend can read the shutdown command.


1-1: Run Prettier via the package’s format script
CI flagged formatting in platform.bible-extension/src/main.ts; execute in that folder:

cd platform.bible-extension && pnpm run format

Likely an incorrect or invalid review comment.

@argos-ci
Copy link

argos-ci bot commented Sep 9, 2025

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - Nov 21, 2025, 4:20 PM

Copy link
Collaborator

@myieye myieye left a comment

Choose a reason for hiding this comment

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

LGTM 🙃 😬

@myieye
Copy link
Collaborator

myieye commented Nov 11, 2025

@copilot Please review and implement as appropriate the open suggestions from coderabbitai. So:

Copy link
Contributor

Copilot AI commented Nov 11, 2025

@myieye I've opened a new pull request, #2101, to work on those changes. Once the pull request is ready, I'll request review from you.

@myieye
Copy link
Collaborator

myieye commented Nov 21, 2025

@imnasnainaec I've implemented the AI feedback.

Would you be willing to take another look and maybe actually run it?
I haven't run the extension for a long time.

@imnasnainaec imnasnainaec marked this pull request as draft November 26, 2025 13:37
@imnasnainaec imnasnainaec self-assigned this Nov 26, 2025
Copy link
Collaborator

@imnasnainaec imnasnainaec left a comment

Choose a reason for hiding this comment

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

Waiting on paranext/paranext-core#1936 (or something equivalent).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💻 FW Lite issues related to the fw lite application, not miniLcm or crdt related 📙 Platform.Bible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants