Repository navigation
feat: Discord /run and /versions for the session-ops jobs - #81
Merged
Merged
Conversation
/run starts a `discord = true` job through its path unit; /versions shows each platform's store and GitHub versions from store-versions' state. The relay runs as opsbot, which can only write request files the path units watch. release-stats is removed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two Discord slash commands:
/runto start a job now, and/versionsfor each store's Session version against GitHub's.release-statsis removed. #71 builds/mauon top of this.Commands
/run job:<job>startssession-ops@<job>.serviceby writing/run/session-ops/requests/<job>, which the job's path unit watches withPathChanged=, then waits up to 1.5 s for the unit's start time to change. Offered for thediscord = truejobs:crowdin-syncandcrowdin-duplicatesfor now. Refused while that job or a queued one is running or waiting, or when the queue's next run is sooner than the job's timeout. The check and the start share one lock; a command arriving while another holds it is refused at once rather than waiting past Discord's 3 s. The queue timer loses its random delay, so its next run is the scheduled time./versionsreplies in the channel with one line per store-versions platform from itsstate.json, which store-versions now writes 0644 for the relay. Read-only, so it is visible to everyone and skips the user and role allowlist.What the app sees: HTTP interactions only,
applications.commandsscope, no gateway./runis registered hidden from everyone but server administrators until Server Settings → Integrations grants it to a role.Gates
DISCORD_GUILD_ID(DMs refused), and the channel inALLOWED_CHANNEL_IDSwhen that is set.ALLOWED_USER_IDS/ALLOWED_ROLE_IDS; both empty refuses everybody./versionsskips this check.opsbot, which cannot start a unit. It can write only/run/session-ops/requests(root:opsbot 0770), where eachdiscord = truejob has aPathChanged=watch and nothing else. No polkit.Registry and install
jobs.toml:discord;timeoutis now checked as a systemd time span, since/runcompares it with the queue's next run.session-ops list --readycovers jobs a timer, the queue or a path unit starts;--timerslists those with a timer of their own, which is allinstall.shenables timers for.--path-unitslists thediscord = truejobs.install.sh: theopsbotaccount, the requests directory, the path units of the readydiscord = truejobs, andsession-ops-discord.serviceoncediscord.envhas content.release-stats(on-demand download counts) and its doc are removed.Deploy
/etc/session-ops/discord.env, then thelocation = /discord/interactionsblock fromnginx-webhooks.confcopied into the live file by hand, since certbot owns it, thensession-ops discord-registeronce. Steps indeploy/README.mdunder "Discord commands".Not yet done: the Discord side ran end to end against a test app (verification, registration, the gates,
/runreplies). Nothing has run on the host. After deploying:systemctl list-units 'session-ops@*.path'lists crowdin-duplicates and crowdin-sync, active./run crowdin-duplicatesstarts the job and its post appears./versionslists the seven platforms.Tests
uv run --locked python -m unittest discover -s tests -t .(906 OK, 1 skipped),ruff check .clean.