Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#1,977 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@hivecommons-hive ci sta già lavorando.

Dal 29/10/2026.

  • #1978 di @hivecommons-hive — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
git, github-actions, javascript
Ambito
backend, data

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
JavaScript
Stelle
0
Fork
3
Merge medio
7h 8m
PR unite (30g)
565

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di cncf/endusers

Tutte le issue di cncf/endusers

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.