nixbot

builds

failed treefmt-check checks.aarch64-linux.treefmt · build #392 · raw

1tribuchet: building on eliza2treefmt v2.5.0traversed 333 files3emitted 267 files for processing4formatted 267 files (3 changed) in 12.158s5 M nixbot/nixbot/tests/test_db.py6 M nixbot/nixbot/tests/test_service.py7 M nixbot/nixbot/tests/test_status.py8diff --git a/nixbot/nixbot/tests/test_db.py b/nixbot/nixbot/tests/test_db.py9index 159209b..d1f2bcd 10064410--- a/nixbot/nixbot/tests/test_db.py11+++ b/nixbot/nixbot/tests/test_db.py12@@ -266,10 +266,13 @@ async def test_terminal_report_ack_rejects_late_target_snapshot(13 await builds_q.mark_build_report_delivered(14 pool, build_id=build_id, generation=0, commit_shas=["pr-sha"]15 )16- assert await pool.fetchval(17- "SELECT reported_generation FROM build_reporting WHERE build_id = $1",18- build_id,19- ) == 020+ assert (21+ await pool.fetchval(22+ "SELECT reported_generation FROM build_reporting WHERE build_id = $1",23+ build_id,24+ )25+ == 026+ )27 28 # Attaching main invalidates the ack. An older in-flight API snapshot may29 # finish afterward, but cannot acknowledge a target it never posted.30@@ -283,10 +286,13 @@ async def test_terminal_report_ack_rejects_late_target_snapshot(31 await builds_q.mark_build_report_delivered(32 pool, build_id=build_id, generation=0, commit_shas=["pr-sha"]33 )34- assert await pool.fetchval(35- "SELECT reported_generation FROM build_reporting WHERE build_id = $1",36- build_id,37- ) is None38+ assert (39+ await pool.fetchval(40+ "SELECT reported_generation FROM build_reporting WHERE build_id = $1",41+ build_id,42+ )43+ is None44+ )45 assert build_id in await builds_q.unreconciled_terminal_builds(pool)46 47 await builds_q.mark_build_report_delivered(48diff --git a/nixbot/nixbot/tests/test_service.py b/nixbot/nixbot/tests/test_service.py49index 0ff4e51..c35c14e 10064450--- a/nixbot/nixbot/tests/test_service.py51+++ b/nixbot/nixbot/tests/test_service.py52@@ -941,9 +941,7 @@ class TargetRecordingReporter(AttributeRecordingReporter):53 async def build_finished(self, event: Any, build: Any, result: BuildResult) -> None:54 self.final_results.append((event.commit_sha, result))55 56- async def eval_finished(57- self, event: Any, build: Any, report: EvalReport58- ) -> None:59+ async def eval_finished(self, event: Any, build: Any, report: EvalReport) -> None:60 self.eval_results.append((event.commit_sha, report.success))61 self.eval_reports.append((event.commit_sha, report))62 63@@ -980,9 +978,7 @@ async def test_restart_and_final_report_use_persisted_targets_after_restart(64 async def no_resumable_builds(*args: Any, **kwargs: Any) -> list[Any]:65 return []66 67- monkeypatch.setattr(68- restart_dispatch, "find_unfinished_builds", no_resumable_builds69- )70+ monkeypatch.setattr(restart_dispatch, "find_unfinished_builds", no_resumable_builds)71 await restart_dispatch.rerun(service, build_id, restart=True)72 73 assert set(reporter.restarted) == {74@@ -1003,9 +999,7 @@ async def test_restart_and_final_report_use_persisted_targets_after_restart(75 await build_reuse.report_eval_finished(76 service.orchestrator, source_event, build, EvalReport(success=False)77 )78- await build_reuse.report_eval_cancelled(79- service.orchestrator, source_event, build80- )81+ await build_reuse.report_eval_cancelled(service.orchestrator, source_event, build)82 assert set(reporter.eval_results) == {83 ("pr-sha", True),84 ("main-sha", True),85@@ -1051,9 +1045,7 @@ async def test_old_terminal_report_does_not_post_after_restart_reset(86 )87 reporter = TargetRecordingReporter()88 service.orchestrator.reporter = reporter89- await service.enqueue_work(90- "report", f"report-{build_id}", {"build_id": build_id}91- )92+ await service.enqueue_work("report", f"report-{build_id}", {"build_id": build_id})93 94 await service.orchestrator.reset_build_for_restart(build_id, None)95 await service.drain_work()96@@ -1109,10 +1101,13 @@ async def test_terminal_eval_api_failure_blocks_ack_until_retry(97 service.orchestrator.request_build_report = service.request_build_report98 99 await service.orchestrator.request_build_report(build_id)100- assert await pool.fetchval(101- "SELECT reported_generation FROM build_reporting WHERE build_id = $1",102- build_id,103- ) is None104+ assert (105+ await pool.fetchval(106+ "SELECT reported_generation FROM build_reporting WHERE build_id = $1",107+ build_id,108+ )109+ is None110+ )111 assert reporter.final_results == []112 113 await service.drain_work()114@@ -1122,10 +1117,13 @@ async def test_terminal_eval_api_failure_blocks_ack_until_retry(115 "pr-sha",116 "main-sha",117 }118- assert await pool.fetchval(119- "SELECT reported_generation FROM build_reporting WHERE build_id = $1",120- build_id,121- ) == 0122+ assert (123+ await pool.fetchval(124+ "SELECT reported_generation FROM build_reporting WHERE build_id = $1",125+ build_id,126+ )127+ == 0128+ )129 130 131 async def test_terminal_report_treats_partial_eval_with_attribute_as_failed(132@@ -1260,7 +1258,13 @@ async def test_terminal_report_formats_production_warning_groups_through_forge(133 ) -> None:134 text = extra.get("text")135 self.posts.append(136- (sha, context, state, description, text if isinstance(text, str) else None)137+ (138+ sha,139+ context,140+ state,141+ description,142+ text if isinstance(text, str) else None,143+ )144 )145 146 pool = service.pool147@@ -1323,9 +1327,7 @@ async def test_terminal_report_formats_production_warning_groups_through_forge(148 assert "download failed (\u00d73)" in eval_post[4]149 assert "input is deprecated" in eval_post[4]150 assert any(151- post[0] == sha152- and post[1] == "nixbot/nix-build"153- and post[2] == build_state154+ post[0] == sha and post[1] == "nixbot/nix-build" and post[2] == build_state155 for post in poster.posts156 )157 158@@ -1375,12 +1377,8 @@ async def test_late_target_crash_recovers_terminal_eval_and_final(159 async def no_unfinished_builds(*args: Any, **kwargs: Any) -> list[Any]:160 return []161 162- monkeypatch.setattr(163- builds_q, "reportable_attribute_failures", no_early_failures164- )165- monkeypatch.setattr(166- builds_q, "unreconciled_terminal_builds", only_this_terminal167- )168+ monkeypatch.setattr(builds_q, "reportable_attribute_failures", no_early_failures)169+ monkeypatch.setattr(builds_q, "unreconciled_terminal_builds", only_this_terminal)170 monkeypatch.setattr("nixbot.service.find_unfinished_builds", no_unfinished_builds)171 reporter = TargetRecordingReporter()172 service.orchestrator.reporter = reporter173@@ -1393,10 +1391,13 @@ async def test_late_target_crash_recovers_terminal_eval_and_final(174 "pr-sha",175 "main-sha",176 }177- assert await pool.fetchval(178- "SELECT reported_generation FROM build_reporting WHERE build_id = $1",179- build_id,180- ) == 0181+ assert (182+ await pool.fetchval(183+ "SELECT reported_generation FROM build_reporting WHERE build_id = $1",184+ build_id,185+ )186+ == 0187+ )188 189 190 async def test_late_terminal_target_gets_rich_failures_and_final_status(191@@ -1445,7 +1446,9 @@ async def test_late_terminal_target_gets_rich_failures_and_final_status(192 assert len(main_results) == 1193 assert main_results[0].attr_prefix == "hydraJobs"194 assert main_results[0].results[0].error == "error: persisted rich diagnostic"195- main_failures = [failure for failure in reporter.failures if failure[0] == "main-sha"]196+ main_failures = [197+ failure for failure in reporter.failures if failure[0] == "main-sha"198+ ]199 assert len(main_failures) == 1200 assert main_failures[0][2] == "error: persisted rich diagnostic"201 assert main_failures[0][5] == "hydraJobs"202@@ -1521,13 +1524,17 @@ async def test_live_reconciliation_repairs_queue_write_and_retry_update_failures203 service.enqueue_work = failed_enqueue # type: ignore[method-assign]204 await service.request_build_report(build_id)205 service.enqueue_work = original_enqueue # type: ignore[method-assign]206- assert await pool.fetchval(207- "SELECT reported_generation FROM build_reporting WHERE build_id = $1",208- build_id,209- ) is None210- assert await pool.fetchval(211- "SELECT count(*) FROM work_queue WHERE kind = 'report'"212- ) == 0213+ assert (214+ await pool.fetchval(215+ "SELECT reported_generation FROM build_reporting WHERE build_id = $1",216+ build_id,217+ )218+ is None219+ )220+ assert (221+ await pool.fetchval("SELECT count(*) FROM work_queue WHERE kind = 'report'")222+ == 0223+ )224 225 queue = WorkQueue(pool)226 await service._reconcile_terminal_reports(queue) # noqa: SLF001227@@ -1543,15 +1550,15 @@ async def test_live_reconciliation_repairs_queue_write_and_retry_update_failures228 with pytest.raises(RuntimeError, match="retry update failed"):229 await service._execute_work(queue, item) # noqa: SLF001230 queue.retry = original_retry # type: ignore[method-assign]231- assert await pool.fetchval(232- "SELECT status FROM work_queue WHERE id = $1", item.id233- ) == "running"234+ assert (235+ await pool.fetchval("SELECT status FROM work_queue WHERE id = $1", item.id)236+ == "running"237+ )238 239 # The idle-loop lease sweep repairs the otherwise unleased running row240 # without requiring a process restart.241 await pool.execute(242- "UPDATE work_queue SET claimed_at = now() - interval '1 hour' "243- "WHERE id = $1",244+ "UPDATE work_queue SET claimed_at = now() - interval '1 hour' WHERE id = $1",245 item.id,246 )247 reporter.available = True248@@ -1559,10 +1566,13 @@ async def test_live_reconciliation_repairs_queue_write_and_retry_update_failures249 await service.drain_work()250 251 assert {commit for commit, _ in reporter.final_results} == {"terminal-sha"}252- assert await pool.fetchval(253- "SELECT reported_generation FROM build_reporting WHERE build_id = $1",254- build_id,255- ) == 0256+ assert (257+ await pool.fetchval(258+ "SELECT reported_generation FROM build_reporting WHERE build_id = $1",259+ build_id,260+ )261+ == 0262+ )263 264 265 async def test_attribute_report_reloads_persisted_failure_retries_and_fans_out(266@@ -1696,9 +1706,7 @@ async def test_terminal_recovery_reconciles_failure_beyond_early_slice(267 early = await builds_q.reportable_attribute_failures(268 pool, report_limit=service.config.failed_build_report_limit269 )270- assert attrs[-1] not in {271- row.attr for row in early if row.build_id == build_id272- }273+ assert attrs[-1] not in {row.attr for row in early if row.build_id == build_id}274 275 async def no_early_failures(*args: Any, **kwargs: Any) -> list[Any]:276 return []277@@ -1706,12 +1714,8 @@ async def test_terminal_recovery_reconciles_failure_beyond_early_slice(278 async def only_terminal_build(*args: Any, **kwargs: Any) -> list[int]:279 return [build_id]280 281- monkeypatch.setattr(282- builds_q, "reportable_attribute_failures", no_early_failures283- )284- monkeypatch.setattr(285- builds_q, "unreconciled_terminal_builds", only_terminal_build286- )287+ monkeypatch.setattr(builds_q, "reportable_attribute_failures", no_early_failures)288+ monkeypatch.setattr(builds_q, "unreconciled_terminal_builds", only_terminal_build)289 reporter = TargetRecordingReporter()290 service.orchestrator.reporter = reporter291 292@@ -1788,10 +1792,13 @@ async def test_direct_cancel_fans_out_and_acknowledges_durable_targets(293 generation = await pool.fetchval(294 "SELECT status_generation FROM builds WHERE id = $1", build_id295 )296- assert await pool.fetchval(297- "SELECT reported_generation FROM build_reporting WHERE build_id = $1",298- build_id,299- ) == generation300+ assert (301+ await pool.fetchval(302+ "SELECT reported_generation FROM build_reporting WHERE build_id = $1",303+ build_id,304+ )305+ == generation306+ )307 308 309 async def test_check_rerequested_dispatch(service: CIService) -> None:310diff --git a/nixbot/nixbot/tests/test_status.py b/nixbot/nixbot/tests/test_status.py311index 99c73e0..126edd8 100644312--- a/nixbot/nixbot/tests/test_status.py313+++ b/nixbot/nixbot/tests/test_status.py314@@ -895,9 +895,7 @@ async def test_poster_network_errors_do_not_propagate() -> None:315 await reporter.build_started(EVENT, BUILD) # must not raise316 await reporter.eval_finished(EVENT, BUILD, EvalReport(success=False))317 with pytest.raises(httpx.ConnectError):318- await reporter.terminal_eval_finished(319- EVENT, BUILD, EvalReport(success=False)320- )321+ await reporter.terminal_eval_finished(EVENT, BUILD, EvalReport(success=False))322 with pytest.raises(httpx.ConnectError):323 await reporter.build_finished(EVENT, BUILD, BuildResult("succeeded", 1, []))324 325@@ -954,9 +952,7 @@ async def test_check_permission_error_does_not_disable_forge() -> None:326 )327 await reporter.build_started(EVENT, BUILD)328 with pytest.raises(CheckPermissionError):329- await reporter.terminal_eval_finished(330- EVENT, BUILD, EvalReport(success=False)331- )332+ await reporter.terminal_eval_finished(EVENT, BUILD, EvalReport(success=False))333 with pytest.raises(CheckPermissionError):334 await reporter.build_finished(EVENT, BUILD, BuildResult("succeeded", 1, []))335 # Every phase still attempts to post. The forge is never latched off.