Skip to content

minor update by agents#305

Merged
shaypal5 merged 33 commits intomasterfrom
update/agents
Jan 22, 2026
Merged

minor update by agents#305
shaypal5 merged 33 commits intomasterfrom
update/agents

Conversation

@Borda
Copy link
Copy Markdown
Contributor

@Borda Borda commented Oct 2, 2025

Ran some automatic issue fixing...

@Borda Borda requested a review from shaypal5 as a code owner October 2, 2025 09:34
@shaypal5
Copy link
Copy Markdown
Member

shaypal5 commented Nov 2, 2025

Hey @Borda , I see this is not a draft.
Is this waiting for my review?
If so:

  1. There are conflicts in tests/test_pickle_core.py that require solving.
  2. Please make sure that codecov coverage warnings are false positives, or make them go away.

Cheers!

@Borda
Copy link
Copy Markdown
Contributor Author

Borda commented Jan 1, 2026

@shaypal5 can we roll back the deployment on PR if is not needed, since it makes PR super noisy and impossible to navigate in past comments...

@Borda
Copy link
Copy Markdown
Contributor Author

Borda commented Jan 1, 2026

About the codecov, it reports too early, even before any test finishes, so for sure it will need to be fixed, but I would make it in a separate PR to keep the changes focused

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.

Comment thread src/cachier/cores/redis.py
return None

@staticmethod
def _get_raw_field(cached_data, field: str):
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

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

The static method _get_raw_field is missing a type annotation for the cached_data parameter. Based on the implementation, it should be typed as something like Dict[Union[bytes, str], Any] or a more specific type. The coding guidelines require "all new code must include full type annotations."

Copilot generated this review using guidance from repository custom instructions.
return cached_data.get(field)

@staticmethod
def _get_bool_field(cached_data, name: str) -> bool:
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

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

The static method _get_bool_field is missing a type annotation for the cached_data parameter. It should be typed consistently with _get_raw_field. The coding guidelines require "all new code must include full type annotations."

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +76 to +122
@staticmethod
def _loading_pickle(raw_value) -> Any:
"""Load pickled data with some recovery attempts."""
try:
if isinstance(raw_value, bytes):
return pickle.loads(raw_value)
elif isinstance(raw_value, str):
# try to recover by encoding; prefer utf-8 but fall
# back to latin-1 in case raw binary was coerced to str
try:
return pickle.loads(raw_value.encode("utf-8"))
except Exception:
return pickle.loads(raw_value.encode("latin-1"))
else:
# unexpected type; attempt pickle.loads directly
try:
return pickle.loads(raw_value)
except Exception:
return None
except Exception as exc:
warnings.warn(
f"Redis value deserialization failed: {exc}",
stacklevel=2,
)
return None

@staticmethod
def _get_raw_field(cached_data, field: str):
"""Fetch field from cached_data with bytes/str key handling."""
# try bytes key first, then str key
bkey = field.encode("utf-8")
if bkey in cached_data:
return cached_data[bkey]
return cached_data.get(field)

@staticmethod
def _get_bool_field(cached_data, name: str) -> bool:
"""Fetch boolean field from cached_data."""
raw = _RedisCore._get_raw_field(cached_data, name) or b"false"
if isinstance(raw, bytes):
try:
s = raw.decode("utf-8")
except Exception:
s = raw.decode("latin-1", errors="ignore")
else:
s = str(raw)
return s.lower() == "true"
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

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

The docstrings for the new static methods (_loading_pickle, _get_raw_field, _get_bool_field) do not follow numpy docstring conventions as required by the coding guidelines. Numpy-style docstrings should include sections like Parameters, Returns, and potentially Notes or Examples. For example, _loading_pickle should document the raw_value parameter, describe what it returns, and explain the recovery attempts it makes.

Copilot generated this review using guidance from repository custom instructions.
Comment thread src/cachier/core.py
Comment thread src/cachier/cores/base.py
Comment thread tests/test_pickle_core.py
Comment thread .pre-commit-config.yaml
- id: ruff
name: Ruff check
args: ["--fix"]
args: ["--fix"] #, "--unsafe-fixes"
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

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

The commented-out --unsafe-fixes argument suggests that unsafe fixes were considered but not enabled. While commenting is fine for documentation, it would be clearer to either remove the comment entirely or add an explanatory comment about why unsafe fixes are not enabled. The current inline comment without explanation may cause confusion for future maintainers.

Suggested change
args: ["--fix"] #, "--unsafe-fixes"
args: ["--fix"] # Unsafe fixes are intentionally disabled in CI; add "--unsafe-fixes" locally if you accept the risk.

Copilot uses AI. Check for mistakes.
@Borda
Copy link
Copy Markdown
Contributor Author

Borda commented Jan 3, 2026

@shaypal5 seems all is green :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants