Skip to content

docs(skills): document periodic audit in cleanup-completed-issues - #2543

Merged
josecelano merged 1 commit into
torrust:developfrom
josecelano:chore/document-periodic-issue-spec-audit
Oct 15, 2026
Merged

josecelano merged 1 commit into
torrust:developfrom
josecelano:chore/document-periodic-issue-spec-audit

Conversation

@josecelano

Copy link
Copy Markdown
Member

Adds a Periodic Audit section to the cleanup-completed-issues skill so maintainers can regularly verify that docs/issues/open/ holds only specs whose GitHub issue is open (catching forgotten closing PRs).

  • Read-only commands that fetch open issues once with gh issue list and report: (1) open/ specs whose issue is not open, (2) closed/ specs whose issue is open, (3) drafts already linked to a GitHub issue, (4) open/ specs with a terminal status
  • Action table mapping each finding to the existing Step 1, Step 0.6, and reopen-issue workflows
  • States that an EPIC with no open children is not complete while draft subissues remain (Step 0.7), and that status in closed/ is not checked because legacy values are inconsistent
  • Links Automate cleanup of completed issue specs in docs/issues with a non-interactive script #1774 as the future automation; no overlap with its script scope

Validation: ran the commands against develop (all four checks empty) and negative-tested checks 1 and 2 with injected mismatches; pre-commit hooks passed. Skill version bumped to 1.12.

Add a read-only audit that checks docs/issues/open/ holds only specs whose
GitHub issue is open, checks the reverse direction for closed/, reconciles
linked drafts, and notes that an EPIC with no open children is not complete
while draft subissues remain. Link torrust#1774 as the future automation.

Co-authored-by: Copilot <[email protected]>
@josecelano
josecelano requested a review from a team as a code owner October 15, 2026 16:10
Copilot AI balanced review requested due to automatic review settings October 15, 2026 16:10
@josecelano josecelano self-assigned this Oct 15, 2026
@josecelano
josecelano requested a review from da2ce7 October 15, 2026 16:20
@josecelano

Copy link
Copy Markdown
Member Author

ACK 34a8db1

Copilot AI 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.

🟡 Changes recommended

Failed GitHub requests are masked, causing misleading audit results.

1 open finding
What changed in this PR

Documents a read-only periodic audit to keep issue specifications aligned with GitHub issue state.

Changes:

  • Adds four checks for misplaced specs and terminal statuses.
  • Maps findings to existing archive, draft-reconciliation, and reopening workflows.
  • Clarifies EPIC safeguards and bumps the skill version to 1.12.
File Description
.github/​skills/​dev/​planning/​cleanup-completed-issues/​SKILL.md Adds periodic audit commands and remediation guidance.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +315 to +316
OPEN_ISSUES=$(gh issue list --repo "$REPO" --state open --limit 5000 --json number --jq '.[].number' \
| LC_ALL=C sort -u)
@josecelano
josecelano merged commit fd04ac5 into torrust:develop Oct 15, 2026
1 check passed
@josecelano
josecelano deleted the chore/document-periodic-issue-spec-audit branch October 15, 2026 16:35

@da2ce7 da2ce7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed at 34a8db13da8f76f328b5c8d53df473b1f313e064 (post-merge). Recomputed from the bytes at the merged head, against the merge base a9d8c5703; the PR merged at 16:33:34Z as fd04ac51e.

Label: POST_MERGE_FINDINGS — the review was requested at 16:10:06Z from the Maintainers team and at 16:20:42Z from this account, and the pull request merged at 16:33:34Z, before this round finished. The five findings below stand at the merged head for a follow-up. None is blocking, and no ACK follows a merged pull request.

The commands, run

