Repository navigation
feat(platform): sync Forgejo, GitHub pull requests and security alerts - #4997
Merged
Merged
Conversation
yannickmonney
force-pushed
the
feat/issue-sync-forgejo-pulls-security
branch
from
October 15, 2026 08:44
4873ec0 to
7fe8180
Compare
This was referenced Oct 15, 2026
Draws the Forgejo connector's branch mark for brand:forgejo, in an orange that keeps AA contrast on the light tile and a lighter orange of the same hue on the dark muted tile, so a Forgejo template card shows its product like the GitHub and GlitchTip ones.
task.sync_issues read GitHub issues and GlitchTip issues only. It now reads four kinds of source: - github: issues by default, or pull requests with type pulls; author narrows to one login (renovate[bot]). An issue source without author keeps the position it had, so existing documents carry on. - github-security: a repository's code scanning, Dependabot and secret scanning alerts, one task per alert. GitHub narrows each listing by tool and severity floor (one scale over security severities and error/warning/note), the reader checks both again, and a secret's value is never read (hide_secret) or kept. - forgejo: a new per-credential connector (Forgejo/Gitea /api/v1, Authorization: token) with repository, issue, comment and pull request actions plus the import natives. Identity is the instance origin and issue id, links are built from the connection's origin, and a refresh reads the repository again by id. - glitchtip, as before. Every source may name taskLabels for the tasks it creates, and the step takes failOn: any to fail as soon as one source failed. A repository's issues and pull requests keep positions and refreshes of their own. The tracker list moves into one registry (@tale/shared task-external-issue) that the task domain, the intake, mentions, the source-status lane and the board read. For forgejo and github-security the REST intake now treats tasks as tracker mirrors, so the contract moves to 3.46.0. Spec rules TASK-R61 to TASK-R65.
Three catalog templates on the one task.sync_issues step: - github/sync-pull-requests: a repository's open pull requests, all of them or one login's (renovate[bot]), beside Sync GitHub issues. - github/sync-security-alerts: one kind of alert from a severity floor up (high to start with) and, for code scanning, the tools named, so a repository with thousands of scanner alerts syncs only the ones worth a task. - forgejo/sync-issues: a Forgejo repository's open issues or pull requests, by a question, read through the connection that names the instance. Each ships its own tests against the mocks; the pack suite proves every sync template stays one step at twenty sources.
The templates page describes Sync GitHub pull requests, Sync GitHub security alerts and Sync Forgejo issues in EN/DE/FR; the schedule page tables the four kinds of source with their fields, the taskLabels of each source and the step's failOn option. The automations suite gains AUTO-F241 to AUTO-F245 for what a live GitHub and Forgejo must show, and the automation register names the specs that now hold TASK-R53 to TASK-R65.
The catalog test pins the connectors the image ships, so a Forgejo connector without its slug in the list fails the catalog walk.
Main took TASK-R61 for a refused dispatch declaration, so the issue sync's rules move one up (R62 to R66), with every test title, cross reference and manual box that names them. The domain spec guard refuses a rule stated twice.
A Forgejo or GlitchTip source's position was named after owner/repo (or organization/project) and its filter alone, while each listing's cursor belongs to its instance. Two automations syncing one repository from two instances (a repository and its Codeberg mirror) shared one row: each run found the other instance's cursor, restarted the pass and saved its own first batch, so a repository larger than one batch never synced past it, and one step listing both was refused as a duplicate. On a tracker whose connection names its instance, a source that names a connection now folds it into the position's digest and the duplicate check. A source on the default connection keeps the name it had, and a filter alone keeps the digest it had, so no stored position moves; a GlitchTip source that names a connection starts one new pass.
Forgejo lists the items carrying every label it is asked for, as GitHub does, but drops a name the repository has no label of without a word (its API: "Non existent labels are discarded"). A misspelt or renamed label therefore widened a source to every open issue or pull request, 100 tasks a run, and "bug,typo" quietly read as "bug". The reader now keeps a row only when its labels carry every name the source asks for, compared without regard to case, as it already did for the kind and the author. Every text that said Forgejo reads labels as alternatives (the template question in en/de/fr, the task and Forgejo connector descriptions, the template and trigger docs) now says an item needs every one of them.
A github-security source looked up its linked tasks by repository alone, so it read again every alert task of the repository, whatever kinds it names. With a code scanning source on one connection and a secret scanning source on another, each refresh read the other's alerts; a token without access answered 404, the task was marked unavailable, and the next run through the right connection restored it, so the flag and the receipts flipped from run to run. The linked query now carries the source's alert kinds, matched on the kind in the snapshot id (<repository id>/<kind>/<number>), as a code host source already reads again only its issues or its pull requests. The real-Postgres lane proves two security sources of one repository read again only their own kinds.
The step and the template took any text as a code scanning tool name, while github.list_import_alerts refused a control character, "&", "#" and "?". A source saved with such a name passed at save time and failed every scheduled run with INPUT_INVALID, three of which restarted its pass. One schema, securityToolName, now holds the rule for the sync's sources and for the listing, and the step's and the action's input schemas carry the same pattern, so the refusal comes where the source is written. Only a control character is refused: the listing encodes the name into its address, so "&", "#" and "?" are read as written.
The register row for the issue sync now names what its specs hold since the review fixes: a position per connection on Forgejo and GlitchTip, labels an item needs every one of (Forgejo's rows checked again), a security source refreshing only its own kinds, and the tool name rule.
yannickmonney
force-pushed
the
feat/issue-sync-forgejo-pulls-security
branch
from
October 15, 2026 13:34
7fe8180 to
79ca033
Compare
yannickmonney
marked this pull request as ready for review
October 15, 2026 13:34
5 tasks done
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.
What
task.sync_issues(the one-step issue sync from #4988) reads four kinds of source instead of two, so the fleet's own Tale can run one intake automation per owner and source kind:githubgainstype: issues | pulls(defaultissues) andauthor(a login,renovate[bot]for Renovate). An issue source withoutauthorkeeps its position name and filter, so existing documents and their saved positions carry on unchanged.github-security(new): a repository's code scanning, Dependabot and secret scanning alerts, one task per alert.alerts,minSeverityandtoolsnarrow it. GitHub narrows each listing itself (code scanning per tool and severity, Dependabot by severity list with itsaftercursor, secret scanning withhide_secret=true). The reader then checks the tool and the level again. One scale covers both kinds of severity: a security severity, or error/warning/note read as high/medium/low; a secret counts as critical. States map open→open, fixed/revoked→resolved, dismissed/auto_dismissed/false positive→ignored, anything else→closed. The secret's value is never read or kept.forgejo(new): a new per-credential Forgejo connector (/api/v1,Authorization: token, allowedHostscodeberg.organdgit.tale.dev). Its actions:list_repos,list_issues/get_issue/create_issue/update_issue,list_issue_comments/create_issue_comment,list_pull_requests/get_pull_request, plus the nativeslist_import_issues/get_import_issue/refresh_import_issues. Paging followsLink rel="next", or a full page of 50 when there is no Link header. The source id is<instance origin>#<issue id>, so it stays stable across instances. Links are built from the connection's own origin, and a refresh reads the repository again by id (once per refresh).labelsmeans an item needs every one of them, as on GitHub; Forgejo drops a label name the repository lacks without a word, so the reader checks each row's labels again.glitchtip, as before.Also:
taskLabelsper source (up to 10): labels a task the source creates is given, e.g.source:glitchtip,repo:ops. A task the sync made before keeps its labels.failOn: anyon the step: fail as soon as one source failed (rate-limited sources still don't count). The default (all) keeps today's behaviour./pull(s)/<n>). A security source likewise refreshes only the alerts of the kinds it names (the kind in the snapshot id<repo id>/<kind>/<n>).credentialkeeps a position of its own: one repository synced from two instances (a repository and its Codeberg mirror) keeps two passes. A source on the default connection keeps the position name it had.ISSUE_TRACKERSin@tale/shared/schemas/task-external-issue) replaces every hard-codedgithub | glitchtip. It records each tracker's scope field, case folding and whether it is per instance. The registry is used by issue-sync, platform-tasks, the task connector enums, task-store (scope/case rules), external-ref (lifecycle, scope, case), external-status (the source-status lane), mentions, the task source card and the status card.github/sync-pull-requests,github/sync-security-alerts(hourly; floor high to start), andforgejo/sync-issues(issues or pull requests by a question). There is also a Forgejo brand mark (brand:forgejo).externalSystemgithub-securityandforgejo, the intake now treats tasks as tracker mirrors.externalStateno longer moves the task,@namesare kept, andPUT …/external-statusrefuses withTASK_EXTERNAL_REF_INVALID. No operation or schema changes.domains/tasks/spec.md(main took TASK-R61 while this was open); TASK-R54's heading now says "by default".No migration.
app.tasks.external_systemhas no CHECK constraint, andtask_import_cursorsaccepts any kebab slug since 0211, which coversgithub-security.Review fixes (second round)
The branch was rebased on main, which had taken TASK-R61, and CI's two unit failures are fixed: the domain-spec guard (rules renumbered R62 to R66) and the shipped-connector list (
forgejoadded). Then each review finding:issue-sync.tspositionKey). A Forgejo source's position and duplicate key wereowner/repoplus filter, while its cursor belongs to its instance. Two instances shared one row and kept restarting each other's pass. Now, on trackers markedperInstance, a namedcredentialis folded into the position digest and the duplicate key. GlitchTip had the same defect on main and gets the same fix. A GitHub source is unchanged, since GitHub is one instance. Test: two Forgejo sources on oneowner/repounder two credentials are both accepted and each resumes its own pass over three runs (fails without the fix).issue-import-forgejo.ts). Each row must now carry every label named, compared case-insensitively. Test: the instance ignores the filter and answers unlabelled and partly-labelled rows; only rows with every label are kept.templates.mdandtriggers.md(en/de/fr), and the code comment.LinkedIssueQuery.alertKindsfilters onsplit_part(external_source_id, '/', 2). Tests: a unit test, and a real-Postgres case (NOT_RUN locally).securityToolNameschema serves both the sync source and the native listing. It refuses only control characters, becauselaneUrlencodes the name, so&,#and?now work. The step's and the action's JSON schemas carry the samepattern, so save-time validation refuses what a run would. Tests check that both layers agree, and that a name with reserved characters is sent encoded.Data note: a GlitchTip source that already names a
credentialmoves to a new position name, so its next run starts one new pass from the oldest issue. Writes go by source identity, so no task is duplicated, and the old position row is left unused. Sources on the default connection, and every Forgejo source (none stored before this PR), are unaffected.Why
The fleet's Tale needs intake for GitHub issues, security alerts and Renovate PRs (until the Forgejo cutover), Forgejo issues and Renovate PRs, and GlitchTip issues. Before this change, the sync knew only GitHub issues and GlitchTip and dropped PRs. There was no Forgejo connector and no security-alert reader. tale holds 7,129 open code-scanning alerts (7,057 from Trivy), so the tool filter and severity floor are applied by GitHub itself. That keeps a high-signal sync cheap. Alerts are not grouped per rule: one task per alert keeps refresh simple, because each alert has its own state.
How tested
All runs were local, with bun 1.4.2.
tsc --noEmit:@tale/platform,@tale/shared,@tale/ui,@tale/ui-docs. Clean.oxlint --type-awareon every changed TS file in platform, shared, ui and ui-docs. Clean.knip: no unused exports.lib/connectors lib/automations lib/engine lib/mcp scripts/openapi backend/domains/connectors backend/domains/tasks backend/core/tasks backend/core/connector_credentials tests/guards lib/i18n. 303 files and 6,088 tests pass. They include:issue-import-forgejo.test.tsandissue-import-alerts.test.ts(fake HTTP APIs, paging, cursors, filters, refresh, instance isolation, secret never kept)failOnlist_external_issues@tale/shared(1,019 tests) and@tale/uidata-display and icons (494 tests). Pass.@tale/docstests (716),lint:links,lint:manualandcheck-guideon the touched suites. Pass.Authorization: token), and GitHubissues?creator=renovate[bot], which returns 200 and the bot's items. The swagger's "any of these labels" is wrong: the review's live read of codeberg.org showed Forgejo requires every label and discards an unknown one, which the reader and every text now follow.Second round (after the rebase):
tsc --noEmitfor platform is clean,oxlint --type-awareon the changed files is clean,knipis clean, andoxfmt --checkpasses. 185 platform unit test files (3,406 tests) pass acrosslib/connectors lib/shared/schemas tests/guards backend/domains/tasks backend/domains/connectors lib/automations, as dolib/engineandlib/i18n(2,845 tests),@tale/docs(716),lint:manual,lint:linksandlint:conflicts. The two intermediate fix commits were typechecked and tested on their own.Not done
backend:integrationwas not run locally (it needs a Postgres/Docker stack). Two cases inissue-sync.integration.tscover item-kind refresh isolation with task labels on create only, and alert-kind refresh isolation for two security sources of one repository. The merge queue's Backend integration check runs them.