Commit cce4b32
authored
feat(selfhost): gate priority label on linked-issue label propagation (#2750)
* feat(selfhost): gate priority label on linked-issue label propagation
gittensor:priority is a maintainer reward/bonus label and must never be
inferred from a PR's title, changed files, AI output, or existing PR
labels. Delete the content-glob-based priority inference in
resolvePrTypeLabel and replace it with a generic, config-driven
linkedIssueLabelPropagation setting: a mapped PR label is only ever
applied when a linked/closing issue already carries the configured
issue label, fetched fail-open (a fetch failure never invents a
priority label). Exclusive mappings replace the bug/feature
classification entirely (the gittensor:priority case); additive
mappings apply alongside it, for a self-hoster's own unrelated
label pair. Also add typeLabels for per-repo label-name overrides.
* fix(selfhost): keep the linked-issue-label-propagation fetch out of the UI typecheck
Splitting the GitHub-fetch orchestrator into its own file
(linked-issue-label-propagation-fetch.ts) keeps
linked-issue-label-propagation.ts limited to pure config types and
the normalizer. focus-manifest.ts imports that pure module, and
focus-manifest.ts is itself pulled into the gittensory-ui workspace's
isolated typecheck via registration-workspace.ts, which has no
visibility into the Worker's ambient Env type -- the fetch
orchestrator's github/app + github/backfill imports broke
ui:typecheck by dragging that whole module graph in. Also regenerate
the stale env-reference file and close two branch-coverage gaps.
* test(selfhost): close the last patch-coverage gap in the type-label block
settings.typeLabels is optional only for RepositorySettings-fixture
backward compat, same as typeLabelsEnabled above it -- getRepositorySettings
always resolves it to a concrete PrTypeLabelSet, so the ?? DEFAULT_TYPE_LABELS
fallback is unreachable on this webhook-integration path.
* fix(selfhost): cap the linked-issue label propagation fetch fan-out
pr.linkedIssues is already hard-capped to MAX_LINKED_ISSUE_NUMBERS (50)
at extraction time, so this Promise.all could never actually exceed
that in production -- but the function itself trusted every caller to
have gone through the capped extractor first. Add a local cap as a
second, self-contained line of defense, and document why the bare
Promise.all needs no per-item catch (fetchLinkedIssueFacts already
fails open internally).
* fix(selfhost): preserve DB values for unnamed typeLabels/propagation keys
A partial .gittensory.yml override naming only one typeLabels or
linkedIssueLabelPropagation field (e.g. typeLabels.priority) previously
reset the other fields to the built-in defaults instead of preserving
the DB-persisted values, violating the documented yml > DB > defaults
precedence. Parse these two settings as sparse partials and merge them
field-by-field in resolveEffectiveSettings.
* test(selfhost): cover the missing linkedIssueLabelPropagation DB-default branch
codecov/patch flagged a partial branch left by the prior commit: the
dbSettings.linkedIssueLabelPropagation ?? DEFAULT fallback in
resolveEffectiveSettings was never exercised with no DB value present,
unlike its already-covered typeLabels counterpart.
* fix(selfhost): validate sparse-override fields before merging them
A present-but-malformed nested field (e.g. typeLabels.priority: 123,
or linkedIssueLabelPropagation.mappings: "oops") was still copied into
the sparse manifest override using the normalizer's built-in-default
fallback, silently overwriting a DB-persisted value on a config typo
instead of being ignored. Gate each field on its own raw shape before
copying it. Also reject a non-boolean removeOtherTypeLabels instead of
silently coercing it to false, which could flip an intended-exclusive
mapping to additive, and validate linkedIssueLabelPropagation.enabled
the same way. Fixes a doc-comment pointing at the wrong file.1 parent 28a6b40 commit cce4b32
19 files changed
Lines changed: 1278 additions & 140 deletions
File tree
- apps/gittensory-ui
- public
- src/lib
- config/examples
- migrations
- src
- db
- openapi
- queue
- review
- settings
- signals
- test/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
305 | 333 | | |
306 | 334 | | |
307 | 335 | | |
| |||
336 | 364 | | |
337 | 365 | | |
338 | 366 | | |
339 | | - | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
340 | 370 | | |
341 | 371 | | |
342 | 372 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8969 | 8969 | | |
8970 | 8970 | | |
8971 | 8971 | | |
| 8972 | + | |
| 8973 | + | |
| 8974 | + | |
| 8975 | + | |
| 8976 | + | |
| 8977 | + | |
| 8978 | + | |
| 8979 | + | |
| 8980 | + | |
| 8981 | + | |
| 8982 | + | |
| 8983 | + | |
| 8984 | + | |
| 8985 | + | |
| 8986 | + | |
| 8987 | + | |
| 8988 | + | |
| 8989 | + | |
| 8990 | + | |
| 8991 | + | |
| 8992 | + | |
| 8993 | + | |
| 8994 | + | |
| 8995 | + | |
| 8996 | + | |
| 8997 | + | |
| 8998 | + | |
| 8999 | + | |
| 9000 | + | |
| 9001 | + | |
| 9002 | + | |
| 9003 | + | |
| 9004 | + | |
| 9005 | + | |
| 9006 | + | |
| 9007 | + | |
| 9008 | + | |
| 9009 | + | |
| 9010 | + | |
| 9011 | + | |
| 9012 | + | |
| 9013 | + | |
| 9014 | + | |
| 9015 | + | |
| 9016 | + | |
| 9017 | + | |
| 9018 | + | |
| 9019 | + | |
| 9020 | + | |
| 9021 | + | |
| 9022 | + | |
| 9023 | + | |
| 9024 | + | |
| 9025 | + | |
| 9026 | + | |
| 9027 | + | |
| 9028 | + | |
| 9029 | + | |
| 9030 | + | |
| 9031 | + | |
8972 | 9032 | | |
8973 | 9033 | | |
8974 | 9034 | | |
| |||
0 commit comments