Skip to content

Conversation

@0xDEC0DE
Copy link
Contributor

Make the MemoryBackend behave like the others, and stop removing keys from the initialization dict.

Fixes: Issue #273

Copy link
Member

@zzzeek zzzeek left a comment

Choose a reason for hiding this comment

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

so I'm a little curious what the use case to add non-consumed keys to the argument dictionary is, but at the same time it's clear the other backends have explicit code to prevent them from mutating the given dictionary so this patch is mostly about getting explicit test coverage for that, so let's do that with explicit tests. thanks for the PR

backend = backend_cls(arguments)
# Fail the test if the parameters have been altered by the backend
# setup; the results in such cases should be considered suspect
if arguments != stashed:
Copy link
Member

Choose a reason for hiding this comment

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

I played with this a bit and in pytest it produces an ERROR rather than FAILURE. I think this would be better done in an explicit test with a few scenarios:

  1. arguments that we know are consumed, remain in the dictionary
  2. arguments that we know are not consumed, remain in the dictionary
  3. no new keys are added to the dictionary

these tests would be added to _GenericBackendTestSuite.

Copy link
Member

Choose a reason for hiding this comment

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

I was proposing new tests be added here to _GenericBackendTestSuite, which I dont see in the PR here. These can be added to the PR, dont worry about gerrit

@zzzeek zzzeek requested a review from sqla-tester August 14, 2025 13:47
Copy link
Collaborator

@sqla-tester sqla-tester left a comment

Choose a reason for hiding this comment

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

OK, this is sqla-tester setting up my work on behalf of zzzeek to try to get revision 759dc77 of this pull request into gerrit so we can run tests and reviews and stuff

@sqla-tester
Copy link
Collaborator

New Gerrit review created for change 759dc77: https://gerrit.sqlalchemy.org/c/sqlalchemy/dogpile.cache/+/6084

@0xDEC0DE
Copy link
Contributor Author

so I'm a little curious what the use case to add non-consumed keys to the argument dictionary is, but at the same time it's clear the other backends have explicit code to prevent them from mutating the given dictionary so this patch is mostly about getting explicit test coverage for that, so let's do that with explicit tests. thanks for the PR

The use case is pedestrian enough that I'm shocked it hasn't ever come up: I have a library that uses dogpile.cache, and cheerfully pass through any/all dogpile.cache configs that exist in my library's config object. If configured to use dogpile.cache.memory with a cache_dict arg defined, it quietly eats part of my library's config object, which is sub-wonderful.

I currently have a guard against this behavior in place, but it seems like mutating inputs for no discernible reason should be frowned upon, at a minimum.

As for the workflow going forward, I am mildly confused. A robot appears to have migrated this into Gerrit (I used to work on OpenStack! I love and miss Gerrit!) but all of the comments still appear to be over here, and I don't have rights to see the Jenkins results over there. Do I push changes here, and they sync, or do I pivot to git review, or... ?

@zzzeek
Copy link
Member

zzzeek commented Aug 15, 2025

right so it's complicated

short answer, leave the comments here, just work w/ the PR like nothing is going on.

