Skip to content

fix: dont upsert for ensure if missing#4615

Merged
MasterPtato merged 1 commit intomainfrom
04-12-fix_dont_upsert_for_ensure_if_missing
Apr 13, 2026
Merged

fix: dont upsert for ensure if missing#4615
MasterPtato merged 1 commit intomainfrom
04-12-fix_dont_upsert_for_ensure_if_missing

Conversation

@MasterPtato
Copy link
Copy Markdown
Contributor

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my 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
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copy link
Copy Markdown
Contributor Author

MasterPtato commented Apr 12, 2026

This was referenced Apr 12, 2026
@claude
Copy link
Copy Markdown

claude bot commented Apr 12, 2026

PR Review: fix: dont upsert for ensure if missing

Status: Merged — bug still present, follow-up needed.

Critical bug: inverted condition in ensure_normal_if_missing.rs

The condition on line 23 is inverted and was merged as-is:

if !pool_res.is_empty() {  // upserts when config EXISTS — wrong
    ctx.op(upsert::Input { ... }).await?;
}

pool_res holds existing runner configs returned by the get op. So !pool_res.is_empty() is true when the config is already present, meaning this function now upserts (and overwrites with defaults) when a config exists, and does nothing when it is missing. That is the opposite of what the function name and docstring promise.

The fix is a one-character change:

if pool_res.is_empty() {  // upsert only when config is missing
    ctx.op(upsert::Input { ... }).await?;
}

A follow-up PR is needed to correct this.


Stale doc comment

The doc comment still says "Returns true when the config was created" but the return type is Result<()>, not Result<bool>. This should be removed.


envoy.rs simplification — looks correct

Removing the has_actors early-exit branch is safe: join_all on an empty Vec resolves immediately, so ToEnvoyMessage::Stop is sent without delay when there are no active actors. The logic is equivalent and simpler.

handle.rs — cosmetic whitespace, no concerns.

@MasterPtato MasterPtato force-pushed the 04-12-fix_dont_upsert_for_ensure_if_missing branch from f94f435 to 896a1bb Compare April 13, 2026 00:20
@MasterPtato MasterPtato force-pushed the 04-12-fix_envoy_require_runner_config_for_ws_conn branch from 5671fec to 6b3850b Compare April 13, 2026 00:20
Copy link
Copy Markdown
Contributor Author

MasterPtato commented Apr 13, 2026

Merge activity

  • Apr 13, 12:21 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Apr 13, 12:42 AM UTC: Graphite rebased this pull request as part of a merge.
  • Apr 13, 12:42 AM UTC: @MasterPtato merged this pull request with Graphite.

@MasterPtato MasterPtato changed the base branch from 04-12-fix_envoy_require_runner_config_for_ws_conn to graphite-base/4615 April 13, 2026 00:39
@MasterPtato MasterPtato changed the base branch from graphite-base/4615 to main April 13, 2026 00:40
@MasterPtato MasterPtato force-pushed the 04-12-fix_dont_upsert_for_ensure_if_missing branch from 896a1bb to c42c359 Compare April 13, 2026 00:41
@MasterPtato MasterPtato merged commit a0ffbcd into main Apr 13, 2026
5 of 7 checks passed
@MasterPtato MasterPtato deleted the 04-12-fix_dont_upsert_for_ensure_if_missing branch April 13, 2026 00:42
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