Commit Graph

20 Commits

Author SHA1 Message Date
Sebastian Poxhofer c32e2391a0 refactor(linters): add prefer-coerce-object rule (#45493)
Refs #45216

The object counterpart to `prefer-coerce-array`: `x ?? {}` becomes
`coerceObject(x)`. The rule flags a `??` whose default is a bare `{}`
literal, so a populated default or an asserted `({} as Foo)` still
passes; a `x ?? y ?? {}` chain maps onto `coerceObject(x, y)`.

Every hit across `lib/` converted cleanly, so no disable comments were
needed.
2026-08-28 09:27:59 +00:00
Sebastian Poxhofer 97327c3d28 refactor(linters): add prefer-coerce-array rule (#45492)
* refactor(linters): add prefer-coerce-array rule

Refs #45217

`x ?? []` and `coerceArray(x)` say the same thing, but only the second
one is searchable and consistent. The rule flags a `??` whose default is
a bare `[]` literal; a non-empty default or an asserted `([] as Foo[])`
still passes.

Applying it across `lib/` surfaced three spots the helper cannot cover,
which keep `?? []` with a disable comment or a narrower fix:

- `package-files.ts` destructures a tuple, which `coerceArray()` widens
- `generate.spec.ts` defaults `matchAll()`, an iterator rather than an array
- `mise/upgradeable-tooling.ts` declares a `Record` return, so its
  `?? []` fallback was wrong to begin with and becomes `coerceObject()`

* refactor(platform/github): hoist the GHE version header lookup

`Object.entries(...).find()` returns a tuple, and defaulting it with
`?? []` only to destructure the second element reads as an array
default when it is not one. Name the found entry instead, which drops
the `?? []` rather than routing a tuple through `coerceArray()`.
2026-08-28 09:27:58 +00:00
Sergei Zharinov e77f3d1fbb fix(stats): avoid max argument overflow (#44494) 2026-07-11 15:08:11 +00:00
Mike Ryan f635ae29c4 chore(instrumentation): add timing statistics for getReleases (#42523)
* feat: timing statistics for getReleases

Adds collection and reporting of timing statistics for
`datasource.getReleases()` calls. Each call records the datasource, registryUrl,
packageName, and duration. The intent is to visibility into where
renovate is retrieving release information and how long that might take.

The report consists of a nested data-structure that provides increasing
detail as we descend datasource, registryUrl, and packageName.

The full report  is logged at trace level
`getReleases statistics with packages`.

A summary report including only datasources and registryUrls is logged
at debug level `getReleases statistics summary`.

* add GetReleasesSpanProcessor

- Re-instrument getReleases calls using open telemetry.
- Adds GetReleasesSpanProcessor, which can adapt
  `getReleases` spans to GetReleasesStats.

* fixup instrumentation tests

* pr feedback

* pr feedback: naming

* pr feedback: comments
2026-04-14 17:36:37 +00:00
Sergei Zharinov b02897fab1 refactor(lint): Fix lint violations (#40965)
* refactor(lint): Fix lint violations

* Update lib/modules/versioning/versioning-metadata.spec.ts

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>

---------

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2026-02-06 15:34:33 +00:00
Sergei Zharinov 930cf6633c refactor: Rewrite imports with .ts extensions (#40700)
fix: Additional vi.mock path corrections and prettier formatting
2026-01-26 22:48:17 +00:00
Michael Kriese 9fe353adb4 test: add coverage (part1) (#40636) 2026-01-23 15:09:01 +00:00
Jamie Tanna b5cd0317cf fix(git): report Git operation statistics at end of run (#39596)
Now we have instrumented our Git operations with tracing, we can make
sure that users who are not using OpenTelemetry still get insights into
their Git operation usage using a debug log output.

Following how other insights are produced, we can introduce a new type
in `lib/util/stats` for `GitOperationStats`, which will track the
overall execution for each operation type, and output them in the same
style as we use for other timing reports.

At the end of a Renovate run, we'll then make sure that this is logged
into a debug log for further investigation.

To create the report, we can make sure that we introduce a new
OpenTelemetry `SpanProcessor`, which will run when we end our Run, and
store any Git operations in `GitOperationStats`.

This adapts code from GPT-4.1 and code from [0].

Co-authored-by: gpt-4.1 <jamie.tanna+github-copilot@mend.io>

[0]: https://github.com/yurisouza/monitoria-sdk/blob/ca9d751fa7c3a785a04f87b8966bb782b4617021/src/adapters/nestjs/span-duration-tracker.ts#L18-L27
2025-12-01 15:53:26 +00:00
Michael Kriese 050ac8d23b chore: better code coverage (#39518) 2025-11-25 15:01:54 +00:00
Sergei Zharinov a02dd076df feat: Abandoned packages logging (#36090)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
2025-05-23 05:31:04 +00:00
Sergei Zharinov 78b0478140 fix: Remove callsite tracking from ObsoleteCacheHitLogger (#36008) 2025-05-18 18:27:52 +00:00
Sergei Zharinov f977700649 feat(http): Switch to memory cache provider (#33901)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2025-03-24 08:02:47 +00:00
renovate[bot] 55845508b6 chore(deps): update eslint monorepo to v9 (major) (#33573)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-02-20 11:31:13 +00:00
Sergei Zharinov 7229d962f7 feat: Stats for datasource cache (#30623) 2024-08-11 08:07:16 +00:00
Rhys Arkins 73ed5a17b9 chore(logs): log url stats as trace (#30421) 2024-07-27 08:49:01 +00:00
Sergei Zharinov 5e02f6eb81 refactor: Compact HTTP cache stats (#28011) 2024-03-19 15:07:15 +00:00
Sergei Zharinov 5d7372f917 feat: Http cache stats (#27956) 2024-03-16 13:17:10 +00:00
Sergei Zharinov fd8684ba6e refactor: Extract "HttpStats" utility class (#27944) 2024-03-15 12:39:31 +00:00
Sergei Zharinov 998705d5b0 refactor: Package cache stats utility (#27936) 2024-03-14 15:06:53 +00:00
Sergei Zharinov 9c06813697 refactor: Create utility for stats collection and reporting (#27919) 2024-03-14 09:46:56 +00:00