| 1 | """Engagement counts select evidence; one place prints them beside a quote. |
| 2 | |
| 3 | Prose carries a count only when its size is the finding. The pulled quote, a |
| 4 | blockquote line under a story paragraph, is the named exception: it shows the |
| 5 | comment's author and count as the engine printed them. Every quoted comment |
| 6 | The report's best six quotes are such lines; other good quotes may stay |
| 7 | inside a paragraph, attributed and linked, with no count. |
| 8 | |
| 9 | These pin the instruction text only. They catch the old "include the vote |
| 10 | count" instruction coming back; they cannot catch a model that prints counts |
| 11 | anyway, which needs a fresh run of the skill on a busy topic. |
| 12 | """ |
| 13 | |
| 14 | from pathlib import Path |
| 15 | |
| 16 | from tests.skill_contract import reference_text |
| 17 | |
| 18 | |
| 19 | SKILL_MD = Path(__file__).resolve().parents[1] / "skills" / "last30days" / "SKILL.md" |
| 20 | RULE_MARKER = "**COUNTS IN PROSE" |
| 21 | PULLED_MARKER = "**PULLED QUOTE" |
| 22 | |
| 23 | |
| 24 | def _rule() -> str: |
| 25 | return reference_text("synthesis").split(RULE_MARKER, 1)[1].split("\n\n", 1)[0] |
| 26 | |
| 27 | |
| 28 | def _pulled_quote_rule() -> str: |
| 29 | return reference_text("synthesis").split(PULLED_MARKER, 1)[1].split("\n\n", 1)[0] |
| 30 | |
| 31 | |
| 32 | def _law9() -> str: |
| 33 | text = SKILL_MD.read_text(encoding="utf-8") |
| 34 | return text.split("**LAW 9 -", 1)[1].split("**LAW 10 -", 1)[0] |
| 35 | |
| 36 | |
| 37 | def test_synthesis_no_longer_asks_for_a_count_beside_each_quote(): |
| 38 | text = reference_text("synthesis") |
| 39 | assert "including the vote count" not in text |
| 40 | assert '"N upvotes" for Reddit' not in text |
| 41 | top_comments = text.split("Pay special attention to top comments", 1)[1].splitlines()[0] |
| 42 | assert "Position picks the quote" in top_comments |
| 43 | assert "Votes pick the quote" not in text |
| 44 | assert "its count appears only on a PULLED QUOTE line" in top_comments |
| 45 | assert "do not print the count" not in text |
| 46 | assert "Quote the text, not its vote count" not in text |
| 47 | |
| 48 | |
| 49 | def test_synthesis_states_when_a_count_may_stay(): |
| 50 | rule = _rule() |
| 51 | for kept in ("comparison", "contrast", "surprise"): |
| 52 | assert kept in rule |
| 53 | assert "rank word" in rule |
| 54 | assert "A prose count that stays is rounded and single" in rule |
| 55 | |
| 56 | |
| 57 | def test_rule_leaves_odds_registers_and_footer_alone(): |
| 58 | rule = _rule() |
| 59 | assert "Polymarket" in rule |
| 60 | assert "`creator`" in rule |
| 61 | assert "`exec`" in rule |
| 62 | assert "footer" in rule |
| 63 | |
| 64 | |
| 65 | def test_prose_rule_stays_beside_the_pulled_quote(): |
| 66 | rule = _rule() |
| 67 | assert "engagement numbers choose what you show, rarely what you say" in rule |
| 68 | assert "print a count only when its size is the finding" in rule |
| 69 | assert PULLED_MARKER not in rule |
| 70 | |
| 71 | |
| 72 | def test_pulled_quote_is_the_named_exception_and_every_quote_is_one(): |
| 73 | rule = _pulled_quote_rule() |
| 74 | assert rule.startswith(" (the named exception to COUNTS IN PROSE).**") |
| 75 | assert "The report's best six quotes of a community comment, a post" in rule |
| 76 | assert "the subject's own post" in rule |
| 77 | assert "their own blockquote line directly under the paragraph they support" in rule |
| 78 | assert '`> "Ofc shes literally him😭" 🎵 @haktimel2 on TikTok · 825,451 likes`' in rule |
| 79 | |
| 80 | |
| 81 | def test_other_good_quotes_may_stay_inline_without_a_quota_or_a_count(): |
| 82 | rule = _pulled_quote_rule() |
| 83 | assert "Another good quote may stay inside its paragraph in quotation marks, author linked (LAW 8), with no count" in rule |
| 84 | assert "allowed, not required" in rule |
| 85 | assert "Never use one quote both ways" in rule |
| 86 | assert "never quote weak or off-topic comments" in rule |
| 87 | assert "None goes inside a paragraph" not in rule |
| 88 | text = reference_text("synthesis") + SKILL_MD.read_text(encoding="utf-8") |
| 89 | for gone in ("none inside a paragraph", "never inside a paragraph", "at least two", "at least 2"): |
| 90 | assert gone not in text.replace("at least two signals", "") |
| 91 | |
| 92 | |
| 93 | def test_pulled_quotes_run_up_to_six_in_the_whole_report_with_a_quality_bar(): |
| 94 | rule = _pulled_quote_rule() |
| 95 | assert "top comment first, then its #2" in rule |
| 96 | assert "like counts do not rank a comment from one place against another" in rule |
| 97 | assert "highest-voted" not in rule |
| 98 | assert "Six in the whole report is a ceiling, not a target" in rule |
| 99 | assert "the subject's standout posts, `funny` entries breaking ties" in rule |
| 100 | assert "per story" not in rule and "each paragraph up to" not in rule |
| 101 | assert "a blank line between" in rule |
| 102 | for cap in ("at most one", "up to three", "up to five", "one per story"): |
| 103 | assert cap not in rule |
| 104 | text = reference_text("synthesis") + SKILL_MD.read_text(encoding="utf-8") |
| 105 | assert "at most one comment" not in text |
| 106 | assert "at least two attributed comments" not in text |
| 107 | assert "weave at least 2" not in text |
| 108 | |
| 109 | |
| 110 | def test_pulled_quote_names_the_engine_blocks_it_copies_from(): |
| 111 | rule = _pulled_quote_rule() |
| 112 | assert "`## Top Community Comments`" in rule |
| 113 | assert "`## Posts by @handle`" in rule |
| 114 | assert "the paragraph above keeps the source link" in rule |
| 115 | |
| 116 | |
| 117 | def test_pulled_quote_copies_the_engine_attribution_and_carries_no_link(): |
| 118 | rule = _pulled_quote_rule() |
| 119 | assert "Copy the entry through its count (through the platform name when it has none)" in rule |
| 120 | assert "up to its URL" not in rule |
| 121 | assert "no link" in rule |
| 122 | assert "](" not in rule |
| 123 | |
| 124 | |
| 125 | def test_pulled_quote_marks_a_translated_comment(): |
| 126 | rule = _pulled_quote_rule() |
| 127 | assert "not in the report's language" in rule |
| 128 | assert "` · translated from Portuguese`" in rule |
| 129 | |
| 130 | |
| 131 | def test_pulled_quote_skips_authorless_comments_and_stories_without_one(): |
| 132 | rule = _pulled_quote_rule() |
| 133 | assert "attributed `Comment`" in rule |
| 134 | assert "none fits, no quote" in rule |
| 135 | |
| 136 | |
| 137 | def test_pulled_quote_stays_out_of_fixed_shape_reports(): |
| 138 | rule = _pulled_quote_rule() |
| 139 | for shape in ("`exec`", "RECOMMENDATIONS", "COMPARISON"): |
| 140 | assert shape in rule.rsplit("Not in", 1)[1] |
| 141 | |
| 142 | |
| 143 | def test_pulled_quote_rule_adds_no_markdown_list(): |
| 144 | for line in _pulled_quote_rule().splitlines(): |
| 145 | assert not line.lstrip().startswith(("- ", "* ", "1. ")) |
| 146 | |
| 147 | |
| 148 | def test_fun_content_sends_translated_or_verbatim_quotes_to_quote_lines(): |
| 149 | text = reference_text("synthesis") |
| 150 | fun = text.split("**FUN CONTENT (see LAW 9)", 1)[1].split("\n\n", 1)[0] |
| 151 | assert "quote the funniest/cleverest, VERBATIM or translated (PULLED QUOTE)" in fun |
| 152 | assert "No separate section." in fun |
| 153 | assert "eave" not in fun |
| 154 | |
| 155 | |
| 156 | def test_root_law_puts_every_quoted_comment_on_a_quote_line(): |
| 157 | law9 = _law9() |
| 158 | assert "QUOTE THE COMMUNITY;" in law9 |
| 159 | assert "the report's best six quotes, verbatim or translated, each get a quote line" in law9 |
| 160 | assert "others may be quoted inline, attributed" in law9 |
| 161 | assert "synthesis PULLED QUOTE" in law9 |
| 162 | assert "Do not create a separate Comments section." in law9 |
| 163 | assert "eave" not in law9 |
| 164 | |
| 165 | |
| 166 | def test_root_law_quotes_the_subjects_own_posts_on_quote_lines(): |
| 167 | text = SKILL_MD.read_text(encoding="utf-8") |
| 168 | law10 = text.split("**LAW 10 -", 1)[1].split("**LAW 11 -", 1)[0] |
| 169 | assert "`## Posts by @handle`" in law10 |
| 170 | assert "quote the standout ones" in law10 |
| 171 | |
| 172 | |
| 173 | def test_final_check_looks_for_quotes_left_inside_paragraphs(): |
| 174 | text = SKILL_MD.read_text(encoding="utf-8") |
| 175 | checklist = text.split("## PRE-PRESENT SELF-CHECK", 1)[1].split("\n## ", 1)[0] |
| 176 | assert "At most six quote lines, the report's best; no quote both on a line and inline." in checklist |
| 177 | assert "Weave" not in checklist |
| 178 | |
| 179 | |
| 180 | def test_report_template_shows_quote_lines_under_paragraphs(): |
| 181 | text = reference_text("synthesis") |
| 182 | template = text.split("{the engine's first line, copied verbatim}", 1)[1].split("```", 1)[0] |
| 183 | assert template.count('\n> "') >= 2 |
| 184 | assert "](" not in "".join(line for line in template.splitlines() if line.startswith("> ")) |
| 185 | |
| 186 | |
| 187 | def test_runbook_describes_what_compact_output_really_holds(): |
| 188 | runbook = reference_text("research-runbook") |
| 189 | assert "EIGHT data sections" not in runbook |
| 190 | line = next(line for line in runbook.splitlines() if line.startswith("**Read the ENTIRE output.**")) |
| 191 | for part in ( |
| 192 | "`## Posts by @handle`", "`## Polymarket Markets`", "`## Top Community Comments`", |
| 193 | "top ranked clusters", "format checklist", |
| 194 | ): |
| 195 | assert part in line, part |
| 196 | |
| 197 | |
| 198 | def test_instruction_examples_do_not_model_tacked_on_counts(): |
| 199 | text = reference_text("synthesis") |
| 200 | assert "1,338-upvote" not in text |
| 201 | assert "flow, 800 upvotes`" not in text |
| 202 | assert "323pt HN`" not in text |
| 203 | |
| 204 | |
| 205 | def test_comparison_template_points_at_the_rule(): |
| 206 | text = reference_text("comparison") |
| 207 | do_not = text.split("**Do NOT:**", 1)[1].split("\n\n", 1)[0] |
| 208 | assert "COUNTS IN PROSE" in do_not |
| 209 | assert "or add pulled-quote lines" in do_not |
| 210 | assert "with its engagement" not in text |
| 211 | |
| 212 | |
| 213 | def test_final_check_strips_counts_that_are_not_the_finding(): |
| 214 | text = SKILL_MD.read_text(encoding="utf-8") |
| 215 | checklist = text.split("## PRE-PRESENT SELF-CHECK", 1)[1].split("\n## ", 1)[0] |
| 216 | assert "Engagement counts select evidence" in checklist |
| 217 | assert "size is the finding" in checklist |
| 218 | assert "COUNTS IN PROSE exceptions" in checklist |
| 219 | |
| 220 | |
| 221 | def _odds_line_rule() -> str: |
| 222 | return reference_text("synthesis").split("**ODDS LINE.**", 1)[1].split("\n\n", 1)[0] |
| 223 | |
| 224 | |
| 225 | def test_odds_line_rule_sits_beside_the_pulled_quote_with_its_shape(): |
| 226 | text = reference_text("synthesis") |
| 227 | assert text.index(PULLED_MARKER) < text.index("**ODDS LINE.**") < text.index("**NO MARKDOWN LISTS") |
| 228 | rule = _odds_line_rule() |
| 229 | assert "names the topic and bears on a story" in rule |
| 230 | assert "its own blockquote line under that story's paragraph" in rule |
| 231 | assert "`> 📊 Polymarket · Huang divorce: 9.5% by Dec 31 (down 1 pt today) · 18% by Mar 31, 2027`" in rule |
| 232 | # The movement note after the last price is part of the line. |
| 233 | assert "Copy the whole odds line from `## Polymarket Markets`, up to the ` — ` before its URL." in rule |
| 234 | assert "last price" not in rule |
| 235 | |
| 236 | |
| 237 | def test_odds_lines_are_capped_at_three_and_apart_from_the_six_quotes(): |
| 238 | rule = _odds_line_rule() |
| 239 | assert "At most three in the report, apart from the six quote lines" in rule |
| 240 | assert "does not repeat the line's numbers" in rule |
| 241 | assert "says what the market is about and links it" in rule |
| 242 | assert "Other markets may be cited inline" in rule |
| 243 | for shape in ("`exec`", "RECOMMENDATIONS", "COMPARISON"): |
| 244 | assert shape in rule.rsplit("Not in", 1)[1] |
| 245 | |
| 246 | |
| 247 | def test_polymarket_guidance_points_at_odds_lines_and_keeps_odds_only(): |
| 248 | text = reference_text("synthesis") |
| 249 | section = text.split("### Prediction Markets (Polymarket)", 1)[1].split("\n### ", 1)[0] |
| 250 | assert "ODDS LINE" in section |
| 251 | assert "NEVER mention dollar volumes, liquidity, or betting amounts" in section |
| 252 | assert "Prefer structural/long-term markets over near-term deadlines" in section |
| 253 | assert "Weave odds into the narrative" not in section |
| 254 | assert "highlight 3-5" not in section |
| 255 | assert "pts" in section and "up 10% this month" not in section |
| 256 | |
| 257 | |
| 258 | def test_final_check_names_odds_lines(): |
| 259 | text = SKILL_MD.read_text(encoding="utf-8") |
| 260 | checklist = text.split("## PRE-PRESENT SELF-CHECK", 1)[1].split("\n## ", 1)[0] |
| 261 | assert "odds lines (at most three) or inline" in checklist |
| 262 | assert "never dollar volume" in checklist |
| 263 | |
| 264 | |
| 265 | def test_report_template_shows_one_odds_line(): |
| 266 | text = reference_text("synthesis") |
| 267 | template = text.split("{the engine's first line, copied verbatim}", 1)[1].split("```", 1)[0] |
| 268 | assert template.count("\n> 📊 Polymarket · ") == 1 |
| 269 |