Skip to content

[libc++] Start tracking Github issues in status pages #149833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
630 changes: 315 additions & 315 deletions libcxx/docs/Status/Cxx17Issues.csv

Large diffs are not rendered by default.

226 changes: 113 additions & 113 deletions libcxx/docs/Status/Cxx17Papers.csv

Large diffs are not rendered by default.

604 changes: 302 additions & 302 deletions libcxx/docs/Status/Cxx20Issues.csv

Large diffs are not rendered by default.

412 changes: 206 additions & 206 deletions libcxx/docs/Status/Cxx20Papers.csv

Large diffs are not rendered by default.

616 changes: 308 additions & 308 deletions libcxx/docs/Status/Cxx23Issues.csv

Large diffs are not rendered by default.

244 changes: 122 additions & 122 deletions libcxx/docs/Status/Cxx23Papers.csv

Large diffs are not rendered by default.

304 changes: 152 additions & 152 deletions libcxx/docs/Status/Cxx2cIssues.csv

Large diffs are not rendered by default.

318 changes: 159 additions & 159 deletions libcxx/docs/Status/Cxx2cPapers.csv

Large diffs are not rendered by default.

44 changes: 39 additions & 5 deletions libcxx/utils/synchronize_csv_status_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ class PaperInfo:
First version of LLVM in which this paper/issue was resolved.
"""

github_issue: Optional[str]
"""
Optional number of the Github issue tracking the implementation status of this paper.
This is used to cross-reference rows in the status pages with Github issues.
"""

notes: Optional[str]
"""
Optional plain text string representing notes to associate to the paper.
Expand All @@ -170,23 +176,26 @@ def __init__(self, paper_number: str, paper_name: str,
status: PaperStatus,
meeting: Optional[str] = None,
first_released_version: Optional[str] = None,
github_issue: Optional[str] = None,
notes: Optional[str] = None,
original: Optional[object] = None):
self.paper_number = paper_number
self.paper_name = paper_name
self.status = status
self.meeting = meeting
self.first_released_version = first_released_version
self.github_issue = github_issue
self.notes = notes
self.original = original

def for_printing(self) -> Tuple[str, str, str, str, str, str]:
def for_printing(self) -> Tuple[str, str, str, str, str, str, str]:
return (
f'`{self.paper_number} <https://wg21.link/{self.paper_number}>`__',
self.paper_name,
self.meeting if self.meeting is not None else '',
self.status.to_csv_entry(),
self.first_released_version if self.first_released_version is not None else '',
f'`#{self.github_issue} <https://github.com/llvm/llvm-project/issues/{self.github_issue}>`__' if self.github_issue is not None else '',
self.notes if self.notes is not None else '',
)

Expand All @@ -203,13 +212,19 @@ def from_csv_row(row: Tuple[str, str, str, str, str, str]):# -> PaperInfo:
if match is None:
raise RuntimeError(f"Can't parse paper/issue number out of row: {row}")

# Match the issue number if present
github_issue = re.search(r'#([0-9]+)', row[5])
if github_issue:
github_issue = github_issue.group(1)

return PaperInfo(
paper_number=match.group(1),
paper_name=row[1],
status=PaperStatus.from_csv_entry(row[3]),
meeting=row[2] or None,
first_released_version=row[4] or None,
notes=row[5] or None,
github_issue=github_issue,
notes=row[6] or None,
original=row,
)

Expand All @@ -235,6 +250,7 @@ def from_github_issue(issue: Dict):# -> PaperInfo:
status=PaperStatus.from_github_issue(issue),
meeting=issue.get('meeting Voted', None),
first_released_version=None, # TODO
github_issue=str(issue['content']['number']),
notes=notes,
original=issue,
)
Expand All @@ -252,19 +268,24 @@ def merge(paper: PaperInfo, gh: PaperInfo) -> PaperInfo:
is not useful.

In case we don't update the CSV row's status, we still take any updated notes coming
from the Github issue.
from the Github issue and we add a link to the Github issue if it was previously missing.
"""
took_gh_in_full = False # Whether we updated the entire PaperInfo from the Github version
if paper.status == PaperStatus(PaperStatus.TODO) and gh.status == PaperStatus(PaperStatus.IN_PROGRESS):
result = copy.deepcopy(paper)
result.notes = gh.notes
elif paper.status < gh.status:
result = copy.deepcopy(gh)
took_gh_in_full = True
elif paper.status == gh.status:
result = copy.deepcopy(paper)
result.notes = gh.notes
else:
print(f"We found a CSV row and a Github issue with different statuses:\nrow: {paper}\nGithub issue: {gh}")
result = copy.deepcopy(paper)

# If we didn't take the Github issue in full, make sure to update the notes, the link and anything else.
if not took_gh_in_full:
result.github_issue = gh.github_issue
result.notes = gh.notes
return result

def load_csv(file: pathlib.Path) -> List[Tuple]:
Expand All @@ -285,6 +306,8 @@ def create_github_issue(paper: PaperInfo, labels: List[str]) -> None:
"""
Create a new Github issue representing the given PaperInfo.
"""
assert paper.github_issue is None, "Trying to create a Github issue for a paper that is already tracked"

paper_name = paper.paper_name.replace('``', '`').replace('\\', '')

create_cli = ['gh', 'issue', 'create', '--repo', 'llvm/llvm-project',
Expand Down Expand Up @@ -363,6 +386,17 @@ def sync_csv(rows: List[Tuple], from_github: List[PaperInfo], create_new: bool,
results.append(row)
continue

# Validate the Github issue associated to the CSV row, if any
if paper.github_issue is not None:
if len(tracking) == 0:
print(f"Found row claiming to have a tracking issue, but failed to find a tracking issue on Github: {row}")
results.append(row)
continue
if len(tracking) == 1 and paper.github_issue != tracking[0].github_issue:
print(f"Found row with incorrect tracking issue: {row}\ntracked by: {tracking[0]}")
results.append(row)
continue

# If there is no tracking issue for that row and we are creating new issues, do that.
# Otherwise just log that we're missing an issue.
if len(tracking) == 0:
Expand Down
Loading