Skip to content

refactor(bootstrap): remove redundant stopping flag - #1909

Merged
jerome-benoit merged 2 commits into
mainfrom
refactor/bootstrap-remove-stopping-flag
Jun 17, 2026
Merged

jerome-benoit merged 2 commits into
mainfrom
refactor/bootstrap-remove-stopping-flag

Conversation

@jerome-benoit

Copy link
Copy Markdown
Contributor

Summary

  • Remove the redundant Bootstrap.stopping field and assignments.
  • Keep stopPromise as the single in-flight stop guard.
  • Update the lifecycle test wording to describe the current stop-in-flight behavior.

Rationale

Bootstrap.stop() now coalesces concurrent stop callers through stopPromise. The stopping flag was still written during doStop(), but no production code read it anymore.

Verification

  • lsp_diagnostics on src/charging-station/Bootstrap.ts
  • lsp_diagnostics on tests/charging-station/Bootstrap.test.ts
  • pnpm exec tsx --test tests/charging-station/Bootstrap.test.ts
  • pnpm typecheck
  • pnpm lint
  • GIT_MASTER=1 git diff --check

@hyperspace-pr-bot

Copy link
Copy Markdown
Contributor

Summary

The following content is AI-generated and provides a summary of the pull request:


Refactor: Remove Redundant stopping Flag from Bootstrap

♻️ Refactor: Eliminates the now-unused stopping boolean field from Bootstrap, relying solely on stopPromise as the single in-flight stop guard.

Changes

  • src/charging-station/Bootstrap.ts:

    • Removed the stopping: boolean field declaration.
    • Removed the this.stopping = false initialization in the constructor.
    • Removed the try/finally block in doStop() that set this.stopping = true on entry and this.stopping = false on exit — the body is now unwrapped directly since stopPromise already handles concurrent stop coalescing.
  • tests/charging-station/Bootstrap.test.ts:

    • Removed the stopping: boolean field from the BootstrapInternal interface.
    • Removed instance.stopping = false initialization in buildLifecycleTestInstance.
    • Updated test description from 'Bootstrap.stop while stopping logs at debug' to 'Bootstrap.stop while stop is in flight logs at debug' to better reflect the stopPromise-based behavior.

  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.25.0

  • Event Trigger: pull_request.opened
  • Correlation ID: 9103fb08-5d4e-43ff-9ee1-95e91afb0de1
  • Summary Prompt: Default Prompt
  • Output Template: Default Template
  • LLM: anthropic--claude-4.6-sonnet
  • File Content Strategy: Full file content

@hyperspace-pr-bot hyperspace-pr-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The PR removes the try/finally guard from doStop along with the now-redundant stopping flag, but this leaves a correctness hole: if any await in doStop rejects, this.started is never reset to false, leaving the instance in a permanently inconsistent state on error paths. The same try/finally pattern is still correctly used in doStart and should be preserved in doStop as well.

PR Bot Information

Version: 1.25.0

Comment thread src/charging-station/Bootstrap.ts Resolved
@jerome-benoit
jerome-benoit force-pushed the refactor/bootstrap-remove-stopping-flag branch from aad09e4 to 58c7a40 Compare June 17, 2026 00:53
@jerome-benoit
jerome-benoit merged commit 11aac65 into main Jun 17, 2026
44 checks passed
@jerome-benoit
jerome-benoit deleted the refactor/bootstrap-remove-stopping-flag branch October 29, 2026 23:47
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.

1 participant