mirror of
https://github.com/kuhyx/signal-bot.git
synced 2026-11-10 20:27:17 +01:00
Per-person photo commands, where the mechanism is public and the album is not. Nothing identifying is in this repository: who the people are, what fires their photos and which file shows whom all live in one directory outside it, and the tests, the docs and the offline e2e run use three invented people instead. Several names in one message intersect -- "!alfa beta" is a photo with both -- and where an entry offers a choice the bot picks among the readings that actually have a photo, so a question the album could answer is not refused. A combination nobody photographed gets one line rather than silence, which from the group's side is indistinguishable from a broken bot. Scoping is enforced in the dispatcher, not in the handler: a command the group is not allowed resolves to nothing, so it is not answered, not counted as a command, and never named in a log line outside its own groups. A handler that quietly returned would leak all three. Commands are named by pseudonym (pack:p1), so the journal and command_uses say somebody asked for a photo and nothing about whose. Video works: the attachment goes out as data:video/mp4;filename=...;base64, which is the container's own spelling, read off its /swagger/doc.json. Told it is a photo, Signal renders a clip as an unplayable file. tool/tagger.py serves one page on loopback to fill the album in -- names are typed into the page, never as arguments, and it prints how many photos each command would have when it stops, because a command with zero is dead on arrival. Also renames the real people who were still sitting in the stats test fixtures. They remain in the history; the point is that nothing new is added to it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017w1HZ3cZ7neL3rFdQ6VMBA
125 lines
3.5 KiB
TOML
125 lines
3.5 KiB
TOML
[project]
|
|
name = "signal-bot"
|
|
version = "0.2.0"
|
|
description = "A Signal group bot: image commands and daily message tallies."
|
|
readme = "README.md"
|
|
license = "MIT"
|
|
license-files = ["LICENSE"]
|
|
requires-python = ">=3.14"
|
|
|
|
# Exact pins, newest stable, per the dependency-freshness rule. A caret range
|
|
# is "newest-compatible" by definition and gives the freshness gate nothing to
|
|
# compare against.
|
|
dependencies = [
|
|
"fastapi==0.141.1",
|
|
"httpx==0.28.1",
|
|
"python-dotenv==1.2.3",
|
|
"PyYAML==6.0.3",
|
|
"uvicorn==0.52.4",
|
|
"websockets==17.1",
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
dev = [
|
|
"mypy==2.3.1",
|
|
"pre-commit==4.6.2",
|
|
"pytest==9.1.1",
|
|
"pytest-asyncio==1.4.0",
|
|
"pytest-cov==7.1.0",
|
|
"ruff==0.16.5",
|
|
"types-PyYAML==6.0.12.20260815",
|
|
]
|
|
|
|
[project.scripts]
|
|
signal-bot = "signal_bot.__main__:main"
|
|
|
|
[build-system]
|
|
requires = ["setuptools==84.0.0"]
|
|
build-backend = "setuptools.build_meta"
|
|
|
|
[tool.setuptools]
|
|
packages = ["signal_bot", "fake_signal"]
|
|
|
|
# ============================================================================
|
|
# RUFF
|
|
# ============================================================================
|
|
[tool.ruff]
|
|
target-version = "py314"
|
|
line-length = 100
|
|
|
|
[tool.ruff.lint]
|
|
select = ["ALL"]
|
|
ignore = [
|
|
"D203", # conflicts with D211, we use D211
|
|
"D213", # conflicts with D212, we use D212
|
|
"COM812", # formatter owns trailing commas
|
|
"ISC001", # formatter may create implicit string concatenation
|
|
]
|
|
fixable = ["ALL"]
|
|
|
|
# Verified empirically, not copied: with this block removed, ruff reports
|
|
# exactly these four rules across tests/ and nothing else. SLF001 was in
|
|
# the original list and fired zero times, so it is gone.
|
|
[tool.ruff.lint.per-file-ignores]
|
|
"tests/**/*.py" = [
|
|
"ARG", # fixture and mock params exist for their side effect
|
|
"D", # test names are the documentation
|
|
"PLR2004", # `assert count == 2` beats a named constant
|
|
"S101", # assert IS what tests do
|
|
]
|
|
|
|
[tool.ruff.lint.pylint]
|
|
# The test envelope builder takes 7 keyword-only fields, one per envelope
|
|
# attribute. Splitting it into a dataclass would only move the count.
|
|
max-args = 7
|
|
|
|
[tool.ruff.lint.pydocstyle]
|
|
convention = "google"
|
|
|
|
[tool.ruff.lint.flake8-quotes]
|
|
docstring-quotes = "double"
|
|
inline-quotes = "double"
|
|
|
|
[tool.ruff.lint.flake8-tidy-imports]
|
|
ban-relative-imports = "all"
|
|
|
|
[tool.ruff.format]
|
|
quote-style = "double"
|
|
docstring-code-format = true
|
|
|
|
# ============================================================================
|
|
# MYPY
|
|
# ============================================================================
|
|
[tool.mypy]
|
|
python_version = "3.14"
|
|
strict = true
|
|
warn_unreachable = true
|
|
disallow_any_explicit = false
|
|
|
|
# ============================================================================
|
|
# PYTEST / COVERAGE
|
|
# ============================================================================
|
|
[tool.pytest.ini_options]
|
|
testpaths = ["tests"]
|
|
asyncio_mode = "auto"
|
|
asyncio_default_fixture_loop_scope = "function"
|
|
addopts = [
|
|
"--cov=signal_bot",
|
|
"--cov=fake_signal",
|
|
"--cov-branch",
|
|
"--cov-report=term-missing",
|
|
"--cov-fail-under=100",
|
|
"--strict-markers",
|
|
]
|
|
|
|
[tool.coverage.run]
|
|
branch = true
|
|
# No omits. Every line of both packages is covered by tests.
|
|
|
|
[tool.coverage.report]
|
|
# No "pragma: no cover" escape hatch: nothing in this repo uses one, and
|
|
# leaving the pattern configured is an invitation to hide code from the
|
|
# 100% gate later. TYPE_CHECKING bodies are genuinely never executed.
|
|
exclude_lines = ["if TYPE_CHECKING:"]
|
|
show_missing = true
|