Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion dist/freebsd/tracer.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ TRACER_URL=https://
# TRACER_TITLES=file the games' names, made here by scripts/make-titles.py --out file (none without it)
# TRACER_ISSUES_REPO=OWNER/NAME the repository an administrator's approval (a reaction) files a report into (none
# without it: no issue)
# TRACER_ISSUES_TOKEN=... a fine-grained token of that repository alone, Issues read and write
# TRACER_ISSUES_TOKEN=... a fine-grained token of that repository alone: Issues read and write, Pull requests and
# Contents read (the issues followed, their fixes compared with the nightlies)
# TRACER_ISSUES_EMOJI=... the approval's emoji (the check mark without it)
# TRACER_ISSUES_LABELS=a,b the labels each issue gets (none without it)
# TRACER_UPSTREAM_REPO=OWNER/NAME the repository whose main a report's build is compared with, its owner's nightly
# the nightlies' (scarletnx/ScarletNX without it; asked with TRACER_ISSUES_TOKEN)
# TRACER_MIN_FREE=MiB the site's file system's MiB kept free: a report that would go under it is refused (1024
# without it; 0 for no floor)
# TRACER_NOTIFY=ping once a report's fix is in a nightly, a reply tells its sender: ping pings them, reply does
# not (off without it); needs TRACER_ISSUES_REPO and its token
5 changes: 3 additions & 2 deletions docs/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ A channel id for `REIWIMSY_CHANNELS` and the card channels: Developer Mode, righ
(the site's address), `TRACER_CHANNELS` (channels' ids, or `all` for every channel it can read; without it no
report is taken), and the other keys
[Tracer](./TRACER.md#settings) lists. For the issues, `TRACER_ISSUES_REPO` and `TRACER_ISSUES_TOKEN`: on GitHub,
Settings, Developer settings, Fine-grained tokens, the repository alone, the permission Issues: Read and write,
nothing else. For the games' names, `TRACER_TITLES`, a file `python3 scripts/make-titles.py --out FILE` makes in
Settings, Developer settings, Fine-grained tokens, the repository alone, the permissions Issues: Read and write,
Pull requests: Read and Contents: Read (the issues followed, a fix compared with the nightlies), nothing else; and
`TRACER_NOTIFY=ping` for a report's sender to be told when its fix is out. For the games' names, `TRACER_TITLES`, a file `python3 scripts/make-titles.py --out FILE` makes in
the jail.
5. On, and started:

Expand Down
2 changes: 1 addition & 1 deletion docs/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ environment (`GIT_CONFIG_*`), and `push.sh` gives curl the push token from its h
| Token | Of | What it may do |
|---|---|---|
| ReiWimsy's `GITHUB_TOKEN` | GitHub, fine-grained | public repositories, read-only |
| Tracer's `TRACER_ISSUES_TOKEN` | GitHub, fine-grained | the issues' repository alone: Issues, read and write |
| Tracer's `TRACER_ISSUES_TOKEN` | GitHub, fine-grained | the issues' repository alone: Issues, read and write; Pull requests and Contents, read |
| AccordWimsy's `GITHUB_TOKEN` | GitHub, fine-grained, of the organization | read-only: Contents, Issues, Pull requests, Metadata |
| AccordWimsy's `ACCORDWIMSY_FORGEJO_TOKEN` | the forge, its own user | `write:repository`, `write:issue`, `write:organization`, `read:user` |
| ReiWimsy's Discord invite | the server | View Channels, Send Messages, Send Messages in Threads, Embed Links, Read Message History, Manage Messages (its first round deletes the webhooks' cards) |
Expand Down
19 changes: 16 additions & 3 deletions docs/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ temporary folder:
site's disk kept free (a report and an update refused under `TRACER_MIN_FREE` before any download, with the MiB
said, one that fits taken, a disk that cannot be read, no floor), the JSON with no Discord id, the channels it
answers in (a list, `all`, none, and other words refused);
- what an issue may hold of a report's text (a title ID as `<game>`, a value naming a game's file cut whole, an
extension alone and a commit kept);
- a report linked to an issue that exists (`link`, `unlink`), through a fake GitHub: by an administrator only, in a
reply or by number, the comment that links back, a pull request, an issue that is none, a refused comment said, the
approval opening none for a linked report;
- the issues followed (`TRACER_NOTIFY` and its refusals), through a fake GitHub: an issue and a pull request open,
then closed by a merged pull request whose commit no nightly has yet and merged with it in one (the sender told
once, pinged, by a reply to the report's message), the next nightly having the first, GitHub failing, a reopened
issue losing its fix, one fixed with no one told asked no more, a report linked to another issue forgetting the
first's;
- two reports of one failure: each named in the other's reply, page and JSON, the second's approval linking it to the
first's issue with a comment and opening none, the first gone from the second's page with its message;
- the issues an approval files, through a fake GitHub: an administrator's reaction files one, a second files none,
anyone else's reaction or another emoji nothing, a refusal said and tried again, the settings and their refusals;
- how old a report's build is, through a fake GitHub: behind main, the plurals, a commit asked once an hour, `-dirty`
Expand Down Expand Up @@ -119,10 +131,11 @@ temporary folder:
`python3 scripts/test-mutants.py` then changes Tracer's code one way at a time in a copy of the tree, and expects its
tests to fail on each: `tracer/src/rules.c` (a threshold one off, a comparison that lets one more in, a condition left
out: 19 mutants, `test_tracer --rules`); what a report keeps of its files, in `files.c`, `report.c` and `issues.c` (a
zip's screenshots, a picture never read as a log, the paths outside a home, the limits said with their values: 30
mutants, `test_tracer --files`); what a log holds of a run, in `probe.c` (Amberlith's starting note, a name that only
zip's screenshots, a picture never read as a log, the paths outside a home, the limits said with their values, what
an issue may hold of the game: 33 mutants, `test_tracer --files`); what a log holds of a run, in `probe.c` (Amberlith's starting note, a name that only
begins like it, libc's detail kept, a worker's answer naming another program: 4 mutants, `test_tracer --probe`); and
the worker's locale for a zip's names, made before it shuts itself in (1 mutant, the whole suite). A mutant they pass,
the worker's locale for a zip's names, made before it shuts itself in, who links a report to an issue, and when a
report's sender is told its fix is out, and an approval of a failure an issue has (5 mutants, the whole suite). A mutant they pass,
or one whose text its file no longer has once, fails it. About 30 s.

`make -C tracer bench [RUNS=1000] [FOLDER=/tmp/tracer-bench]` (`tracer/tests/bench_probe.c`, built by `make test`,
Expand Down
68 changes: 55 additions & 13 deletions docs/TRACER.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* [Summarized and named again](#summarized-and-named-again)
* [Commands](#commands)
* [Issues](#issues)
* [Followed, and the sender told](#followed-and-the-sender-told)
* [How old a build is](#how-old-a-build-is)
* [What the runs say together](#what-the-runs-say-together)
* [What it keeps of people](#what-it-keeps-of-people)
Expand Down Expand Up @@ -202,23 +203,63 @@ Each is a message that mentions Tracer, in a channel it answers in:
| `@Tracer add 12`, and words; or a reply to one of report 12's messages | adds the message's files and words to report 12 | the one who sent it, the server's owner and administrators, `TRACER_ADMINS` |
| a reply with no file, to a message with a log | a report of that message | anyone |
| `@Tracer delete 12`, or `@Tracer delete` in a reply | deletes report 12 | the one who sent it, the server's owner and administrators, `TRACER_ADMINS` |
| `@Tracer link 12 1234`, or `@Tracer link 1234` in a reply | links report 12 to issue or pull request 1234 of `TRACER_ISSUES_REPO` ([Issues](#issues)) | the server's owner and administrators, `TRACER_ADMINS` |
| `@Tracer unlink 12`, or `@Tracer unlink` in a reply | takes report 12's link to an issue out | the same |

## Issues

A report becomes a GitHub issue once a server's administrator approves it: with `TRACER_ISSUES_REPO`, the owner or an
administrator of the server it was sent in (or one of `TRACER_ADMINS`) reacts to one of its messages (the one that sent
it, an update, Tracer's answer) with the approval's emoji, `TRACER_ISSUES_EMOJI`, the check mark by default. Tracer
opens the issue in that repository with what the site shows of the report: its facts and its first log's summary (home
folders and the folders of paths outside them as `~`, addresses as `[ip]` and `[email]`, no dumps), each of a log's or
a player's words in a code block, where GitHub links no `@name` and no `#number`, the report's page, and its
screenshots, each the site's picture 320 pixels wide linked to it and named by its number in the report (a file's
name is a player's words). GitHub's API takes no file for an issue: its image proxy fetches each picture from the site,
so the site must answer it. The issue's number goes into the database, onto
the report's page and its JSON, and into a short reply on Discord. A report is filed once: a second approval opens no
other issue, and one GitHub refused (its status and message in the reply) is tried again by the next approval. Anyone
else's reaction, and another emoji, are left as they are. GitHub is asked from the bot's own process, with a 30 s
timeout; the worker that reads the files never holds this token either. The gateway asks for the reactions only when
`TRACER_ISSUES_REPO` is set.
opens the issue in that repository, titled `Tracer report 12: <its failure's signature> (<console>)`, with what the site
shows of the failure: its facts (console, game version, build, system, GPU, driver, outcome, signature, what the runtime
missed) and its first log's fatal and frames (home folders and the folders of paths outside them as `~`, addresses as
`[ip]` and `[email]`, no dumps), each of a log's words in a code block, where GitHub links no `@name` and no `#number`,
the report's page, and its screenshots, each the site's picture 320 pixels wide linked to it and named by its number in
the report (a file's name is a player's words). GitHub's API takes no file for an issue: its image proxy fetches each
picture from the site, so the site must answer it. An issue names no game, as the repository's issues never do: no
title, no title ID (one in a value is written `<game>`), no player's note and no last lines (where a game's name may
be), and a value that names a game's file (a dump's, an update's, a mod's: `.nsp`, `.xci`, `.3ds`, `.pchtxt`...) is cut
whole, as the name before it may hold spaces; the report's page, which the issue links, has them all. The issue's number
goes into the database, onto the report's page and its JSON, and into a short reply on Discord. A report is filed once:
a second approval opens no other issue, and one GitHub refused (its status and message in the reply) is tried again by
the next approval. Anyone else's reaction, and another emoji, are left as they are. GitHub is asked from the bot's own
process, with a 30 s timeout; the worker that reads the files never holds this token either. The gateway asks for the
reactions only when `TRACER_ISSUES_REPO` is set.

A report also links to an issue or a pull request that exists, in the same repository: `@Tracer link 12 1234` (`#12`
and `#1234` too), or a reply to one of its messages with `@Tracer link 1234`, from those who approve. Tracer asks
GitHub for it (`GET repos/<repo>/issues/1234`, which answers pull requests too), keeps its number and page as an
approval's, draws the report's page again and comments on the issue with the report's page, `Tracer report 12 is
linked to this issue, by a server's administrator on Discord: <page>`, so each links to the other. A number GitHub has
no issue for, and a comment GitHub refuses, are said with its status and message; the link stays without its
comment. A report linked to another issue says which it replaced; `@Tracer unlink 12` takes the link out, the comment
on GitHub staying. A report with an issue opens no other at an approval.

A new report whose first log failed with a signature other reports have (the log summary's: where and how the run
ended) names the newest five in its reply (`Same failure: #40 (issue #1234), #52`), on its page and in its JSON
(`same_failure`), whatever their game; their pages name it too. An approval of a report whose game and signature a
report linked to an issue has links it to that issue, with a comment on it that says so, and opens none: `Report #61
has the failure of report #40, which is issue #1234: linked to it, and no other issue opened.`

### Followed, and the sender told

With `TRACER_ISSUES_TOKEN`, every 10 minutes Tracer asks GitHub (one GraphQL query for 50 issues at a time, from the
bot's own process) how each report's issue or pull request stands, and the report's page and JSON say it
(`issue_state`, `issue_reason`): open, closed and why (`COMPLETED`, `NOT_PLANNED`...), merged. A pull request linked
that merged, or the one whose merge closed the issue as completed (a commit that closed it too), is the report's fix
(`fix_pr`, `fix_commit`); then the newest nightly of `TRACER_UPSTREAM_REPO`'s owner is compared with that commit
(`GET repos/<upstream>/compare/<fix>...<nightly's commit>`), and the first that has it is kept (`fix_nightly`). An
issue reopened loses its fix.

With `TRACER_NOTIFY=reply` or `ping`, once a report's fix is in a nightly, Tracer replies to the message that sent the
report, once (`ping` pings its author, as a reply does; `reply` does not):

Report #74: fixed
Fixed by pull request #1479 (abc1234), in nightly 2026-11-10 (def5678). Try it, and send a new log if it still fails.

A report whose fix is in a nightly, its sender told (or no one, with `TRACER_NOTIFY=off`), is asked no more. A report
linked to another issue starts over. What GitHub refuses is said in the log, and asked again in the next round.

## How old a build is

Expand Down Expand Up @@ -290,7 +331,7 @@ Static files, drawn again where a report changes them, and all of them at each s
| `index.html` | each game, its latest outcome, its reports' count; a search and a filter by outcome |
| `all.html` | every report, the newest first |
| `g/<key>.html` | a game's reports: `<key>` its title ID, or `n-` and its name's letters for a game known by name |
| `r/<id>/` | a report: its facts, its screenshots (each shown small, and opened whole by a click), and each log with its summary, to read or download (a log sent in a `.zip` or a `.gz` is kept as its text and downloads as one: `logs.zip` as `logs.log`, `game.log.gz` as `game.log`); a run of edenprobe's has its counts and each case that did not pass |
| `r/<id>/` | a report: its facts (its issue as GitHub said it last, and its fix; the other reports of its failure), its screenshots (each shown small, and opened whole by a click), and each log with its summary, to read or download (a log sent in a `.zip` or a `.gz` is kept as its text and downloads as one: `logs.zip` as `logs.log`, `game.log.gz` as `game.log`); a run of edenprobe's has its counts and each case that did not pass |
| `probe/index.html` | the runs of Amberlith: the machines (an emulator, a driver and its version, a system), each case that fails somewhere with its results on each machine, each suite's, and each run |
| `probe/c/<key>.html` | a case of Amberlith: `<key>` 16 hex digits of its suite and name; its results on each machine, what the rules say of it, and its newest 200 failures and skips with their detail |
| `probe/d/<driver>.html` | a driver, by the ban table's name (`radv`, `nvidia`; `unknown` for the console's reports): its machines, the cases that fail on it, its ban candidates, its runs |
Expand Down Expand Up @@ -320,9 +361,10 @@ fill in; an empty value stops the service):
| `TRACER_ASSETS` | `/usr/local/share/tracer` | where `style.css`, `site.js` and `tracer.svg` are |
| `TRACER_TITLES` | none: no list | the games' names by title ID, made by `scripts/make-titles.py --out FILE`; without it a game its logs don't name keeps its title ID |
| `TRACER_ISSUES_REPO` | none: no issue is filed | `OWNER/NAME`: the repository an approved report becomes an issue of; the start's log line says it, or that it is not set |
| `TRACER_ISSUES_TOKEN` | none: needed with the repository | a fine-grained token of that repository alone, with Issues read and write and nothing else; never in the log |
| `TRACER_ISSUES_TOKEN` | none: needed with the repository | a fine-grained token of that repository alone, with Issues read and write, Pull requests and Contents read (the issues followed, a fix compared with the nightlies) and nothing else; never in the log |
| `TRACER_ISSUES_EMOJI` | the check mark (U+2705) | the approval's emoji: its character, or a server emoji's name |
| `TRACER_ISSUES_LABELS` | none | `label,label`: the labels each issue gets |
| `TRACER_NOTIFY` | `off` | `reply` or `ping`: a report's sender is told by a reply, which pings them with `ping`, once its fix is in a nightly ([Followed, and the sender told](#followed-and-the-sender-told)); needs `TRACER_ISSUES_REPO`; any other word stops it, naming the value |
| `TRACER_MIN_FREE` | `1024` | the MiB the site's file system keeps free: a report whose files would go under it is refused ([above](#deleting-and-the-hourly-limit)); `0` for no floor; a value that is no whole number from 0 to 1048576 stops it, naming the value |
| `TRACER_UPSTREAM_REPO` | `scarletnx/ScarletNX` | `OWNER/NAME`: the repository whose main a report's build is compared with, its owner's `nightly` the nightlies'; asked with `TRACER_ISSUES_TOKEN`, not at all without it |

Expand Down
15 changes: 9 additions & 6 deletions rei/src/rest.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ static void said_wrong(const char* what, const char* path, const RgAnswer* a) {
: a->body ? a->body
: "nothing");
}
/* the body of a message carrying embed: no pings, a reply to reply_to when not 0; owned */
static char* message_of(const cJSON* embed, u64 reply_to) {
/* the body of a message carrying embed: a reply to reply_to when not 0, which pings its author when ping is 1, and
no other ping; owned */
static char* message_of(const cJSON* embed, u64 reply_to, int ping) {
cJSON *m = cJSON_CreateObject(), *embeds = cJSON_AddArrayToObject(m, "embeds"),
*mentions = cJSON_AddObjectToObject(m, "allowed_mentions");
char* text;
Expand All @@ -69,7 +70,7 @@ static char* message_of(const cJSON* embed, u64 reply_to) {
snprintf(id, sizeof id, "%llu", (unsigned long long)reply_to);
cJSON_AddStringToObject(ref, "message_id", id);
cJSON_AddBoolToObject(ref, "fail_if_not_exists", 0);
cJSON_AddBoolToObject(mentions, "replied_user", 0);
cJSON_AddBoolToObject(mentions, "replied_user", ping);
}
text = cJSON_PrintUnformatted(m);
cJSON_Delete(m);
Expand Down Expand Up @@ -105,8 +106,10 @@ cJSON* dc_emojis(Dc* d) {
free(path);
return items;
}
u64 dc_post(Dc* d, u64 channel, const cJSON* embed, u64 reply_to) {
char *path = rei_format("channels/%llu/messages", (unsigned long long)channel), *body = message_of(embed, reply_to);
u64 dc_post(Dc* d, u64 channel, const cJSON* embed, u64 reply_to) { return dc_reply(d, channel, embed, reply_to, 0); }
u64 dc_reply(Dc* d, u64 channel, const cJSON* embed, u64 reply_to, int ping) {
char *path = rei_format("channels/%llu/messages", (unsigned long long)channel),
*body = message_of(embed, reply_to, ping);
RgAnswer a = {0};
u64 id = 0;
if (ask(d, "POST", path, body, &a) == 200) {
Expand Down Expand Up @@ -136,7 +139,7 @@ static int done_or_gone(const char* what, const char* path, RgAnswer* a, int sta
}
int dc_edit(Dc* d, u64 channel, u64 message, const cJSON* embed) {
char *path = rei_format("channels/%llu/messages/%llu", (unsigned long long)channel, (unsigned long long)message),
*body = message_of(embed, 0);
*body = message_of(embed, 0, 0);
RgAnswer a = {0};
int said = done_or_gone("PATCH", path, &a, ask(d, "PATCH", path, body, &a));
free(body);
Expand Down
Loading