jenkins and now gerrit are behind a password because we have swarm bots crawling them and crashing my server (they are both heavy java VMs and can't serve requests that fast without pushing the load to 35). I'm going to see if cloudflare or something can fix this

@zzzeek
Copy link
Member

zzzeek commented Aug 15, 2025

the suites that failed are:

tox -e pep484

and

tox -e pep8

for the latter one I'd install pre-commit which will do the checks before you commit

@zzzeek
Copy link
Member

zzzeek commented Aug 15, 2025

jenkins and gerrit should be open now

0xDEC0DE added a commit to 0xDEC0DE/dogpile.cache that referenced this pull request Aug 16, 2025
Make the `MemoryBackend` behave like the others, and stop removing keys from the initialization dict.

Fixes: Issue sqlalchemy#273

Closes: sqlalchemy#274
Pull-request: sqlalchemy#274
Pull-request-sha: 759dc77

Change-Id: Ifd3f0d88b18a73a0ce287e1a514a6268daf157c4
@0xDEC0DE
Copy link
Contributor Author

0xDEC0DE commented Aug 16, 2025

jenkins and gerrit should be open now

Jenkins is accessible, but your Gerrit SSH endpoint seems unhappy (web UI works fine). I'll try pushing here to see if it works itself out.

0xDEC0DE added a commit to 0xDEC0DE/dogpile.cache that referenced this pull request Aug 16, 2025
Make the `MemoryBackend` behave like the others, and stop removing keys from the initialization dict.

Drive-by: fix some PEP8 and PEP484 errors in unrelated files

Fixes: Issue sqlalchemy#273

Closes: sqlalchemy#274
Pull-request: sqlalchemy#274
Pull-request-sha: 759dc77

Change-Id: Ifd3f0d88b18a73a0ce287e1a514a6268daf157c4
@zzzeek
Copy link
Member

zzzeek commented Aug 16, 2025

jenkins and gerrit should be open now

Jenkins is accessible, but your Gerrit SSH endpoint seems unhappy (web UI works fine). I'll try pushing here to see if it works itself out.

ive moved the ssh endpoint to ssh.gerrit.sqlalchemy.org

@zzzeek zzzeek requested a review from sqla-tester August 16, 2025 13:24
Copy link
Collaborator

@sqla-tester sqla-tester left a comment

Choose a reason for hiding this comment

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

OK, this is sqla-tester setting up my work on behalf of zzzeek to try to get revision d3128bf of this pull request into gerrit so we can run tests and reviews and stuff

@zzzeek zzzeek requested a review from sqla-tester August 16, 2025 13:28
Copy link
Collaborator

@sqla-tester sqla-tester left a comment

Choose a reason for hiding this comment

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

OK, this is sqla-tester setting up my work on behalf of zzzeek to try to get revision d3128bf of this pull request into gerrit so we can run tests and reviews and stuff

@zzzeek zzzeek self-requested a review August 16, 2025 13:30
@zzzeek
Copy link
Member

zzzeek commented Aug 16, 2025

sorry for the troubles, we had to put gerrit behind cloudflare because bots were bringing the server down, so now we're juts hitting all the problems w that

@sqla-tester
Copy link
Collaborator

Michael Bayer (zzzeek) wrote:

when flake8 and friends have updates, things break. we could of course pin the versions but then we'd never upgrade it, so ill push fixes for whatever it is and you can rebase.

not sure who knows/doesnt but gerrit /jenkins should be fully accessible now, the worst you should get is a cloudflare clickthrough page maybe but probably/hopefully not.

View this in Gerrit at https://gerrit.sqlalchemy.org/c/sqlalchemy/dogpile.cache/+/6084

Copy link
Collaborator

@sqla-tester sqla-tester left a comment

Choose a reason for hiding this comment

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

Michael Bayer (zzzeek) wrote:

lets:

  1. rebase on main, I've fixed pep8/pep484
  2. revert the fixes for pep8/pep484 which are addressed by main
  3. make the remaining changes from my gh review in the test suite (dont cause setup errors, add dedicated all-backend test for dictionary not mutated)

View this in Gerrit at https://gerrit.sqlalchemy.org/c/sqlalchemy/dogpile.cache/+/6084

@sqla-tester
Copy link
Collaborator

Michael Bayer (zzzeek) wrote:

Done

View this in Gerrit at https://gerrit.sqlalchemy.org/c/sqlalchemy/dogpile.cache/+/6084

Make the `MemoryBackend` behave like the others, and stop removing keys from the initialization dict.

Fixes: Issue sqlalchemy#273

Closes: sqlalchemy#274
Pull-request: sqlalchemy#274
Pull-request-sha: 759dc77

Change-Id: Ifd3f0d88b18a73a0ce287e1a514a6268daf157c4
Copy link
Collaborator

@sqla-tester sqla-tester left a comment

Choose a reason for hiding this comment

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

Nicolas Simonds (0xDEC0DE) wrote:

The Gerrit SSH server claims I don't have write permission to push changes, but it's been a minute since I've used the Gerrit workflow, and I've likely forgotten the correct steps. I just shoved the changes into Github, since you appear to have the needed automation to sync things up, and that appears to work.

Sorry for all the noise and drama, I just wanted to give you a simple little fix! 😄

View this in Gerrit at https://gerrit.sqlalchemy.org/c/sqlalchemy/dogpile.cache/+/6084

  • dogpile/cache/backends/memcached.py (line 21): Done
  • dogpile/cache/region.py (line 820): Done
  • dogpile/testing/fixtures.py (line 39): Done

@zzzeek
Copy link
Member

zzzeek commented Aug 17, 2025

right you dont have gerrit write perms, it's a closed server. we dont make people learn gerrit we just synchronize their commits from their PR to our own gerrit server. i mean if you were contributing a lot, we could set you up with gerrit access, but it's just this one PR for now.

@zzzeek zzzeek requested a review from sqla-tester August 17, 2025 20:31
Copy link
Collaborator

@sqla-tester sqla-tester left a comment

Choose a reason for hiding this comment

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

OK, this is sqla-tester setting up my work on behalf of zzzeek to try to get revision b893879 of this pull request into gerrit so we can run tests and reviews and stuff

@sqla-tester
Copy link
Collaborator

Patchset b893879 added to existing Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/dogpile.cache/+/6084

@zzzeek zzzeek mentioned this pull request Aug 18, 2025
@CaselIT
Copy link
Member

CaselIT commented Aug 21, 2025

this seems now a subset of #270

@zzzeek
Copy link
Member

zzzeek commented Aug 22, 2025

OK, still waiting for generic tests so if #270 can add this, will transfer this to that one

@0xDEC0DE
Copy link
Contributor Author

This now looks to be superseded by #270 and #275, which both solve this problem as a side-effect of how they are doing things. Closing this one rather than making things confusing.

@0xDEC0DE 0xDEC0DE closed this Aug 24, 2025
@0xDEC0DE 0xDEC0DE deleted the issue/273 branch August 24, 2025 17:13
@0xDEC0DE 0xDEC0DE mentioned this pull request Aug 24, 2025
@zzzeek
Copy link
Member

zzzeek commented Aug 30, 2025

I want this general fix in so I'm going to finish it up now

@zzzeek
Copy link
Member

zzzeek commented Aug 30, 2025

(another win for gerrit I still have your code! :) )

@sqla-tester
Copy link
Collaborator

Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/dogpile.cache/+/6084 has been merged. Congratulations! :)

sqlalchemy-bot pushed a commit that referenced this pull request Aug 30, 2025
Make the `MemoryBackend` behave like the others, and stop removing keys
from the initialization dict.

Fixes: #273
Closes: #274
Pull-request: #274
Pull-request-sha: b893879

Change-Id: Ifd3f0d88b18a73a0ce287e1a514a6268daf157c4
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.

4 participants