Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions .github/scripts/competitor_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,23 @@ def split_who_section(text):


def table_projects(section):
rows = [line for line in section.splitlines() if line.strip().startswith("|")]
cells = [[c.strip() for c in row.strip().strip("|").split("|")] for row in rows]
return [row[0] for row in cells[2:] if row and row[0]], [
line for line in section.splitlines() if not line.strip().startswith("|")]
"""Project names (first column) and the notes outside the table. The
table may be a Markdown pipe table or a fenced block of aligned columns."""
lines = section.splitlines()
rows = [line for line in lines if line.strip().startswith("|")]
if rows:
cells = [[c.strip() for c in row.strip().strip("|").split("|")] for row in rows]
projects = [row[0] for row in cells[2:] if row and row[0]]
notes = [line for line in lines if not line.strip().startswith("|")]
return projects, notes
fenced = re.findall(r"```[^\n]*\n(.*?)```", section, re.S)
projects = []
for block in fenced:
body = [line for line in block.splitlines()[1:] if line.strip()
and not re.fullmatch(r"[-+| ]+", line.strip())]
projects += [re.split(r"\s*\|\s*|\s{2,}", line.strip())[0] for line in body]
notes = re.sub(r"```.*?```", "", section, flags=re.S).splitlines()
return [p for p in projects if p], notes


def check_discord_matches(report, message):
Expand All @@ -228,7 +241,7 @@ def check_discord_matches(report, message):
"Discord and GitHub reports differ outside the project table "
"(ledger and sources details belong only on GitHub)")
projects, notes = table_projects(github_who)
require(projects, f'GitHub "{WHO_HEADING}" section needs a Markdown table')
require(projects, f'GitHub "{WHO_HEADING}" section needs a project table')
fenced = re.findall(r"```[^\n]*\n(.*?)```", discord_who, re.S)
require(fenced, f'Discord "{WHO_HEADING}" table must be a fenced code block')
block = squash(" ".join(fenced))
Expand Down
12 changes: 12 additions & 0 deletions .github/scripts/test_competitor_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,18 @@ def test_discord_formatting_differences_are_allowed(self):
not be required."""
self.validate()

def test_github_table_may_be_a_fenced_block(self):
"""Regression for run 43065486702: the agent used a fenced block on
GitHub too, which must count as the project table."""
payload = self.payload()
payload["items"][0]["body"] = payload["items"][0]["body"].replace(
self.GITHUB_TABLE, self.DISCORD_TABLE.replace("Owners: OpenHands All Hands AI; Roo Code Roo.\n", ""))
self.validate(payload)
payload["items"][1]["message"] = self.discord_text().replace(
"Roo Code (arch.) editor could be Apache-2.0\n", "", 1)
with self.assertRaisesRegex(ValueError, "missing 'Roo Code"):
self.validate(payload)

def test_discord_prose_must_match_github(self):
payload = self.payload()
payload["items"][1]["message"] = self.discord_text().replace(
Expand Down
1 change: 1 addition & 0 deletions changelog.d/fixed-competitor-report-fenced-table.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Weekly competitor report: the publication gate accepts the "Who does what" project table as a fenced block on GitHub as well as a Markdown table (catch-up run 43065486702 failed on this).
Loading