mirror of
https://github.com/penpot/penpot.git
synced 2026-11-26 21:00:32 +00:00
Merge remote-tracking branch 'origin/staging' into develop
This commit is contained in:
commit
35a7189682
@ -5,57 +5,12 @@ description: Update the project CHANGES.md with issues from a given GitHub miles
|
||||
|
||||
# Skill: update-changelog
|
||||
|
||||
Entry point for all changelog work. All rules — sections, exclusions, entry
|
||||
format, the `:boom:`, `:rocket:` and `:lock:` contracts, pre-flight, and the
|
||||
anomaly report — live in `mem:workflow/updating-changelog` (file:
|
||||
`.serena/memories/workflow/updating-changelog.md`). This skill routes to that
|
||||
memory; it does not repeat it.
|
||||
Use this skill to prepare, refresh, or audit a changelog version.
|
||||
|
||||
## When to Use
|
||||
Read `mem:workflow/updating-changelog` for the rules and follow its **Flow**:
|
||||
collect, review, write, verify. Start with `collect <VERSION>` and keep its
|
||||
JSON snapshot in a private temporary file. Reuse it for the review and checks;
|
||||
collect again if the GitHub data changes.
|
||||
|
||||
- Before a new release, to populate the changelog with all fixed issues
|
||||
- When new issues are added to an existing milestone and the changelog needs
|
||||
to be refreshed
|
||||
- To audit or repair an existing version section
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- `gh` CLI authenticated (`gh auth status`)
|
||||
- Python 3.8+
|
||||
- `scripts/gh.py` for GitHub queries, `scripts/changelog.py` for changelog
|
||||
checks (run `python3 scripts/changelog.py <command> --help` for usage)
|
||||
|
||||
## What to Read
|
||||
|
||||
1. `mem:workflow/updating-changelog` — the canonical flow: sources of truth,
|
||||
layout, entry rules, the `## Breaking change note` comment contract, the
|
||||
advisory (`:lock:`) contract, pre-flight checks, anomaly types, and pitfalls.
|
||||
2. `mem:scripts/changelog` — `boom`, `security`, `check-merged`, `cross-ref`,
|
||||
`dev-only-bugs`, `report`.
|
||||
3. `mem:scripts/gh` — `issues`, `issue`, `comments`, `prs`, `advisories`.
|
||||
|
||||
## Commands
|
||||
|
||||
```bash
|
||||
python3 scripts/gh.py issues "<VERSION>" --exclude "no changelog"
|
||||
python3 scripts/gh.py issues "<VERSION>" --label "release blocker" --exclude "no changelog" # closed non-bug residue to review by hand
|
||||
python3 scripts/gh.py advisories --patched-version "<VERSION>"
|
||||
python3 scripts/changelog.py dev-only-bugs "<VERSION>" # list bugs that never reached production
|
||||
python3 scripts/changelog.py dev-only-bugs "<VERSION>" --apply # label the sure ones `no changelog`
|
||||
python3 scripts/changelog.py check-merged <PR numbers...>
|
||||
python3 scripts/changelog.py boom "<VERSION>" # print the :boom: section
|
||||
python3 scripts/changelog.py boom "<VERSION>" --write # replace it in CHANGES.md
|
||||
python3 scripts/changelog.py security "<VERSION>" # print the :lock: section
|
||||
python3 scripts/changelog.py security "<VERSION>" --write # replace it in CHANGES.md
|
||||
python3 scripts/changelog.py cross-ref "<VERSION>"
|
||||
python3 scripts/changelog.py report "<VERSION>"
|
||||
```
|
||||
|
||||
## Hard Rules
|
||||
|
||||
- `CHANGES.md` is edited only on explicit request or during the release process.
|
||||
- Only closed, non-excluded milestone issues are included; the issue is the changelog unit and the PR is inline.
|
||||
- `:boom:` and `:rocket:` are label-generated and `:lock:` is advisory-generated: never hand-edit them; edit the label, the `## Breaking change note` comment or the advisory and re-run the command.
|
||||
- Verify PR merge status before writing; only merged PRs are referenced.
|
||||
- Bugs that never reached production stay out: `dev-only-bugs --apply` labels the sure ones; candidates are the user's call, never label them yourself.
|
||||
- Fill `patched_versions` in the advisories before running `security`; unpublished advisories are valid.
|
||||
Keep review read-only. Follow the separate `--apply` branch only when the
|
||||
workflow calls for it.
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
- The v3 format carries no size per file: the size of one is the sum of its own entries plus the `objects/` its media and thumbnail metadata reference, the only link between a file and that shared storage.
|
||||
- Those metadata entries are read one at a time on purpose: a container holds thousands and every read opens its own decompression stream, which makes Chromium fail the analysis — zip.js then masks the cause behind a `Cannot close a ERRORED writable stream` — while Firefox tolerates it. Do not turn this back into a parallel read. The read is best-effort: a reference that cannot be read leaves that file without size, never the whole package.
|
||||
- The `:error` of an import entry is user-facing text, never an i18n key. The legacy SSE import stays in the backend for other clients.
|
||||
- Import entries from local files or downloaded onboarding templates retain the original `File` or `Blob` through analysis. The chunked upload uses it directly rather than fetching the `blob:` URL again. Template links that supply only a URL still use the fetch path.
|
||||
- File creation/duplication strips file `:data` before putting file summaries into dashboard state.
|
||||
- The pending invitations are a team-admin only list (backend `:is-admin` already includes the owner). The dashboard hides the invitations entry from the header tabs and the team-options dropdown for non-admins, `invitations-section-content` keys the section on `:is-admin`, and `fetch-invitations` answers `insufficient-permissions` by emitting `invitations-fetched` with `[]`, so a demoted admin does not keep the cached emails and the header does not paint the invite button from a stale list. The organization `send-invitations` policy (`can-invite?`) does not gate the list, but it gates every action on it: inviting (header and empty-state buttons render disabled with the `dashboard.invite-profile-disabled` tooltip), the role selector (read-only label), row selection (so resend and delete never show) and copy link (`invitation-link-copyable?`). The backend enforces the same rule.
|
||||
|
||||
@ -18,4 +19,4 @@
|
||||
- Viewer bundle fetch sends the full supported feature set because anonymous shared viewers may not know team-enabled features.
|
||||
- View-only bundles can contain pointer values in `:pages-index` and file data (membership bundles; share-link bundles carry components inline and deny their fragment). Viewer resolves those fragments with `:get-file-fragment` before storing the bundle, through `app.main.features.pointer-map/resolve-pointer` (share-link scoped; the workspace and library loaders use `resolve-file`, which resolves the same two levels). Both fail loudly: a fragment that cannot be resolved rejects the stream and is logged with file id and fragment id instead of silently dropping the page.
|
||||
- `bundle-fetched` indexes pages and precomputes viewer frames/all-frames, stores libraries/users/thumbnails/permissions under `:viewer`, then navigates to frame id, query index, or auto-selected frame.
|
||||
- Viewer zoom and interaction mode changes update both `:viewer-local` and the `:viewer` route query params. `update-zoom-querystring` guards with a query-param comparison (`not= current expected`) and uses `::rt/replace`; without that guard the load sequence (`bundle-fetched` → `zoom-to-fill` → `update-zoom-querystring` → `rt/nav`) re-runs on every navigation and crashes with React "maximum update depth exceeded" (2.18.0-RC5 regression, fixed in `31b73460c3`; regression test: `bundle-fetched-with-zoom-fill-url-does-not-navigate`).
|
||||
- Viewer zoom and interaction mode changes update both `:viewer-local` and the `:viewer` route query params. `update-zoom-querystring` guards with a query-param comparison (`not= current expected`) and uses `::rt/replace`; without that guard the load sequence (`bundle-fetched` → `zoom-to-fill` → `update-zoom-querystring` → `rt/nav`) re-runs on every navigation and crashes with React "maximum update depth exceeded" (2.18.0-RC5 regression, fixed in `31b73460c3`; regression test: `bundle-fetched-with-zoom-fill-url-does-not-navigate`).
|
||||
|
||||
@ -4,11 +4,13 @@
|
||||
|
||||
## Subcommands
|
||||
|
||||
- `collect <MILESTONE> [--changes CHANGES.md]` — read-only. Prints JSON to stdout with all milestone `issues` and `prs`, `eligible_issues` (issue numbers), `related_issues` and `related_prs` resolved in batches, `breaking_notes` keyed by issue number, `advisories`, `security_prs` keyed by GHSA, `dev_only_bugs` (`auto` and `suggested`), and `comparison` against the current changelog (references, missing and ineligible issues, cross-version duplicates, unlisted merged PRs). A missing version section is valid. Keep the snapshot private; it can contain unpublished advisories and PR text. See `mem:workflow/updating-changelog` for when to refresh it.
|
||||
- `boom`, `security`, `cross-ref`, `dev-only-bugs` and `report` accept `--snapshot <FILE>` to reuse GitHub data from `collect` for the same milestone. `cross-ref` and `report` still read the current changelog; `--write`, `--apply` and `report` retain their existing write behavior. Without a snapshot, commands query GitHub as before.
|
||||
- `check-merged <PR...>` (`--file`, `--stdin` accepted) — warn on any non-merged PR, exit 1 when found; run before writing changelog entries.
|
||||
- `boom <MILESTONE> [--changes CHANGES.md --write]` — generate `### :boom: Breaking changes & Deprecations` from the closed, non-excluded milestone issues labelled `breaking change`, sorted by issue number. Each issue becomes a `#### <issue title>` block: content = body of the issue's last `## Breaking change note` comment (whole markdown, headings demoted to `#####` outside code fences; fallback = heading plus refs with a stderr warning), refs = issue link plus merged closing PRs on their own line, with `(by @author)` for `community contribution`. `--write` replaces only that subsection of the version (inserts it after the version header when missing, keeps the heading when there are no entries; idempotent). Print-only by default. Uses `gh.py comments`.
|
||||
- `boom <MILESTONE> [--changes CHANGES.md --write]` — generate `### :boom: Breaking changes & Deprecations` from the closed, non-excluded milestone issues labelled `breaking change`, sorted by issue number. Each issue becomes a `#### <issue title>` block: content = body of the issue's last `## Breaking change note` comment (whole markdown, headings demoted to `#####` outside code fences; fallback = heading plus refs with a stderr warning), refs = issue link plus merged closing PRs on their own line, with `(by @author)` for `community contribution`. `--write` replaces only that subsection of the version, inserts it after the version header when needed, and removes it when there are no entries. Print-only by default. Uses `gh.py comments`.
|
||||
- `security <MILESTONE> [--changes CHANGES.md --write]` — generate `### :lock: Security fixes` from the advisories whose `patched_versions` include the version (via `gh.py advisories --patched-version`), sorted by GHSA id. Entry: `- Fix <description> (<advisory URL>) (PR: [#N](...))`; description = `Fix` + advisory summary, first word decapitalized unless it starts with an acronym; PRs = merged milestone PRs labelled `pr pt` whose body contains the GHSA id, comma-separated, and no PR is legal. Warns on stderr when a `pr pt` PR references an advisory with no matching `patched_versions`. `--write` replaces only that subsection, placed after `:rocket:` (or `:boom:`, or the version header when neither exists); empty entries remove the subsection; idempotent. Print-only by default.
|
||||
- `cross-ref <MILESTONE> [--changes CHANGES.md]` — fetch milestone PRs with `--state all` once, report merged PRs missing from the version section plus CLOSED (unmerged) warnings. PR links inside `:lock:` entries count as referenced; advisory URLs never appear here by design.
|
||||
- `dev-only-bugs <MILESTONE> [--apply]` — list closed milestone bugs that never reached production, without `no changelog` (bugs carrying `release blocker` are analyzed too). Sure: parent issue is a `Feature`/`Enhancement` of the same milestone; `--apply` adds `no changelog` to these only. Candidates (never labelled automatically): parent is an epic of the milestone, `regression` label, or the "Affected versions" / "Environment" body field names only hourly, develop, staging, PRE or the milestone version itself (`only_unreleased_envs`; any production hint or other version keeps the bug in — versions compare as full semver with missing patch = 0, so for milestone 2.19.2 the released 2.19.0 keeps the bug in). Reads `body` and `parent` from one batched `gh.py issue` lookup.
|
||||
- `dev-only-bugs <MILESTONE> [--apply]` — list closed milestone bugs that never reached production, without `no changelog`. Sure: parent issue is a `Feature`/`Enhancement` of the same milestone; `--apply` adds `no changelog` to these only and prints each successful edit to stdout with its issue URL and reason. On failure it exits nonzero and names the failed issue on stderr; earlier confirmations remain visible. Candidates (never labelled automatically): parent is an epic of the milestone, `regression` label, or the "Affected versions" / "Environment" body field names only hourly, develop, staging, PRE or the milestone version itself (`only_unreleased_envs`; any production hint or other version keeps the bug in — versions compare as full semver with missing patch = 0, so for milestone 2.19.2 the released 2.19.0 keeps the bug in). Reads `body` and `parent` from one batched `gh.py issue` lookup.
|
||||
- `report <MILESTONE> [--changes CHANGES.md --output CHANGES-ISSUES.md]` — overwrite the anomaly report: A/B milestone mismatches, E `:boom:` entry without the label, F `:rocket:` sync, G `:boom:` sync, plus the C/D `:rocket:` gaps and the `dev-only-bugs` lists (warnings). `:boom:`/`:rocket:` rule violations are fixed by regenerating or relabelling, not by editing entries in place.
|
||||
|
||||
## Conventions
|
||||
@ -19,4 +21,4 @@
|
||||
- PR/issue reference parsing covers standard `[#N](.../pull/N)` / `[#N](.../issues/N)` links plus legacy `PR:[N]` / `[Github #N]` forms.
|
||||
- Shared parsing helpers (`extract_version_section`, `extract_subsection`, `collect_changelog_prs/issues`) live at module top so future subcommands reuse them instead of duplicating regexes.
|
||||
- Report anomaly types: A/B milestone mismatches, E `:boom:` entry whose issue lacks the `breaking change` label (counted, entries preserved — human labels the issue or moves the entry), G `breaking change` issue missing from `:boom:` (counted, same contract as F); C/D are `:rocket:` gaps (warnings, never counted).
|
||||
- `issue_excluded` (closed, non-Task, non-Rejected, no `no changelog` label) is module-level and shared by `report` and `boom` so the exclusions cannot drift.
|
||||
- `issue_excluded` (closed, non-Task, non-Rejected, no `no changelog` label) is module-level and shared by `report` and `boom` so the exclusions cannot drift. `release blocker` is not a changelog exclusion.
|
||||
|
||||
@ -151,6 +151,8 @@ python3 scripts/gh.py advisories GHSA-xvj6-fh9w-gjw7
|
||||
|
||||
`--patched-version` filters the raw advisories before formatting: the match is an exact token of `vulnerabilities[*].patched_versions` (split on `,`/`;`), so `2.19.1` never matches `2.19.10`. Every state is included (`triage`, `draft`, `published`, `closed`, `withdrawn`). The raw `vulnerabilities` stay internal to the filter: the list output keeps the summary schema.
|
||||
|
||||
The repository security-advisories endpoint uses cursor pagination (`before`/`after`), not numeric `page` pagination. Observed failure: `page=1` and `page=2` both returned the same 100 advisories, so a length-based loop never ended. `fetch_advisories` must use `gh api --paginate --slurp` so the GitHub CLI follows the response `Link` headers and returns page arrays for flattening. Do not hand-increment `page`.
|
||||
|
||||
**Output**: JSON to stdout; progress to stderr.
|
||||
|
||||
## Key principles
|
||||
|
||||
@ -28,9 +28,9 @@ Editing `CHANGES.md` happens only on explicit request or as part of the release
|
||||
- **Security fixes come from advisories**: an advisory whose `patched_versions` include the version becomes a `:lock:` entry (section 7). `triage`, `draft` and `published` are all valid states; the advisory may still be unpublished when the changelog is written. A security fix may also carry a regular bug issue; both entries are legal and independent (the issue lives in `:bug:` as any other bug).
|
||||
- **Two labels override the Issue Type**: `breaking change` → an entry only under `:boom:`, never in its regular section; `release highlight` → an extra entry under `:rocket:` on top of its regular entry.
|
||||
- **Only closed issues**. An open issue in the milestone is not generated, even if someone added a provisional entry by hand before the merge.
|
||||
- **Excluded issues**: `no changelog`, `Task` issue type, `Rejected` project status. `release blocker` is a workflow label (the issue blocks the release), not a changelog exclusion: bugs carrying it are analyzed by `dev-only-bugs` (section 8, step 3), and closed non-bug issues carrying it are reviewed by hand (section 8, step 3).
|
||||
- **Bugs that never reached production** stay out: a bug found and fixed while building a feature of the same, unreleased version never affected users. The team rarely labels them, so the flow finds them with `dev-only-bugs` and labels them `no changelog` (section 8, step 3).
|
||||
- **Excluded PRs**: a PR with `release blocker` or `no issue required` does not bring an entry of its own.
|
||||
- **Excluded issues**: `no changelog`, `Task` issue type, `Rejected` project status. `release blocker` is not a changelog filter.
|
||||
- **Bugs that never reached production** stay out: a bug found and fixed while building a feature of the same, unreleased version never affected users. The flow finds these bugs and labels the sure cases `no changelog` (section 8, Review).
|
||||
- **Excluded PRs**: a PR with `no issue required` does not bring an entry of its own.
|
||||
- **An issue with no milestone** belongs to another (probably private) project: it is neither changelog candidate nor anomaly.
|
||||
|
||||
## 3. Layout of `CHANGES.md`
|
||||
@ -74,7 +74,7 @@ The newest version goes at the top, right after the `# CHANGELOG` header. Inside
|
||||
- `:boom:` first, then `:rocket:`, `:lock:`, `:tada:`, `:sparkles:`, `:bug:`. Features come before enhancements so they stand out to readers deciding whether to update.
|
||||
- **This layout applies from 2.20.0.** Versions up to 2.19.x use the old one: `:bug: Bugs fixed` before `:sparkles: New features & Enhancements`, which mixes features and enhancements. Keep the old layout in those sections, including new 2.19.x patches, so a minor line reads the same. The in-app update dialog only reads `:rocket:`, so the change does not affect it.
|
||||
- Other headings exist in old versions (`:heart:` community contributions); do not add them to new versions.
|
||||
- Include a section only when it has entries. Historical versions may have an empty `:boom:` or `:rocket:` heading; `boom --write` keeps the `:boom:` heading even when there are no entries. `:lock:` is omitted (and removed on `--write`) when the version has no security advisories.
|
||||
- Include a section only when it has entries. `boom --write` removes an empty `:boom:` subsection and does not insert one when there are no breaking changes. `:lock:` is omitted (and removed on `--write`) when the version has no security advisories.
|
||||
- One blank line between the last entry of a section and the next heading.
|
||||
- No manual line wrapping: one line per bullet or paragraph, however long.
|
||||
|
||||
@ -129,7 +129,6 @@ Rules for the note:
|
||||
- **Write it for admins**: what changes, what they must do, and what breaks if they do nothing. Do not paste the full runbook; explain the implications and link the runbook or docs.
|
||||
- **Link a long-lived branch**, `staging` or `main`, never a feature branch (`issue-1234`). The link may 404 until the PR merges; that is expected.
|
||||
- **Do not add issue or PR links**: the generator appends them.
|
||||
- **Do not hard-wrap the text**: one line per paragraph or bullet. The generator copies lines verbatim, so wrapped lines end up wrapped in `CHANGES.md`.
|
||||
- **One note per issue**. If several comments carry the marker, the generator uses the last one and warns.
|
||||
- **No note**: the generator warns on stderr and emits only the heading and references; fix the issue, not `CHANGES.md`.
|
||||
- **`####`, not `###`**: `###` is the level of the changelog sections. An entry at `###` would render as a sibling section and the scripts that read and rewrite `:boom:` would cut the section there. The note author never writes the `####`: the generator adds it.
|
||||
@ -141,7 +140,7 @@ Rules for the note:
|
||||
- Lists exactly the milestone issues with the `release highlight` label, and nothing else. Product decides highlights by labelling issues; a regeneration cannot undo that choice.
|
||||
- Every entry copies the text and references of the issue's regular entry and MUST carry both an issue link and a PR reference.
|
||||
- If no issue is labelled, leave the section out; do not pick highlights yourself.
|
||||
- Never edit `:rocket:` by hand: add or remove the label and regenerate.
|
||||
- No command generates `:rocket:` today. Build it from the eligible labelled issues in the snapshot, using their regular entries, and verify it with `report`. Change the label on GitHub to change which issues appear; do not pick highlights in the changelog.
|
||||
|
||||
## 7. `:lock:`: security fixes
|
||||
|
||||
@ -158,29 +157,50 @@ Generated from the advisories that declare the version in `patched_versions`; ne
|
||||
|
||||
## 8. Flow
|
||||
|
||||
1. **Confirm the version** (a semver string such as `2.19.0`) with the user when it is not obvious.
|
||||
2. **Fetch the milestone issues**: `python3 scripts/gh.py issues "<VERSION>" --exclude "no changelog"` (closed by default; add `--state all` only to inspect open issues). `gh.py` already drops `Task` and `Rejected`; pass `--include-tasks` / `--include-rejected` only to inspect them. To find what is missing from an existing section, add `--compare CHANGES.md`.
|
||||
3. **Keep out bugs that never reached production**: `python3 scripts/changelog.py dev-only-bugs "<VERSION>"` lists them; add `--apply` to label the sure ones `no changelog` on GitHub, then re-fetch step 2. The label puts the decision on the issue, so it survives a regeneration. Bugs carrying `release blocker` are analyzed like any other bug.
|
||||
- **Sure**: a bug whose parent issue is a `Feature` or `Enhancement` of the same milestone. `--apply` labels these.
|
||||
- **Candidates**: a bug whose parent is an epic of the same milestone, that carries the `regression` label, or whose "Affected versions" / "Environment" field names only hourly, develop, staging, PRE or the milestone version itself. `regression` also marks regressions users hit in production, and the field says where the bug was seen, not since when it exists, so never label these yourself: show them to the user, who labels the ones they confirm. The anomaly report lists them too (section 10).
|
||||
- **Closed non-bug issues carrying `release blocker`** have no automatic check: `python3 scripts/gh.py issues "<VERSION>" --label "release blocker" --exclude "no changelog"` lists them (closed, non-Task). Show them to the user: the internal ones get the `no changelog` label, the rest keep their entry.
|
||||
4. **Fetch PR details when needed**: `python3 scripts/gh.py prs <numbers...>` (also `--milestone`). Use it for the PR author, labels and merge state.
|
||||
5. **Categorize** by Issue Type and the two labels (section 2), and **build the descriptions** (section 4).
|
||||
6. **Verify PR merge status** before writing: `python3 scripts/changelog.py check-merged <PR numbers...>`. Only merged PRs go in the changelog; if a closing PR was closed unmerged, look for the PR that superseded it.
|
||||
7. **Reconcile the existing text** (section 9).
|
||||
8. **Generate `:boom:`**: `python3 scripts/changelog.py boom "<VERSION>"` prints the section; add `--write` to replace it in `CHANGES.md`. The write replaces only that subsection, inserts it after the version header when missing, keeps the heading when there are no entries, and is idempotent.
|
||||
9. **Generate `:rocket:`** from the `release highlight` label (section 6).
|
||||
10. **Generate `:lock:`**: `python3 scripts/changelog.py security "<VERSION>"` prints the section; add `--write` to replace it in `CHANGES.md`. The contract lives in section 7.
|
||||
11. **Cross-check PRs**: `python3 scripts/changelog.py cross-ref "<VERSION>"`. It lists merged milestone PRs missing from the section and warns about closed (unmerged) PRs. PRs linked from `:lock:` count as referenced; an advisory with no PR is invisible here by design.
|
||||
12. **Generate the anomaly report**: `python3 scripts/changelog.py report "<VERSION>"`. It overwrites `CHANGES-ISSUES.md` with the current state (section 10).
|
||||
### Collect
|
||||
|
||||
- Confirm the version if unclear. Use an authenticated `gh` CLI and a private temporary file: the snapshot can contain unpublished advisories and PR text.
|
||||
|
||||
```bash
|
||||
snapshot=$(mktemp)
|
||||
python3 scripts/changelog.py collect "<VERSION>" > "$snapshot"
|
||||
```
|
||||
|
||||
- Use the same snapshot throughout. Collect again if GitHub data changes or if the final report needs to resolve a new reference absent from the snapshot.
|
||||
|
||||
### Review
|
||||
|
||||
- Use `eligible_issues` to select entries, `comparison` to reconcile the current text (section 9), and `prs` and `related_prs` to verify links. Reference only `MERGED` PRs. If a closing PR was closed unmerged, look for its replacement; use `check-merged` for PRs looked up outside the snapshot.
|
||||
- Review `dev_only_bugs`. A bug with a `Feature` or `Enhancement` parent in the same milestone is a sure case (`auto`). An epic parent in the same milestone, a `regression` label, or an unreleased-only environment is only a hint (`suggested`). Show candidates to the user, who labels the ones they confirm.
|
||||
- Use the snapshot to find eligible non-bug issues labelled `release blocker`. Show them to the user for review: internal work gets `no changelog`, and the rest keeps its entry. `release blocker` alone excludes nothing.
|
||||
- **Separate GitHub write, only if there are sure cases:** `python3 scripts/changelog.py dev-only-bugs "<VERSION>" --snapshot "$snapshot" --apply` adds `no changelog` to `auto` issues and prints each successful edit to stdout. If a later edit fails, earlier edits still stand. Collect again after applying labels before proceeding.
|
||||
|
||||
### Write
|
||||
|
||||
- Update only on explicit request or during a release. Categorize and draft entries using sections 2–4. Build `:rocket:` from `release highlight` as described in section 6.
|
||||
- Use the generators for `:boom:` and `:lock:` (sections 5 and 7). Omit `--write` to preview; use it only after the version header exists.
|
||||
|
||||
```bash
|
||||
python3 scripts/changelog.py boom "<VERSION>" --snapshot "$snapshot" --write
|
||||
python3 scripts/changelog.py security "<VERSION>" --snapshot "$snapshot" --write
|
||||
```
|
||||
|
||||
### Verify
|
||||
|
||||
- `cross-ref` shows missing merged PRs and warns about closed, unmerged PRs. `report` checks the updated changelog and overwrites `CHANGES-ISSUES.md` (section 10).
|
||||
|
||||
```bash
|
||||
python3 scripts/changelog.py cross-ref "<VERSION>" --snapshot "$snapshot"
|
||||
python3 scripts/changelog.py report "<VERSION>" --snapshot "$snapshot"
|
||||
```
|
||||
|
||||
## 9. Pre-flight: reconcile before writing
|
||||
|
||||
Re-fetch the milestone (do not trust cached data) and fix these in `CHANGES.md` before adding the new section:
|
||||
Start from a fresh `collect` snapshot. Refresh it if GitHub changes during review (labels, notes, advisories, or PRs). Fix these in `CHANGES.md` before adding the new section:
|
||||
|
||||
1. **Duplicate across versions** → remove it from the current section; the earlier version wins for backports. The same holds after merging a patch branch into `staging`: the fix keeps its released patch entry and leaves the newer, unreleased section (the merge conflict in `CHANGES.md` is resolved by keeping both sections, newest first, minus the duplicate).
|
||||
1. **Duplicate across versions** → remove it from the current section; the earlier version wins for backports.
|
||||
2. **Stale milestone assignment** (the issue moved out of this milestone) → remove the entry.
|
||||
3. **Newly applied exclusion labels** (`no changelog`) → remove the entry. (`release blocker` is not an exclusion label; it never removes an entry by itself.)
|
||||
3. **Newly applied exclusion label** (`no changelog`) → remove the entry.
|
||||
4. **Issue no longer closed, deleted, or now `Rejected`** → remove the entry.
|
||||
5. **Unmerged or moved PR reference** → fix the reference or remove the entry. A PR merged in a different milestone is an anomaly (section 10); do not remove it silently.
|
||||
6. **Issue Type changed** → to `Task`: remove the entry; to another type: move the entry to that type's section.
|
||||
@ -200,7 +220,7 @@ Re-fetch the milestone (do not trust cached data) and fix these in `CHANGES.md`
|
||||
- **C — released X.Y.0 version without a `:rocket:` section** (gap; patches never carry highlights).
|
||||
- **D — `:rocket:` entry without issue AND PR references** (gap).
|
||||
|
||||
**Bugs that may never have reached production** are warnings too (section 8, step 3): sub-issues of a milestone feature still unlabelled (run `dev-only-bugs --apply`) and candidates for the user to confirm. They never count toward the total.
|
||||
**Bugs that may never have reached production** are warnings too (section 8, Review): sure cases still unlabelled and candidates for the user to confirm. They never count toward the total.
|
||||
|
||||
Anything else is a rule violation, not a report item: fix it in the pre-flight and re-run.
|
||||
|
||||
@ -210,12 +230,12 @@ Anything else is a rule violation, not a report item: fix it in the pre-flight a
|
||||
- **Labels, not emoji**: title prefixes are cosmetic and often missing; the section comes from Issue Type and the two labels.
|
||||
- **Taiga references**: old entries link to Taiga. Resolve them to the GitHub issue via the description text or the PRs that mention the Taiga URL, then link issue and PR.
|
||||
- **Long-lived links only**: runbooks and docs referenced from a note must point to `staging` or `main`, never to a feature branch that will be deleted.
|
||||
- **Generated sections**: `:boom:`, `:rocket:` and `:lock:` are generated. Never patch them by hand; edit the label, the note comment or the advisory and re-run.
|
||||
- **Generated sections**: use `boom` and `security` for `:boom:` and `:lock:`. Change the label, note or advisory on GitHub rather than patching their output. For `:rocket:`, follow the label-driven workflow in section 6.
|
||||
- **Deleted or transferred issues**: an issue referenced in the changelog that returns 410/404 (deleted or moved out of the repo) must lose its entry in the pre-flight. Its security fixes, if any, stay in `:lock:` through the advisory.
|
||||
|
||||
## 12. Where the code is
|
||||
|
||||
- `scripts/gh.py`: `issues`, `issue`, `comments`, `prs`, `link-issue`, `advisories` (with `--patched-version`). Details: `mem:scripts/gh`.
|
||||
- `scripts/changelog.py`: `check-merged`, `boom`, `security`, `cross-ref`, `dev-only-bugs`, `report`. Details: `mem:scripts/changelog`.
|
||||
- `scripts/changelog.py`: `collect`, `check-merged`, `boom`, `security`, `cross-ref`, `dev-only-bugs`, `report`. Details: `mem:scripts/changelog`.
|
||||
- Tests: `scripts/test_gh.py`, `scripts/test_changelog.py`.
|
||||
- The note contract for issue authors: `mem:workflow/creating-issues`, section **Breaking changes**.
|
||||
|
||||
13
CHANGES.md
13
CHANGES.md
@ -135,6 +135,19 @@ If you upgrade blindly: on fresh databases and small instances the startup migra
|
||||
- Fix workspace memory growing on every page switch with the WebGL renderer [#13028](https://github.com/penpot/penpot/issues/13028) (PR: [#12877](https://github.com/penpot/penpot/pull/12877))
|
||||
- Fix workspace showing React error #310 when the team container renders without a team id (by @filipsajdak) [#12728](https://github.com/penpot/penpot/issues/12728) (PR: [#12920](https://github.com/penpot/penpot/pull/12920))
|
||||
|
||||
## 2.19.4
|
||||
|
||||
### :bug: Bugs fixed
|
||||
|
||||
- Fix importing large `.penpot` files in Chrome [#13165](https://github.com/penpot/penpot/issues/13165) (PR: [#13183](https://github.com/penpot/penpot/pull/13183))
|
||||
|
||||
## 2.19.3
|
||||
|
||||
### :bug: Bugs fixed
|
||||
|
||||
- Fix app startup failure on Chromium browsers with Tampermonkey user scripts enabled [#12924](https://github.com/penpot/penpot/issues/12924) (PR: [#13085](https://github.com/penpot/penpot/pull/13085))
|
||||
- Size frontend nginx workers from the container CPU limit to prevent OOM kills on large nodes [#13103](https://github.com/penpot/penpot/issues/13103) (PR: [#13110](https://github.com/penpot/penpot/pull/13110))
|
||||
|
||||
## 2.19.2
|
||||
|
||||
### :bug: Bugs fixed
|
||||
|
||||
@ -362,7 +362,10 @@
|
||||
(rx/push! upload-events message)))]
|
||||
(rx/merge
|
||||
upload-events
|
||||
(->> (slurp-uri uri :blob)
|
||||
(->> (if-let [blob (:blob (first entries))]
|
||||
(rx/of blob)
|
||||
;; Template links can supply only a URL.
|
||||
(slurp-uri uri :blob))
|
||||
(rx/mapcat (fn [blob]
|
||||
(->> (uploads/upload-blob-chunked blob :on-progress report-upload!)
|
||||
(rx/tap (fn [_] (finish-upload!))))))
|
||||
|
||||
@ -51,7 +51,8 @@
|
||||
(mapv (fn [file]
|
||||
{:name (.-name file)
|
||||
:size (.-size file)
|
||||
:uri (wapi/create-uri file)}))
|
||||
:uri (wapi/create-uri file)
|
||||
:blob file}))
|
||||
(not-empty))]
|
||||
(when entries
|
||||
(st/emit! (modal/show
|
||||
@ -1178,4 +1179,4 @@
|
||||
:on-summary-back on-summary-back
|
||||
:on-confirm-library-links on-confirm-library-links}]]
|
||||
|
||||
nil)]]))
|
||||
nil)]]))
|
||||
|
||||
@ -895,6 +895,7 @@
|
||||
invite-button
|
||||
[:> tooltip* {:content (tr "dashboard.invite-profile-disabled")
|
||||
:id "empty-invite-member-disabled-tooltip"
|
||||
:class (stl/css :empty-invitations-tooltip)
|
||||
:tab-index 0}
|
||||
invite-button]))]))
|
||||
|
||||
|
||||
@ -435,6 +435,12 @@
|
||||
margin-block-start: var(--sp-l);
|
||||
}
|
||||
|
||||
// The tooltip trigger is a fit-content grid, which the text-align of the
|
||||
// empty state does not center.
|
||||
.empty-invitations-tooltip {
|
||||
margin-inline: auto;
|
||||
}
|
||||
|
||||
.title-field-status {
|
||||
position: relative;
|
||||
cursor: default;
|
||||
|
||||
@ -70,6 +70,11 @@
|
||||
--button-focus-inner-ring-color: var(--color-background-secondary);
|
||||
--button-focus-outer-ring-color: var(--color-accent-primary);
|
||||
|
||||
// The light theme muted background is too pale for a light label.
|
||||
:global(.light) & {
|
||||
--button-disabled-fg-color: var(--color-accent-tertiary);
|
||||
}
|
||||
|
||||
&:active,
|
||||
&[aria-pressed="true"] {
|
||||
box-shadow: inset 0 0 #{px2rem(10)} #{px2rem(2)} rgb(0 0 0 / 0.2);
|
||||
|
||||
@ -33,14 +33,17 @@
|
||||
(st/emit! (modal/show
|
||||
{:type :import
|
||||
:project-id project-id
|
||||
:files [file]
|
||||
:entries [file]
|
||||
:on-finish-import on-finish-import})))
|
||||
on-click
|
||||
(fn []
|
||||
(reset! downloading? true)
|
||||
(->> (http/send! {:method :get :uri link :response-type :blob :mode :no-cors})
|
||||
(rx/subs! (fn [{:keys [body] :as response}]
|
||||
(open-import-modal {:name name :uri (wapi/create-uri body)}))
|
||||
(open-import-modal {:name name
|
||||
:uri (wapi/create-uri body)
|
||||
:blob body
|
||||
:size (.-size body)}))
|
||||
(fn [error]
|
||||
(reset! downloading? false)
|
||||
(js/console.error "error" error))
|
||||
|
||||
@ -12,6 +12,8 @@
|
||||
[app.main.data.profile :as dp]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.components.forms :as fm]
|
||||
[app.main.ui.ds.foundations.typography :as t]
|
||||
[app.main.ui.ds.foundations.typography.heading :refer [heading*]]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[rumext.v2 :as mf]))
|
||||
@ -49,9 +51,18 @@
|
||||
:on-submit on-submit
|
||||
:form form}
|
||||
[:div {:class (stl/css :form-container)}
|
||||
[:h2 (tr "dashboard.settings.notifications.title")]
|
||||
[:h3 (tr "dashboard.settings.notifications.dashboard.title")]
|
||||
[:h4 (tr "dashboard.settings.notifications.dashboard-comments.title")]
|
||||
[:> heading* {:level 2
|
||||
:typography t/title-large
|
||||
:class (stl/css :page-title)}
|
||||
(tr "dashboard.settings.notifications.title")]
|
||||
[:> heading* {:level 3
|
||||
:typography t/headline-small
|
||||
:class (stl/css :section-title)}
|
||||
(tr "dashboard.settings.notifications.dashboard.title")]
|
||||
[:> heading* {:level 4
|
||||
:typography t/headline-small
|
||||
:class (stl/css :group-title)}
|
||||
(tr "dashboard.settings.notifications.dashboard-comments.title")]
|
||||
[:div {:class (stl/css :fields-row)}
|
||||
[:& fm/radio-buttons
|
||||
{:options [{:label (tr "dashboard.settings.notifications.dashboard-comments.all") :value "all"}
|
||||
@ -60,8 +71,14 @@
|
||||
:name :dashboard-comments
|
||||
:class (stl/css :radio-btns)}]]
|
||||
|
||||
[:h3 (tr "dashboard.settings.notifications.email.title")]
|
||||
[:h4 (tr "dashboard.settings.notifications.email-comments.title")]
|
||||
[:> heading* {:level 3
|
||||
:typography t/headline-small
|
||||
:class (stl/css :section-title)}
|
||||
(tr "dashboard.settings.notifications.email.title")]
|
||||
[:> heading* {:level 4
|
||||
:typography t/headline-small
|
||||
:class (stl/css :group-title)}
|
||||
(tr "dashboard.settings.notifications.email-comments.title")]
|
||||
[:div {:class (stl/css :fields-row)}
|
||||
[:& fm/radio-buttons
|
||||
{:options [{:label (tr "dashboard.settings.notifications.email-comments.all") :value "all"}
|
||||
@ -70,7 +87,10 @@
|
||||
:name :email-comments
|
||||
:class (stl/css :radio-btns)}]]
|
||||
|
||||
[:h4 (tr "dashboard.settings.notifications.email-invites.title")]
|
||||
[:> heading* {:level 4
|
||||
:typography t/headline-small
|
||||
:class (stl/css :group-title)}
|
||||
(tr "dashboard.settings.notifications.email-invites.title")]
|
||||
[:div {:class (stl/css :fields-row)}
|
||||
[:& fm/radio-buttons
|
||||
{:options [{:label (tr "dashboard.settings.notifications.email-invites.all") :value "all"}
|
||||
|
||||
@ -30,15 +30,12 @@
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.form-container {
|
||||
h3 {
|
||||
color: var(--color-foreground-secondary);
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: deprecated.$fs-11;
|
||||
color: var(--color-foreground-primary);
|
||||
text-transform: uppercase;
|
||||
margin: deprecated.$s-12;
|
||||
}
|
||||
.section-title {
|
||||
color: var(--color-foreground-secondary);
|
||||
margin-block: var(--sp-s);
|
||||
}
|
||||
|
||||
.group-title {
|
||||
color: var(--color-foreground-primary);
|
||||
margin: var(--sp-m);
|
||||
}
|
||||
|
||||
@ -12,6 +12,8 @@
|
||||
[app.main.data.profile :as udu]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.components.forms :as fm]
|
||||
[app.main.ui.ds.foundations.typography :as t]
|
||||
[app.main.ui.ds.foundations.typography.heading :refer [heading*]]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[rumext.v2 :as mf]))
|
||||
@ -123,5 +125,9 @@
|
||||
[:section {:class (stl/css :dashboard-settings)
|
||||
:aria-labelledby "password-section-title"}
|
||||
[:div {:class (stl/css :form-container)}
|
||||
[:h2 {:id "password-section-title"} (tr "dashboard.password-change")]
|
||||
[:> heading* {:level 2
|
||||
:typography t/title-large
|
||||
:class (stl/css :page-title)
|
||||
:id "password-section-title"}
|
||||
(tr "dashboard.password-change")]
|
||||
[:> password-form*]]])
|
||||
|
||||
@ -325,16 +325,24 @@
|
||||
calls (atom [])
|
||||
rows (atom {})
|
||||
seen (atom [])
|
||||
uploaded (atom [])
|
||||
fetched (atom [])
|
||||
session-id (uuid/next)
|
||||
resolution {:done [{:id (str (uuid/next)) :name "Published"}]}
|
||||
one (entry :name "First")
|
||||
other (entry :name "Second")]
|
||||
blob (js/Blob. #js ["package"])
|
||||
one (assoc (entry :name "First") :blob blob)
|
||||
other (assoc (entry :name "Second") :blob blob)]
|
||||
|
||||
(await
|
||||
(mock/with-mocks*
|
||||
{st/state (atom {:ws-conn ws-stream})
|
||||
http/send! (slurp-stub ::blob)
|
||||
uploads/upload-blob-chunked (upload-stub session-id)
|
||||
http/send! (mock/stub
|
||||
(fn [request]
|
||||
(swap! fetched conj request)
|
||||
(rx/of {:body ::blob})))
|
||||
uploads/upload-blob-chunked (fn [body & _]
|
||||
(swap! uploaded conj body)
|
||||
(rx/of {:session-id session-id}))
|
||||
rp/cmd! (fake-server calls rows (fn [job-id] (job job-id "running")))
|
||||
ws/get-rcv-stream (ws-stub ws-stream)}
|
||||
|
||||
@ -344,6 +352,8 @@
|
||||
job-id (:job-id (first @calls))]
|
||||
|
||||
(t/testing "the package is uploaded and imported as one job"
|
||||
(t/is (= [blob] @uploaded))
|
||||
(t/is (empty? @fetched))
|
||||
(t/is (= :create-import-binfile-job (:cmd (first @calls))))
|
||||
(t/is (= {:project-id project-id :name "First" :version 3}
|
||||
(:params (:params (first @calls)))))
|
||||
|
||||
@ -6,6 +6,7 @@ Uses ``scripts/gh.py`` (via subprocess) and the local ``CHANGES.md`` so the
|
||||
flow memory (`mem:workflow/updating-changelog`) stays free of inline programs.
|
||||
|
||||
Subcommands:
|
||||
collect Collect the release inputs and changelog comparison as JSON
|
||||
check-merged Verify that every given PR is merged (warns otherwise)
|
||||
boom Generate the :boom: section from `breaking change` issues
|
||||
security Generate the :lock: section from advisories fixed in a version
|
||||
@ -14,6 +15,7 @@ Subcommands:
|
||||
report Generate the anomaly report (CHANGES-ISSUES.md)
|
||||
|
||||
Usage:
|
||||
python3 scripts/changelog.py collect "2.19.0"
|
||||
python3 scripts/changelog.py check-merged 9179 9204 9311
|
||||
cat prs.txt | python3 scripts/changelog.py check-merged --stdin
|
||||
python3 scripts/changelog.py boom "2.19.0"
|
||||
@ -111,6 +113,19 @@ def fetch_milestone_prs(milestone: str, state: str) -> list[dict]:
|
||||
return json.loads(stdout)
|
||||
|
||||
|
||||
def load_snapshot(args: argparse.Namespace) -> dict | None:
|
||||
path = getattr(args, "snapshot", None)
|
||||
if path is None:
|
||||
return None
|
||||
try:
|
||||
snapshot = json.loads(Path(path).read_text(encoding="utf-8"))
|
||||
if snapshot["milestone"] != args.milestone:
|
||||
raise ValueError(f"expected milestone {args.milestone}")
|
||||
except (OSError, ValueError, KeyError, TypeError) as err:
|
||||
sys.exit(f"ERROR: invalid changelog snapshot {path}: {err}")
|
||||
return snapshot
|
||||
|
||||
|
||||
def extract_version_section(content: str, milestone: str) -> str:
|
||||
"""Return the changelog body of a ``## <VERSION>`` section (or "")."""
|
||||
match = re.search(
|
||||
@ -290,8 +305,9 @@ def entry_list_body(entries: list[str]) -> str:
|
||||
def replace_boom_section(content: str, milestone: str, entries: list[str]) -> str:
|
||||
"""Return ``content`` with its ``:boom:`` subsection replaced.
|
||||
|
||||
The subsection is inserted right after the version header when missing,
|
||||
which keeps ``:boom:`` as the first section.
|
||||
The subsection is inserted right after the version header when needed,
|
||||
which keeps ``:boom:`` as the first section. Empty subsections are removed
|
||||
and are not inserted.
|
||||
"""
|
||||
bounds = version_section_bounds(content, milestone)
|
||||
if bounds is None:
|
||||
@ -299,6 +315,13 @@ def replace_boom_section(content: str, milestone: str, entries: list[str]) -> st
|
||||
start, end = bounds
|
||||
section = content[start:end]
|
||||
heading = re.search(rf"(?m)^{re.escape(BOOM_HEADING)}[ \t]*$", section)
|
||||
if not entries:
|
||||
if heading is None:
|
||||
return content
|
||||
body_start = start + heading.end()
|
||||
next_heading = re.search(r"(?m)^### ", content[body_start:end])
|
||||
body_end = body_start + next_heading.start() if next_heading else end
|
||||
return content[: start + heading.start()] + content[body_end:]
|
||||
if heading:
|
||||
body_start = start + heading.end()
|
||||
next_heading = re.search(r"(?m)^### ", content[body_start:end])
|
||||
@ -343,24 +366,30 @@ def fetch_breaking_notes(issues: list[dict]) -> dict[int, str]:
|
||||
return notes
|
||||
|
||||
|
||||
def cmd_boom(args: argparse.Namespace) -> None:
|
||||
"""Generate the ``:boom:`` section from ``breaking change`` issues."""
|
||||
all_issues = json.loads(run_gh_py("issues", args.milestone, "--state", "all"))
|
||||
labelled = sorted(
|
||||
def breaking_issues(issues: list[dict]) -> list[dict]:
|
||||
return sorted(
|
||||
(
|
||||
issue
|
||||
for issue in all_issues
|
||||
if BREAKING_LABEL in issue.get("labels", [])
|
||||
and not issue_excluded(issue)
|
||||
for issue in issues
|
||||
if BREAKING_LABEL in issue.get("labels", []) and not issue_excluded(issue)
|
||||
),
|
||||
key=lambda issue: issue["number"],
|
||||
)
|
||||
|
||||
notes: dict[int, str] = {}
|
||||
prs: dict[int, dict] = {}
|
||||
if labelled:
|
||||
|
||||
def cmd_boom(args: argparse.Namespace) -> None:
|
||||
"""Generate the ``:boom:`` section from ``breaking change`` issues."""
|
||||
snapshot = load_snapshot(args)
|
||||
if snapshot is None:
|
||||
labelled = breaking_issues(
|
||||
json.loads(run_gh_py("issues", args.milestone, "--state", "all"))
|
||||
)
|
||||
notes = fetch_breaking_notes(labelled)
|
||||
prs = fetch_prs_by_issue(labelled)
|
||||
else:
|
||||
labelled = breaking_issues(snapshot["issues"])
|
||||
notes = {int(n): note for n, note in snapshot["breaking_notes"].items()}
|
||||
prs = {pr["number"]: pr for pr in snapshot["prs"] + snapshot["related_prs"]}
|
||||
|
||||
entries: list[str] = []
|
||||
for issue in labelled:
|
||||
@ -454,8 +483,12 @@ def fetch_security_advisories(milestone: str) -> list[dict]:
|
||||
|
||||
def fetch_security_prs(milestone: str) -> dict[str, list[int]]:
|
||||
"""Map each GHSA id to the merged ``pr pt`` PRs in a milestone referencing it."""
|
||||
return security_prs_by_advisory(fetch_milestone_prs(milestone, "all"))
|
||||
|
||||
|
||||
def security_prs_by_advisory(prs: list[dict]) -> dict[str, list[int]]:
|
||||
by_ghsa: dict[str, list[int]] = {}
|
||||
for pr in fetch_milestone_prs(milestone, "all"):
|
||||
for pr in prs:
|
||||
if pr.get("state") != "MERGED":
|
||||
continue
|
||||
if SECURITY_PR_LABEL not in pr.get("labels", []):
|
||||
@ -533,8 +566,13 @@ def replace_security_section(
|
||||
def cmd_security(args: argparse.Namespace) -> None:
|
||||
"""Generate the ``:lock:`` section from advisories fixed in the version."""
|
||||
milestone = args.milestone
|
||||
advisories = fetch_security_advisories(milestone)
|
||||
prs_by_ghsa = fetch_security_prs(milestone)
|
||||
snapshot = load_snapshot(args)
|
||||
if snapshot is None:
|
||||
advisories = fetch_security_advisories(milestone)
|
||||
prs_by_ghsa = fetch_security_prs(milestone)
|
||||
else:
|
||||
advisories = snapshot["advisories"]
|
||||
prs_by_ghsa = snapshot["security_prs"]
|
||||
|
||||
matched = {
|
||||
advisory["ghsa_id"].upper()
|
||||
@ -598,7 +636,12 @@ def cmd_cross_ref(args: argparse.Namespace) -> None:
|
||||
sys.exit(1)
|
||||
|
||||
changelog_refs = collect_changelog_prs(section)
|
||||
milestone_prs = fetch_milestone_prs(args.milestone, "all")
|
||||
snapshot = load_snapshot(args)
|
||||
milestone_prs = (
|
||||
fetch_milestone_prs(args.milestone, "all")
|
||||
if snapshot is None
|
||||
else snapshot["prs"]
|
||||
)
|
||||
|
||||
merged = {pr["number"] for pr in milestone_prs if pr.get("state") == "MERGED"}
|
||||
closed = [pr for pr in milestone_prs if pr.get("state") == "CLOSED"]
|
||||
@ -667,15 +710,14 @@ def find_dev_only_bugs(milestone: str, issues: list[dict]) -> tuple[list[dict],
|
||||
"""Split the milestone's changelog bugs that never reached production.
|
||||
|
||||
``issues`` come from ``gh.py issue`` (they carry ``body`` and
|
||||
``parent``). Bugs labelled ``release blocker`` are analyzed like any
|
||||
other bug. Returns ``(auto, suggested)``: ``auto`` bugs are
|
||||
``parent``). Returns ``(auto, suggested)``: ``auto`` bugs are
|
||||
sub-issues of a Feature or Enhancement of this milestone and get the
|
||||
`no changelog` label; ``suggested`` ones need a human to confirm."""
|
||||
auto, suggested = [], []
|
||||
for issue in issues:
|
||||
if issue.get("issue_type") != "Bug" or issue.get("state") != "CLOSED":
|
||||
continue
|
||||
if "no changelog" in set(issue.get("labels", [])):
|
||||
if "no changelog" in issue.get("labels", []):
|
||||
continue
|
||||
parent = issue.get("parent") or {}
|
||||
entry = {"issue": issue["number"], "issue_title": issue.get("title", "")}
|
||||
@ -705,7 +747,14 @@ def fetch_milestone_bugs(milestone: str) -> list[dict]:
|
||||
|
||||
def cmd_dev_only_bugs(args: argparse.Namespace) -> None:
|
||||
"""List bugs that never reached production; --apply labels the sure ones."""
|
||||
auto, suggested = find_dev_only_bugs(args.milestone, fetch_milestone_bugs(args.milestone))
|
||||
snapshot = load_snapshot(args)
|
||||
if snapshot is None:
|
||||
auto, suggested = find_dev_only_bugs(
|
||||
args.milestone, fetch_milestone_bugs(args.milestone)
|
||||
)
|
||||
else:
|
||||
auto = snapshot["dev_only_bugs"]["auto"]
|
||||
suggested = snapshot["dev_only_bugs"]["suggested"]
|
||||
|
||||
print(f"Label `no changelog` ({len(auto)}):")
|
||||
for e in auto:
|
||||
@ -716,14 +765,122 @@ def cmd_dev_only_bugs(args: argparse.Namespace) -> None:
|
||||
|
||||
if args.apply:
|
||||
for e in auto:
|
||||
subprocess.run(
|
||||
["gh", "issue", "edit", str(e["issue"]), "--repo", REPO,
|
||||
"--add-label", "no changelog"],
|
||||
check=True, capture_output=True,
|
||||
url = issue_url(e["issue"])
|
||||
try:
|
||||
subprocess.run(
|
||||
[
|
||||
"gh",
|
||||
"issue",
|
||||
"edit",
|
||||
str(e["issue"]),
|
||||
"--repo",
|
||||
REPO,
|
||||
"--add-label",
|
||||
"no changelog",
|
||||
],
|
||||
check=True,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
except subprocess.CalledProcessError as err:
|
||||
detail = (err.stderr or "").strip()
|
||||
detail = detail or f"gh exited with status {err.returncode}"
|
||||
sys.exit(f"ERROR: could not apply `no changelog` to {url}: {detail}")
|
||||
print(
|
||||
f"Applied `no changelog`: {url} ({e['reason']})",
|
||||
flush=True,
|
||||
)
|
||||
print(f"Labelled {len(auto)} issues `no changelog`", file=sys.stderr)
|
||||
|
||||
|
||||
def cmd_collect(args: argparse.Namespace) -> None:
|
||||
"""Collect release inputs without changing the changelog or GitHub."""
|
||||
milestone = args.milestone
|
||||
content = Path(args.changes).read_text(encoding="utf-8")
|
||||
section = extract_version_section(content, milestone)
|
||||
issue_refs = collect_changelog_issues(section)
|
||||
pr_refs = collect_changelog_prs(section)
|
||||
|
||||
issues = json.loads(
|
||||
run_gh_py(
|
||||
"issues",
|
||||
milestone,
|
||||
"--state",
|
||||
"all",
|
||||
"--include-tasks",
|
||||
"--include-rejected",
|
||||
)
|
||||
)
|
||||
prs = fetch_milestone_prs(milestone, "all")
|
||||
eligible = {issue["number"] for issue in issues if not issue_excluded(issue)}
|
||||
issue_numbers = {issue["number"] for issue in issues}
|
||||
pr_numbers = {pr["number"] for pr in prs}
|
||||
bugs = {
|
||||
issue["number"]
|
||||
for issue in issues
|
||||
if issue["number"] in eligible and issue.get("issue_type") == "Bug"
|
||||
}
|
||||
related_issue_numbers = (
|
||||
issue_refs | {n for pr in prs for n in pr.get("closing_issues", [])}
|
||||
) - issue_numbers
|
||||
detail_numbers = sorted(bugs | related_issue_numbers)
|
||||
details = (
|
||||
json.loads(run_gh_py("issue", *map(str, detail_numbers)))
|
||||
if detail_numbers
|
||||
else []
|
||||
)
|
||||
related_pr_numbers = (
|
||||
pr_refs | {n for issue in issues for n in closing_pr_numbers(issue)}
|
||||
) - pr_numbers
|
||||
related_prs = (
|
||||
fetch_prs_by_numbers(sorted(related_pr_numbers)) if related_pr_numbers else []
|
||||
)
|
||||
auto, suggested = find_dev_only_bugs(
|
||||
milestone, [issue for issue in details if issue["number"] in bugs]
|
||||
)
|
||||
notes = fetch_breaking_notes(breaking_issues(issues))
|
||||
advisories = fetch_security_advisories(milestone)
|
||||
|
||||
other_versions: dict[int, list[str]] = {}
|
||||
for version_section in re.split(r"(?m)(?=^## \d+\.\d+\.\d+)", content):
|
||||
header = re.match(r"^## (\d+\.\d+\.\d+)\b", version_section)
|
||||
if header is None or header[1] == milestone:
|
||||
continue
|
||||
for number in sorted(
|
||||
collect_changelog_issues(version_section) & (eligible | issue_refs)
|
||||
):
|
||||
other_versions.setdefault(number, []).append(header[1])
|
||||
|
||||
snapshot = {
|
||||
"milestone": milestone,
|
||||
"issues": issues,
|
||||
"eligible_issues": sorted(eligible),
|
||||
"prs": prs,
|
||||
"related_issues": [
|
||||
issue for issue in details if issue["number"] in related_issue_numbers
|
||||
],
|
||||
"related_prs": related_prs,
|
||||
"breaking_notes": notes,
|
||||
"advisories": advisories,
|
||||
"security_prs": security_prs_by_advisory(prs),
|
||||
"dev_only_bugs": {"auto": auto, "suggested": suggested},
|
||||
"comparison": {
|
||||
"section_exists": version_section_bounds(content, milestone) is not None,
|
||||
"issue_refs": sorted(issue_refs),
|
||||
"pr_refs": sorted(pr_refs),
|
||||
"missing_issues": sorted(eligible - issue_refs - other_versions.keys()),
|
||||
"ineligible_references": sorted(issue_refs - eligible),
|
||||
"issues_in_other_versions": other_versions,
|
||||
"unlisted_merged_prs": sorted(
|
||||
pr["number"]
|
||||
for pr in prs
|
||||
if pr.get("state") == "MERGED" and pr["number"] not in pr_refs
|
||||
),
|
||||
},
|
||||
}
|
||||
print(json.dumps(snapshot, indent=2))
|
||||
|
||||
|
||||
# ─────────────────────────────────────────────
|
||||
# Subcommand: report
|
||||
# ─────────────────────────────────────────────
|
||||
@ -763,10 +920,14 @@ def cmd_report(args: argparse.Namespace) -> None:
|
||||
"""Generate the changelog anomaly report and write it to a file."""
|
||||
milestone = args.milestone
|
||||
|
||||
all_issues = json.loads(run_gh_py("issues", milestone, "--state", "all"))
|
||||
snapshot = load_snapshot(args)
|
||||
if snapshot is None:
|
||||
all_issues = json.loads(run_gh_py("issues", milestone, "--state", "all"))
|
||||
all_prs = fetch_milestone_prs(milestone, "all")
|
||||
else:
|
||||
all_issues = snapshot["issues"]
|
||||
all_prs = snapshot["prs"]
|
||||
issue_by_num = {i["number"]: i for i in all_issues}
|
||||
|
||||
all_prs = fetch_milestone_prs(milestone, "all")
|
||||
pr_by_num = {p["number"]: p for p in all_prs}
|
||||
|
||||
with open(args.changes) as f:
|
||||
@ -785,7 +946,10 @@ def cmd_report(args: argparse.Namespace) -> None:
|
||||
for issue in issue_by_num.values():
|
||||
unknown_prs.update(issue.get("closing_prs", []))
|
||||
unknown_prs -= set(pr_milestone_cache)
|
||||
if unknown_prs:
|
||||
if snapshot is not None:
|
||||
for pr in snapshot["related_prs"]:
|
||||
pr_milestone_cache[pr["number"]] = pr.get("milestone")
|
||||
elif unknown_prs:
|
||||
print(
|
||||
f"Resolving milestones for {len(unknown_prs)} PRs outside {milestone}...",
|
||||
file=sys.stderr,
|
||||
@ -800,7 +964,12 @@ def cmd_report(args: argparse.Namespace) -> None:
|
||||
unknown_issues |= collect_changelog_issues(extract_subsection(section, r"### :rocket:"))
|
||||
unknown_issues -= set(issue_milestone_cache)
|
||||
external_issues: dict[int, dict] = {}
|
||||
if unknown_issues:
|
||||
if snapshot is not None:
|
||||
for issue in snapshot["related_issues"]:
|
||||
issue_milestone_cache[issue["number"]] = issue.get("milestone")
|
||||
if "error" not in issue:
|
||||
external_issues[issue["number"]] = issue
|
||||
elif unknown_issues:
|
||||
print(
|
||||
f"Resolving milestones for {len(unknown_issues)} issues outside {milestone}...",
|
||||
file=sys.stderr,
|
||||
@ -982,7 +1151,13 @@ def cmd_report(args: argparse.Namespace) -> None:
|
||||
anomalies_d.append({"version": ver, "line": line[:100]})
|
||||
|
||||
# Bugs that may never have reached production: warnings, not anomalies.
|
||||
dev_auto, dev_suggested = find_dev_only_bugs(milestone, fetch_milestone_bugs(milestone))
|
||||
if snapshot is None:
|
||||
dev_auto, dev_suggested = find_dev_only_bugs(
|
||||
milestone, fetch_milestone_bugs(milestone)
|
||||
)
|
||||
else:
|
||||
dev_auto = snapshot["dev_only_bugs"]["auto"]
|
||||
dev_suggested = snapshot["dev_only_bugs"]["suggested"]
|
||||
|
||||
def fmt_ms(ms: str | None) -> str:
|
||||
return ms if ms else "_none_"
|
||||
@ -1192,6 +1367,13 @@ def main() -> None:
|
||||
)
|
||||
sub = parser.add_subparsers(dest="command", required=True, title="subcommands")
|
||||
|
||||
p_collect = sub.add_parser("collect", help="Collect changelog inputs as JSON")
|
||||
p_collect.add_argument("milestone", help="Milestone title (e.g. '2.19.0')")
|
||||
p_collect.add_argument(
|
||||
"--changes", default="CHANGES.md", help="Path to the changelog"
|
||||
)
|
||||
p_collect.set_defaults(func=cmd_collect)
|
||||
|
||||
p_check = sub.add_parser(
|
||||
"check-merged", help="Verify that every given PR is merged"
|
||||
)
|
||||
@ -1251,6 +1433,11 @@ def main() -> None:
|
||||
help="Report output path (default: CHANGES-ISSUES.md)")
|
||||
p_report.set_defaults(func=cmd_report)
|
||||
|
||||
for command in (p_boom, p_security, p_cross, p_dev, p_report):
|
||||
command.add_argument(
|
||||
"--snapshot", help="Use JSON from collect instead of GitHub"
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
args.func(args)
|
||||
|
||||
|
||||
@ -1075,21 +1075,23 @@ def cmd_comments(args: argparse.Namespace) -> None:
|
||||
|
||||
|
||||
def fetch_advisories() -> list[dict]:
|
||||
"""Fetch all security advisories for the repository via REST API."""
|
||||
all_advisories: list[dict] = []
|
||||
page = 1
|
||||
|
||||
while True:
|
||||
advisories = run_gh_rest(
|
||||
f"repos/{REPO}/security-advisories?per_page=100&page={page}"
|
||||
"""Fetch all security advisories using GitHub's cursor-based pagination."""
|
||||
try:
|
||||
pages = json.loads(
|
||||
run_gh_command(
|
||||
[
|
||||
"gh",
|
||||
"api",
|
||||
"--paginate",
|
||||
"--slurp",
|
||||
f"repos/{REPO}/security-advisories?per_page=100",
|
||||
]
|
||||
)
|
||||
)
|
||||
all_advisories.extend(advisories)
|
||||
except GhCommandFailed as err:
|
||||
fail_gh(err.stderr)
|
||||
|
||||
if len(advisories) < 100:
|
||||
break
|
||||
page += 1
|
||||
|
||||
return all_advisories
|
||||
return [advisory for page in pages for advisory in page]
|
||||
|
||||
|
||||
def fetch_advisory(ghsa_id: str) -> dict:
|
||||
|
||||
@ -126,17 +126,12 @@ class IssueExcludedTests(unittest.TestCase):
|
||||
def test_keeps_a_valid_closed_issue(self):
|
||||
self.assertFalse(ch.issue_excluded(self.issue()))
|
||||
|
||||
def test_excludes_open_task_rejected_and_labelled(self):
|
||||
def test_excludes_open_task_rejected_and_no_changelog(self):
|
||||
self.assertTrue(ch.issue_excluded(None))
|
||||
self.assertTrue(ch.issue_excluded(self.issue(state="OPEN")))
|
||||
self.assertTrue(ch.issue_excluded(self.issue(issue_type="Task")))
|
||||
self.assertTrue(ch.issue_excluded(self.issue(project_status="Rejected")))
|
||||
self.assertTrue(ch.issue_excluded(self.issue(labels=["no changelog"])))
|
||||
|
||||
def test_keeps_a_release_blocker_issue(self):
|
||||
# `release blocker` marks work that blocks the release; it is not a
|
||||
# changelog exclusion. Bugs go through dev-only-bugs, anything else is
|
||||
# a human call in the pre-flight.
|
||||
self.assertFalse(ch.issue_excluded(self.issue(labels=["release blocker"])))
|
||||
|
||||
|
||||
@ -185,10 +180,18 @@ class ReplaceBoomSectionTests(unittest.TestCase):
|
||||
once = ch.replace_boom_section(CHANGES, "2.19.0", [entry])
|
||||
self.assertEqual(once, ch.replace_boom_section(once, "2.19.0", [entry]))
|
||||
|
||||
def test_empty_section_keeps_the_heading(self):
|
||||
def test_empty_section_removes_the_heading(self):
|
||||
updated = ch.replace_boom_section(CHANGES, "2.19.0", [])
|
||||
self.assertIn(
|
||||
"### :boom: Breaking changes & Deprecations\n\n### :rocket:", updated
|
||||
self.assertNotIn("### :boom: Breaking changes & Deprecations", updated)
|
||||
self.assertIn("### :rocket:", updated)
|
||||
|
||||
def test_empty_entries_do_not_insert_the_subsection(self):
|
||||
without = CHANGES.replace(
|
||||
"### :boom: Breaking changes & Deprecations\n\n- Old entry.\n\n", ""
|
||||
)
|
||||
self.assertEqual(
|
||||
without,
|
||||
ch.replace_boom_section(without, "2.19.0", []),
|
||||
)
|
||||
|
||||
def test_inserts_the_subsection_when_missing(self):
|
||||
@ -332,6 +335,115 @@ class CmdBoomTests(unittest.TestCase):
|
||||
self.assertIn("Deploy the new service.", out)
|
||||
|
||||
|
||||
class CollectTests(unittest.TestCase):
|
||||
def test_collect_batches_extra_details_and_reuses_them_for_local_checks(self):
|
||||
issues = [
|
||||
{
|
||||
"number": 1,
|
||||
"state": "CLOSED",
|
||||
"issue_type": "Bug",
|
||||
"title": "Change a default",
|
||||
"labels": ["breaking change"],
|
||||
"closing_prs": [10, 11],
|
||||
},
|
||||
{"number": 2, "state": "OPEN", "issue_type": "Task"},
|
||||
]
|
||||
prs = [
|
||||
{
|
||||
"number": 10,
|
||||
"title": "Change a default",
|
||||
"state": "MERGED",
|
||||
"closing_issues": [1, 3],
|
||||
}
|
||||
]
|
||||
responses = {
|
||||
(
|
||||
"issues",
|
||||
"2.19.0",
|
||||
"--state",
|
||||
"all",
|
||||
"--include-tasks",
|
||||
"--include-rejected",
|
||||
): issues,
|
||||
("prs", "--milestone", "2.19.0", "--state", "all"): prs,
|
||||
("issue", "1", "3", "4"): [
|
||||
{**issues[0], "body": "", "parent": None},
|
||||
{"number": 3, "milestone": "2.18.0"},
|
||||
{"number": 4, "error": "not_found"},
|
||||
],
|
||||
("prs", "11"): [{"number": 11, "state": "OPEN"}],
|
||||
("comments", "1"): [
|
||||
{"issue": 1, "body": "## Breaking change note\n\nNote."}
|
||||
],
|
||||
("advisories", "--patched-version", "2.19.0"): [],
|
||||
}
|
||||
content = (
|
||||
"## 2.19.0\n\n[#4](https://github.com/penpot/penpot/issues/4)\n\n"
|
||||
"## 2.18.0\n\n[#1](https://github.com/penpot/penpot/issues/1)\n"
|
||||
)
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
changes = pathlib.Path(tmp) / "CHANGES.md"
|
||||
changes.write_text(content)
|
||||
snapshot_path = pathlib.Path(tmp) / "snapshot.json"
|
||||
args = argparse.Namespace(milestone="2.19.0", changes=str(changes))
|
||||
out = io.StringIO()
|
||||
with (
|
||||
patch.object(
|
||||
ch, "run_gh_py", side_effect=lambda *a: json.dumps(responses[a])
|
||||
) as gh,
|
||||
contextlib.redirect_stdout(out),
|
||||
):
|
||||
ch.cmd_collect(args)
|
||||
snapshot = json.loads(out.getvalue())
|
||||
self.assertCountEqual([call.args for call in gh.call_args_list], responses)
|
||||
self.assertEqual(changes.read_text(), content)
|
||||
self.assertEqual(snapshot["eligible_issues"], [1])
|
||||
self.assertEqual(snapshot["comparison"]["missing_issues"], [])
|
||||
self.assertEqual(
|
||||
snapshot["comparison"]["issues_in_other_versions"], {"1": ["2.18.0"]}
|
||||
)
|
||||
self.assertEqual(snapshot["comparison"]["ineligible_references"], [4])
|
||||
self.assertEqual(snapshot["comparison"]["unlisted_merged_prs"], [10])
|
||||
|
||||
snapshot_path.write_text(out.getvalue())
|
||||
changes.write_text(
|
||||
content.replace(
|
||||
"## 2.19.0\n\n",
|
||||
"## 2.19.0\n\n[#10](https://github.com/penpot/penpot/pull/10)\n\n",
|
||||
)
|
||||
)
|
||||
args.snapshot = str(snapshot_path)
|
||||
args.write = False
|
||||
args.output = str(pathlib.Path(tmp) / "report.md")
|
||||
out = io.StringIO()
|
||||
with (
|
||||
patch.object(
|
||||
ch,
|
||||
"run_gh_py",
|
||||
side_effect=AssertionError("unexpected GitHub lookup"),
|
||||
),
|
||||
contextlib.redirect_stdout(out),
|
||||
):
|
||||
ch.cmd_boom(args)
|
||||
ch.cmd_security(args)
|
||||
ch.cmd_dev_only_bugs(argparse.Namespace(**vars(args), apply=False))
|
||||
ch.cmd_cross_ref(args)
|
||||
ch.cmd_report(args)
|
||||
self.assertIn("Note.", out.getvalue())
|
||||
self.assertIn("pull/10", out.getvalue())
|
||||
self.assertNotIn("pull/11", out.getvalue())
|
||||
self.assertIn("PRs in milestone but NOT in changelog: 0", out.getvalue())
|
||||
self.assertTrue(pathlib.Path(args.output).is_file())
|
||||
|
||||
def test_snapshot_for_another_milestone_is_rejected(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
snapshot = pathlib.Path(tmp) / "snapshot.json"
|
||||
snapshot.write_text('{"milestone": "2.18.0"}')
|
||||
args = argparse.Namespace(milestone="2.19.0", snapshot=str(snapshot))
|
||||
with self.assertRaisesRegex(SystemExit, "expected milestone 2.19.0"):
|
||||
ch.load_snapshot(args)
|
||||
|
||||
|
||||
class ReportTests(unittest.TestCase):
|
||||
"""Focused check of the `:boom:` sync anomaly (type G) in the report."""
|
||||
|
||||
@ -733,5 +845,45 @@ class FindDevOnlyBugsTests(unittest.TestCase):
|
||||
self.assertEqual([e["issue"] for e in suggested], [3, 5, 9, 11])
|
||||
|
||||
|
||||
class DevOnlyBugsApplyTests(unittest.TestCase):
|
||||
def test_reports_only_successful_edits_if_a_later_edit_fails(self):
|
||||
snapshot = {
|
||||
"dev_only_bugs": {
|
||||
"auto": [
|
||||
{
|
||||
"issue": 1,
|
||||
"issue_title": "First bug",
|
||||
"reason": "Same milestone",
|
||||
},
|
||||
{
|
||||
"issue": 2,
|
||||
"issue_title": "Second bug",
|
||||
"reason": "Same milestone",
|
||||
},
|
||||
],
|
||||
"suggested": [],
|
||||
}
|
||||
}
|
||||
args = argparse.Namespace(milestone="2.19.0", apply=True)
|
||||
out = io.StringIO()
|
||||
with (
|
||||
patch.object(ch, "load_snapshot", return_value=snapshot),
|
||||
patch.object(
|
||||
ch.subprocess,
|
||||
"run",
|
||||
side_effect=[None, ch.subprocess.CalledProcessError(1, "gh")],
|
||||
),
|
||||
contextlib.redirect_stdout(out),
|
||||
self.assertRaisesRegex(SystemExit, r"could not apply .*issues/2"),
|
||||
):
|
||||
ch.cmd_dev_only_bugs(args)
|
||||
|
||||
self.assertIn(
|
||||
"Applied `no changelog`: https://github.com/penpot/penpot/issues/1",
|
||||
out.getvalue(),
|
||||
)
|
||||
self.assertNotIn("https://github.com/penpot/penpot/issues/2", out.getvalue())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(verbosity=2)
|
||||
|
||||
@ -334,6 +334,18 @@ class AdvisoriesTests(unittest.TestCase):
|
||||
gh.advisory_fixed_in_version(self.advisory(" 2.19.1 "), "2.19.1")
|
||||
)
|
||||
|
||||
@patch.object(gh, "run_gh_command")
|
||||
def test_fetch_advisories_uses_cursor_pagination(self, run_gh_command):
|
||||
first_page = [{"ghsa_id": "GHSA-first"}]
|
||||
second_page = [{"ghsa_id": "GHSA-second"}]
|
||||
run_gh_command.return_value = json.dumps([first_page, second_page])
|
||||
|
||||
self.assertEqual(gh.fetch_advisories(), first_page + second_page)
|
||||
|
||||
command = run_gh_command.call_args.args[0]
|
||||
self.assertIn("--paginate", command)
|
||||
self.assertIn("--slurp", command)
|
||||
|
||||
@patch.object(gh, "fetch_advisories")
|
||||
def test_cmd_advisories_filters_by_patched_version(self, fetch_advisories):
|
||||
matching = self.advisory("2.19.1", "GHSA-j4vc-cmf6-jhr7")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user