Skip to content

Conversation

@atomaka
Copy link
Contributor

@atomaka atomaka commented Jun 7, 2025

Fixes #202

What is the purpose of this pull request?

Provide Logidze.with_meta! and Logidize.with_responsible! to attach these details permanently instead of for the duration of a block. This resolves #202 and allows the behavior outlined in #200:

console do
  Logidze.with_responsible(current_user.id)
end

It also considers feedback in the attempt from #203.

Finally, this resolves #221, although using this in web requests comes with its own risks.

What changes did you make? (overview)

In Logidze::Meta

  • New class MetaBase pulling meta stack management from MetaWrapper
  • New class MetaForConnection to manage metadata for bang methods
  • New method .with_meta! to set metadata with no implicit end
  • New method .with_responsible! to set actor id with no implicit end
  • New method .clear_meta! to explicitly clear metadata

Is there anything you'd like reviewers to focus on?

I'm not sure how I feel about this implementation so I'm happy to revisit it if there are suggestions. I believe i hit the use-cases missed in #203.

Changelog/Readme changes will be added after the approach has been established.

Checklist

  • I've added tests for this change
  • I've added a Changelog entry
  • I've updated a documentation (Readme)

@palkan
Copy link
Owner

palkan commented Oct 8, 2025

I'm not sure how I feel about this implementation

Me neither. But that's an old problem with the whole meta.rb, so let's not bother about it now.

Thanks!

@palkan palkan merged commit a6a9969 into palkan:master Oct 8, 2025
17 checks passed
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.

Meta per request Add Logidze.with_responsible! (block-less version)

2 participants