@bongos/core 1.19.360 → 1.19.362

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.
package/src/module-api.js CHANGED
@@ -1150,8 +1150,12 @@ const { validateOrRespond, LIMITS, parseId, asyncHandler, corsPublicGet, parsePa
1150
1150
  // landed since 1.19.358 with no explicit bump. run 32877754251. (task 1002620)
1151
1151
  // 1.19.360 — CI auto-patch (publish-on-merge, ADR 0161): carrier for merges
1152
1152
  // landed since 1.19.359 with no explicit bump. run 32881040669. (task 1002620)
1153
+ // 1.19.361 — CI auto-patch (publish-on-merge, ADR 0161): carrier for merges
1154
+ // landed since 1.19.360 with no explicit bump. run 32883230235. (task 1002620)
1155
+ // 1.19.362 — CI auto-patch (publish-on-merge, ADR 0161): carrier for merges
1156
+ // landed since 1.19.361 with no explicit bump. run 32886106098. (task 1002620)
1153
1157
  // ---------------------------------------------------------------------------
1154
- const CORE_VERSION = '1.19.360'; // CI auto-patch carrier (ADR 0161); see changelog above
1158
+ const CORE_VERSION = '1.19.362'; // CI auto-patch carrier (ADR 0161); see changelog above
1155
1159
 
1156
1160
  // A namespaced logger so a module's log lines are attributable + consistent.
1157
1161
  // Usage: const log = api.logger('dev-box'); log.info('mounted');
@@ -0,0 +1,87 @@
1
+ // tests/doc_comment_coverage.mjs — the ADR 0095 doc-comment nudge detects real
2
+ // gaps, stays advisory, and survives CRLF (task 1001654).
3
+ //
4
+ // Three things are pinned here, each a way this check could quietly become useless:
5
+ // 1. It must stay ADVISORY. The ADR says a doc-comment gate must not block a ship
6
+ // without owner sign-off, because a blocking gate buys filler prose. A future
7
+ // edit that flips hardFail should fail this test and force that decision.
8
+ // 2. It must be CRLF-safe. The sibling scanner docs-entropy.js finds ZERO
9
+ // markdown headings on a Windows checkout because its regex breaks on a
10
+ // trailing \r; this check reads source files the same way and must not
11
+ // repeat it.
12
+ // 3. An empty enumeration is a scan defect, not a clean pass (the task 1002526
13
+ // lesson: a lint that scans nothing reports success forever).
14
+ import assert from 'node:assert/strict';
15
+ import { test } from 'node:test';
16
+ import { createRequire } from 'node:module';
17
+ import { fileURLToPath } from 'node:url';
18
+ import path from 'node:path';
19
+
20
+ const require = createRequire(import.meta.url);
21
+ const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
22
+ const { checkDocCommentCoverage, scanHeaders, leadingComment, wordCount, MIN_WORDS } =
23
+ require(path.join(ROOT, 'scripts', 'gds', 'doc-comment-coverage.js'));
24
+
25
+ const FILES = {
26
+ 'src/no-header.js': "const x = require('y');\nmodule.exports = x;\n",
27
+ 'src/code-first.js': 'const a = 1;\n// a comment AFTER code is not a header\n',
28
+ 'src/thin.js': '// config.js — config.\nconst a = 1;\n',
29
+ 'src/good.js': '// src/good.js — does the thing.\n//\n// WHY. It exists because the other thing could not do it safely.\nconst a = 1;\n',
30
+ 'src/prologue.js': "#!/usr/bin/env node\n'use strict';\n// src/prologue.js — a real header stating what this does and why it exists.\nconst a = 1;\n",
31
+ 'src/block.js': '/*\n * src/block.js — a block-comment header that explains what this file does\n * and the reason it exists at all.\n */\nconst a = 1;\n',
32
+ };
33
+ const read = (rel) => FILES[rel];
34
+
35
+ test('a file with no leading comment is reported missing', () => {
36
+ const { missing } = scanHeaders(Object.keys(FILES), read);
37
+ assert.ok(missing.includes('src/no-header.js'));
38
+ });
39
+
40
+ test('a comment that follows code is NOT a header', () => {
41
+ // Otherwise any stray inline note anywhere in the file would count as coverage.
42
+ assert.equal(leadingComment(FILES['src/code-first.js']), '');
43
+ const { missing } = scanHeaders(Object.keys(FILES), read);
44
+ assert.ok(missing.includes('src/code-first.js'));
45
+ });
46
+
47
+ test('a header that only restates the filename is flagged thin, not missing', () => {
48
+ const { thin, missing } = scanHeaders(Object.keys(FILES), read);
49
+ assert.ok(!missing.includes('src/thin.js'));
50
+ assert.ok(thin.some((t) => t.file === 'src/thin.js' && t.words < MIN_WORDS));
51
+ });
52
+
53
+ test('a shebang + use-strict prologue may precede the header', () => {
54
+ const { missing, thin } = scanHeaders(['src/prologue.js'], read);
55
+ assert.deepEqual(missing, [], 'a CLI opening with #! still has a header');
56
+ assert.deepEqual(thin, []);
57
+ });
58
+
59
+ test('block-comment headers count too', () => {
60
+ const { missing, thin } = scanHeaders(['src/block.js'], read);
61
+ assert.deepEqual(missing, []);
62
+ assert.deepEqual(thin, []);
63
+ });
64
+
65
+ test('CRLF files are parsed identically to LF — the docs-entropy trap', () => {
66
+ // docs-entropy.js finds zero headings on a CRLF checkout because `.` does not
67
+ // match \r and `$` (no /m) only matches end-of-input. Reading source the same
68
+ // naive way would make this check report full coverage on Windows regardless of
69
+ // the truth, so LF and CRLF must agree exactly.
70
+ const lf = '// src/x.js — states what this file does and the reason it exists.\nconst a = 1;\n';
71
+ const crlf = lf.replace(/\n/g, '\r\n');
72
+ assert.equal(wordCount(leadingComment(crlf)), wordCount(leadingComment(lf)));
73
+ assert.ok(wordCount(leadingComment(crlf)) >= MIN_WORDS, 'a real CRLF header must not read as thin');
74
+ });
75
+
76
+ test('the check is ADVISORY — it never fails the build (ADR 0095)', () => {
77
+ const r = checkDocCommentCoverage();
78
+ assert.equal(r.hardFail, false, 'promoting this to blocking needs owner sign-off + its own ADR');
79
+ assert.equal(r.ok, true);
80
+ assert.deepEqual(r.violations, [], 'findings surface as warnings, never violations');
81
+ });
82
+
83
+ test('the live repo scan actually reads files (never a silent empty scan)', () => {
84
+ const r = checkDocCommentCoverage();
85
+ const scanned = Number(/^(\d+)\/(\d+)/.exec(r.note)?.[2] ?? 0);
86
+ assert.ok(scanned > 100, `expected hundreds of scanned files, got ${scanned} — an empty scan proves nothing`);
87
+ });
@@ -68,10 +68,11 @@ const ORACLE = {
68
68
  '/builders/scouting': 'requireProjectCuratePage',
69
69
 
70
70
  // Metic+ since R16 (goal 1000069): the Government page is three rooms —
71
- // Constitution · Board Room · Ranks & Permissions — and only the third is the
72
- // archon admin surface, whose DATA routes all still gate on government.manage
73
- // individually. The shell follows the widest legitimate audience; the board
74
- // reads carry the vote atom, the manage tab seals itself for non-archons.
71
+ // Permissions · Board Room · Constitution (reordered, task 1003269) — and only
72
+ // the Permissions room is the archon admin surface, whose DATA routes all still
73
+ // gate on government.manage individually. The shell follows the widest
74
+ // legitimate audience; the board reads carry the vote atom, and the manage
75
+ // tab seals itself for non-archons.
75
76
  '/builders/government': 'requireGovernmentPage',
76
77
 
77
78
  // Deliberately UNGATED — the landing card, the rank ladder, the reward