refactor(forge): address PR #318 review — PR/Issue split, sqlite state, drop footer
Addresses the five review comments on PR #318: - Split PullRequest from Issue and add a dedicated read_pr method on Forge/ScopedForge/GiteaForge (a PR carries merge state an issue does not); is_pr_open now derives from read_pr. - Replace the JSON-file forge state with a thin swappable CRUD interface (ForgeStateStore) backed by SQLite (SqliteForgeStateStore) at ~/.bot-bottle/bot-bottle.db. - Remove the provenance footer (provenance.py + its test): a mutable, unsigned PR comment is not an audit record. - Reword the PRD: provenance is exposed via an API, not surfaced in the PR; document the Issue/PullRequest split and the SQLite store. pyright clean (whole repo), pylint 10/10, 38 forge/resume unit tests pass; no remaining refs to the removed provenance module or old JSON state API. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WL77TgFxKbs3cidGMG9dz7
This commit is contained in:
@@ -126,6 +126,20 @@ class TestPRHelpers(unittest.TestCase):
|
||||
with patch(_URLOPEN, return_value=_resp({"state": "closed"})):
|
||||
self.assertFalse(GiteaForge(_client()).is_pr_open(18))
|
||||
|
||||
def test_read_pr_maps_fields_including_merged(self):
|
||||
raw = {"number": 18, "title": "Fix", "body": "patch",
|
||||
"state": "closed", "merged": True}
|
||||
with patch(_URLOPEN, return_value=_resp(raw)) as m:
|
||||
pr = GiteaForge(_client()).read_pr(18)
|
||||
self.assertEqual((18, "Fix", "patch", "closed", True),
|
||||
(pr.number, pr.title, pr.body, pr.state, pr.merged))
|
||||
self.assertIn("/repos/didericis/bot-bottle/pulls/18",
|
||||
m.call_args.args[0].full_url)
|
||||
|
||||
def test_read_pr_merged_defaults_false(self):
|
||||
with patch(_URLOPEN, return_value=_resp({"number": 18, "state": "open"})):
|
||||
self.assertFalse(GiteaForge(_client()).read_pr(18).merged)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user