Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

[quality] /resources/metrics publishes a commit count as "Reference architecture submissions" (28 on the chart, 8 on the card)

Cerrado
#1,977 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Ya se ha fusionado un pull request relacionado.

  • #1985 de @mrbobbytables — fusionado

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
git, github-actions, javascript
Área
backend, data

Línea de trabajo

Read architectureTimelineData() in scripts/collect-metrics.mjs and the fixture in tests/collect-metrics.test.mjs. Update the series to count each architecture directory once when its first file is added, adjust the expected timeline, and point its sourceUrl to the architecture directory page. Done when the test covers later edits or additions within an existing directory without increasing the submission count. A pull request is already open for this issue.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

agent/quality hive/claimed-by-scanner stage/040-covered-by-pr testing

Finding

/resources/metrics publishes a chart titled "Reference architecture submissions" whose values are a count of git commits, not submissions.

architectureTimelineData() in scripts/collect-metrics.mjs builds the series from git log --format=%aI -- content/en/architectures, which emits one line per commit, buckets those lines by month and publishes the running total:

const commits = execFileSync(
  'git',
  ['-C', dir, 'log', '--format=%aI', '--', 'content/en/architectures'],
  { encoding: 'utf8' },
)

So every commit that touches an existing architecture — a typo fix, an image swap, a front-matter edit, a directory rename — adds one to the published "submissions" count.

What a visitor sees

On the same page, in data/metrics.json as committed today (generatedAt 2026-10-25, cncf/architecture revision 3ddf917facd0aea9694cc9c12c52e583fd2f86cb):

Element on /resources/metrics Value
"Reference architectures" stat card 8
"Reference architecture submissions" chart, last point (2026-07) 28

Both are collected in the same run from the same upstream path. A reader cannot reconcile them, and the 28 is not a count of anything a reader would call a submission. /architectures separately reports "10 real-world architecture reports".

Reproduction

The behaviour is pinned by the committed fixture. tests/collect-metrics.test.mjs builds an upstream repo with two architecture directories (acme-platform, globex-edge) and three commit dates, where the third commit only edits an existing page, and asserts:

assert.deepEqual(data.series.referenceArchitectures.values, [
  { date: '2024-01', value: 2 },
  { date: '2024-03', value: 3 },
]);

Two architectures, a published "submissions" total of three.

Recommendation

Count each architecture directory once, at the commit that first added a file under it. Replace architectureTimelineData() in scripts/collect-metrics.mjs with:

// One cumulative point per month, counting each architecture directory once at
// the commit that first added a file under it. `git log --format=%aI` alone
// counts commits, so an edit to an existing architecture used to register as a
// new submission.
function architectureTimelineData(dir) {
  const log = execFileSync(
    'git',
    [
      '-C',
      dir,
      'log',
      '--reverse',
      '--format=%aI',
      '--name-only',
      '--diff-filter=A',
      '--',
      'content/en/architectures',
    ],
    { encoding: 'utf8' },
  );
  // --reverse walks oldest-first, so the first commit a directory appears
  // under is the one that introduced it.
  const added = new Map();
  let month = null;
  for (const line of log.split('\n')) {
    if (!line) continue;
    if (/^\d{4}-\d{2}-\d{2}T/.test(line)) {
      month = line.slice(0, 7);
      continue;
    }
    // content/en/architectures/<id>/<rest>: a path with no <rest> is a loose
    // file in the root, not an architecture, and the stat card does not count
    // it either.
    const parts = line.split('/');
    if (parts.length < 5) continue;
    if (added.has(parts[3])) continue;
    added.set(parts[3], month);
  }
  const months = {};
  for (const value of added.values()) months[value] = (months[value] || 0) + 1;
  let total = 0;
  return Object.entries(months)
    .sort(([a], [b]) => a.localeCompare(b))
    .map(([date, value]) => ({ date, value: (total += value) }));
}

Verified against a local git repository built to match the test fixture exactly (two architecture directories; commits dated 2024-01-10, 2024-01-20 and a 2024-03-05 edit to an existing page):

current : [{"date":"2024-01","value":2},{"date":"2024-03","value":3}]
proposed: [{"date":"2024-01","value":2}]

The same deliverable also needs:

  • tests/collect-metrics.test.mjs — the pinned expectation becomes [{ date: '2024-01', value: 2 }], and the test name should say the series counts architectures added, not commits. Worth adding a case where a directory is added in two commits (page, then images) to show it is counted once.
  • scripts/collect-metrics.mjs — the series sourceUrl currently points at https://github.com/cncf/architecture/commits/main/content/en/architectures, the commit list. Once the series counts directories, point it at https://github.com/cncf/architecture/tree/main/content/en/architectures, the same URL the stat card uses.
  • data/metrics.json is regenerated by the weekly Refresh metrics lane (.github/workflows/refresh-metrics.yml), so no hand edit is needed; the published figure corrects itself on the next run after the script change merges.

Scope

One deliverable, one PR: scripts/collect-metrics.mjs plus its test. No workflow file is involved.

The quality lane is testing-only and does not open PRs that change production scripts, so this needs a maintainer or another lane to land.

Priority

  • Impact: high — a wrong number is published on a page whose stated purpose is "a transparent snapshot", and it contradicts another number on the same page
  • Effort: low

Remit: corrects a figure an end user reads on /resources/metrics.


🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5n31 | SHA: e7ac6e8

— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88

Lenguaje dominante
JavaScript
Estrellas
0
Forks
3
Merge medio
7 h 8 min
PR fusionados (30 d)
565

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de cncf/endusers

Todos los issues de cncf/endusers

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.