Skip to content

refactor: inline single-use _get_contract_child_storage_key - #801

Merged
anderdc merged 3 commits into
entrius:testfrom
ebios-star:refactor/inline-get-contract-child-storage-key
Apr 28, 2026
Merged

refactor: inline single-use _get_contract_child_storage_key#801
anderdc merged 3 commits into
entrius:testfrom
ebios-star:refactor/inline-get-contract-child-storage-key

Conversation

@ebios-star

Copy link
Copy Markdown
Contributor

Summary

`_get_contract_child_storage_key` in gittensor/cli/issue_commands/helpers.py was a private wrapper with exactly one caller — `_read_issues_from_child_storage` — that just added a try/except plus a verbose debug log around `get_contract_child_storage_key`.

The neighbouring `_read_contract_packed_storage` already calls `get_contract_child_storage_key` directly (without going through this wrapper), so the wrapper isn't a load-bearing abstraction. Inlining matches the pattern from #748 / #641 ("inline single-use helper into its only caller").

The inline version preserves the same behaviour:

  • Try the RPC; log `Contract info query failed: {e}` on `--verbose` when an exception is raised.
  • Treat both empty results and exceptions as "no child storage key".
  • The "Cannot read issues" debug line now includes the contract address so `gitt issues list -v` against a missing contract is easier to diagnose.

Net: -27 / +8 lines, one fewer private helper in `helpers.py`.

Related Issues

N/A — same family of cleanups as #641 / #748.

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other

Testing

  • `grep -rn _get_contract_child_storage_key` confirms no other call sites in `gittensor/`, `neurons/`, or `tests/`.
  • `uv run --extra dev pytest tests/` — all 443 tests pass. The `tests/cli/test_issues_list_json.py` suite patches at `read_issues_from_contract`, which still exercises the same code path.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Changes are documented (if applicable)

_get_contract_child_storage_key was a private wrapper with one caller —
_read_issues_from_child_storage — that just added a try/except plus a
verbose debug log around get_contract_child_storage_key.

The neighbouring _read_contract_packed_storage already calls
get_contract_child_storage_key directly, so the wrapper wasn't a
load-bearing abstraction. Inlining matches the pattern from entrius#748 / entrius#641
(remove single-use indirection).

The inline version preserves the same behaviour: try the RPC, log the
failure when --verbose, and treat both empty results and exceptions as
"no child storage key". The "Cannot read issues" debug line now includes
the contract address so a `gitt issues list -v` against a missing
contract is easier to diagnose.

Net: -27 / +8 lines; tests/cli already cover the path through
read_issues_from_contract.
@ebios-star

Copy link
Copy Markdown
Contributor Author

@anderdc @LandynDev — friendly ping for review when you have a moment.

This is the same family as #748 (which you merged) — single-use private helper inlined into its only caller. grep -rn _get_contract_child_storage_key confirms exactly one call site, no test references. -27/+8 lines, full test suite passes.

Happy to rebase if needed.

@anderdc anderdc added the refactor Code restructuring without behavior change label Apr 28, 2026
@anderdc
anderdc merged commit 1ce5460 into entrius:test Apr 28, 2026
3 checks passed
plind-junior added a commit to plind-junior/gittensor that referenced this pull request Apr 30, 2026
…lper

- Restore additional_acceptable_branches dropped during rebase (jupyterlab,
  FastGPT, monero, nextcloud/desktop, nextcloud/server, zed) — added upstream
  in entrius#831 and lost when this branch was based on a stale snapshot.
- Add entrius/das-github-mirror at weight 0.2 with trusted_label_pipeline
  (deliverable entrius#4 from issue entrius#911).
- Inline _label_actor_trusted into _resolve_maintainer_set_label per the
  codebase's single-use-helper convention (entrius#818/entrius#811/entrius#801); drop the
  now-redundant TestLabelActorTrusted truth table since coverage lives in
  TestLabelResolution end-to-end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Code restructuring without behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants