{
 "number": 36497,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/36497",
 "title": "test: Add coverage for TorControl `SAFECOOKIE` authentication",
 "author": "winterrdog",
 "author_association": "CONTRIBUTOR",
 "created_at": "2026-10-10T19:04:19Z",
 "updated_at": "2026-10-31T05:14:15Z",
 "description_hash": "13d6d85ba88ae34a",
 "age_days": 22,
 "draft": false,
 "labels": [
  "Tests"
 ],
 "milestone": null,
 "base": "master",
 "head_sha": "6827006f4f0d144248244731e75191bf203e1dd6",
 "head_ref": "test/torcontrol-safecookie-auth",
 "head_repo": "winterrdog/bitcoin",
 "head_history": [],
 "additions": 206,
 "deletions": 0,
 "changed_files": 1,
 "commit_count": 1,
 "size_bucket": "M",
 "mergeable_state": "clean",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {
    "ack": [
     {
      "login": "jpk68",
      "url": "https://github.com/bitcoin/bitcoin/pull/36497#issuecomment-6281552302"
     }
    ],
    "concept_ack": [
     {
      "login": "mercie-ux",
      "url": "https://github.com/bitcoin/bitcoin/pull/36497#issuecomment-6327384742"
     }
    ]
   },
   "conflicts": []
  }
 },
 "acks_parsed": {
  "jpk68": {
   "kind": "ack",
   "hash": "6827006f4f0d144248244731e75191bf203e1dd6",
   "t": "2026-10-20T01:59:10Z",
   "stale": false
  },
  "mercie-ux": {
   "kind": "concept_ack",
   "hash": "6827006f4f",
   "t": "2026-10-21T21:53:40Z",
   "stale": false
  }
 },
 "acks_tally": {
  "ack": 1,
  "stale_ack": 0,
  "concept_ack": 1,
  "approach_ack": 0,
  "nack": 0,
  "concept_nack": 0,
  "approach_nack": 0
 },
 "reviews": {
  "approved": 0,
  "changes_requested": 0,
  "distinct_reviewers": [
   "jpk68",
   "mercie-ux"
  ]
 },
 "signals": {
  "needs_rebase": false,
  "ci_failed": false,
  "mergeable_state": "clean",
  "last_author_activity": "2026-10-10T19:15:38Z",
  "last_reviewer_activity": "2026-10-21T21:53:40Z",
  "last_reviewer": "mercie-ux",
  "author_silent_days": 22,
  "waiting_on_author_days": 11,
  "days_since_update": 1
 },
 "refs": {
  "mentioned": [
   35292
  ],
  "depends_on": [],
  "fixes": [],
  "linked_issues": [],
  "references": [
   {
    "number": 35292,
    "type": "pull",
    "state": "open",
    "merged": false,
    "merged_at": null,
    "title": "test: Add coverage for Tor control `HASHEDPASSWORD` authentication"
   }
  ],
  "conflicts": []
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [],
 "body": "adds functional test coverage for `SAFECOOKIE` authentication, including\nsuccessful authentication, `AUTHCHALLENGE` failure, an invalid server\nnonce, a mismatched server hash, an invalid-length cookie file, and a\nmissing cookie file\n\nwhile working on #35292, i realised we did not have coverage for\n`SAFECOOKIE` authentication either, so i added it here",
 "commits": [
  {
   "sha": "6827006f4f0d144248244731e75191bf203e1dd6",
   "date": "2026-10-10T14:36:07Z",
   "message": "test: Add coverage for TorControl `SAFECOOKIE` authentication\n\nTest successful authentication and failures caused by an unsuccessful\n`AUTHCHALLENGE`, an invalid server nonce or hash, and a missing or\ninvalid-length cookie file."
  }
 ],
 "timeline": [
  {
   "t": "2026-10-10T19:15:38Z",
   "kind": "comment",
   "who": "winterrdog",
   "assoc": "CONTRIBUTOR",
   "text": "### \"Targeted\" Test Coverage Improvements\n| Scope | Metric | Before (merge-base at cf80493e2367786ce9946c522eb8313a52c90557) | After (PR `HEAD`) | Change |\n|---|---|---|---|---|\n| `src/torcontrol\\.cpp$` | Lines | 71.7% (281/392) | 81.9% (321/392) | +10.2 pp (+40 lines) |\n| `src/torcontrol\\.cpp$` | Functions | 88.9% (24/27) | 96.3% (26/27) | +7.4 pp (+2 funcs) |\n| `src/torcontrol\\.cpp$` | Branches | 39.7% (265/668) | 47.9% (320/668) | +8.2 pp (+55 branches) |\n\nto get these results, i only ran `feature_torcontrol.py` before and after the\nchange on the same build, using GCC's coverage instrumentation and lcov\n`2.0`\n\nbash script used to get test coverage locally\n\n```sh\n# 1. compile once with coverage baked in\ncmake -B build -DCMAKE_BUILD_TYPE=Coverage\ncmake --build build -j$(nproc)\n\n# 2. BEFORE: run the merge-base version of the test file\ngit checkout $(git merge-base HEAD master) -- test/functional/feature_torcontrol.py\nfind build -name '*.gcda' -delete\npython3 test/functional/feature_torcontrol.py --configfile=build/test/config.ini\nlcov --capture --directory build --gcov-tool gcov-$(gcc -dumpversion | cut -d. -f1) \\\n     --rc branch_coverage=1 --ignore-errors inconsistent,mismatch,unused,negative \\\n     --output-file base.info\n\n# 3. AFTER: run the PR version of the test file\ngit checkout HEAD -- test/functional/feature_torcontrol.py\nfind build -name '*.gcda' -delete\npython3 test/functional/feature_torcontrol.py --configfile=build/test/config.ini\nlcov --capture --directory build --gcov-tool gcov-$(gcc -dumpversion | cut -d. -f1) \\\n     --rc branch_coverage=1 --ignore-errors inconsistent,mismatch,unused,negative \\\n     --output-file after.info\n\n# 4. keep only the file under test, then build the HTML report\nlcov --extract base.info  '*/src/torcontrol.cpp' --rc branch_coverage=1 -o base_tor.info\nlcov --extract after.info '*/src/torcontrol.cpp' --rc branch_coverage=1 -o after_tor.info\ngenhtml after_tor.info --baseline-file base_tor.info --branch-coverage -o cov_diff\n\n## DONE...\n\n# opens the system's default browser on linux. on other systems, just open the\n# differential coverage report (./cov_diff/index.html) in your browser of choice\nxdg-open cov_diff/index.html\n```",
   "id": "c:6101212829",
   "url": "https://github.com/bitcoin/bitcoin/pull/36497#issuecomment-6101212829",
   "hash": "678e9973369ca228",
   "edited": null
  },
  {
   "t": "2026-10-20T01:59:10Z",
   "kind": "comment",
   "who": "jpk68",
   "assoc": "CONTRIBUTOR",
   "text": "ACK 6827006f4f0d144248244731e75191bf203e1dd6",
   "id": "c:6281552302",
   "url": "https://github.com/bitcoin/bitcoin/pull/36497#issuecomment-6281552302",
   "hash": "498cd52794a66a4e",
   "edited": null
  },
  {
   "t": "2026-10-21T21:53:40Z",
   "kind": "comment",
   "who": "mercie-ux",
   "assoc": "CONTRIBUTOR",
   "text": "Concept ACK 6827006f4f\n\nI introduced a few changes in `torcontrol.cpp` skipping the ServerHash comparison, dropping the ServerNonce length check, using the wrong key for the client hash and accepting any cookie length, all of this pass on master and fail on this branch, so the new tests catch them.",
   "id": "c:6327384742",
   "url": "https://github.com/bitcoin/bitcoin/pull/36497#issuecomment-6327384742",
   "hash": "4ea166fd2aef80fa",
   "edited": null
  }
 ],
 "labels_log": [
  {
   "t": "2026-10-10T19:04:23Z",
   "action": "labeled",
   "label": "Tests",
   "who": "DrahtBot"
  }
 ],
 "state_log": [],
 "text_chars": 3187,
 "text_tokens_estimate": 796,
 "changed_paths": [
  "test/functional/feature_torcontrol.py"
 ],
 "files": [
  {
   "path": "test/functional/feature_torcontrol.py",
   "add": 206,
   "del": 0
  }
 ],
 "test_lines": 206,
 "git": {
  "head": "6827006f4f0d144248244731e75191bf203e1dd6",
  "head_matches_backup": true,
  "base": "cf80493e2367786ce9946c522eb8313a52c90557",
  "patch_id": "11c5ddbd32c0b77b",
  "commits": [
   {
    "sha": "6827006f4f",
    "subject": "test: Add coverage for TorControl `SAFECOOKIE` authentication",
    "files": 1,
    "add": 206,
    "del": 0
   }
  ],
  "patch_truncated": false
 },
 "patch_id": "11c5ddbd32c0b77b",
 "input_hash": "f2c8f45b67e0732a",
 "extracted_at": "2026-11-02T01:09:49+00:00"
}