Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address local review: keep the keycap constant out of the JSDoc, and make the gate's base resolution injectable so its fail-closed tests do not depend on the checkout

[._.]/ Adam Eivy951bc90ee429
diff --git a/scripts/scan-diff-hidden-content.js b/scripts/scan-diff-hidden-content.js
index 3f56bcaad8..3c8791a224 100644
--- a/scripts/scan-diff-hidden-content.js
+++ b/scripts/scan-diff-hidden-content.js
@@ -62,7 +62,12 @@ export function resolveBase(explicit) {
* Run the gate. Returns the process exit code and the lines to print, so the
* suite can exercise the real verdict in-process rather than through a spawn.
*/
-export async function runHiddenContentScan({ argv = [], stdin = null, env = process.env } = {}) {
+export async function runHiddenContentScan({
+ argv = [],
+ stdin = null,
+ env = process.env,
+ resolveDiffBase = resolveBase,
+} = {}) {
const baseFlag = argv.indexOf('--base');
const explicit = baseFlag === -1 ? null : argv[baseFlag + 1];
let diff;
@@ -70,7 +75,7 @@ export async function runHiddenContentScan({ argv = [], stdin = null, env = proc
if (argv.includes('--stdin')) {
diff = typeof stdin === 'string' ? stdin : await readStdin(stdin || process.stdin);
} else {
- const base = resolveBase(explicit);
+ const base = resolveDiffBase(explicit);
if (!base) {
// A pull request always has a base, so failing to find one there means
// the gate would scan nothing — the one outcome a gate must not report
diff --git a/scripts/scan-diff-hidden-content.test.js b/scripts/scan-diff-hidden-content.test.js
index 9487442d5c..c9ab886c22 100644
--- a/scripts/scan-diff-hidden-content.test.js
+++ b/scripts/scan-diff-hidden-content.test.js
@@ -40,12 +40,16 @@ describe('scan-diff-hidden-content', () => {
// A gate that cannot find the diff must not report success on the one event
// that always has one.
it('fails closed when a pull-request run cannot resolve its base', async () => {
- const result = await runHiddenContentScan({ argv: ['--base', 'no-such-ref'], env: { GITHUB_EVENT_NAME: 'pull_request' } });
- expect(result.code).toBe(2);
+ const unresolvable = { resolveDiffBase: () => null };
+ expect((await runHiddenContentScan({ argv: [], env: { GITHUB_EVENT_NAME: 'pull_request' }, ...unresolvable })).code).toBe(2);
+ // An explicitly named base that does not resolve is an error on any event:
+ // the run asked for a specific comparison and did not get it.
+ expect((await runHiddenContentScan({ argv: ['--base', 'no-such-ref'], env: {}, ...unresolvable })).code).toBe(2);
});
it('skips a run that genuinely has no pull-request base', async () => {
- const result = await runHiddenContentScan({ argv: ['--base', ''], env: { GITHUB_EVENT_NAME: 'schedule' } });
+ const result = await runHiddenContentScan({ argv: [], env: { GITHUB_EVENT_NAME: 'schedule' }, resolveDiffBase: () => null });
expect(result.code).toBe(0);
+ expect(result.lines.join(' ')).toContain('skipped');
});
});
diff --git a/server/lib/modelAbuseGuard.js b/server/lib/modelAbuseGuard.js
index 81f4810c72..f2f8d9b32d 100644
--- a/server/lib/modelAbuseGuard.js
+++ b/server/lib/modelAbuseGuard.js
@@ -354,6 +354,10 @@ const VARIATION_SELECTOR_RE = /[\uFE00-\uFE0F\u{E0100}-\u{E01EF}]/u;
const EMOJI_PRESENTATION_SELECTORS = new Set(['\uFE0E', '\uFE0F']);
const PICTOGRAPHIC_RE = /\p{Extended_Pictographic}/u;
+// A keycap ("1" + U+FE0F + U+20E3) is the one sequence where the selector
+// follows an ordinary digit or symbol rather than a pictograph.
+const KEYCAP = '\u20E3';
+
/**
* Whether the variation selector at `index` is the ordinary emoji-presentation
* one: U+FE0E/U+FE0F directly after a pictographic character, and not itself
@@ -366,9 +370,6 @@ const PICTOGRAPHIC_RE = /\p{Extended_Pictographic}/u;
* The 240 selectors of the supplement (U+E0100+) carry no emoji meaning at all
* and are never exempt.
*/
-// A keycap ("1" + U+FE0F + U+20E3) is the one sequence where the selector
-// follows an ordinary digit or symbol rather than a pictograph.
-const KEYCAP = '\u20E3';
const isEmojiPresentationSelector = (value, index) => {
if (!EMOJI_PRESENTATION_SELECTORS.has(value[index])) return false;
if (VARIATION_SELECTOR_RE.test(value.slice(index + 1, index + 3))) return false;
@@ -393,7 +394,7 @@ const INVISIBLE_CLUSTER_WINDOW = 200;
* not, and only positions are held — never a copy of the input.
*/
export function invisibleClusterSummary(value) {
- if (typeof value !== "string" || !value) return null;
+ if (typeof value !== 'string' || !value) return null;
const positions = [];
for (const match of value.matchAll(HIDDEN_CODEPOINT_RE)) positions.push(match.index);
for (let i = 0; i + INVISIBLE_CLUSTER_COUNT - 1 < positions.length; i += 1) {