From 295ae1910856181167e52edf6a723ef317cba1e9 Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Thu, 14 May 2026 10:25:54 +0100 Subject: [PATCH 1/2] fix: escape inner quotes in issue_holding_statement (was undef @statement_str) `return "STMT: "$statement""` is parsed by Julia as three tokens: the literal "STMT: ", then `$statement""` which the parser interprets as the string macro `@statement_str ""`. No such macro exists, so precompile fails with 'UndefVarError: @statement_str not defined'. Every consumer of PRComms (TradeUnionist.jl#5/#6, etc.) hits this immediately. Properly escape the inner quotes so the value gets quoted in the output as originally intended. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/crisis.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crisis.jl b/src/crisis.jl index c567775..7af9917 100644 --- a/src/crisis.jl +++ b/src/crisis.jl @@ -16,7 +16,7 @@ end function issue_holding_statement(playbook::CrisisPlaybook, variant_idx::Int) statement = playbook.holding_statements[variant_idx] - return "STMT: "$statement"" + return "STMT: \"$statement\"" end end # module From 935ad640718b6a0b2c017538f5e82990d8ba1920 Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Thu, 14 May 2026 14:18:05 +0100 Subject: [PATCH 2/2] =?UTF-8?q?fix(tests):=20satisfy=20MIN=5FBODY=5FLENGTH?= =?UTF-8?q?,=20switch=20to=20=E2=89=88,=20pass=20Mustache=20view=20as=20Di?= =?UTF-8?q?ct?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After the Crisis precompile fix landed, four pre-existing failure categories surfaced in PRComms.jl's own CI: 1. `draft_release` requires body ≥ 50 chars (newsroom.jl:42). Five test sites were passing 4–29 char placeholders (`"Body"`, `"We launch our product."`, `"Body text"`). Replace with substantive ≥50-char copy so the validator is exercised by tests that don't intend to trip it. 2. `third_order_ratio(0.8, 0.6, 2.0)` returns 0.10000000000000003 due to floating-point subtraction. Replace `==` with `≈` (isapprox). 3. `make_email_signature` was rendering an empty template because Mustache.jl 1.x does not accept the view as kwargs to `render`. Pass it as a positional `Dict{String,Any}` instead. The four `occursin(...)` assertions now match populated HTML. These are all test-fixture and view-passing fixes; no production contract changes. Co-Authored-By: Claude Opus 4.7 --- src/assets/templates.jl | 7 ++++++- test/e2e_test.jl | 4 +++- test/property_test.jl | 4 +++- test/runtests.jl | 15 +++++++++------ 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/assets/templates.jl b/src/assets/templates.jl index 6d95908..d854349 100644 --- a/src/assets/templates.jl +++ b/src/assets/templates.jl @@ -20,7 +20,12 @@ function make_email_signature(name, role, email, phone) Phone: {{phone}} """ - return render(template, name=name, role=role, email=email, phone=phone) + return render(template, Dict( + "name" => name, + "role" => role, + "email" => email, + "phone" => phone, + )) end """ diff --git a/test/e2e_test.jl b/test/e2e_test.jl index da4098a..8361dfc 100644 --- a/test/e2e_test.jl +++ b/test/e2e_test.jl @@ -18,7 +18,9 @@ using Dates @test variant isa AudienceVariant @test variant.pillar_id == :camp_p - pr = draft_release(:camp_pr, "Big Launch Today", "We launch our product.") + pr = draft_release(:camp_pr, "Big Launch Today", + "We launch our product today with full availability across all " * + "supported regions starting at 09:00 UTC.") review_release(pr) @test pr.status == :review diff --git a/test/property_test.jl b/test/property_test.jl index b6eb039..00aa2a1 100644 --- a/test/property_test.jl +++ b/test/property_test.jl @@ -47,7 +47,9 @@ using PRComms @testset "Invariant: draft_release always starts as draft" begin for _ in 1:50 id = Symbol("pr$(rand(1:99999))") - pr = draft_release(id, "Title $(rand(1:99999))", "Body text") + pr = draft_release(id, "Title $(rand(1:99999))", + "Property-based test body that exceeds the fifty-character " * + "minimum length required by draft_release().") @test pr.status == :draft @test pr.embargo_at === nothing end diff --git a/test/runtests.jl b/test/runtests.jl index 3d14fa7..41f4fb7 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -151,19 +151,22 @@ using DataFrames # Newsroom # ----------------------------------------------------------------------- @testset "Newsroom" begin + sample_body = "We are excited to announce our launch with " * + "comprehensive details for press and partners." + @testset "draft_release" begin - pr = draft_release(:nr1, "Launch Day", "We are excited to announce...") + pr = draft_release(:nr1, "Launch Day", sample_body) @test pr isa PressRelease @test pr.id == :nr1 @test pr.title == "Launch Day" - @test pr.body == "We are excited to announce..." + @test pr.body == sample_body @test pr.status == :draft @test pr.embargo_at === nothing @test pr.approved_at === nothing end @testset "review_release" begin - pr = draft_release(:nr2, "Review Test", "Body") + pr = draft_release(:nr2, "Review Test", sample_body) result = review_release(pr) @test result isa String @test pr.status == :review @@ -171,7 +174,7 @@ using DataFrames end @testset "publish_release without embargo" begin - pr = draft_release(:nr3, "Publish Test", "Body") + pr = draft_release(:nr3, "Publish Test", sample_body) result = publish_release(pr) @test result isa String @test pr.status == :published @@ -179,7 +182,7 @@ using DataFrames end @testset "publish_release with embargo" begin - pr = draft_release(:nr4, "Embargo Test", "Body") + pr = draft_release(:nr4, "Embargo Test", sample_body) embargo_time = DateTime(2026, 6, 1, 9, 0) result = publish_release(pr; embargo=embargo_time) @test result isa String @@ -278,7 +281,7 @@ using DataFrames end @testset "third_order_ratio" begin - @test third_order_ratio(0.8, 0.6, 2.0) == 0.1 + @test third_order_ratio(0.8, 0.6, 2.0) ≈ 0.1 @test third_order_ratio(0.5, 0.5, 0) == 0.0 # divide by zero guard end end