Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

[Bug][Project] Invalid metric plugin options are accepted on project save and only fail at the next pipeline run

Ouverte
#9,227 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 2 jours

@chenwei791129 y travaille déjà.

Depuis le 15/10/2026.

  • #9228 par @chenwei791129 — ouverte

Évaluation

Difficulté
3/5
Temps estimé
Une demi-journée
Accessibilité débutants
22/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
À l'abandon
Stack technique
go
Domaine
backend

Piste de recherche

Start in backend/server/services/project.go at refreshProjectMetrics, which CreateProject and PatchProject call without validating pluginOption. Then read the MakeMetricPluginPipelinePlanV200 implementations in the monorepo and dora plugins, which already compile the regex. Done means an invalid regex or empty sub-project list returns HTTP 400 without writing to the database, while valid Go-only syntax such as (?i) is still accepted. Pull request #9228 is already open against this issue, so check it before starting.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Search before asking
  • I had searched in the issues and found no similar issues.
What happened

Some metric plugin settings on the Config UI Project → Settings page take a regex, e.g. the
Deploy job pattern of Monorepo Sub-Projects.

If the regex is invalid (e.g. ^deploy-(a, missing a closing parenthesis), clicking Save reports
success and the setting is stored. The error only surfaces the next time a pipeline plan is generated
(Collect Data or the scheduled run):

  • The whole blueprint fails to start, not just that metric — data collection from every data source
    stops as well.
  • The error is reported on the pipeline / blueprint, far from the Settings page where the mistake was
    made, so it is hard to connect the two.
  • With a scheduled blueprint, it can take hours before anyone notices the data stopped updating.

The same happens when Monorepo Sub-Projects is enabled with no sub-projects at all.

Project Settings → Save                    Collect Data / cron (hours later)
        │                                            │
        ▼                                            ▼
PATCH /projects/:projectName               MakePlanForBlueprint
        │                                            │
        ▼                                            ▼
refreshProjectMetrics                      MakeMetricPluginPipelinePlanV200
  stores pluginOption as-is  ──── DB ────►   compiles `^deploy-(a`  ✗ error
        │                                            │
        ▼                                            ▼
   2xx  ✓ "saved"                           whole blueprint fails,
                                            no data collected at all

Root cause:

  • POST /projects and PATCH /projects/:projectName store each metric's pluginOption as-is via
    refreshProjectMetrics (backend/server/services/project.go), without any validation.
  • The actual validation lives in each metric plugin's MakeMetricPluginPipelinePlanV200 (monorepo
    rejects an empty subProjects list and compiles every deployJobPattern, returning BadInput), which
    is only called when a pipeline plan is generated — i.e. when a blueprint is saved or triggered.
  • The monorepo code comment says "Validate eagerly so a bad regex is reported when the blueprint is
    saved"
    , but editing metric settings from Project Settings never goes through the blueprint save
    flow, so this path is never validated.
What do you expect to happen

Invalid metric plugin options should be rejected when the project is saved:

  • Saving with an invalid regex shows an error, and the previous settings remain unchanged.
  • Saving with a valid regex (including Go-only syntax such as (?i)) succeeds.
  • Disabled metrics carrying invalid options do not block saving (they are not used for plan generation
    either).
  • Creating a project (POST /projects) is validated the same way.

Proposed fix: before writing to the database, CreateProject / PatchProject dry-run
MakeMetricPluginPipelinePlanV200(projectName, pluginOption) for every enabled metric, discard the
generated plan, and reject the request with HTTP 400 (BadInput) as invalid options for metric plugin <name>,
wrapping the plugin's own error (e.g. subProjects[0] (serviceA): invalid deployJobPattern caused by
error parsing regexp: missing closing ): `^deploy-(a` ).

  • Every current metric plugin (dora, linker, issue_trace, monorepo) only parses JSON and builds a plan
    in MakeMetricPluginPipelinePlanV200 — no database access or other side effects — so it is safe to
    reuse as a validator.
  • Some plugins return errors.Default (500) on a JSON unmarshal failure; wrapping with BadInput
    makes it a 400 instead of a server error.
  • No Config UI change is needed: the Save button already shows the API error message as a toast.
  • Any metric plugin that validates its options in MakeMetricPluginPipelinePlanV200 automatically
    gets save-time validation, with no further server change.

Out of scope:

  • Client-side regex validation: JavaScript RegExp differs from Go RE2 (e.g. no (?i)) and would
    reject valid patterns.
  • The linker prToIssueRegexp: it is only compiled at task runtime, not in
    MakeMetricPluginPipelinePlanV200, so this fix does not cover it. Could be a follow-up.
  • A dedicated plugin validation interface (e.g. ValidateMetricPluginOption): cleaner semantically,
    but requires a core/plugin interface change.
How to reproduce
  1. Create a project and enable Monorepo Sub-Projects on the Settings tab.
  2. Add a sub-project with Deploy job pattern ^deploy-(a and click Save — it reports success.
  3. Go to the Blueprint tab and click Collect Data — plan generation fails and no pipeline runs, so
    no data is collected at all.
Anything else

Happens every time an enabled metric has invalid options.

Version

main (4ad2f66df042386888cbcd7a0b585c4a2c13f90a)

Are you willing to submit PR?
  • Yes I am willing to submit a PR!
Code of Conduct
Langage dominant
Go
Étoiles
3.2k
Forks
819
Merge moyen
2 j 22 h
PR mergées (30 j)
43

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

  • Aucun Dockerfile ni fichier Docker Compose
  • Propose un modèle de pull request
  • Aucun guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de apache/devlake

Toutes les issues de apache/devlake

Issues similaires

Plus d'issues Go

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.