Fix three defects of the English-comments check found in the trial (task 8) #212

Merged
Tirsvad merged 3 commits from mil-013-judge-each-line into main 2026-10-21 05:47:53 +02:00
Owner

Fixes three defects that the trial of the English-comments check found on the instance (MIL-013 task 8, #204). The trial ran on the throwaway pull request 213 (closed, not merged).

The defects

  1. A Danish line next to an English one was missed. The check joined the lines of a block and judged the mixed text, which counted as English. Run 433 at @main flagged only the Malay comment that stood alone.
  2. No comment was written on the pull request. In a called workflow gitea.event_name is workflow_call, not pull_request, so the step "Tell the author" was skipped (seen in a debug workflow: event_name=workflow_call number=213 author=Tirsvad base_ref=main). The step now asks for gitea.event.pull_request.number != '', which was shown to hold.
  3. The link in the comment pointed at the wrong run. It used the run number (440); the address of a run on the instance holds the run id (2485).

The changes

  • A block of several consecutive comment lines is judged line by line first (at least four words, probability 0.7), then as a whole when no line is flagged. A single comment line is judged once, as before. The stricter line values come from the 464 comment lines of this repository: lines at 0.6 and three words gave three false positives in real code, at 0.7 and four words none.
  • The condition of the author step and the run link, each with a test that reads the workflow.
  • The guide, the wiki pages (English, Danish, Bahasa Malaysia) and ADR-0012 describe the line-by-line judgement.

678 tests pass; coverage of tools/ 98 %.

What the trial showed on the instance (calling this branch)

  • The check found the Danish (da 1.0) and the Malay (id 0.66) comments and skipped the one marked english-comments: ignore; the run failed.
  • The Actions bot wrote one comment that mentions the author (@Tirsvad) with the findings.
  • A re-run with a changed Danish comment updated that comment (same id, still one comment).
  • With both comments rewritten the run passed, the failing step was skipped and the comment was marked resolved, without a mention.
  • No credential appears in the logs of the four english-comments jobs: REPORT_TOKEN is shown as ***, the clone header as AUTHORIZATION: basic ***, and a search for token <chars>, basic <base64> and bearer found nothing else.

Not shown: a pull request from a fork (read-only token), a custom REPORT_TOKEN secret, and the check as a required status (task 9).

Issues

No issue closed.

Refs #200
Refs #201
Refs #204

Commits carry Task: MIL-013#4, #5 and #10 trailers. Not merged by the author.

Fixes three defects that the trial of the English-comments check found on the instance (MIL-013 task 8, #204). The trial ran on the throwaway pull request 213 (closed, not merged). ## The defects 1. **A Danish line next to an English one was missed.** The check joined the lines of a block and judged the mixed text, which counted as English. Run 433 at `@main` flagged only the Malay comment that stood alone. 2. **No comment was written on the pull request.** In a called workflow `gitea.event_name` is `workflow_call`, not `pull_request`, so the step "Tell the author" was skipped (seen in a debug workflow: `event_name=workflow_call number=213 author=Tirsvad base_ref=main`). The step now asks for `gitea.event.pull_request.number != ''`, which was shown to hold. 3. **The link in the comment pointed at the wrong run.** It used the run number (440); the address of a run on the instance holds the run id (2485). ## The changes - A block of several consecutive comment lines is judged line by line first (at least four words, probability 0.7), then as a whole when no line is flagged. A single comment line is judged once, as before. The stricter line values come from the 464 comment lines of this repository: lines at 0.6 and three words gave three false positives in real code, at 0.7 and four words none. - The condition of the author step and the run link, each with a test that reads the workflow. - The guide, the wiki pages (English, Danish, Bahasa Malaysia) and ADR-0012 describe the line-by-line judgement. 678 tests pass; coverage of `tools/` 98 %. ## What the trial showed on the instance (calling this branch) - The check found the Danish (da 1.0) and the Malay (id 0.66) comments and skipped the one marked `english-comments: ignore`; the run failed. - The Actions bot wrote **one** comment that mentions the author (`@Tirsvad`) with the findings. - A re-run with a changed Danish comment **updated** that comment (same id, still one comment). - With both comments rewritten the run passed, the failing step was skipped and the comment was marked resolved, without a mention. - No credential appears in the logs of the four `english-comments` jobs: `REPORT_TOKEN` is shown as `***`, the clone header as `AUTHORIZATION: basic ***`, and a search for `token <chars>`, `basic <base64>` and `bearer` found nothing else. Not shown: a pull request from a fork (read-only token), a custom `REPORT_TOKEN` secret, and the check as a required status (task 9). ## Issues No issue closed. Refs #200 Refs #201 Refs #204 Commits carry `Task: MIL-013#4`, `#5` and `#10` trailers. Not merged by the author.
Tirsvad added 1 commit 2026-10-21 04:18:39 +02:00
Judge each line of a comment block, then the block
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
Validate workflows / validate (pull_request) Successful in 1m0s
198830588c
The trial of the English-comments check found that a Danish comment line next
to an English one was missed: the joined block counted as English. A block of
several lines is now judged line by line first (at least four words and a
probability of 0.7), and as a whole when no line is flagged. Found and fixed
while preparing MIL-013 task 8; the guide, the wiki and ADR-0012 say so.

Refs #200
Refs #204
Task: MIL-013#4
Task: MIL-013#10
Tirsvad added 1 commit 2026-10-21 04:26:19 +02:00
Tell the author in a called workflow: ask for the pull request, not the event
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
Validate workflows / validate (pull_request) Successful in 1m2s
3d46c4b60a
The trial on the instance showed that gitea.event_name is workflow_call inside
a called workflow, so the step that comments on the pull request was skipped.
The pull request number, its author and the base ref are available there, and
the step now runs when the number is set.

Refs #201
Refs #204
Task: MIL-013#5
Tirsvad added 1 commit 2026-10-21 04:29:27 +02:00
Link the run by its id in the comment on the pull request
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
Validate workflows / validate (pull_request) Successful in 1m2s
39bcaa5bac
The trial showed that the web address of a run on the instance holds the id of
the run, not its number, so the link in the comment pointed to another run.

Refs #201
Refs #204
Task: MIL-013#5
Tirsvad changed title from Judge each line of a comment block, then the block (English-comments check) to Fix three defects of the English-comments check found in the trial (task 8) 2026-10-21 04:36:53 +02:00
Tirsvad merged commit a772088730 into main 2026-10-21 05:47:53 +02:00
Tirsvad deleted branch mil-013-judge-each-line 2026-10-21 05:47:54 +02:00
Sign in to join this conversation.