The section's block was extracted byte-for-byte and run from the head's root under bash, with only the gh issue list call replaced by a filter over a capture of all 772 issues (82 open). All four headings print nothing, as the description says. The verbatim block, run with a stub gh that answers that one call from the same capture, gives the same result. Failure modes, tested on scratch copies:

  • No issues fetched: when gh fails or returns no rows, [1] lists all 53 numbered open/ folders as not open, and nothing notices (F2).
  • Wrong directory: run outside the root, every heading is empty and the errors appear only on stderr.
  • Exit status: it is the last grep's: 1 on a consistent tree, 0 when [4] reports something, 2 when a glob matches nothing.
  • Locale: comm running under the caller's locale is harmless here. For digit-only lines of two to four digits, and for a synthetic 1–5000 set, C, POSIX, C.UTF-8, en_GB.UTF-8 and en_US.UTF-8 all sort and compare identically, with no order warning.
  • [4] misses status: "done", 'done' and a two-space form, which the validator reads as done. Both [3] and [4] also report a matching line anywhere in the body (F3).
  • [3] targets the right field: github-issue, a nullable positive integer whose template form is null. It matches a real draft carrying a number, and a quoted number is invalid anyway.
  • spec_numbers: 53 numbers in open/ and 218 in closed/; no non-numeric name, duplicate or overlap. Only README.md and AGENTS.md are skipped. The stated convention holds: in all 271 specs the leading number equals github-issue, and in all 90 N-E-… names the second number equals epic, matching create-issue's {number}-{epic-issue-number}-… rule.

The rules and the table

All four anchors resolve to their headings (Step 1, Step 0.6, Step 0.7 and the new section). ../reopen-issue/SKILL.md and the five-level link to the #1774 spec both exist. The reading rules check out: an EPIC appears under [1] only when its own issue is closed, and the legacy closed/ values include closed, completed, resolved, open and in_progress. Rows [1] and [3] point at the right steps. Row [2]'s second branch skips the move-back work in reopen-issue Steps 4–5 (F4). Step 0.5 has no check for an open pull request that already archives a candidate. This section widens that gap: it schedules the periodic runs that produced the duplicate #2542 and routes [1] into Steps 0–7, which still lack that check (F1). The new triggers, the When to Archive bullet and the bump to 1.12 fit the file's history: each of the 12 commits that touched its version line raised the minor version, and no written rule exists.

The repository's review bot

It was requested, but the capture holds no review or review comment from it, so there is nothing to recompute.

Hygiene

The single commit 34a8db13d has the subject docs(skills): document periodic audit in cleanup-completed-issues, which is Conventional, uses the scope earlier commits on this file use, and matches the title. Author and committer are the same identity and time. It carries one attribution footer naming an automated co-author; commit-changes allows optional footers, and AGENTS.md says nothing about them. Its body says the audit reconciles drafts (F5). git diff --check is clean. Against a9d8c5703, git merge-tree exits 0 with no conflict and writes the head's own tree, because that commit is the head's only parent. The open-pull-request commit-id check, run verbatim with UPSTREAM_REMOTE=work, prints nothing, because the file cites no commit id. Only this one file changes, and project-words.txt is untouched.

Findings

  • F1 (Minor): row [1] leads to duplicate archive pull requests.
  • F2 (Minor): the block cannot tell a failed run from a result.
  • F3 (Nit): [3] and [4] match text rather than frontmatter values.
  • F4 (Minor): row [2]'s move back skips reopen-issue Steps 4–5.
  • F5 (Nit): the commit body misdescribes [3].

None blocks; each is a sentence or two.

Checked, no finding

The table's padding drifts in rows [1]–[3], but MD060 is disabled in .markdownlint.json. The description links no issue, and the change has none of its own.

Checks

On the loop's compute hub at this head, merge base a9d8c5703 (receipt server-gates-krkavec-319): pre-commit profile gate exit 0 (85 s); linter markdown, linter cspell, linter lychee exit 0; frontmatter-validator --all: 19 errors / 4 warnings at this head and 19 / 4 at a9d8c5703 re-measured, the same 23 diagnostics by path and category, none in the file this PR touches; no Rust changes, so no cargo step. GitHub checks at this head at posting time: "Docs Lint: completed/success". At posting, develop is fd04ac51e.


