Skip to content

Harden the Check workflow; thumbnails at the OG size - #2

Merged
Jing-yilin merged 1 commit into
mainfrom
harden-check
Sep 25, 2026
Merged

Jing-yilin merged 1 commit into
mainfrom
harden-check

Conversation

@Jing-yilin

Copy link
Copy Markdown
Contributor

Fixes from a three-way review of the Check workflow, plus the new thumbnail size.

  • Changed files come from the PR's file list (renames included, capped at 3000); a file outside projects/<id>/ fails.
  • The author is matched by numeric GitHub id from the base index.json, not the login. A non-author must already be in contributors, or be added by this PR.
  • Every author/contributors login must exist. Any non-zero sp pack --check fails, even with no problem line.
  • thumbnail.png must be 2400 × 1260 (an Open Graph image's 1200 × 630, twice over) and at most 5 MB.
  • index.yml checks out main explicitly; the sort parses timestamps.
  • README: the step order (--check reports a missing id/author that -o fills in) and the thumbnail rule.

Needs ReScienceLab/super-prototyping#183's sp for the new thumbnail size.

🤖 Generated with Claude Code

…e OG size

- The changed files come from the PR's file list, renames included, capped
  at 3000, and any outside projects/<id>/ is refused.
- The author is matched by numeric account id, so a renamed or re-registered
  login cannot take a project over; a non-author must already be in
  contributors or be added by the same PR.
- Every login named must exist; any non-zero sp pack --check fails.
- thumbnail.png is 2400x1260, an Open Graph image twice over, 5 MB at most.
- The index job builds from main, and sorts by parsed timestamps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a42b236003

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/community.py
Comment on lines +74 to +77
listed = {e["id"]: e["author"]["id"] for e in read(Path("index.json"))["projects"]}

def author_id(name):
return listed.get(name) or user_id(read(base[name] / "project.json")["author"])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid authorizing from a stale index after a handoff

When an author hands a project to another user, the project commit reaches main before the separate Index workflow commits the regenerated index.json. A Check workflow started in that interval reads the new project.json but this expression still returns the former author's ID from the stale index, so the former author can remove or hand off the project while the actual new author is denied those operations. Compare the indexed login with the base project's author before trusting its ID, or otherwise make the identity source update atomically with the handoff.

Useful? React with 👍 / 👎.

Comment thread .github/community.py
Comment on lines +134 to +135
found = user(f"user/{known[login.lower()]}" if login.lower() in known else f"users/{login}")
return {"login": found["login"], "id": found["id"]} if found else {"login": login, "id": None}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve the stable ID when an account lookup returns 404

If a previously indexed author deletes their account, known still contains the immutable numeric ID, but a 404 now rewrites that entry with id: None. The checker consequently falls back to resolving the author string by login; if GitHub later assigns that login to someone else, the new account is treated as the project's author and gains removal and handoff privileges. Keep the known ID on lookup failure rather than discarding the identity that this change is intended to protect.

Useful? React with 👍 / 👎.

Comment thread .github/community.py
# A rename lists its old path too, which is a change to the folder it left.
changed = gh("--paginate", f"repos/{os.environ['GITHUB_REPOSITORY']}/pulls/"
f"{os.environ['PR']}/files", "--jq", ".[] | .filename, .previous_filename // empty")
found = check(Path(sys.argv[2]), sys.argv[3], int(sys.argv[4]), changed.split())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep API filenames intact when parsing the file list

For a package containing a valid filename with spaces or other whitespace, gh --jq emits the path on one line but changed.split() breaks it into multiple alleged paths. The first fragment may select the project while the remaining fragments are reported as changes outside projects/<id>/, causing the Check workflow to reject the PR. Parse the command output without whitespace tokenization, such as by returning JSON and decoding the filename array.

Useful? React with 👍 / 👎.

@Jing-yilin
Jing-yilin merged commit f340da2 into main Sep 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant