@weareikko/code-review 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -560,7 +560,7 @@ function buildSummaryBody(summary, costFooter, options = {}) {
560
560
  return `${withFooter}\n\n${buildSummaryHistoryBlock(historyEntries)}`;
561
561
  }
562
562
  function buildReviewedCommitFooter(commitSha) {
563
- return `Reviewed by ${PRODUCT_LINK} v0.9.0 for commit ${commitSha}.`;
563
+ return `Reviewed by ${PRODUCT_LINK} v0.9.1 for commit ${commitSha}.`;
564
564
  }
565
565
  function extractReviewedCommitSha(body) {
566
566
  return REVIEWED_COMMIT_FOOTER_PATTERN.exec(body)?.[1] ?? null;
@@ -5236,6 +5236,26 @@ function buildAgentSubscriber(tracer, tokenUsage, operationCost, timeToFirstToke
5236
5236
  });
5237
5237
  };
5238
5238
  }
5239
+ /**
5240
+ * Applies our OTLP exporter env defaults, only when the caller hasn't set them
5241
+ * (explicit choices, including `none`, always win).
5242
+ *
5243
+ * Metrics temporality defaults to **delta** because code-review runs as a
5244
+ * short-lived CI job. With the OTel SDK's default cumulative temporality, each
5245
+ * ephemeral job's metric series starts mid-flight in the backend (its first
5246
+ * export already carries accumulated counts, and per-run histograms are a single
5247
+ * observation), so range aggregation of cost/token totals is unreliable —
5248
+ * `sum_over_time` over-counts and `increase` under-counts or returns nothing.
5249
+ * Delta makes each job's metrics self-contained deltas that sum correctly across
5250
+ * runs. Override with `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=cumulative`
5251
+ * for long-running hosts, and confirm your backend ingests delta (Grafana
5252
+ * Cloud/Mimir converts to cumulative or stores it natively) before relying on it.
5253
+ */
5254
+ function applyOtelExporterDefaults(env = process.env) {
5255
+ env.OTEL_METRICS_EXPORTER = env.OTEL_METRICS_EXPORTER ?? "otlp";
5256
+ env.OTEL_LOGS_EXPORTER = env.OTEL_LOGS_EXPORTER ?? "otlp";
5257
+ env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE = env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE ?? "delta";
5258
+ }
5239
5259
  async function loadDefaultRuntime() {
5240
5260
  let modules;
5241
5261
  try {
@@ -5246,10 +5266,9 @@ async function loadDefaultRuntime() {
5246
5266
  const [sdkNode, resources, semconv] = modules;
5247
5267
  const serviceResource = resources.resourceFromAttributes({
5248
5268
  [semconv.ATTR_SERVICE_NAME ?? "service.name"]: SERVICE_NAME,
5249
- [semconv.ATTR_SERVICE_VERSION ?? "service.version"]: "0.9.0"
5269
+ [semconv.ATTR_SERVICE_VERSION ?? "service.version"]: "0.9.1"
5250
5270
  });
5251
- process.env.OTEL_METRICS_EXPORTER = process.env.OTEL_METRICS_EXPORTER ?? "otlp";
5252
- process.env.OTEL_LOGS_EXPORTER = process.env.OTEL_LOGS_EXPORTER ?? "otlp";
5271
+ applyOtelExporterDefaults(process.env);
5253
5272
  const sdk = new sdkNode.NodeSDK({ resource: resources.defaultResource().merge(serviceResource) });
5254
5273
  sdk.start();
5255
5274
  return {
@@ -5719,7 +5738,7 @@ function boldCommentTitle(body) {
5719
5738
  */
5720
5739
  function buildCommentBody(body, commitSha, confidence) {
5721
5740
  const confidenceLine = `_Confidence: ${confidence}._`;
5722
- const footer = `<sub>Reviewed by ${PRODUCT_LINK} v0.9.0 for commit ${commitSha}.</sub>`;
5741
+ const footer = `<sub>Reviewed by ${PRODUCT_LINK} v0.9.1 for commit ${commitSha}.</sub>`;
5723
5742
  return `${boldCommentTitle(body.trim())}\n\n${confidenceLine}\n\n---\n\n${footer}`;
5724
5743
  }
5725
5744
  function buildPayload(comment, body, refs, resolved) {
@@ -6826,10 +6845,10 @@ async function main(argv = process.argv.slice(2)) {
6826
6845
  return;
6827
6846
  }
6828
6847
  if (argv.includes("--version") || argv.includes("-v")) {
6829
- console.log("0.9.0");
6848
+ console.log("0.9.1");
6830
6849
  return;
6831
6850
  }
6832
- process.stderr.write(`[code-review] @weareikko/code-review v0.9.0\n`);
6851
+ process.stderr.write(`[code-review] @weareikko/code-review v0.9.1\n`);
6833
6852
  assertNodeVersion();
6834
6853
  applyCodeReviewEnvPrefix();
6835
6854
  applyDefaultCacheRetention();
@@ -6852,4 +6871,4 @@ if (isDirectRun()) main().catch((error) => {
6852
6871
  //#endregion
6853
6872
  export { normalizeBody as $, SUMMARY_HISTORY_END as A, buildSummaryHistoryEntries as B, createDiagnosticContext as C, traceDiagnosticPhase as D, traceDiagnostic as E, SUMMARY_MARKER as F, findExistingSummaryNoteId as G, extractSummaryHistoryEntries as H, buildArchivedSummaryEntry as I, upsertSummaryNote as J, stripSummaryHistory as K, buildReviewedCommitFooter as L, SUMMARY_HISTORY_ENTRY_START as M, SUMMARY_HISTORY_LIMIT as N, normalizeSeverity as O, SUMMARY_HISTORY_START as P, fingerprints as Q, buildSizeNoticeBlock as R, DIAGNOSTIC_CHANNEL_PREFIX as S, diagnosticChannels as T, findExistingReviewedCommitSha as U, extractReviewedCommitSha as V, findExistingSummaryNote as W, extractDiffHunkContext as X, appendFingerprintMarkers as Y, extractExistingFingerprints as Z, resolveNpmSkillDir as _, main as a, parseReviewMarkdownWithWarnings as b, buildGeneratedComments as c, startOtelBridge as d, sha256 as et, filterDiff as f, parseSkillSpec as g, loadNamedSkill as h, formatUsageLine as i, SUMMARY_HISTORY_ENTRY_END as j, toGitLabReviewSeverity as k, buildPayload as l, gitSkillCacheKey as m, formatPerModelUsage as n, run as o, runReview as p, stripSummaryMarker as q, formatSkillsFooter as r, withHttpStamping as s, countPostedBySeverity as t, isOtelEnabled as u, resolveSkillCacheDir as v, createDiagnosticRunId as w, DIAGNOSTIC_CHANNEL_NAMES as x, parseReviewMarkdown as y, buildSummaryBody as z };
6854
6873
 
6855
- //# sourceMappingURL=cli-DK0kteLL.js.map
6874
+ //# sourceMappingURL=cli-BGn8g23f.js.map