Skip to content

prompts: verify cross-function resource cleanup - #425

Draft
OllieinCanada wants to merge 1 commit into
sashiko-dev:mainfrom
OllieinCanada:fix/124-cross-function-cleanup
Draft

prompts: verify cross-function resource cleanup#425
OllieinCanada wants to merge 1 commit into
sashiko-dev:mainfrom
OllieinCanada:fix/124-cross-function-cleanup

Conversation

@OllieinCanada

Copy link
Copy Markdown
Contributor

Fixes #124

Summary

Require Sashiko to inspect cleanup helper implementations before reporting a cross-function resource leak.

Root cause

The resource-management prompts required ownership tracking across function boundaries, but the final false-positive verification did not explicitly require opening cleanup, unwind, destroy, unregister, or release helpers. A call site could therefore appear to leak a resource even when a conditional helper released it internally.

Changes

  • inspect cleanup helper bodies and relevant callees rather than inferring behavior from names
  • evaluate the condition guarding a cleanup call on the exact candidate path
  • track the same object, field, reference, descriptor, or registration from acquisition to release
  • account for nested helpers, managed resources, ownership transfer, and subsystem unregister behavior
  • retain real findings when cleanup is bypassed, partial, applies to another resource, or cannot be verified
  • require an auditable acquisition-to-release verdict

Validation

  • confirmed the guide is always loaded during Stage 10 false-positive verification
  • cargo fmt --all -- --check
  • git diff --check
  • exact one-file cumulative diff
  • signed-off commit verified

No model-backed regression or paid API call was used.

Signed-off-by: OllieinCanada <73385593+OllieinCanada@users.noreply.github.com>
@rgushchin

Copy link
Copy Markdown
Member

This look reasonable to me, but do you have any examples or stats on how it helps in practice? Any specific false positives it helps to avoid? I strongly prefer to make prompts changes based on data.

@OllieinCanada
OllieinCanada marked this pull request as draft August 14, 2026 15:31
@OllieinCanada

Copy link
Copy Markdown
Contributor Author

I don't have aggregate stats. The source is #124, but that report doesn't include the affected patchset, code, or exact false-positive output. I agree that isn't enough evidence for a confident prompt change, so I've moved this back to draft and asked for a concrete reproducer before taking it further.

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.

Bug: False Positive in Resource Cleanup Detection

2 participants