Contributing to SiriScore¶
Getting started¶
Fork the repo on GitHub, then clone your fork:
git clone https://github.com/<your-username>/siriscore.git
cd siriscore
git remote add upstream https://github.com/siri-score/siriscore.git
pip install -e ".[dev]"
Keep your fork in sync:
Branch naming¶
All PRs target the dev branch. main is release-only.
Running tests¶
Single file or test:
python3 -m pytest tests/test_heuristics.py -q
python3 -m pytest tests/test_heuristics.py::TestH2RoundAmount::test_fires_on_round_output -q
With coverage:
Linting¶
Fix automatically:
PR process¶
- Open a PR against
dev(notmain) - CI must pass (tests + ruff + wheel build)
- One approval required
- Squash-merge preferred for small changes; merge commit for large features
Adding a new heuristic¶
- Create
scorer/heuristics/hN_name.pywith a singlecheckfunction:
from scorer.report import Finding, Severity
def check(tx, psbt_meta) -> Finding | None:
# tx has: .inputs, .outputs, .version, .locktime
# psbt_meta is a dict of optional metadata
if <condition>:
return Finding(
heuristic_id="HN",
severity=Severity.WARNING,
title="Short title",
detail="What was found in this transaction.",
suggestion="What the user should do about it.",
weight=10, # penalty weight; use negative for a bonus
positive=False, # True for privacy-positive findings (H9/H10/H11)
)
return None
- Add it to
LOCAL(orNETWORKif it makes outbound calls) inscorer/heuristics/__init__.py:
- Add an entry to
_HEURISTIC_DEFSinscorer/__init__.py:
-
Add tests in
tests/test_heuristics.py— at minimum one test that fires and one that does not. -
Update the heuristics overview table in the docs.
Code owners¶
| Area | Owner |
|---|---|
scorer/heuristics/ |
open |
scorer/lookup.py |
open |
api/ |
open |
web/ |
open |
| CI / packaging | @nkatha23 |