From f83225c76911ca5dcecc4fdc50164552344f5f87 Mon Sep 17 00:00:00 2001 From: lmr Date: Sat, 18 Jul 2026 14:19:42 +0800 Subject: [PATCH] fix: move declaration to after runtime flags for positional compat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DouyinVideoUploadRequest dataclass 声明字段位置 被独立审查者(deleg_61d33c80)标记为P1兼容问题: 旧位置调用 ('scheduled', False, False) 会被错位解析。 把 declaration 移到最后,保留旧位置契约。 Previous-Review: deleg_61d33c80 Ref: dreammis/social-auto-upload#213(安全后续修正) --- sau_cli.py | 2 +- tests/test_sau_browser_cli.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sau_cli.py b/sau_cli.py index 584e7e1..a896718 100644 --- a/sau_cli.py +++ b/sau_cli.py @@ -63,10 +63,10 @@ class DouyinVideoUploadRequest: thumbnail_portrait_file: Path | None = None product_link: str = "" product_title: str = "" - declaration: str | None = None publish_strategy: str = DOUYIN_PUBLISH_STRATEGY_IMMEDIATE debug: bool = True headless: bool = True + declaration: str | None = None @dataclass(slots=True) diff --git a/tests/test_sau_browser_cli.py b/tests/test_sau_browser_cli.py index 22bc885..4da58c6 100644 --- a/tests/test_sau_browser_cli.py +++ b/tests/test_sau_browser_cli.py @@ -90,6 +90,16 @@ class BrowserCliParserTests(unittest.TestCase): ]) self.assertIsNone(args.declaration) + def test_douyin_request_legacy_positional_runtime_flags_keep_their_meaning(self): + request = sau_cli.DouyinVideoUploadRequest( + "creator", Path("demo.mp4"), "标题", "简介", [], 0, + None, None, None, "", "", "scheduled", False, False, + ) + self.assertEqual(request.publish_strategy, "scheduled") + self.assertFalse(request.debug) + self.assertFalse(request.headless) + self.assertIsNone(request.declaration) + def test_tencent_upload_video_accepts_dual_thumbnail_aspects(self): with tempfile.TemporaryDirectory() as tmp_dir: video_path = Path(tmp_dir) / "demo.mp4"