From 5f4ca3e7ef048b1c2e36e5228e94a8f051ea40dd Mon Sep 17 00:00:00 2001 From: Adam Moussa Date: Fri, 25 Sep 2026 17:47:39 -0400 Subject: [PATCH] fix(menu): address review feedback Use the form deadline in the Monday Slack post, and compare that message exactly so CodeQL does not treat the test as URL sanitization. --- src/server/jobs/publish_menu.py | 8 +++----- tests/test_publish_menu.py | 7 +++++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/server/jobs/publish_menu.py b/src/server/jobs/publish_menu.py index 664c0d5..7a96340 100644 --- a/src/server/jobs/publish_menu.py +++ b/src/server/jobs/publish_menu.py @@ -16,9 +16,6 @@ DEFAULT_DEADLINE = "Thursday at 11:59 PM" FORM_BUCKET_PARAM = "/meal-order-manager/deploy/form-bucket" DISTRIBUTION_ID_PARAM = "/meal-order-manager/deploy/distribution-id" -# Same announcement the GitHub weekly-menu workflow posted. -_SLACK_TEXT = "This week's meal order is open! Deadline: Thursday 6pm." - def lambda_handler(event, context): del event, context @@ -113,6 +110,7 @@ def _invalidate(distribution_id: str, week: str, scraped_at: str) -> None: def _notify(form_url: str) -> None: from shared.slack import post_channel_message + text = f"This week's meal order is open! Deadline: {DEFAULT_DEADLINE}." blocks = [ { "type": "header", @@ -123,11 +121,11 @@ def _notify(form_url: str) -> None: "text": { "type": "mrkdwn", "text": ( - f"*<{form_url}|Place your order>*\n\n*Deadline:* Thursday 6pm\n" + f"*<{form_url}|Place your order>*\n\n*Deadline:* {DEFAULT_DEADLINE}\n" ), }, }, ] - result = post_channel_message(_SLACK_TEXT, blocks) + result = post_channel_message(text, blocks) if not result.get("ok"): raise RuntimeError(f"Slack API error: {result.get('error')}") diff --git a/tests/test_publish_menu.py b/tests/test_publish_menu.py index 8ff09de..c460824 100644 --- a/tests/test_publish_menu.py +++ b/tests/test_publish_menu.py @@ -92,8 +92,11 @@ def test_publish_menu_uploads_after_the_menu_write( assert invalidation["DistributionId"] == "E123" assert invalidation["InvalidationBatch"]["Paths"]["Items"] == ["/index.html"] mock_slack.assert_called_once() - assert ( - "https://orders.seahaven.com" in mock_slack.call_args.args[1][1]["text"]["text"] + assert mock_slack.call_args.args[0] == ( + "This week's meal order is open! Deadline: Thursday at 11:59 PM." + ) + assert mock_slack.call_args.args[1][1]["text"]["text"] == ( + f"*<{ENV['FORM_URL']}|Place your order>*\n\n*Deadline:* Thursday at 11:59 PM\n" ) assert order == [ "menu",