| Finding | Meaning | Action |
| --------------------------------------------- | ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| [1] a number | The issue is closed, or no such GitHub issue exists | Confirm with [Step 1](#step-1-verify-issue-is-closed-on-github). If `CLOSED`, archive it with Steps 0-7. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Minor][F1] Row [1] sends a periodic run straight into a duplicate archive pull request

While an archive pull request is open, develop still holds the spec under open/ and the issue is closed. So [1] lists the number, Step 1 confirms CLOSED, and this row says to archive it with Steps 0-7. Nothing in those steps or in this section checks for an open pull request that already archives the candidate. That is how #2542 duplicated #2541, from a periodic run of this skill.

Suggest one sentence here, or a fourth reading rule: before archiving a number from [1], check for an open pull request that already archives it (Step 7's title form is archive closed issue #N), and skip the number if one exists.


```bash
REPO=torrust/torrust-tracker
OPEN_ISSUES=$(gh issue list --repo "$REPO" --state open --limit 5000 --json number --jq '.[].number' \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Minor][F2] The block cannot tell a failed run from a result

Run on scratch copies with a stub gh:

  • When gh fails (not authenticated) or returns no rows, OPEN_ISSUES is empty and nothing checks it. [1] then lists all 53 numbered open/ folders as not open, and only the failure case leaves a line on stderr.
  • Run from any directory other than the root, every heading is empty, which line 338 calls consistent. The find and grep errors go to stderr only.
  • The exit status is the last grep's: 1 on a consistent tree, 0 when [4] reports something, and 2 when a glob matches nothing. It cannot be used as a signal either.

Suggest guarding both inputs, for example [ -d docs/issues/open ] || exit 1 before the first heading and [ -n "$OPEN_ISSUES" ] || { echo "no open issues fetched" >&2; exit 1; } after the fetch. Then either end with exit 0 or say that the exit status carries no meaning.

grep -rlE '^github-issue: [0-9]+' docs/issues/drafts --include=ISSUE.md --include=EPIC.md

echo "[4] open/ specs with a terminal status"
grep -lE '^status: (done|closed|completed|resolved)' \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Nit][F3] [4] and [3] match text, not frontmatter values

[4] misses status: "done", status: 'done' and status: done (two spaces). The validator reads all three as the same done, because status deserializes into the IssueStatus enum (contrib/dev-tools/checks/frontmatter-validator/src/profile.rs:307).

Both checks also match any line in the file. On scratch copies, a fenced status: done example in an open spec's body and a fenced github-issue: 42 example in a draft's body were each reported, although both frontmatters were consistent.

Every current spec uses the plain unquoted frontmatter form, so today's result is right. Suggest matching only inside the leading --- block, and allowing optional quotes and spaces around the value.

| Finding | Meaning | Action |
| --------------------------------------------- | ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| [1] a number | The issue is closed, or no such GitHub issue exists | Confirm with [Step 1](#step-1-verify-issue-is-closed-on-github). If `CLOSED`, archive it with Steps 0-7. |
| [2] a number | The issue is open again, or the spec was filed in `closed/` early | Follow [reopen-issue](../reopen-issue/SKILL.md) if it regressed; otherwise move the spec back to `open/`. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Minor][F4] Row [2]'s "otherwise move the spec back to open/" skips the work a move back needs

A spec in closed/ carries several things that must change when it moves back:

  • status: done, which the validator rejects in open/ (contrib/dev-tools/checks/frontmatter-validator/src/repository.rs:166);
  • a closed/ spec-path;
  • a ticked closure checkpoint;
  • live references that point at closed/.

reopen-issue Steps 4 and 5 cover exactly these, and they apply whether or not the issue regressed. Only Steps 1 and 3 (the decision and the reopen) are moot when the issue never closed.

Suggest: "Move it back with reopen-issue Steps 4 and 5; follow the whole skill if the issue was reopened after a regression."

echo "[2] closed/ specs whose issue is open"
comm -12 <(spec_numbers docs/issues/closed) <(echo "$OPEN_ISSUES")

echo "[3] drafts already linked to a GitHub issue"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Nit][F5] The commit body says the audit reconciles linked drafts; it only reports them

The commit body says the audit "reconciles linked drafts". [3], on this line, only lists them; the table then sends the reader to Step 0.6, which does the reconciling. The body also leaves out the [4] terminal-status check, the new description triggers and the version bump.

The merged commit can no longer be amended. A follow-up that addresses F1-F4 can state in its own commit body that [3] only reports linked drafts, and that the section also adds the [4] check, the new triggers and the version bump. The merge message carries the pull request description, which is accurate.

josecelano added a commit that referenced this pull request Oct 16, 2026
…measurement to #2547

Record manual scenarios M1 to M6 and M8 from the 18 real merges from
PR #2526 to #2543. M1 is proven indirectly, because the merge-tool output
was not captured. Tick AC1 to AC4 and AC6 with evidence, and move T7 and
AC9 to follow-up issue #2547 by maintainer decision. Add a Closure Plan,
the implementation retrospective, and the Task Reviewer report.

Co-authored-by: Copilot <[email protected]>
josecelano added a commit that referenced this pull request Oct 16, 2026
…and move the measurement to #2547

b2d33e1 docs(pr-reviews): add the reply URL of the eighth review round of PR #2550 (Jose Celano)
514cef3 docs(pr-reviews): record the eighth review round of PR #2550 (Jose Celano)
d1a5498 docs(pr-reviews): add the reply URL of the seventh review round of PR #2550 (Jose Celano)
af0da1a docs(pr-reviews): record the seventh review round of PR #2550 (Jose Celano)
759278c docs(pr-reviews): add the reply URL of the sixth review round of PR #2550 (Jose Celano)
2fb9cb0 docs(pr-reviews): record the sixth review round of PR #2550 (Jose Celano)
d5537ac docs(pr-reviews): add the reply URLs of the fifth review round of PR #2550 (Jose Celano)
c22fc52 docs(issues): [#2507] log the fifth PR #2550 review round (Jose Celano)
db1d2e4 docs(pr-reviews): record the fifth review round of PR #2550 (Jose Celano)
04d82d3 docs(issues): [#2547] state the selection rules as this specification's own (Jose Celano)
36ca2d1 docs(pr-reviews): add the reply URLs of the fourth review round of PR #2550 (Jose Celano)
09792d3 docs(issues): [#2507] log the fourth PR #2550 review round (Jose Celano)
a1bfb60 docs(pr-reviews): record the third dismissal and the fourth review round of PR #2550 (Jose Celano)
91a39a1 docs(issues): [#2547] limit the shared population to the force-push measures (Jose Celano)
b7a547d docs(pr-reviews): add the reply URLs of the third review round of PR #2550 (Jose Celano)
916925c docs(issues): [#2507] log the third PR #2550 review round (Jose Celano)
4b92ec0 docs(pr-reviews): record the second dismissal and the third review round of PR #2550 (Jose Celano)
1aecd2b docs(issues): [#2507] name the contradiction in the second re-review's scope (Jose Celano)
cbf2b8b docs(issues): [#2547] count and classify the force-pushes of the PRs merged in the window (Jose Celano)
7386f69 docs(pr-reviews): record the dismissed approval and the second review round of PR #2550 (Jose Celano)
c20f6cc docs(issues): [#2507] log the second PR #2550 review round (Jose Celano)
3e6f931 docs(issues): [#2547] label the PR #2531 merge time as merged_at (Jose Celano)
014c0e7 docs(issues): [#2507] state what the second re-review did not check (Jose Celano)
1dea064 docs(issues): [#2507] classify the V4 force-pushes by whether the push moved the base (Jose Celano)
e774c1d docs(issues): [#2507] set the evidence stamp to its newest edit (Jose Celano)
0dbe53d docs(issues): [#2547] classify a force-push by whether it moved the base (Jose Celano)
2562247 docs(pr-reviews): add the PR #2550 review audit (Jose Celano)
975501e docs(issues): [#2507] record the Task Reviewer's re-review of the close-out fixes (Jose Celano)
3fa9bca docs(issues): [#2547] log the edits that moved the last-updated stamp (Jose Celano)
c72184d docs(issues): [#2547] use the merge time that GitHub reports for PR #2531 (Jose Celano)
436a91d docs(issues): [#2507] account for every force-push of the 18 merges in V4 (Jose Celano)
a2eb4c1 docs(issues): [#2507] describe M1 as inferred, not proven (Jose Celano)
4b1c567 docs(issues): [#2507] attribute the delivery-sequence log line to the #2525 spec (Jose Celano)
08d1e07 docs(issues): [#2507] label the force-push event commits and record how to fetch them (Jose Celano)
7a3d1cc docs(issues): [#2547] classify force-pushes that are not rebases separately (Jose Celano)
b2bcd00 docs(issues): [#2547] use the merge's target tip as the refresh-path cutoff (Jose Celano)
2733f2e docs(issues): [#2547] limit the rebase-fallout baseline to 1 to 13 October (Jose Celano)
f4d1817 docs(issues): [#2525] record the agreed delivery sequence (Jose Celano)
3cb3548 docs(issues): [#2507] record the close-out verification and move the measurement to #2547 (Jose Celano)
38658d8 docs(issues): add issue specification for #2547 (Jose Celano)

Pull request description:

  Related to #2507

  ## Summary

  Closes out #2507 without waiting two weeks, records the follow-up issue #2547 that takes over its measurement, and records the agreed delivery sequence for #2525. Documentation only: every change is under `docs/issues/open/`.

  ### #2547 specification (`docs(issues)`)

  New `docs/issues/open/2547-measure-effect-of-optional-rebases/`. The maintainer approved the draft and the issue was created on GitHub. It takes over #2507 task T7 and acceptance criterion AC9: compare 2026-10-15 to 2026-10-28 with the #2507 baseline, classify each force-push as required (conflict) or recommended, and count merges through the merge tool's recorded-base refresh. It starts no earlier than 2026-10-29.

  ### #2507 close-out (`docs(issues)`)

  - **Manual verification** from the 18 real merges from PR #2526 to #2543 (`manual-verification-evidence.md`, section "Merges Under the New Policy"):
    - nine pull requests merged while behind `develop` without a rebase at merge time (M2), and every merged head stays reachable from `develop` (M3);
    - six were merged through the recorded-base refresh (M1). This is indirect evidence: the tool output was not captured, so the reasoning from GitHub state is spelled out in section V1;
    - #2532 and #2537 took the conflict rebase path (M4);
    - code and documentation-only merges happened with no ruleset changed (M5, M6), and first-parent history has one merge per pull request (M8).
  - **Acceptance criteria:** AC1 to AC4 and AC6 ticked with evidence. The maintainer accepted AC6 while no check is required, with the required `CI gate` tracked by #2525. AC9 and T7 were reworded as moved to #2547.
  - **New Closure Plan (C1 to C7)** in the spec, so the remaining steps are written down. After this PR merges, #2507 is closed manually on GitHub and its spec is archived with `cleanup-completed-issues`.
  - **New files:** `implementation-retrospective.md` and `agent-review-reports.md`, the latter holding the Task Reviewer report. The Task Reviewer's first verdict was `REVIEW FAILED` (five should-fix and three nit findings, all fixed); a later re-review first failed on residual wording and then passed, and each verdict is its own entry.

  ### #2525 delivery sequence (`docs(issues)`)

  - **Rust first:** pure-Rust tasks T1 to T3, then the sandbox decision gates T4 and T5.
  - **Before-baseline:** recorded before the orchestrator merges.
  - **Gate not required at first (T6):** `CI gate` lands reporting but not required, and is observed on real code and documentation-only pull requests.
  - **Then required (T7):** only with maintainer approval, with the ruleset JSON saved and a rollback documented.
  - **Measurement split (T8):** moved to a follow-up issue created when the gate becomes required, so #2525 can close without a waiting period.

  ## Validation

  - `TORRUST_GIT_HOOKS_LOG_DIR=.tmp ./contrib/dev-tools/git/hooks/pre-commit.sh --format=json`: pass.
  - `TORRUST_GIT_HOOKS_LOG_DIR=.tmp ./contrib/dev-tools/git/hooks/pre-push.sh --format=json` (nightly and stable Rust toolchains): pass, after rebasing onto `develop`.
  - `python3 contrib/dev-tools/git/tests/test-github-merge-symlinks.py` (Python 3.14.4): 51 tests OK. `bash contrib/dev-tools/git/tests/test-merge-pull-request.sh`: passed.
  - Independent Task Reviewer re-derived the evidence from `git` and `gh api`; its reports and two re-reviews are in `agent-review-reports.md`.
  - Review round: the findings of Copilot and da2ce7 are fixed in separate signed commits and recorded in `docs/pr-reviews/pr-2550-review/PR-REVIEW.md`; `validate-audit-record.py --pr-number 2550` reports no failures.

  ## Notes for reviewers

  - The PR-branch commit-id check from the `open-pull-request` skill reports the before and after commits of the #2532 and #2537 force-pushes (for example `55a414e98`) once a clone has fetched them. They are not commits of this branch: V4 cites them as the `beforeCommit` and `afterCommit` values of GitHub's `HeadRefForcePushedEvent`, with the fetch step and the full ids recorded. The skill defines no exception for this case.
  - The evidence cites `develop` at `fd04ac51e`. This branch was then rebased onto `30b368f0f` before opening; the two newer merges (#2500 and #2544) are outside the evidence window.

ACKs for top commit:
  da2ce7:
    ACK b2d33e1 — the round-9 correction entry against the captured times, the audit's twenty-nine rows against the captured reviews, thread, reply and timeline, and the commit-id check were recomputed with no finding
  josecelano:
    ACK b2d33e1

Tree-SHA512: 17030dd5806832cc53121a800b1681b816fb6ea61c560c7c390cee34aa8a95d3f6d59d3fdff78991f463ba1278ae8d37951c8497014f0e4221269974e8dd46eb
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.

3 participants