DevWeave logoDevWeave
CommunitiesDiscoverHelp ForumFeaturesWhy DevWeaveAI & Verification
Log inGet started
Back to Issue Discovery
niyazmft/zulip-hermes-integration #313openPythonPython

chore(zulip): remove dead code and fix mechanical hygiene smells

Opened by @niyazmft · Assignees: None

View on GitHub
help wantedgood first issue

Solve & Merge Reward: Up to +210 XP & +60 Coins

+30 XP on PR open · +180 XP & +60 coins on merge

14 GitHub Stars

Claim Status & GitHub Signal

Unassigned with 0 comments. Open the workspace to inspect linked PRs before claiming or coding.

AI Issue Assessment · Grounded Analyzer
2.8 / 10 · 3–4 · Beginner

Estimated from issue labels (help wanted, good first issue), Python context, and discussion depth. No comments are posted yet, so check repository conventions carefully. Note: this is an estimate, not a guarantee.

What It's About

chore(zulip): remove dead code and fix mechanical hygiene smells. Summary Mechanical cleanup across five files. No behaviour change; each item is independent and can be reviewed as its own commit in one PR. Items 1. zulip/connection.py:296–297 — duplicated statement The same assignment is written twice, back to back. Delete

Why It Matters

Resolving #313 improves reliability and developer experience in niyazmft/zulip-hermes-integration.

Expected Outcome

A focused pull request addressing #313 with relevant checks or tests verified locally.

Skill Match Breakdown

Log in to compare this issue's requirements against your profile skills. Required concepts: Python, Testing & pytest, HTTP & REST APIs, Git & Collaboration, CLI & Shell, Object-Oriented Design.

Progressive AI Hints

Hint #1 is always free and calibrated to your experience level. Extra hints unlock with coins without spoiling the full solution.

Log in to receive your free level-adapted Hint #1 grounded in this repository's files.

Skill-Gap Learning

Gap-Targeted
Learn Git

Branching, commits, rebasing, and collaborative Git workflows.

Addresses skill gap: Git & Collaboration

Learn Linux

Shell navigation, process inspection, pipes, and CLI debugging.

Addresses skill gap: CLI & Shell

Learn Code in Python

Core Python syntax, functions, control flow, and debugging basics.

Addresses skill gap: Python

Hands-On CodeCrafters Practice
Skill-Gap Challenge
Build your own Shell
Python

Parse commands, manage PATH lookups, pipes, and process execution.

Practice skill gap: Python

Build your own HTTP Server
Python

Handle raw TCP connections, HTTP parsing, headers, and concurrent routes.

Practice skill gap: Python

Issue Description

Summary

Mechanical cleanup across five files. No behaviour change; each item is independent and can be reviewed as its own commit in one PR.

Items

1. zulip/connection.py:296–297 — duplicated statement

bot_user_id = str(probe_result.get("bot", {}).get("id", ""))
bot_user_id = str(probe_result.get("bot", {}).get("id", ""))

The same assignment is written twice, back to back. Delete the second line.

2. zulip/updater.py — dead scaffolding + scattered imports

  • _GITHUB_PINNED_FINGERPRINTS: set[str] = set() (line 47) — empty, never read.
  • _verify_github_cert(...) (line 55) — defined, never called.
  • _PinnedHTTPSHandler (line 73) + urllib.request.install_opener(...) (lines 81–82) — installs a global opener that is no stricter than the default and runs at import time as a side effect. Delete the class and the install_opener call.
  • Duplicate imports: from dataclasses import dataclass appears at line 22 and line 282; from typing import Optional at line 24 and line 432. Consolidate to the top of the file.

Reference: the module's own docstring and tests/test_updater.py / tests/test_release_notes.py cover the update path — confirm the suite still passes after removal.

3. zulip/audit_logger.py:59 — undefined type annotation

self._write_queue: asyncio_lock = None  # type: ignore

asyncio_lock is not an imported name. Change the annotation to Optional[asyncio.Lock] and import asyncio / Optional at the top. The # type: ignore goes away.

4. zulip/commands.py:24 and zulip/policy.py:21 — logger idiom

logger = __import__("logging").getLogger(__name__)

Every other module in the package uses:

import logging
logger = logging.getLogger(__name__)

Switch these two to match. No functional difference.

5. zulip/text_utils.py — dead code reachable only from tests

  • convert_markdown_tables (line 295) and _format_zulip_table (line 339) — no production caller.
  • _chunk_markdown_text (line 134) and the if mode == "markdown": branch in chunk_text (line 83) — resolve_chunk_config() in zulip/settings.py only ever produces "length" / "newline", so "markdown" mode is unreachable in production.

Remove these and their tests in tests/test_text_utils.py (the markdown-table tests and the markdown-chunking tests). Note in the PR body that this is a deliberate dead-code removal; the repo rule is "git history has it."

Acceptance

  • python3 -m pytest tests/test_updater.py tests/test_release_notes.py tests/test_text_utils.py -q green
  • Full suite green; bash .githooks/pre-push regenerates checksums.txt with no re-run diff
  • rg -n "_verify_github_cert|_GITHUB_PINNED_FINGERPRINTS|_PinnedHTTPSHandler|install_opener|asyncio_lock|convert_markdown_tables|_format_zulip_table|_chunk_markdown_text" zulip/ returns nothing

Reference

  • CONTRIBUTING.md § "Rules That Bite" (esp. #3 checksums) and § "Commit Messages".

Linked Pull Requests (0)

No linked or cross-referenced pull requests detected via GitHub timeline. Check comments below for informal claims before starting.

GitHub Comments (0)

No comments on this issue yet.

Peer Help Forum · niyazmft/zulip-hermes-integration #313

Issue Troubleshooting Threads (0)

Ask Peers for Help

No troubleshooting threads opened for this issue yet. If you hit a test, build, or navigation blocker, post what you've tried so fellow contributors can help.

PR Verification & Rewards

Sign in and link GitHub to verify your PR against this issue and earn XP + coins.

Sign In

Contribution Workflow

Track your local progress before opening a pull request on GitHub.

Repository Context

Top Repository Paths

.env.example
[dir] .githooks
.githooks/pre-push
[dir] .github
.github/BRANCH_PROTECTION.md
.github/CODEOWNERS
[dir] .github/ISSUE_TEMPLATE
.github/ISSUE_TEMPLATE/bug_report.yml
.github/ISSUE_TEMPLATE/feature_request.yml
.github/ISSUE_TEMPLATE/question.yml
.github/PULL_REQUEST_TEMPLATE.md
.github/release.yml
[dir] .github/workflows
.github/workflows/ci.yml
.gitignore
.gitleaks.toml
AGENTS.md
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
README.md
SECURITY.md
SUPPORT.md

CONTRIBUTING.md Excerpt

Contributing

Thanks for taking the time to contribute. This document covers development setup, the checks CI will run on your PR, and the handful of repo-specific rules that are easy to trip over.

Table of Contents

  • Development Setup
  • Project Layout
  • Rules That Bite
  • Testing
  • Documentation Claims Are Tested
  • Commit Messages
  • Pull Request Process
  • Release Process

Development Setup

  1. Fork and clone:

    git clone https://github.com/YOUR_USERNAME/zulip-hermes-integration.git
    cd zulip-hermes-integration
    
  2. Install dependencies (Python 3.10+; CI runs the suite on 3.12):

    python3 -m pip install -r requirements.txt
    
  3. Install the pre-push hook:

    bash scripts/setup-hooks.sh
    

    This points core.hooksPath at .githooks. The hook regenerates checksums.txt and runs py_compile, the plugin.yaml parse and the full test suite before any push, mirroring the fast CI job. To bypass it in an emergency, push with --no-verify (not recommended).

  4. Verify:

    bash .githooks/pre-push
    

What CI runs, and how to run it yourself

Local commandCI
bash .githooks/pre-pushthe fast zulip-bridge job: checksums.txt freshness, py_compile, plugin.yaml, pytest
pip-audit -r requirements.txtthe fast job's dependency audit
gitleaks dir . (or git .)the fast job's secret scan; tuned by .gitleaks.toml
python3 scripts/check_compat.pythe compat matrix legs — see Testing
python3 scripts/parity_check.pynothing — the parity workflow was removed (#229); this is manual

The fast job is the required status check. It runs for documentation-only PRs too, because the doc claims are tested. The compat matrix is shaped so it can be a required check as well (issue #241): it always starts and always reports, and only its work is skipped for docs-only changes, because a required check that is skipped at the job level never reports and would leave such a PR permanently unmergeable.


Project Layout

zulip/            the plugin package — one module per concern

... (truncated)

Advisory PR Assistant

Helps structure your PR description or unpack reviewer feedback. Does not perform GitHub actions.