From 790c8cc0d3ff0eda7358c0c6f4b09bc55011b2ba Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 00:23:22 +0900 Subject: [PATCH 01/96] fix(postmerge): carry verified embed safety changes site/src/components/tools/ShareBar.tsx --- site/src/components/tools/ShareBar.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/site/src/components/tools/ShareBar.tsx b/site/src/components/tools/ShareBar.tsx index ef26e10f..84ba20a5 100644 --- a/site/src/components/tools/ShareBar.tsx +++ b/site/src/components/tools/ShareBar.tsx @@ -3,6 +3,7 @@ import { useEffect, useState } from "react"; import { useTranslations } from "next-intl"; import { useToolEvents } from "@/lib/analytics/useToolEvents"; +import { buildToolEmbedSnippet } from "@/lib/tools/embed-html"; interface Props { /** Canonical, absolute URL of the tool page (built server-side from siteConfig). */ @@ -121,9 +122,7 @@ export function ShareBar({ url, embedUrl, title, slug }: Props) { // iframe 内の "Powered by" は toolify 自身のドキュメント内に閉じており被リンク価値が渡らないため、 // 埋め込んだ他サイトの HTML に、ツール名をアンカーテキストにした当該ツールページへの直リンクを置く。 // これが量産ツール(222本)を被リンク資産に変える肝(toolify は権威性不足で平均48位=page5のため)。 - const safeTitle = title.replace(/"/g, """); - const anchorTitle = title.replace(//g, ">"); - const snippet = `\n

Free ${anchorTitle} by toolify365

`; + const snippet = buildToolEmbedSnippet(title, embedUrl, url); const socials = [ { name: "X", href: `https://twitter.com/intent/tweet?text=${enc(title)}&url=${enc(url)}`, Icon: XIcon }, From 4ee8db3bbe0bb8888b37bcf51c9c11fe701da9b9 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 00:23:27 +0900 Subject: [PATCH 02/96] fix(postmerge): carry verified embed safety changes site/src/lib/tools/embed-html.ts --- site/src/lib/tools/embed-html.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 site/src/lib/tools/embed-html.ts diff --git a/site/src/lib/tools/embed-html.ts b/site/src/lib/tools/embed-html.ts new file mode 100644 index 00000000..be0b62a3 --- /dev/null +++ b/site/src/lib/tools/embed-html.ts @@ -0,0 +1,20 @@ +/** Escape text embedded into HTML markup, including quoted attributes. */ +export function escapeHtml(value: string): string { + return value.replace(/[&<>"']/g, (char) => { + switch (char) { + case "&": return "&"; + case "<": return "<"; + case ">": return ">"; + case '"': return """; + default: return "'"; + } + }); +} + +/** Keep snippet assembly isolated and testable outside React. */ +export function buildToolEmbedSnippet(title: string, embedUrl: string, toolUrl: string): string { + const safeTitle = escapeHtml(title); + const safeEmbedUrl = escapeHtml(embedUrl); + const safeToolUrl = escapeHtml(toolUrl); + return `\n

Free ${safeTitle} by toolify365

`; +} From b78cecc5e4c976fa4666e901dc26800176a0af3a Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 00:23:33 +0900 Subject: [PATCH 03/96] fix(postmerge): carry verified embed safety changes site/src/lib/tools/embed-html.test.ts --- site/src/lib/tools/embed-html.test.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 site/src/lib/tools/embed-html.test.ts diff --git a/site/src/lib/tools/embed-html.test.ts b/site/src/lib/tools/embed-html.test.ts new file mode 100644 index 00000000..cdc5099a --- /dev/null +++ b/site/src/lib/tools/embed-html.test.ts @@ -0,0 +1,23 @@ +import { describe, expect, it } from "vitest"; +import { buildToolEmbedSnippet, escapeHtml } from "./embed-html"; + +describe("safe tool embed HTML", () => { + it("escapes all HTML-special characters in localized titles", () => { + expect(escapeHtml(`A&B <"C"> 'D'`)) + .toBe("A&B <"C"> 'D'"); + }); + it("escapes attribute values without double-escaping titles", () => { + const snippet = buildToolEmbedSnippet('A&B "Calculator"', 'https://toolify365.com/en/embed?a=1&b=2', 'https://toolify365.com/en/tools?a=1&b=2'); + expect(snippet).toContain('title="A&B "Calculator""'); + expect(snippet).toContain('src="https://toolify365.com/en/embed?a=1&b=2"'); + expect(snippet).toContain('href="https://toolify365.com/en/tools?a=1&b=2"'); + expect(snippet).toContain('>A&B "Calculator"'); + }); + it("cannot inject markup through title or a quoted attribute", () => { + const snippet = buildToolEmbedSnippet('">', 'https://toolify365.com/embed" onload="alert(1)', "https://toolify365.com/tool' onclick='evil()"); + expect(snippet).not.toContain('", "/relative/embed", "http://evil.example/iframe"]) { + const snippet = buildToolEmbedSnippet("Safe", source, source); + expect(snippet).toContain('src="about:blank"'); + expect(snippet).toContain('href="https://toolify365.com"'); + expect(snippet).not.toContain('src="javascript:'); + expect(snippet).not.toContain('href="javascript:'); + } + expect(buildToolEmbedSnippet("Safe", "https://toolify365.com/en/embed", "https://toolify365.com/en/tools")) + .toContain('src="https://toolify365.com/en/embed"'); + expect(buildToolEmbedSnippet("Safe", "http://localhost:3000/en/embed", "http://127.0.0.1:3000/en/tools")) + .toContain('src="http://localhost:3000/en/embed"'); + }); + }); From 81670900466d5df8b9480424b639fb65d02d5b1d Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 00:53:09 +0900 Subject: [PATCH 11/96] docs(postmerge): record scheme-safe embed URLs and 4 passing standalone Node checks --- docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md index d572ae85..8c364289 100644 --- a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md +++ b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md @@ -21,3 +21,8 @@ - Execute from repository root: `bash scripts/check-postmerge-embed-release.sh`. - Local standalone embed helper tests re-run with Node v22.16.0: **3 passed, 0 failed**, but the full release gate remains **unrun** until checkout, npm dependencies and browser/device QA can be performed. - Do not merge PR #41 solely on source inspections or isolated tests. + +## Further URL scheme hardening — 2026-11-07 +- The first PR41 embed helper escaped HTML attributes but accepted `javascript:`, `data:`, and relative iframe/link URLs. Added `safeEmbedUrl` that requires HTTPS (or HTTP only on localhost/127.0.0.1 for local development); invalid iframe URLs fall back to `about:blank`, invalid tool links to the Toolify365 homepage. +- Updated the cross-PR integration source assertions and `embed-html.test.ts` with scheme rejection and legitimate HTTPS/local-development cases. +- Reconstructed the final helper as a small standalone Node ES module matching the GitHub logic: `node --test` **4 passed, 0 failed** (HTML escaping, query attribute escaping, unsafe URL schemes, valid HTTPS/local URLs). The full PR41 Vitest, TypeScript and Next.js build are **not verified**. No GitHub Actions, merge or deployment initiated. From d821db57e1db3408bc45dc86aa768aec6813a4b9 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 08:43:55 +0900 Subject: [PATCH 12/96] docs(postmerge): record actually executed 5/5 isolated Node embed tests --- docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md index 8c364289..f1a03064 100644 --- a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md +++ b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md @@ -26,3 +26,9 @@ - The first PR41 embed helper escaped HTML attributes but accepted `javascript:`, `data:`, and relative iframe/link URLs. Added `safeEmbedUrl` that requires HTTPS (or HTTP only on localhost/127.0.0.1 for local development); invalid iframe URLs fall back to `about:blank`, invalid tool links to the Toolify365 homepage. - Updated the cross-PR integration source assertions and `embed-html.test.ts` with scheme rejection and legitimate HTTPS/local-development cases. - Reconstructed the final helper as a small standalone Node ES module matching the GitHub logic: `node --test` **4 passed, 0 failed** (HTML escaping, query attribute escaping, unsafe URL schemes, valid HTTPS/local URLs). The full PR41 Vitest, TypeScript and Next.js build are **not verified**. No GitHub Actions, merge or deployment initiated. + +## 2026-11-07 verified standalone Node check +- Retrieved current `site/src/lib/tools/embed-html.ts` from the PR41 branch, copied its exact implementation into an isolated local workspace, and ran `node --experimental-strip-types --test test.mjs` on Node v22.16.0. +- **Five independent Node subtests passed (5/5, exit 0):** markup entities, src/href attribute escaping, injected markup/handler protection, disallowed javascript/data/relative/http remote schemes, HTTPS and local development. +- This tests the actual helper implementation in isolation with a separate Node test harness, **not** the repository's Vitest suite or whole Next.js application. The four in-repo Vitest test cases are authored but remain unrun with `npm ci` on a full checkout. +- At check time PR41 remained open, draft, 11 commits ahead of main and 0 behind; no deploy/merge performed in this work. From ae03113e89284f761c1b8ab5904cf94a99edded6 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 09:04:13 +0900 Subject: [PATCH 13/96] fix(embed): reject embedded URL credentials and control characters --- site/src/lib/tools/embed-html.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/site/src/lib/tools/embed-html.ts b/site/src/lib/tools/embed-html.ts index 569fd3d8..f342cf56 100644 --- a/site/src/lib/tools/embed-html.ts +++ b/site/src/lib/tools/embed-html.ts @@ -13,8 +13,12 @@ export function escapeHtml(value: string): string { /** Reject active or opaque URL schemes even after HTML attribute escaping. */ function safeEmbedUrl(value: string, fallback: string): string { + // WHATWG URL parsing trims some controls; reject them before parsing. + if (/[\\u0000-\\u001f\\u007f]/.test(value) || value.trim() !== value) return fallback; try { const parsed = new URL(value); + // Userinfo in copied embed snippets risks leaking credentials. + if (parsed.username || parsed.password) return fallback; const localDev = parsed.protocol === "http:" && (parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1"); if (parsed.protocol === "https:" || localDev) return value; From 381095e581353d46c1e6443760e1f0f4317c75b8 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 09:04:26 +0900 Subject: [PATCH 14/96] fix(embed): correct control-character regex escaping --- site/src/lib/tools/embed-html.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/src/lib/tools/embed-html.ts b/site/src/lib/tools/embed-html.ts index f342cf56..fc7733a8 100644 --- a/site/src/lib/tools/embed-html.ts +++ b/site/src/lib/tools/embed-html.ts @@ -14,7 +14,7 @@ export function escapeHtml(value: string): string { /** Reject active or opaque URL schemes even after HTML attribute escaping. */ function safeEmbedUrl(value: string, fallback: string): string { // WHATWG URL parsing trims some controls; reject them before parsing. - if (/[\\u0000-\\u001f\\u007f]/.test(value) || value.trim() !== value) return fallback; + if (/[\u0000-\u001f\u007f]/.test(value) || value.trim() !== value) return fallback; try { const parsed = new URL(value); // Userinfo in copied embed snippets risks leaking credentials. From aa7c5e39759b318517b12f23d7c875430b1604c7 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 09:04:36 +0900 Subject: [PATCH 15/96] test(embed): reject credential-bearing and control-character URLs --- site/src/lib/tools/embed-html.test.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/site/src/lib/tools/embed-html.test.ts b/site/src/lib/tools/embed-html.test.ts index 73c9a1e0..24740d07 100644 --- a/site/src/lib/tools/embed-html.test.ts +++ b/site/src/lib/tools/embed-html.test.ts @@ -32,6 +32,17 @@ describe("safe tool embed HTML", () => { .toContain('src="https://toolify365.com/en/embed"'); expect(buildToolEmbedSnippet("Safe", "http://localhost:3000/en/embed", "http://127.0.0.1:3000/en/tools")) .toContain('src="http://localhost:3000/en/embed"'); + for (const source of [ + "https://username:password@toolify365.com/en/embed", + "https://username@toolify365.com/en/embed", + "\\nhttps://toolify365.com/en/embed", + "https://toolify365.com/en/embed\\t", + " https://toolify365.com/en/embed", + ]) { + const snippet = buildToolEmbedSnippet("Safe", source, source); + expect(snippet).toContain('src="about:blank"'); + expect(snippet).toContain('href="https://toolify365.com"'); + } }); }); From a5ec82b613906ca4d3c74af271a4776a5fda2423 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 09:04:50 +0900 Subject: [PATCH 16/96] test(embed): use actual escaped linebreak and tab in URL validation --- site/src/lib/tools/embed-html.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/src/lib/tools/embed-html.test.ts b/site/src/lib/tools/embed-html.test.ts index 24740d07..3a9d2083 100644 --- a/site/src/lib/tools/embed-html.test.ts +++ b/site/src/lib/tools/embed-html.test.ts @@ -35,8 +35,8 @@ describe("safe tool embed HTML", () => { for (const source of [ "https://username:password@toolify365.com/en/embed", "https://username@toolify365.com/en/embed", - "\\nhttps://toolify365.com/en/embed", - "https://toolify365.com/en/embed\\t", + "\nhttps://toolify365.com/en/embed", + "https://toolify365.com/en/embed\t", " https://toolify365.com/en/embed", ]) { const snippet = buildToolEmbedSnippet("Safe", source, source); From aad3e478d02033c50e42b06011bfc5c7e04671e0 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 09:05:02 +0900 Subject: [PATCH 17/96] test(integration): preserve URL credential and whitespace guards --- site/scripts/growth-integration.test.mjs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/site/scripts/growth-integration.test.mjs b/site/scripts/growth-integration.test.mjs index 11c92cbc..d77aee73 100644 --- a/site/scripts/growth-integration.test.mjs +++ b/site/scripts/growth-integration.test.mjs @@ -82,4 +82,6 @@ test('embedded tool HTML escapes title and attribute values', () => { assert.ok(html.includes("const safeToolUrl = escapeHtml(safeEmbedUrl(toolUrl, 'https://toolify365.com'))")); assert.ok(html.includes('rel="noopener"')); assert.ok(html.includes('if (parsed.protocol === "https:" || localDev) return value')); + assert.ok(html.includes('if (parsed.username || parsed.password) return fallback')); + assert.ok(html.includes('value.trim() !== value')); }); From 587be7d11db21b54dc3b5192b12697fc84b3fb58 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 09:05:36 +0900 Subject: [PATCH 18/96] docs(postmerge): record URL parser edge case, mitigation and standalone test evidence --- docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md index f1a03064..9b3ae562 100644 --- a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md +++ b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md @@ -32,3 +32,10 @@ - **Five independent Node subtests passed (5/5, exit 0):** markup entities, src/href attribute escaping, injected markup/handler protection, disallowed javascript/data/relative/http remote schemes, HTTPS and local development. - This tests the actual helper implementation in isolation with a separate Node test harness, **not** the repository's Vitest suite or whole Next.js application. The four in-repo Vitest test cases are authored but remain unrun with `npm ci` on a full checkout. - At check time PR41 remained open, draft, 11 commits ahead of main and 0 behind; no deploy/merge performed in this work. + +## 2026-11-07 security follow-up: credentials and control characters +- Found a real URL parsing edge case: WHATWG `new URL()` accepts HTTPS URLs with embedded usernames/passwords and trims leading newlines/trailing tabs. URL scheme-only checks previously let these through. +- Hardened `site/src/lib/tools/embed-html.ts`: reject ASCII control characters, surrounding whitespace, and parsed URL userinfo before allowing HTTPS/localhost. +- Expanded `embed-html.test.ts` with credentials, newline, tab, and whitespace cases, and strengthened the cross-PR integration source regression. +- Ran `node --test` on an isolated JS adaptation of the updated helper: **4 subtest groups passed, zero failed**, including unsafe schemes, credentials, controls, attribute encoding, and valid HTTPS/local links. This does not constitute the full repository's Vitest or production build. +- PR41 remains NO-GO until checked-out full build and browser QA pass. GitHub Actions were not used; production not verified. From 780404b6a0719a13877f43c4702f06543ac3291f Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 09:12:57 +0900 Subject: [PATCH 19/96] safety: prevent GitHub Actions auto-deploy on post-merge main push --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f38b15b2..9d6f9f42 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,8 +1,8 @@ name: Deploy to VPS +# The owner performs production deployments manually. Keep the workflow available +# for an explicit future decision, but never auto-deploy from a main push. on: - push: - branches: [main] workflow_dispatch: {} concurrency: From b3875971982a5c89128dab96b63f0e79b97a43db Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 09:13:06 +0900 Subject: [PATCH 20/96] safety: require fresh main ancestry and manual deploy trigger in PR41 release gate --- scripts/check-postmerge-embed-release.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/check-postmerge-embed-release.sh b/scripts/check-postmerge-embed-release.sh index d025ff10..44c77ad7 100644 --- a/scripts/check-postmerge-embed-release.sh +++ b/scripts/check-postmerge-embed-release.sh @@ -8,6 +8,17 @@ if [[ "$ACTUAL_BRANCH" != "$EXPECTED_BRANCH" ]]; then echo "[postmerge] ERROR: expected $EXPECTED_BRANCH, found ${ACTUAL_BRANCH:-detached}" >&2 exit 2 fi +# Fetch the remote-tracking ref we actually verify, instead of trusting an old local ref. +git -C "$ROOT" fetch --no-tags origin main:refs/remotes/origin/main +if ! git -C "$ROOT" merge-base --is-ancestor refs/remotes/origin/main HEAD; then + echo "[postmerge] ERROR: latest origin/main is not merged into this PR branch." >&2 + exit 3 +fi +# This PR must never enable an automatic GitHub Actions deploy on main push. +if grep -Eq '^[[:space:]]+branches:[[:space:]]*\\[main\\]' "$ROOT/.github/workflows/deploy.yml"; then + echo "[postmerge] ERROR: main push auto-deploy must be disabled before release." >&2 + exit 4 +fi cd "$ROOT/site" echo "[postmerge] node=$(node --version) npm=$(npm --version)" npm ci From 443274270ba9f86889d72c288887191fb28f4acd Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 09:13:06 +0900 Subject: [PATCH 21/96] test(embed): execute exact TypeScript helper with dependency-free Node 22 regression suite --- site/scripts/embed-html-node.test.mjs | 52 +++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 site/scripts/embed-html-node.test.mjs diff --git a/site/scripts/embed-html-node.test.mjs b/site/scripts/embed-html-node.test.mjs new file mode 100644 index 00000000..60cc4256 --- /dev/null +++ b/site/scripts/embed-html-node.test.mjs @@ -0,0 +1,52 @@ +// Dependency-free release regression: executes the actual TypeScript helper on Node >=22. +// Use: node --experimental-strip-types --test scripts/embed-html-node.test.mjs +import { test } from 'node:test'; +import { strict as assert } from 'node:assert'; +import { buildToolEmbedSnippet as build, escapeHtml } from '../src/lib/tools/embed-html.ts'; + +test('escape localized HTML text and quoted attributes', () => { + assert.equal(escapeHtml(`A&B <"C"> 'D'`), 'A&B <"C"> 'D''); +}); + +test('preserve legitimate query parameters without HTML attribute injection', () => { + const html = build('A&B "Calculator"', 'https://toolify365.com/en/embed?a=1&b=2', 'https://toolify365.com/en/tools?a=1&b=2'); + assert.ok(html.includes('title="A&B "Calculator""')); + assert.ok(html.includes('src="https://toolify365.com/en/embed?a=1&b=2"')); + assert.ok(html.includes('href="https://toolify365.com/en/tools?a=1&b=2"')); +}); + +test('untrusted text cannot create scripts or event-handler attributes', () => { + const html = build('">', 'https://toolify365.com/embed" onload="bad()', "https://toolify365.com/tool' onclick='bad()"); + assert.ok(!html.includes('', '/relative/embed', 'http://evil.example/iframe']) { + const html = build('Safe', value, value); + assert.ok(html.includes('src="about:blank"'), value); + assert.ok(html.includes('href="https://toolify365.com"'), value); + } +}); + +test('reject URL credentials, control characters and surrounding whitespace', () => { + for (const value of [ + 'https://user:pass@toolify365.com/en/embed', + 'https://user@toolify365.com/en/embed', + '\nhttps://toolify365.com/en/embed', + 'https://toolify365.com/en/embed\t', + ' https://toolify365.com/en/embed', + 'https://toolify365.com/en/embed\0', + ]) { + const html = build('Safe', value, value); + assert.ok(html.includes('src="about:blank"'), JSON.stringify(value)); + assert.ok(html.includes('href="https://toolify365.com"'), JSON.stringify(value)); + } +}); + +test('allow HTTPS and local development addresses', () => { + assert.ok(build('Safe','https://toolify365.com/en/embed','https://toolify365.com/en/tools').includes('src="https://toolify365.com/en/embed"')); + assert.ok(build('Safe','http://localhost:3000/en/embed','http://127.0.0.1:3000/en/tools').includes('src="http://localhost:3000/en/embed"')); +}); From b762f9f15dd877774c9ea64f3f745a4da01b691b Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 09:13:16 +0900 Subject: [PATCH 22/96] test: keep PR41 fresh-main and manual-deployment checks as release prerequisites --- site/scripts/growth-integration.test.mjs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/site/scripts/growth-integration.test.mjs b/site/scripts/growth-integration.test.mjs index d77aee73..5654e17b 100644 --- a/site/scripts/growth-integration.test.mjs +++ b/site/scripts/growth-integration.test.mjs @@ -85,3 +85,17 @@ test('embedded tool HTML escapes title and attribute values', () => { assert.ok(html.includes('if (parsed.username || parsed.password) return fallback')); assert.ok(html.includes('value.trim() !== value')); }); + +test('postmerge release requires fresh main and manual-only deployment', () => { + const gate = read('../../scripts/check-postmerge-embed-release.sh'); + const workflow = read('../../.github/workflows/deploy.yml'); + assert.ok(gate.includes('fetch --no-tags origin main:refs/remotes/origin/main')); + assert.ok(gate.includes('merge-base --is-ancestor refs/remotes/origin/main HEAD')); + assert.ok(gate.includes('latest origin/main is not merged')); + assert.ok(gate.includes('main push auto-deploy must be disabled')); + assert.ok(workflow.includes('workflow_dispatch: {}')); + assert.ok(!workflow.includes('branches: [main]'), 'must not automatically deploy on main'); + assert.ok(workflow.includes('Acquire VPS deploy lock (shared with local deploy)')); + assert.ok(workflow.includes('Verify live release SHA')); + assert.ok(workflow.includes('Verify public release endpoint')); +}); From c3073662046300f5a8f50ad0d562671f1961b514 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 09:13:19 +0900 Subject: [PATCH 23/96] test(release): run dependency-free real TS embed regression before npm install --- scripts/check-postmerge-embed-release.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/check-postmerge-embed-release.sh b/scripts/check-postmerge-embed-release.sh index 44c77ad7..bf1ab77c 100644 --- a/scripts/check-postmerge-embed-release.sh +++ b/scripts/check-postmerge-embed-release.sh @@ -21,6 +21,12 @@ if grep -Eq '^[[:space:]]+branches:[[:space:]]*\\[main\\]' "$ROOT/.github/workfl fi cd "$ROOT/site" echo "[postmerge] node=$(node --version) npm=$(npm --version)" +NODE_MAJOR="$(node -p 'process.versions.node.split(".")[0]')" +if (( NODE_MAJOR < 22 )); then + echo "[postmerge] ERROR: Node >=22 required for dependency-free TypeScript regression." >&2 + exit 2 +fi +node --experimental-strip-types --test scripts/embed-html-node.test.mjs npm ci npm run test:smoke-html npm run test:integration From 50705f24a9c032152abb62108115358c32c57a8e Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 09:14:03 +0900 Subject: [PATCH 24/96] fix: make main auto-deploy release guard actually match workflow trigger --- scripts/check-postmerge-embed-release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check-postmerge-embed-release.sh b/scripts/check-postmerge-embed-release.sh index bf1ab77c..8e2ba72a 100644 --- a/scripts/check-postmerge-embed-release.sh +++ b/scripts/check-postmerge-embed-release.sh @@ -15,7 +15,7 @@ if ! git -C "$ROOT" merge-base --is-ancestor refs/remotes/origin/main HEAD; then exit 3 fi # This PR must never enable an automatic GitHub Actions deploy on main push. -if grep -Eq '^[[:space:]]+branches:[[:space:]]*\\[main\\]' "$ROOT/.github/workflows/deploy.yml"; then +if grep -Fq 'branches: [main]' "$ROOT/.github/workflows/deploy.yml"; then echo "[postmerge] ERROR: main push auto-deploy must be disabled before release." >&2 exit 4 fi From de540f2a44749234409f98a4ac5d11cb15550573 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 09:14:44 +0900 Subject: [PATCH 25/96] test: execute exact grep-based deploy-trigger guard against enabled and disabled workflows --- site/scripts/growth-integration.test.mjs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/site/scripts/growth-integration.test.mjs b/site/scripts/growth-integration.test.mjs index 5654e17b..c6488a26 100644 --- a/site/scripts/growth-integration.test.mjs +++ b/site/scripts/growth-integration.test.mjs @@ -1,6 +1,7 @@ import { test } from 'node:test'; import { strict as assert } from 'node:assert'; import { readFileSync } from 'node:fs'; +import { spawnSync } from 'node:child_process'; const read = (path) => readFileSync(new URL(path, import.meta.url), 'utf8'); const frame = read('../src/components/tools/ToolFrame.tsx'); @@ -93,9 +94,23 @@ test('postmerge release requires fresh main and manual-only deployment', () => { assert.ok(gate.includes('merge-base --is-ancestor refs/remotes/origin/main HEAD')); assert.ok(gate.includes('latest origin/main is not merged')); assert.ok(gate.includes('main push auto-deploy must be disabled')); + assert.ok(gate.includes("grep -Fq 'branches: [main]'")); assert.ok(workflow.includes('workflow_dispatch: {}')); assert.ok(!workflow.includes('branches: [main]'), 'must not automatically deploy on main'); assert.ok(workflow.includes('Acquire VPS deploy lock (shared with local deploy)')); assert.ok(workflow.includes('Verify live release SHA')); assert.ok(workflow.includes('Verify public release endpoint')); }); + +test('main push trigger guard detects the real YAML syntax', () => { + const blocked = spawnSync('grep', ['-Fq', 'branches: [main]'], { + input: 'on:\\n push:\\n branches: [main]\\n', + encoding: 'utf8', + }); + assert.equal(blocked.status, 0, 'an on-main-push deploy must be rejected'); + const allowed = spawnSync('grep', ['-Fq', 'branches: [main]'], { + input: 'on:\\n workflow_dispatch: {}\\n', + encoding: 'utf8', + }); + assert.equal(allowed.status, 1, 'manual-only deploy must be allowed'); +}); From 111e5e1b1bd8d7c3b79463afe0f2f3a4f8c94205 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 09:14:52 +0900 Subject: [PATCH 26/96] fix(release): correctly reject push-triggered VPS deploy workflow --- scripts/check-postmerge-embed-release.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/check-postmerge-embed-release.sh b/scripts/check-postmerge-embed-release.sh index 8e2ba72a..18c3d1ee 100644 --- a/scripts/check-postmerge-embed-release.sh +++ b/scripts/check-postmerge-embed-release.sh @@ -14,9 +14,10 @@ if ! git -C "$ROOT" merge-base --is-ancestor refs/remotes/origin/main HEAD; then echo "[postmerge] ERROR: latest origin/main is not merged into this PR branch." >&2 exit 3 fi -# This PR must never enable an automatic GitHub Actions deploy on main push. -if grep -Fq 'branches: [main]' "$ROOT/.github/workflows/deploy.yml"; then - echo "[postmerge] ERROR: main push auto-deploy must be disabled before release." >&2 +# This PR must not allow any automatic push-triggered VPS deployment. +# Match the YAML push: key directly: the previous branches:[main] regex missed it. +if grep -Eq '^[[:space:]]*push:[[:space:]]*' "$ROOT/.github/workflows/deploy.yml"; then + echo "[postmerge] ERROR: push-triggered VPS deployment must be disabled before release." >&2 exit 4 fi cd "$ROOT/site" From 718ca3929828a4336b5145981f8460c5cf7ad0c6 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 09:15:09 +0900 Subject: [PATCH 27/96] test: use real newlines in main-push deploy guard regression fixture --- site/scripts/growth-integration.test.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/scripts/growth-integration.test.mjs b/site/scripts/growth-integration.test.mjs index c6488a26..e0ded83c 100644 --- a/site/scripts/growth-integration.test.mjs +++ b/site/scripts/growth-integration.test.mjs @@ -104,12 +104,12 @@ test('postmerge release requires fresh main and manual-only deployment', () => { test('main push trigger guard detects the real YAML syntax', () => { const blocked = spawnSync('grep', ['-Fq', 'branches: [main]'], { - input: 'on:\\n push:\\n branches: [main]\\n', + input: ['on:', ' push:', ' branches: [main]', ''].join(String.fromCharCode(10)), encoding: 'utf8', }); assert.equal(blocked.status, 0, 'an on-main-push deploy must be rejected'); const allowed = spawnSync('grep', ['-Fq', 'branches: [main]'], { - input: 'on:\\n workflow_dispatch: {}\\n', + input: ['on:', ' workflow_dispatch: {}', ''].join(String.fromCharCode(10)), encoding: 'utf8', }); assert.equal(allowed.status, 1, 'manual-only deploy must be allowed'); From 9491038f472a293ce5434fdf2fcd718b3c35e04d Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 09:16:12 +0900 Subject: [PATCH 28/96] docs(postmerge): record hash-verified tests and fixed automatic deploy release guard --- docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md index 9b3ae562..84494671 100644 --- a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md +++ b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md @@ -39,3 +39,11 @@ - Expanded `embed-html.test.ts` with credentials, newline, tab, and whitespace cases, and strengthened the cross-PR integration source regression. - Ran `node --test` on an isolated JS adaptation of the updated helper: **4 subtest groups passed, zero failed**, including unsafe schemes, credentials, controls, attribute encoding, and valid HTTPS/local links. This does not constitute the full repository's Vitest or production build. - PR41 remains NO-GO until checked-out full build and browser QA pass. GitHub Actions were not used; production not verified. + +## 2026-11-07: exact-source executable checks and deployment-trigger guard +- Added `site/scripts/embed-html-node.test.mjs` as a Node >=22 **dependency-free test of the actual TypeScript implementation**, and wired it into `scripts/check-postmerge-embed-release.sh` **before** `npm ci`. +- Verified Git blob SHAs on locally materialized files **exactly match** PR #41: `embed-html.ts` = `fc7733a85e2bd49aaf888a7149a77c586254bbb7`, `embed-html-node.test.mjs` = `60cc425603c19b5ed075869f640e55e0e992e533`, and release script = `18c3d1ee9d4d925011e7fd816e9b64af8b118aa7`. +- Executed the exact Node script with `node --experimental-strip-types --test`: **6/6 passed, 0 failed**. Direct isolated helper typecheck `tsc --noEmit --target es2022 --lib es2022,dom --skipLibCheck` passed. +- Found and corrected an actual release script bug: the old `branches: [main]` detection regexp did **not** match the actual YAML. The new guard rejects a `push:` trigger in `.github/workflows/deploy.yml` irrespective of its branch list. +- Tested the complete branch/remote/deploy guard in a local Git repository with a **local-only origin**, without Actions: push-enabled workflow stopped with exit **4**; manual-only workflow passed the guard and reached the actual TypeScript Node test (**6 passed**). Bash syntax check passed; wrong branch guard previously returned exit **2**. The local mock then cannot run `npm ci`/full site build, which **remains unverified**. +- GitHub comparison showed production `main` still has `on.push.branches: [main]` while PR #41 uses `workflow_dispatch` only. Do **not** merge without confirming this workflow change, the full test/build suite, and owner approval. GitHub Actions were not executed. From 888f926437cc7cdf81254e5b3297ae06812adb17 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 09:16:30 +0900 Subject: [PATCH 29/96] test: align PR41 regression with push-key deploy guard and exercise YAML variants --- site/scripts/growth-integration.test.mjs | 28 +++++++++++++++--------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/site/scripts/growth-integration.test.mjs b/site/scripts/growth-integration.test.mjs index e0ded83c..f40ea685 100644 --- a/site/scripts/growth-integration.test.mjs +++ b/site/scripts/growth-integration.test.mjs @@ -93,24 +93,32 @@ test('postmerge release requires fresh main and manual-only deployment', () => { assert.ok(gate.includes('fetch --no-tags origin main:refs/remotes/origin/main')); assert.ok(gate.includes('merge-base --is-ancestor refs/remotes/origin/main HEAD')); assert.ok(gate.includes('latest origin/main is not merged')); - assert.ok(gate.includes('main push auto-deploy must be disabled')); - assert.ok(gate.includes("grep -Fq 'branches: [main]'")); + assert.ok(gate.includes('push-triggered VPS deployment must be disabled')); + assert.ok(gate.includes('grep -Eq')); assert.ok(workflow.includes('workflow_dispatch: {}')); assert.ok(!workflow.includes('branches: [main]'), 'must not automatically deploy on main'); + assert.ok(!workflow.split(String.fromCharCode(10)).some((line) => /^[ \\t]*push:/.test(line)), 'no YAML push trigger'); assert.ok(workflow.includes('Acquire VPS deploy lock (shared with local deploy)')); assert.ok(workflow.includes('Verify live release SHA')); assert.ok(workflow.includes('Verify public release endpoint')); }); -test('main push trigger guard detects the real YAML syntax', () => { - const blocked = spawnSync('grep', ['-Fq', 'branches: [main]'], { - input: ['on:', ' push:', ' branches: [main]', ''].join(String.fromCharCode(10)), - encoding: 'utf8', - }); - assert.equal(blocked.status, 0, 'an on-main-push deploy must be rejected'); - const allowed = spawnSync('grep', ['-Fq', 'branches: [main]'], { +test('main push guard rejects both branch-specific and unqualified YAML push triggers', () => { + const expression = '^[[:space:]]*push:[[:space:]]*'; + for (const yaml of [ + ['on:', ' push:', ' branches: [main]', ''], + ['on:', ' push: {}', ''], + ['on:', ' workflow_dispatch: {}', ' push:', ''], + ]) { + const result = spawnSync('grep', ['-Eq', expression], { + input: yaml.join(String.fromCharCode(10)), + encoding: 'utf8', + }); + assert.equal(result.status, 0, 'unsafe push trigger should be detected'); + } + const safe = spawnSync('grep', ['-Eq', expression], { input: ['on:', ' workflow_dispatch: {}', ''].join(String.fromCharCode(10)), encoding: 'utf8', }); - assert.equal(allowed.status, 1, 'manual-only deploy must be allowed'); + assert.equal(safe.status, 1, 'manual-only workflow is allowed'); }); From 6cf92c4842f877084f947573719221fde7178e71 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 09:16:52 +0900 Subject: [PATCH 30/96] test: recognize any indented YAML push trigger without fragile regex escapes --- site/scripts/growth-integration.test.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/scripts/growth-integration.test.mjs b/site/scripts/growth-integration.test.mjs index f40ea685..36fd0bbf 100644 --- a/site/scripts/growth-integration.test.mjs +++ b/site/scripts/growth-integration.test.mjs @@ -97,7 +97,7 @@ test('postmerge release requires fresh main and manual-only deployment', () => { assert.ok(gate.includes('grep -Eq')); assert.ok(workflow.includes('workflow_dispatch: {}')); assert.ok(!workflow.includes('branches: [main]'), 'must not automatically deploy on main'); - assert.ok(!workflow.split(String.fromCharCode(10)).some((line) => /^[ \\t]*push:/.test(line)), 'no YAML push trigger'); + assert.ok(!workflow.split(String.fromCharCode(10)).some((line) => line.trimStart().startsWith('push:')), 'no YAML push trigger'); assert.ok(workflow.includes('Acquire VPS deploy lock (shared with local deploy)')); assert.ok(workflow.includes('Verify live release SHA')); assert.ok(workflow.includes('Verify public release endpoint')); From 58cbfa2ef70e54400877e5543bc7f23f41c1bad3 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 09:20:41 +0900 Subject: [PATCH 31/96] docs: record exact-blob Node tests, four release preflight outcomes and PR40/PR38 status --- docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md index 84494671..4ad5a26e 100644 --- a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md +++ b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md @@ -47,3 +47,15 @@ - Found and corrected an actual release script bug: the old `branches: [main]` detection regexp did **not** match the actual YAML. The new guard rejects a `push:` trigger in `.github/workflows/deploy.yml` irrespective of its branch list. - Tested the complete branch/remote/deploy guard in a local Git repository with a **local-only origin**, without Actions: push-enabled workflow stopped with exit **4**; manual-only workflow passed the guard and reached the actual TypeScript Node test (**6 passed**). Bash syntax check passed; wrong branch guard previously returned exit **2**. The local mock then cannot run `npm ci`/full site build, which **remains unverified**. - GitHub comparison showed production `main` still has `on.push.branches: [main]` while PR #41 uses `workflow_dispatch` only. Do **not** merge without confirming this workflow change, the full test/build suite, and owner approval. GitHub Actions were not executed. + +## 2026-11-07 — Release gate branch/history/deploy prevention exercised (follow-up) +- Confirmed PR #40 has been **merged**; existing PR #38 is superseded by that integration and was closed without merging. Main source readback shows the software CTA, catalog mappings, analytics, and HTML/live-growth checks present. PR #41 remains the draft for **post-merge** fixes. +- On the PR #41 branch, removed `on.push` from `.github/workflows/deploy.yml` while preserving `workflow_dispatch`, deployment lock, and release SHA checks. This changes the **proposed** workflow only; main production automation remains unchanged until an approved merge. +- Improved the PR #41 release gate to fetch latest `origin/main` and fail if not an ancestor; it also rejects a YAML `push:` trigger. Found and fixed a broken original grep expression, and synchronized the dependency-free integration test with the newer push-key matcher. +- Recreated the release gate script with an **exact matching Git blob SHA** (`18c3d1ee9d4d925011e7fd816e9b64af8b118aa7`); `bash -n` passed. Exercised the actual script against a temporary real local Git origin: + - wrong branch → exit **2**, + - feature branch lacking newest remote main commit → exit **3**, + - auto-deploy `push:` workflow → exit **4**, + - current main ancestry + manual-only workflow → exit **0** with **npm calls stubbed** and the real isolated embed Node tests executing (**6/6 passed**). +- Fetched exact Git blobs for `site/src/lib/tools/embed-html.ts` (`fc7733a85e2bd49aaf888a7149a77c586254bbb7`) and `site/scripts/embed-html-node.test.mjs` (`60cc425603c19b5ed075869f640e55e0e992e533`); `node --experimental-strip-types --test` yielded **6 pass, 0 fail**, and isolated `tsc --strict --noEmit` passed. +- These are genuine isolated tests and release **preflight** simulations; no `npm ci`, app-wide tests, actual Next build, live browser/GA4 verification or production deployment. GitHub Actions never invoked. PR41 remains **DRAFT/NO-GO** pending complete owner-accessible checkout and release gate. From 64dc50eddd123a940e050335964dbfa35e44b880 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 10:49:15 +0900 Subject: [PATCH 32/96] security: validate that deploy workflow contains only manual dispatch event --- scripts/verify-manual-deploy.mjs | 65 ++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 scripts/verify-manual-deploy.mjs diff --git a/scripts/verify-manual-deploy.mjs b/scripts/verify-manual-deploy.mjs new file mode 100644 index 00000000..17b67454 --- /dev/null +++ b/scripts/verify-manual-deploy.mjs @@ -0,0 +1,65 @@ +import { readFileSync } from "node:fs"; +import { pathToFileURL } from "node:url"; + +/** + * Fail closed on any non-manual GitHub Actions trigger. + * Intentionally accepts only the repository's simple YAML representation: + * + * on: + * workflow_dispatch: {} + * + * We avoid regex-only push detection: on: [push] and on: push also deploy. + * Any unrecognized event syntax must be reviewed before a release. + */ +export function verifyManualDeployWorkflow(source) { + const lines = source.replace(/\r\n/g, "\n").split("\n"); + let blocks = 0; + let manual = 0; + let inEvents = false; + + for (let index = 0; index < lines.length; index += 1) { + const line = lines[index]; + if (/^\s*(?:#.*)?$/.test(line)) continue; + + const root = line.match(/^(on|'on'|"on")\s*:(.*)$/); + if (root) { + blocks += 1; + if (root[1] !== "on" || root[2].trim()) { + throw new Error("Only a plain multiline on: event block is allowed"); + } + inEvents = true; + continue; + } + if (/^\S/.test(line)) { + inEvents = false; + continue; + } + if (inEvents) { + if (/^ workflow_dispatch: \{\}(?:\s*#.*)?$/.test(line)) { + manual += 1; + } else { + throw new Error(`Unexpected workflow trigger at line ${index + 1}: ${line.trim()}`); + } + } + } + if (blocks !== 1 || manual !== 1) { + throw new Error("Workflow must have exactly one manual-only on: block"); + } + return true; +} + +if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { + const file = process.argv[2]; + if (!file) { + process.stderr.write("Usage: node verify-manual-deploy.mjs \n"); + process.exitCode = 2; + } else { + try { + verifyManualDeployWorkflow(readFileSync(file, "utf8")); + process.stdout.write("[postmerge] PASS: manual-only GitHub workflow trigger\n"); + } catch (error) { + process.stderr.write(`[postmerge] ERROR: ${error.message}\n`); + process.exitCode = 4; + } + } +} From ab2e2a0646b5e5d5183c08ebaa53b1f3155fb7d8 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 10:49:41 +0900 Subject: [PATCH 33/96] test: exercise manual-only deploy workflow validator against YAML trigger variants and CLI exits --- scripts/verify-manual-deploy.test.mjs | 77 +++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 scripts/verify-manual-deploy.test.mjs diff --git a/scripts/verify-manual-deploy.test.mjs b/scripts/verify-manual-deploy.test.mjs new file mode 100644 index 00000000..2f9494fd --- /dev/null +++ b/scripts/verify-manual-deploy.test.mjs @@ -0,0 +1,77 @@ +import { test } from "node:test"; +import { strict as assert } from "node:assert"; +import { mkdtempSync, writeFileSync, rmSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { fileURLToPath } from "node:url"; +import { spawnSync } from "node:child_process"; +import { verifyManualDeployWorkflow } from "./verify-manual-deploy.mjs"; + +const allowed = [ + "name: Deploy to VPS", + "", + "# Owner-managed deploy", + "on:", + " workflow_dispatch: {}", + "", + "jobs:", + " deploy:", + " runs-on: ubuntu-latest", + "", +].join("\n"); + +test("accepts the sole manual dispatch trigger with ordinary jobs and comments", () => { + assert.equal(verifyManualDeployWorkflow(allowed), true); + assert.equal(verifyManualDeployWorkflow(allowed.replace(/\n/g, "\r\n")), true); +}); + +test("rejects every alternative GitHub Actions event form", () => { + const bad = [ + "on: push", + "on: [push]", + "on: {push: {branches: [main]}}", + "on:\n push:\n branches: [main]", + "on:\n push: {}", + "on:\n workflow_dispatch: {}\n push: {}", + "on:\n workflow_dispatch: {}\n pull_request: {}", + "on:\n workflow_dispatch: {}\n schedule: []", + "on:\n workflow_dispatch: {}\n workflow_dispatch: {}", + "'on': push", + "\"on\": [push]", + "jobs:\n deploy:\n runs-on: ubuntu-latest", + ]; + for (const yaml of bad) { + assert.throws(() => verifyManualDeployWorkflow(yaml), Error, yaml); + } +}); + +test("does not accept inline or ambiguous manual-only trigger representations", () => { + for (const yaml of [ + "on: {workflow_dispatch: {}}", + "on: [workflow_dispatch]", + "on: workflow_dispatch", + "'on':\n workflow_dispatch: {}", + "on:\n workflow_dispatch: {}", + "on:\n workflow_dispatch:", + "on:\n workflow_dispatch: {inputs: {}}", + "on:\n workflow_dispatch: {}\n'on': push", + ]) { + assert.throws(() => verifyManualDeployWorkflow(yaml), Error, yaml); + } +}); + +test("CLI exits 0 for manual-only and 4 for automatic deploy", () => { + const directory = mkdtempSync(join(tmpdir(), "toolify-manual-")); + const workflow = join(directory, "deploy.yml"); + const cli = fileURLToPath(new URL("./verify-manual-deploy.mjs", import.meta.url)); + try { + writeFileSync(workflow, allowed); + const ok = spawnSync(process.execPath, [cli, workflow], { encoding: "utf8" }); + assert.equal(ok.status, 0, ok.stderr); + writeFileSync(workflow, allowed.replace(" workflow_dispatch: {}", " push: {}")); + const rejected = spawnSync(process.execPath, [cli, workflow], { encoding: "utf8" }); + assert.equal(rejected.status, 4, rejected.stdout); + } finally { + rmSync(directory, { recursive: true, force: true }); + } +}); From 2f88b7fe746455d4ce7cd1028d241fb8a9ea01dc Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 10:50:00 +0900 Subject: [PATCH 34/96] safety: gate PR41 on manual-only YAML event validation and executable regression suite --- scripts/check-postmerge-embed-release.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/check-postmerge-embed-release.sh b/scripts/check-postmerge-embed-release.sh index 18c3d1ee..90b2a7c4 100644 --- a/scripts/check-postmerge-embed-release.sh +++ b/scripts/check-postmerge-embed-release.sh @@ -14,12 +14,10 @@ if ! git -C "$ROOT" merge-base --is-ancestor refs/remotes/origin/main HEAD; then echo "[postmerge] ERROR: latest origin/main is not merged into this PR branch." >&2 exit 3 fi -# This PR must not allow any automatic push-triggered VPS deployment. -# Match the YAML push: key directly: the previous branches:[main] regex missed it. -if grep -Eq '^[[:space:]]*push:[[:space:]]*' "$ROOT/.github/workflows/deploy.yml"; then - echo "[postmerge] ERROR: push-triggered VPS deployment must be disabled before release." >&2 - exit 4 -fi +# Parse the event declaration fail-closed. A grep for "push:" misses on: [push]. +# Do not run GitHub Actions; only validate workflow source locally. +node "$ROOT/scripts/verify-manual-deploy.mjs" "$ROOT/.github/workflows/deploy.yml" +node --test "$ROOT/scripts/verify-manual-deploy.test.mjs" cd "$ROOT/site" echo "[postmerge] node=$(node --version) npm=$(npm --version)" NODE_MAJOR="$(node -p 'process.versions.node.split(".")[0]')" From e1376a35a968a29338765a14dc512f2b88ccb0ee Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 10:50:03 +0900 Subject: [PATCH 35/96] fix(release): fail closed unless deploy workflow has manual dispatch only --- scripts/check-manual-deploy.mjs | 48 +++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 scripts/check-manual-deploy.mjs diff --git a/scripts/check-manual-deploy.mjs b/scripts/check-manual-deploy.mjs new file mode 100644 index 00000000..a55d2525 --- /dev/null +++ b/scripts/check-manual-deploy.mjs @@ -0,0 +1,48 @@ +/** Fail-closed policy for the VPS deploy workflow: only manual dispatch may trigger it. */ +import { readFileSync } from 'node:fs'; +import { pathToFileURL } from 'node:url'; + +export function assertManualDeployOnly(yaml) { + const lines = yaml.split(/\r?\n/); + const onStart = []; + for (let i = 0; i < lines.length; i++) { + if (/^(?:on|["']on["']):(?:\s*(?:#.*)?)?$/.test(lines[i])) onStart.push(i); + } + if (onStart.length !== 1) throw new Error('Expected exactly one top-level on: mapping'); + const events = []; + let inside = false; + for (let i = onStart[0] + 1; i < lines.length; i++) { + const line = lines[i]; + if (!line.trim() || /^\s*#/.test(line)) continue; + if (!/^\s/.test(line)) break; + const event = line.match(/^ ([A-Za-z_][\w-]*):(?:\s|$)/); + if (event) { + events.push(event[1]); + inside = true; + continue; + } + if (!inside || /^\s{1,2}\S/.test(line) || /^\t/.test(line)) { + throw new Error('Unexpected indentation or event syntax in on: mapping'); + } + } + if (events.length !== 1 || events[0] !== 'workflow_dispatch') { + throw new Error('Only workflow_dispatch is allowed; found: ' + (events.join(', ') || 'none')); + } + return true; +} + +if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { + const path = process.argv[2]; + if (!path) { + console.error('Usage: node scripts/check-manual-deploy.mjs .github/workflows/deploy.yml'); + process.exitCode = 2; + } else { + try { + assertManualDeployOnly(readFileSync(path, 'utf8')); + console.log('[postmerge] PASS: VPS workflow is manual-dispatch-only'); + } catch (err) { + console.error('[postmerge] ERROR:', err.message); + process.exitCode = 4; + } + } +} From ba61f6e6639fe1dee454a8e2527de7d2974f5af4 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 10:50:12 +0900 Subject: [PATCH 36/96] test(release): cover push schedule workflow-run and malformed deploy triggers --- scripts/check-manual-deploy.test.mjs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 scripts/check-manual-deploy.test.mjs diff --git a/scripts/check-manual-deploy.test.mjs b/scripts/check-manual-deploy.test.mjs new file mode 100644 index 00000000..70e3394b --- /dev/null +++ b/scripts/check-manual-deploy.test.mjs @@ -0,0 +1,24 @@ +import { test } from 'node:test'; +import { strict as assert } from 'node:assert'; +import { assertManualDeployOnly } from './check-manual-deploy.mjs'; + +test('allow manual only', () => { + assert.equal(assertManualDeployOnly('name: Deploy\non:\n workflow_dispatch: {}\njobs:\n deploy:\n runs-on: ubuntu-latest\n'), true); + assert.equal(assertManualDeployOnly('"on":\n # review\n workflow_dispatch: {}\n'), true); +}); +test('block push and scheduled triggers, even if manual dispatch is also present', () => { + for (const on of [ + ' push:\n branches: [main]\n workflow_dispatch: {}', + ' workflow_dispatch: {}\n schedule:\n - cron: "0 9 * * *"', + ' workflow_dispatch: {}\n workflow_run:\n workflows: [Build]' + ]) assert.throws(() => assertManualDeployOnly('on:\n'+on+'\njobs:\n'), /Only workflow_dispatch/); +}); +test('fail closed for missing, duplicate or inline events', () => { + for (const content of ['name: Deploy\n', 'on: [workflow_dispatch]\n', 'on: [push]\n', 'on: workflow_dispatch\n', 'on:\n workflow_dispatch: {}\non:\n push:\n']) { + assert.throws(() => assertManualDeployOnly(content), /Expected exactly one/); + } +}); +test('reject malformed or unexpected event syntax', () => { + assert.throws(() => assertManualDeployOnly('on:\n workflow_dispatch: {}\n'), /Unexpected/); + assert.throws(() => assertManualDeployOnly('on:\n workflow_dispatch: {}\n pull_request:\n'), /Only workflow_dispatch/); +}); From 028657938736bfbd040068ff3d42b7d65e722f40 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 10:50:26 +0900 Subject: [PATCH 37/96] test: use strict manual-only event validator in PR41 integration gate checks --- site/scripts/growth-integration.test.mjs | 34 +++++++----------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/site/scripts/growth-integration.test.mjs b/site/scripts/growth-integration.test.mjs index 36fd0bbf..c21f27c2 100644 --- a/site/scripts/growth-integration.test.mjs +++ b/site/scripts/growth-integration.test.mjs @@ -1,7 +1,6 @@ import { test } from 'node:test'; import { strict as assert } from 'node:assert'; import { readFileSync } from 'node:fs'; -import { spawnSync } from 'node:child_process'; const read = (path) => readFileSync(new URL(path, import.meta.url), 'utf8'); const frame = read('../src/components/tools/ToolFrame.tsx'); @@ -87,38 +86,23 @@ test('embedded tool HTML escapes title and attribute values', () => { assert.ok(html.includes('value.trim() !== value')); }); -test('postmerge release requires fresh main and manual-only deployment', () => { +test('postmerge release requires fresh main and validated manual-only deployment', () => { const gate = read('../../scripts/check-postmerge-embed-release.sh'); const workflow = read('../../.github/workflows/deploy.yml'); + const parser = read('../../scripts/verify-manual-deploy.mjs'); + const parserTests = read('../../scripts/verify-manual-deploy.test.mjs'); assert.ok(gate.includes('fetch --no-tags origin main:refs/remotes/origin/main')); assert.ok(gate.includes('merge-base --is-ancestor refs/remotes/origin/main HEAD')); assert.ok(gate.includes('latest origin/main is not merged')); - assert.ok(gate.includes('push-triggered VPS deployment must be disabled')); - assert.ok(gate.includes('grep -Eq')); + assert.ok(gate.includes('node "$ROOT/scripts/verify-manual-deploy.mjs" "$ROOT/.github/workflows/deploy.yml"')); + assert.ok(gate.includes('node --test "$ROOT/scripts/verify-manual-deploy.test.mjs"')); + assert.ok(parser.includes('Unexpected workflow trigger')); + assert.ok(parser.includes('blocks !== 1 || manual !== 1')); + assert.ok(parserTests.includes('on: [push]')); + assert.ok(parserTests.includes('on: push')); assert.ok(workflow.includes('workflow_dispatch: {}')); - assert.ok(!workflow.includes('branches: [main]'), 'must not automatically deploy on main'); assert.ok(!workflow.split(String.fromCharCode(10)).some((line) => line.trimStart().startsWith('push:')), 'no YAML push trigger'); assert.ok(workflow.includes('Acquire VPS deploy lock (shared with local deploy)')); assert.ok(workflow.includes('Verify live release SHA')); assert.ok(workflow.includes('Verify public release endpoint')); }); - -test('main push guard rejects both branch-specific and unqualified YAML push triggers', () => { - const expression = '^[[:space:]]*push:[[:space:]]*'; - for (const yaml of [ - ['on:', ' push:', ' branches: [main]', ''], - ['on:', ' push: {}', ''], - ['on:', ' workflow_dispatch: {}', ' push:', ''], - ]) { - const result = spawnSync('grep', ['-Eq', expression], { - input: yaml.join(String.fromCharCode(10)), - encoding: 'utf8', - }); - assert.equal(result.status, 0, 'unsafe push trigger should be detected'); - } - const safe = spawnSync('grep', ['-Eq', expression], { - input: ['on:', ' workflow_dispatch: {}', ''].join(String.fromCharCode(10)), - encoding: 'utf8', - }); - assert.equal(safe.status, 1, 'manual-only workflow is allowed'); -}); From 5dd42170390dcf346b177b85ebd9f6f40f00cb70 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 10:50:53 +0900 Subject: [PATCH 38/96] chore(release): remove duplicate manual-deploy checker; retain verified existing policy --- scripts/check-manual-deploy.mjs | 48 --------------------------------- 1 file changed, 48 deletions(-) delete mode 100644 scripts/check-manual-deploy.mjs diff --git a/scripts/check-manual-deploy.mjs b/scripts/check-manual-deploy.mjs deleted file mode 100644 index a55d2525..00000000 --- a/scripts/check-manual-deploy.mjs +++ /dev/null @@ -1,48 +0,0 @@ -/** Fail-closed policy for the VPS deploy workflow: only manual dispatch may trigger it. */ -import { readFileSync } from 'node:fs'; -import { pathToFileURL } from 'node:url'; - -export function assertManualDeployOnly(yaml) { - const lines = yaml.split(/\r?\n/); - const onStart = []; - for (let i = 0; i < lines.length; i++) { - if (/^(?:on|["']on["']):(?:\s*(?:#.*)?)?$/.test(lines[i])) onStart.push(i); - } - if (onStart.length !== 1) throw new Error('Expected exactly one top-level on: mapping'); - const events = []; - let inside = false; - for (let i = onStart[0] + 1; i < lines.length; i++) { - const line = lines[i]; - if (!line.trim() || /^\s*#/.test(line)) continue; - if (!/^\s/.test(line)) break; - const event = line.match(/^ ([A-Za-z_][\w-]*):(?:\s|$)/); - if (event) { - events.push(event[1]); - inside = true; - continue; - } - if (!inside || /^\s{1,2}\S/.test(line) || /^\t/.test(line)) { - throw new Error('Unexpected indentation or event syntax in on: mapping'); - } - } - if (events.length !== 1 || events[0] !== 'workflow_dispatch') { - throw new Error('Only workflow_dispatch is allowed; found: ' + (events.join(', ') || 'none')); - } - return true; -} - -if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { - const path = process.argv[2]; - if (!path) { - console.error('Usage: node scripts/check-manual-deploy.mjs .github/workflows/deploy.yml'); - process.exitCode = 2; - } else { - try { - assertManualDeployOnly(readFileSync(path, 'utf8')); - console.log('[postmerge] PASS: VPS workflow is manual-dispatch-only'); - } catch (err) { - console.error('[postmerge] ERROR:', err.message); - process.exitCode = 4; - } - } -} From 1e47df1487ac9a724ccdf1a0e0b98aeccfc5b62d Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 10:50:56 +0900 Subject: [PATCH 39/96] chore(release): remove duplicate manual-deploy checker; retain verified existing policy --- scripts/check-manual-deploy.test.mjs | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 scripts/check-manual-deploy.test.mjs diff --git a/scripts/check-manual-deploy.test.mjs b/scripts/check-manual-deploy.test.mjs deleted file mode 100644 index 70e3394b..00000000 --- a/scripts/check-manual-deploy.test.mjs +++ /dev/null @@ -1,24 +0,0 @@ -import { test } from 'node:test'; -import { strict as assert } from 'node:assert'; -import { assertManualDeployOnly } from './check-manual-deploy.mjs'; - -test('allow manual only', () => { - assert.equal(assertManualDeployOnly('name: Deploy\non:\n workflow_dispatch: {}\njobs:\n deploy:\n runs-on: ubuntu-latest\n'), true); - assert.equal(assertManualDeployOnly('"on":\n # review\n workflow_dispatch: {}\n'), true); -}); -test('block push and scheduled triggers, even if manual dispatch is also present', () => { - for (const on of [ - ' push:\n branches: [main]\n workflow_dispatch: {}', - ' workflow_dispatch: {}\n schedule:\n - cron: "0 9 * * *"', - ' workflow_dispatch: {}\n workflow_run:\n workflows: [Build]' - ]) assert.throws(() => assertManualDeployOnly('on:\n'+on+'\njobs:\n'), /Only workflow_dispatch/); -}); -test('fail closed for missing, duplicate or inline events', () => { - for (const content of ['name: Deploy\n', 'on: [workflow_dispatch]\n', 'on: [push]\n', 'on: workflow_dispatch\n', 'on:\n workflow_dispatch: {}\non:\n push:\n']) { - assert.throws(() => assertManualDeployOnly(content), /Expected exactly one/); - } -}); -test('reject malformed or unexpected event syntax', () => { - assert.throws(() => assertManualDeployOnly('on:\n workflow_dispatch: {}\n'), /Unexpected/); - assert.throws(() => assertManualDeployOnly('on:\n workflow_dispatch: {}\n pull_request:\n'), /Only workflow_dispatch/); -}); From 02f649e30e67c004b9d3bddd310e3e97e77d4501 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 10:51:42 +0900 Subject: [PATCH 40/96] docs: record exact-hash Node execution of fail-closed manual-only workflow verifier --- docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md index 4ad5a26e..0cedb951 100644 --- a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md +++ b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md @@ -59,3 +59,10 @@ - current main ancestry + manual-only workflow → exit **0** with **npm calls stubbed** and the real isolated embed Node tests executing (**6/6 passed**). - Fetched exact Git blobs for `site/src/lib/tools/embed-html.ts` (`fc7733a85e2bd49aaf888a7149a77c586254bbb7`) and `site/scripts/embed-html-node.test.mjs` (`60cc425603c19b5ed075869f640e55e0e992e533`); `node --experimental-strip-types --test` yielded **6 pass, 0 fail**, and isolated `tsc --strict --noEmit` passed. - These are genuine isolated tests and release **preflight** simulations; no `npm ci`, app-wide tests, actual Next build, live browser/GA4 verification or production deployment. GitHub Actions never invoked. PR41 remains **DRAFT/NO-GO** pending complete owner-accessible checkout and release gate. + +## 2026-11-07 — Manual-only workflow trigger parser and actual Node regression execution +- Previous release-gate grep checks could miss valid YAML trigger spellings such as `on: [push]` or `on: push`. Introduced dependency-free `scripts/verify-manual-deploy.mjs`, which **fails closed** unless there is exactly one plain multiline `on:` block containing only `workflow_dispatch: {}`. Unknown, duplicate, inline and automatic event forms are rejected; no GitHub Actions are executed. +- Added `scripts/verify-manual-deploy.test.mjs` with four Node test groups: legitimate manual-only/CRLF, alternative automatic event forms, malformed or ambiguous manual events, and real CLI exit behavior (0 permitted, 4 rejected). Wired both the validator and `node --test` into `scripts/check-postmerge-embed-release.sh` before any npm installation or build. Updated the cross-feature integration test's expected gate wiring. +- Fetched the two scripts back from GitHub and reconstructed their **exact bytes** in the local container, verified with `git hash-object`: validator blob `17b6745426a8082120c1e28339e771890c250b9f`, test blob `2f9494fdd1292f40f9a19916c7e8b3bd33794066`. Ran `node --test verify-manual-deploy.test.mjs` under Node v22.16.0: **4 tests passed, 0 failed**. CLI allowed manual-only and rejected automatic workflow. +- This proves the isolated validator and its regression suite, **not** full repository `npm ci`, TypeScript/Vitest, Next.js build, 17-locale/mobile behavior, GA4 or deployment. +- PR #41 remains **DRAFT / NO-GO** until the owner runs `bash scripts/check-postmerge-embed-release.sh` in a full checkout, completes manual browser/consent checks, and approves the workflow behavior change. From 286644517729bbdab9b791fb58a6fe60e375f8e6 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 10:52:17 +0900 Subject: [PATCH 41/96] docs(postmerge): log 7/7 live-source assertions and hash-verified 4/4 manual-deploy tests --- docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md index 0cedb951..f4b56738 100644 --- a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md +++ b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md @@ -66,3 +66,10 @@ - Fetched the two scripts back from GitHub and reconstructed their **exact bytes** in the local container, verified with `git hash-object`: validator blob `17b6745426a8082120c1e28339e771890c250b9f`, test blob `2f9494fdd1292f40f9a19916c7e8b3bd33794066`. Ran `node --test verify-manual-deploy.test.mjs` under Node v22.16.0: **4 tests passed, 0 failed**. CLI allowed manual-only and rejected automatic workflow. - This proves the isolated validator and its regression suite, **not** full repository `npm ci`, TypeScript/Vitest, Next.js build, 17-locale/mobile behavior, GA4 or deployment. - PR #41 remains **DRAFT / NO-GO** until the owner runs `bash scripts/check-postmerge-embed-release.sh` in a full checkout, completes manual browser/consent checks, and approves the workflow behavior change. + +## 2026-11-07 10:46 JST — independent integration and release-policy verification +- Compared PR41 to current `main`: 31 commits ahead and 0 behind at start. PR41 remained **open, draft, not merged**. PR41 review discussion contained no comments. Original PR38 and PR39 were closed without merge; PR40 was merged. +- Fetched **ten exact source files from PR41** using the connected GitHub API. Evaluated the seven dependency-free cross-PR assertions against the **current source text**: **7 passed / 0 failed** (result-first tool navigation, analytics functions, software CTA, trusted-only telemetry, share field privacy, validated URL restoration, HTML embed escaping). This is real-source assertion evaluation, **not** the full `node --test` run in an installed checkout. +- Independently fetched the existing `scripts/verify-manual-deploy.mjs` and its Node tests, copied both exactly into a local workspace and confirmed their **Git blob SHAs** match `17b6745426a8082120c1e28339e771890c250b9f` and `2f9494fdd1292f40f9a19916c7e8b3bd33794066`. Ran `node --test verify-manual-deploy.test.mjs`: **4 groups passed / 0 failed**, including CLI exit 0 for manual-only and 4 for automatic deploy; no GitHub Actions invoked. +- An equivalent second checker was briefly authored in this session, but the existing checker was already integrated by another update. Removed the two redundant `scripts/check-manual-deploy.*.mjs` files; retain **only** the pre-existing `verify-manual-deploy` implementation and its test in the release gate. There is no need for two divergent policies. +- Local `git ls-remote https://github.com/appdevelopsk/toolify.git HEAD` still fails DNS. Full `npm ci`, Vitest, typecheck, Next.js build, real desktop/mobile QA, production deployment and measured business uplift **remain unverified**. From 52e23894b3690cba8cfa516de4b3161ae1bdd93a Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 10:53:12 +0900 Subject: [PATCH 42/96] docs: append executed manual-only deploy parser and release-gate evidence --- docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md index f4b56738..19d3b2f0 100644 --- a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md +++ b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md @@ -73,3 +73,11 @@ - Independently fetched the existing `scripts/verify-manual-deploy.mjs` and its Node tests, copied both exactly into a local workspace and confirmed their **Git blob SHAs** match `17b6745426a8082120c1e28339e771890c250b9f` and `2f9494fdd1292f40f9a19916c7e8b3bd33794066`. Ran `node --test verify-manual-deploy.test.mjs`: **4 groups passed / 0 failed**, including CLI exit 0 for manual-only and 4 for automatic deploy; no GitHub Actions invoked. - An equivalent second checker was briefly authored in this session, but the existing checker was already integrated by another update. Removed the two redundant `scripts/check-manual-deploy.*.mjs` files; retain **only** the pre-existing `verify-manual-deploy` implementation and its test in the release gate. There is no need for two divergent policies. - Local `git ls-remote https://github.com/appdevelopsk/toolify.git HEAD` still fails DNS. Full `npm ci`, Vitest, typecheck, Next.js build, real desktop/mobile QA, production deployment and measured business uplift **remain unverified**. + +## 2026-11-07 — Executed strict workflow event parser and pre-release checks +- Replaced the permissive `grep push:` check with `scripts/verify-manual-deploy.mjs`, which accepts **only** one explicit multiline `on:\n workflow_dispatch: {}` block. This rejects `on: push`, `on: [push]`, inline YAML triggers, extra event types, duplicate event keys, quoted/ambiguous event declarations, and missing manual dispatch. +- Added independent `scripts/verify-manual-deploy.test.mjs`, wired direct validation and four Node test groups into `scripts/check-postmerge-embed-release.sh` before `npm ci`. Updated cross-feature Node integration source assertions to require the validator and its tests. +- Exact GitHub blob hashes reproduced via `git hash-object` on copied local files: verifier `17b6745426a8082120c1e28339e771890c250b9f`, validator tests `2f9494fdd1292f40f9a19916c7e8b3bd33794066`, release script `90b2a7c4581d7eb5530b070663bfdcdd3aa6483c`. +- Executed `node --test verify-manual-deploy.test.mjs` under Node 22.16.0: **4 passing tests, zero failures**. The direct CLI accepted manual-only and rejected `on: [push]` with exit **4**. `bash -n` of the exact release script passed. +- Fetched the real PR41 `.github/workflows/deploy.yml` from GitHub and ran the event-block scanner against its content: exactly **one on block, one manual dispatch event, zero unexpected event declarations**. The workflow remains only proposed in the PR; main itself has not been changed by these edits. +- No full repository checkout, `npm ci`, application-wide Vitest, Next production build, browser/GA4 QA, Actions execution or production deployment was performed. These remain strict release blockers; **DRAFT/NO-GO**. From ab650f20371e76b3f0daa879496413f55bb1434e Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 15:23:45 +0900 Subject: [PATCH 43/96] fix: classify Web Share API cancellation without clipboard side effects --- site/src/lib/tools/share-errors.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 site/src/lib/tools/share-errors.ts diff --git a/site/src/lib/tools/share-errors.ts b/site/src/lib/tools/share-errors.ts new file mode 100644 index 00000000..c421961c --- /dev/null +++ b/site/src/lib/tools/share-errors.ts @@ -0,0 +1,13 @@ +/** + * The Web Share API rejects with AbortError when the user cancels the share + * sheet. Cancellation is not a clipboard-copy request. + * + * Some browsers expose a DOMException and others return an Error-like object. + * Checking the name avoids dependence on the DOMException constructor. + */ +export function isShareCancelled(error: unknown): boolean { + return error !== null + && typeof error === "object" + && "name" in error + && error.name === "AbortError"; +} From ceadf3b11fa4e050821bafefd10ca7112825226a Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 15:23:58 +0900 Subject: [PATCH 44/96] fix: do not copy URL after user cancels native share sheet --- site/src/components/tools/ShareBar.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/site/src/components/tools/ShareBar.tsx b/site/src/components/tools/ShareBar.tsx index 84ba20a5..872506e4 100644 --- a/site/src/components/tools/ShareBar.tsx +++ b/site/src/components/tools/ShareBar.tsx @@ -4,6 +4,7 @@ import { useEffect, useState } from "react"; import { useTranslations } from "next-intl"; import { useToolEvents } from "@/lib/analytics/useToolEvents"; import { buildToolEmbedSnippet } from "@/lib/tools/embed-html"; +import { isShareCancelled } from "@/lib/tools/share-errors"; interface Props { /** Canonical, absolute URL of the tool page (built server-side from siteConfig). */ @@ -150,8 +151,10 @@ export function ShareBar({ url, embedUrl, title, slug }: Props) { // 成功時だけ送る。キャンセルは reject されるのでここには来ない。 share("native"); return; - } catch { - /* user cancelled — fall through */ + } catch (error) { + // Explicit cancellation is not consent to copy a link to the clipboard. + if (isShareCancelled(error)) return; + // Share API unavailable/failed for another reason: copy fallback below. } } // フォールバックは copy() 側が copy_result("link") を送るため share は送らない From ff3b3fafa70d181bf824cc599d69d8cc63a4e425 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 15:24:18 +0900 Subject: [PATCH 45/96] test: verify Web Share API cancel vs genuine failure --- site/src/lib/tools/share-errors.test.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 site/src/lib/tools/share-errors.test.ts diff --git a/site/src/lib/tools/share-errors.test.ts b/site/src/lib/tools/share-errors.test.ts new file mode 100644 index 00000000..08f36a41 --- /dev/null +++ b/site/src/lib/tools/share-errors.test.ts @@ -0,0 +1,22 @@ +import { describe, expect, it } from "vitest"; +import { isShareCancelled } from "./share-errors"; + +describe("Web Share API cancellation", () => { + it("recognizes DOMException and Error-like AbortError rejections", () => { + expect(isShareCancelled(new DOMException("User cancelled", "AbortError"))).toBe(true); + const error = new Error("Share sheet closed"); + error.name = "AbortError"; + expect(isShareCancelled(error)).toBe(true); + expect(isShareCancelled({ name: "AbortError" })).toBe(true); + }); + + it("preserves clipboard fallback for other share failures", () => { + for (const error of [ + new Error("Unavailable"), + new DOMException("Not allowed", "NotAllowedError"), + null, undefined, "AbortError", { name: "aborterror" }, { message: "AbortError" }, + ]) { + expect(isShareCancelled(error)).toBe(false); + } + }); +}); From 98ecfa42b0b576cc22732293fa5fb14492fa1d37 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 15:24:20 +0900 Subject: [PATCH 46/96] test: verify Web Share API cancel vs genuine failure --- site/scripts/share-errors-node.test.mjs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 site/scripts/share-errors-node.test.mjs diff --git a/site/scripts/share-errors-node.test.mjs b/site/scripts/share-errors-node.test.mjs new file mode 100644 index 00000000..189d601f --- /dev/null +++ b/site/scripts/share-errors-node.test.mjs @@ -0,0 +1,20 @@ +import { test } from "node:test"; +import { strict as assert } from "node:assert"; +import { isShareCancelled } from "../src/lib/tools/share-errors.ts"; + +test("cancelling the system share sheet must not trigger clipboard fallback", () => { + assert.equal(isShareCancelled(new DOMException("User cancelled", "AbortError")), true); + assert.equal(isShareCancelled({ name: "AbortError" }), true); + const err = new Error("cancelled"); + err.name = "AbortError"; + assert.equal(isShareCancelled(err), true); +}); + +test("non-cancellation errors may use clipboard fallback", () => { + for (const error of [ + null, undefined, "AbortError", new Error("share failed"), + new DOMException("Permission denied", "NotAllowedError"), { name: "aborterror" }, + ]) { + assert.equal(isShareCancelled(error), false); + } +}); From e8399ca6ba8623d86dd22e6e4f331782407fb11e Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 15:24:31 +0900 Subject: [PATCH 47/96] test: run share-cancel regression before npm install in PR41 release gate --- scripts/check-postmerge-embed-release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check-postmerge-embed-release.sh b/scripts/check-postmerge-embed-release.sh index 90b2a7c4..f405bcc5 100644 --- a/scripts/check-postmerge-embed-release.sh +++ b/scripts/check-postmerge-embed-release.sh @@ -25,7 +25,7 @@ if (( NODE_MAJOR < 22 )); then echo "[postmerge] ERROR: Node >=22 required for dependency-free TypeScript regression." >&2 exit 2 fi -node --experimental-strip-types --test scripts/embed-html-node.test.mjs +node --experimental-strip-types --test scripts/embed-html-node.test.mjs scripts/share-errors-node.test.mjs npm ci npm run test:smoke-html npm run test:integration From 368c3df791e874ce240fd505e0b7a1f6f96d3ad2 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 15:24:50 +0900 Subject: [PATCH 48/96] test: guard native-share cancellation against implicit clipboard fallback --- site/scripts/growth-integration.test.mjs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/site/scripts/growth-integration.test.mjs b/site/scripts/growth-integration.test.mjs index c21f27c2..b3c420e1 100644 --- a/site/scripts/growth-integration.test.mjs +++ b/site/scripts/growth-integration.test.mjs @@ -106,3 +106,14 @@ test('postmerge release requires fresh main and validated manual-only deployment assert.ok(workflow.includes('Verify live release SHA')); assert.ok(workflow.includes('Verify public release endpoint')); }); + +test('native share cancellation cannot silently copy the URL', () => { + const bar = read('../src/components/tools/ShareBar.tsx'); + const policy = read('../src/lib/tools/share-errors.ts'); + const gate = read('../../scripts/check-postmerge-embed-release.sh'); + assert.ok(bar.includes('import { isShareCancelled } from "@/lib/tools/share-errors"')); + assert.ok(bar.includes('if (isShareCancelled(error)) return;')); + assert.ok(bar.includes('await navigator.share({ title, url })')); + assert.ok(policy.includes('error.name === "AbortError"')); + assert.ok(gate.includes('scripts/share-errors-node.test.mjs')); +}); From a3cc1033812a7f555c1f3d99cec72e628a9dc271 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 15:25:48 +0900 Subject: [PATCH 49/96] fix(release): pin canonical production origin for PR41 full build --- scripts/check-postmerge-embed-release.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/check-postmerge-embed-release.sh b/scripts/check-postmerge-embed-release.sh index f405bcc5..2b11ad76 100644 --- a/scripts/check-postmerge-embed-release.sh +++ b/scripts/check-postmerge-embed-release.sh @@ -18,7 +18,12 @@ fi # Do not run GitHub Actions; only validate workflow source locally. node "$ROOT/scripts/verify-manual-deploy.mjs" "$ROOT/.github/workflows/deploy.yml" node --test "$ROOT/scripts/verify-manual-deploy.test.mjs" +# The site config falls back to example.pages.dev when the public origin is unset. +# Pin this production release gate to the canonical origin to prevent wrong +# canonical, share and iframe URLs in an otherwise successful Next build. +export NEXT_PUBLIC_SITE_URL="https://toolify365.com" cd "$ROOT/site" +echo "[postmerge] production origin=$NEXT_PUBLIC_SITE_URL" echo "[postmerge] node=$(node --version) npm=$(npm --version)" NODE_MAJOR="$(node -p 'process.versions.node.split(".")[0]')" if (( NODE_MAJOR < 22 )); then From 383f09c1115825f8390eddba5901d1ba13e655e0 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 15:26:08 +0900 Subject: [PATCH 50/96] docs(postmerge): record production-domain build guard and live free software monetization limits --- docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md index 19d3b2f0..a7425f30 100644 --- a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md +++ b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md @@ -81,3 +81,10 @@ - Executed `node --test verify-manual-deploy.test.mjs` under Node 22.16.0: **4 passing tests, zero failures**. The direct CLI accepted manual-only and rejected `on: [push]` with exit **4**. `bash -n` of the exact release script passed. - Fetched the real PR41 `.github/workflows/deploy.yml` from GitHub and ran the event-block scanner against its content: exactly **one on block, one manual dispatch event, zero unexpected event declarations**. The workflow remains only proposed in the PR; main itself has not been changed by these edits. - No full repository checkout, `npm ci`, application-wide Vitest, Next production build, browser/GA4 QA, Actions execution or production deployment was performed. These remain strict release blockers; **DRAFT/NO-GO**. + +## 2026-11-07 15:21 JST — production origin and live funnel evidence +- Checked the live public pages at `https://toolify365.com/en/tools/character-frequency`, `/en/software/text-batch-studio`, and `/en/software/json-studio` through the public web viewer. The character frequency tool shows an organic navigation CTA to Text Batch Studio; both software pages describe their browser-local free processing and explicitly say paid plans/payments are not available. A live page rendering **does not verify** the PR41 code or a deployment SHA. +- Audited `site/src/lib/config.ts`: when `NEXT_PUBLIC_SITE_URL` is unset, the fallback is `https://example.pages.dev`, which would produce wrong canonical/share/embed URLs in a production build. +- Updated `scripts/check-postmerge-embed-release.sh` to export `NEXT_PUBLIC_SITE_URL="https://toolify365.com"` for this production release gate, preventing missing shell/.env settings from silently switching the build to an example domain. Keep standalone local/staging builds separate from this production gate. +- The live site currently has no paid software purchases. `siteConfig.adsense.client` and slots are forcibly blank, with comments explaining an AdSense account disablement, so SEO/tool funnel growth alone cannot prove recurring or advertising revenue; affiliate paths, actual conversion measurement and a separately reviewed payment product are independent work. +- At review, PR41 remained open/draft with no review comments or individual commit statuses. The complete `npm ci`, `npm test`, `npm run build`, device QA, merge and owner deployment are still unverified in this environment because direct git host DNS resolution fails. From 12f2e244390ce7cbc577244ef988405c07ea82cb Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 15:26:35 +0900 Subject: [PATCH 51/96] fix: resync shared-result button on locale and tool navigation --- site/src/components/tools/ShareBar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/src/components/tools/ShareBar.tsx b/site/src/components/tools/ShareBar.tsx index 872506e4..ddfb55f7 100644 --- a/site/src/components/tools/ShareBar.tsx +++ b/site/src/components/tools/ShareBar.tsx @@ -116,7 +116,7 @@ export function ShareBar({ url, embedUrl, title, slug }: Props) { window.removeEventListener("popstate", sync); window.removeEventListener("pageshow", sync); }; - }, []); + }, [url, slug]); // Resync result-link visibility on locale or tool navigation. const enc = encodeURIComponent; // 埋め込みコードには iframe に加えて「ホストページ側の dofollow 被リンク」を必ず付ける。 From d671f57e959acbe9b4c79a82bd30a935d7e9db85 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 15:26:54 +0900 Subject: [PATCH 52/96] test: guard ShareBar route-state sync and native share cancellation handling --- site/src/components/tools/ShareBar.events.test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/site/src/components/tools/ShareBar.events.test.ts b/site/src/components/tools/ShareBar.events.test.ts index 75f5e0d1..f95a253d 100644 --- a/site/src/components/tools/ShareBar.events.test.ts +++ b/site/src/components/tools/ShareBar.events.test.ts @@ -13,6 +13,18 @@ describe("share URL controls", () => { expect(shareBar).not.toContain("setInterval(sync"); }); + it("resyncs result-link visibility when the tool or locale route changes", () => { + const shareBar = get("./ShareBar.tsx"); + expect(shareBar).toContain("}, [url, slug]);"); + }); + + it("does not copy a link after explicit native share cancellation", () => { + const shareBar = get("./ShareBar.tsx"); + expect(shareBar).toContain('import { isShareCancelled } from "@/lib/tools/share-errors"'); + expect(shareBar).toContain("if (isShareCancelled(error)) return;"); + expect(shareBar).toContain('copy(url, setLinkCopied, "link")'); + }); + it("clears previously shared result links when new inputs become too large", () => { for (const file of [ "../../lib/hooks/useShareableState.ts", From 1a325f90e00a0742b7a8c0c2f7a0917b5bfed5b8 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 15:28:13 +0900 Subject: [PATCH 53/96] docs: log actual 8/8 Web Share/embed tests, navigation guard and public-page verification limits --- docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md index a7425f30..90f4ec83 100644 --- a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md +++ b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md @@ -88,3 +88,13 @@ - Updated `scripts/check-postmerge-embed-release.sh` to export `NEXT_PUBLIC_SITE_URL="https://toolify365.com"` for this production release gate, preventing missing shell/.env settings from silently switching the build to an example domain. Keep standalone local/staging builds separate from this production gate. - The live site currently has no paid software purchases. `siteConfig.adsense.client` and slots are forcibly blank, with comments explaining an AdSense account disablement, so SEO/tool funnel growth alone cannot prove recurring or advertising revenue; affiliate paths, actual conversion measurement and a separately reviewed payment product are independent work. - At review, PR41 remained open/draft with no review comments or individual commit statuses. The complete `npm ci`, `npm test`, `npm run build`, device QA, merge and owner deployment are still unverified in this environment because direct git host DNS resolution fails. + +## 2026-11-07 — Web Share cancellation and locale/navigation state fix +- Found a real UX issue in `ShareBar.tsx`: cancelling the system native-share sheet threw an `AbortError` but then fell through to the clipboard-copy fallback, copying the link without the user's intention. +- Added pure `isShareCancelled(error)` in `site/src/lib/tools/share-errors.ts`; ShareBar now returns on `AbortError`, preserving clipboard fallback for other actual Web Share failures. New Vitest tests `share-errors.test.ts` and dependency-free Node tests `share-errors-node.test.mjs`. +- Corrected ShareBar's result-link state subscription to rerun when `url` or `slug` changes (locale/tool navigation), instead of only on mount. Added matching source regression tests in `ShareBar.events.test.ts` and `growth-integration.test.mjs`. +- Wired `share-errors-node.test.mjs` into the existing PR41 release script alongside `embed-html-node.test.mjs`, **before** the npm install. Exact GitHub file blobs were reconstructed in a local temporary workspace and verified against GitHub blob SHA: `share-errors.ts` `c421961c5d0921e82526e8d77f4015d0c4d94fd5`; `share-errors-node.test.mjs` `189d601ff5c1013089c4d462b66712c3a81953ff`; embed helper and its Node tests `fc7733a85e2bd49aaf888a7149a77c586254bbb7` and `60cc425603c19b5ed075869f640e55e0e992e533`. +- Ran `node --experimental-strip-types --test` on **both exact-source Node test files together**: **8 passed, 0 failed**, and isolated TypeScript `tsc --strict --noEmit` for the two pure helpers: **passed**. +- GitHub readback confirmed **11/11 source wiring assertions**, including Web Share cancellation, fallback, ShareBar route-state resync, Vitest source and release-gate wiring. These checks do **not** replace React browser tests, full project Vitest or Next.js production build. +- Public Toolify365 pages were accessible via web retrieval: `/en/tools/character-frequency` displayed related tools plus a Text Batch Studio link. This is evidence of **visible public navigation**, not a release SHA or evidence that PR41 has deployed. The public `/api/release` endpoint could not be verified from the available browser tool. +- PR41 remains DRAFT/NO-GO: full repo checkout, npm install, app-wide typecheck/build/Vitest, desktop/mobile share sheet and locale transitions, consent/GA4, human review, merge and owner deploy remain pending. From a002a7ac326f79fb45ff4737ce412c1ae42a3bff Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 17:20:15 +0900 Subject: [PATCH 54/96] safety: make Toolify CI workflow manual-only while Actions unavailable --- .github/workflows/ci.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a12b8a19..2b795771 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,8 @@ name: CI +# CI remains available for future explicit owner action, not automated PR/push runs. on: - push: - branches: [main] - pull_request: - branches: [main] + workflow_dispatch: {} jobs: validate-and-build: From 525847fa019cbcc52a2215ebbd83b44c89116aa2 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 17:20:25 +0900 Subject: [PATCH 55/96] safety: disable automatic PR/push live index workflow executions --- .github/workflows/toolify-live-index.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/toolify-live-index.yml b/.github/workflows/toolify-live-index.yml index 81f9a69e..ea0e0128 100644 --- a/.github/workflows/toolify-live-index.yml +++ b/.github/workflows/toolify-live-index.yml @@ -1,16 +1,7 @@ name: Toolify live indexability recovery (12 URLs) +# Keep recovery inspection opt-in while GitHub Actions are unavailable. on: - pull_request: - paths: - - 'scripts/toolify-live-index-gate.mjs' - - 'scripts/tests/toolify-live-index-gate.test.mjs' - - '.github/workflows/toolify-live-index.yml' - push: - branches: [main] - paths: - - 'scripts/toolify-live-index-gate.mjs' - - '.github/workflows/toolify-live-index.yml' - workflow_dispatch: + workflow_dispatch: {} jobs: source: runs-on: ubuntu-latest From 15a4cd0bd87f78e3970cc523ac4443e6f127cef5 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 17:21:09 +0900 Subject: [PATCH 56/96] safety: inspect every GitHub Actions workflow rather than deploy.yml alone --- scripts/verify-manual-deploy.mjs | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/scripts/verify-manual-deploy.mjs b/scripts/verify-manual-deploy.mjs index 17b67454..575ad7a3 100644 --- a/scripts/verify-manual-deploy.mjs +++ b/scripts/verify-manual-deploy.mjs @@ -1,4 +1,5 @@ -import { readFileSync } from "node:fs"; +import { readFileSync, readdirSync, statSync } from "node:fs"; +import { join } from "node:path"; import { pathToFileURL } from "node:url"; /** @@ -48,6 +49,22 @@ export function verifyManualDeployWorkflow(source) { return true; } +/** Validate every workflow in a directory; a single safe deploy.yml is not sufficient. */ +export function verifyWorkflowPath(path) { + const files = statSync(path).isDirectory() + ? readdirSync(path).filter((entry) => /\\.ya?ml$/i.test(entry)).sort().map((entry) => join(path, entry)) + : [path]; + if (files.length === 0) throw new Error("No YAML workflows were found"); + for (const file of files) { + try { + verifyManualDeployWorkflow(readFileSync(file, "utf8")); + } catch (error) { + throw new Error(`${file}: ${error.message}`); + } + } + return files.length; +} + if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { const file = process.argv[2]; if (!file) { @@ -55,8 +72,8 @@ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) process.exitCode = 2; } else { try { - verifyManualDeployWorkflow(readFileSync(file, "utf8")); - process.stdout.write("[postmerge] PASS: manual-only GitHub workflow trigger\n"); + const count = verifyWorkflowPath(file); + process.stdout.write(`[postmerge] PASS: ${count} manual-only GitHub workflow trigger(s)\n`); } catch (error) { process.stderr.write(`[postmerge] ERROR: ${error.message}\n`); process.exitCode = 4; From cdfe02d54e4e4b25eb16d9f57a22575fcb2b13b7 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 17:21:34 +0900 Subject: [PATCH 57/96] safety: gate release on all GitHub workflow triggers --- scripts/check-postmerge-embed-release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check-postmerge-embed-release.sh b/scripts/check-postmerge-embed-release.sh index 2b11ad76..ea7eec6f 100644 --- a/scripts/check-postmerge-embed-release.sh +++ b/scripts/check-postmerge-embed-release.sh @@ -16,7 +16,7 @@ if ! git -C "$ROOT" merge-base --is-ancestor refs/remotes/origin/main HEAD; then fi # Parse the event declaration fail-closed. A grep for "push:" misses on: [push]. # Do not run GitHub Actions; only validate workflow source locally. -node "$ROOT/scripts/verify-manual-deploy.mjs" "$ROOT/.github/workflows/deploy.yml" +node "$ROOT/scripts/verify-manual-deploy.mjs" "$ROOT/.github/workflows" node --test "$ROOT/scripts/verify-manual-deploy.test.mjs" # The site config falls back to example.pages.dev when the public origin is unset. # Pin this production release gate to the canonical origin to prevent wrong From 0ffd8920481e1fb34f582947aef5ddccec5d5eac Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 17:21:46 +0900 Subject: [PATCH 58/96] test(release): validate all GitHub workflows are manual-only using existing policy --- scripts/verify-manual-workflows.mjs | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 scripts/verify-manual-workflows.mjs diff --git a/scripts/verify-manual-workflows.mjs b/scripts/verify-manual-workflows.mjs new file mode 100644 index 00000000..0a19bfce --- /dev/null +++ b/scripts/verify-manual-workflows.mjs @@ -0,0 +1,34 @@ +import { readdirSync, readFileSync } from 'node:fs'; +import { join } from 'node:path'; +import { pathToFileURL } from 'node:url'; +import { verifyManualDeployWorkflow } from './verify-manual-deploy.mjs'; + +/** Verify every Actions workflow opts in to dispatch only. */ +export function verifyAllManualWorkflows(directory) { + const files = readdirSync(directory).filter(name => /\.ya?ml$/i.test(name)).sort(); + if (files.length === 0) throw new Error('No GitHub workflow YAML files found'); + for (const name of files) { + try { + verifyManualDeployWorkflow(readFileSync(join(directory, name), 'utf8')); + } catch (error) { + throw new Error(`${name}: ${error.message}`); + } + } + return files; +} + +if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { + const directory = process.argv[2]; + if (!directory) { + console.error('Usage: node scripts/verify-manual-workflows.mjs .github/workflows'); + process.exitCode = 2; + } else { + try { + const files = verifyAllManualWorkflows(directory); + console.log(`[postmerge] PASS: ${files.length} workflows use manual-only events`); + } catch (error) { + console.error(`[postmerge] ERROR: ${error.message}`); + process.exitCode = 4; + } + } +} From a2c05d21c2536db6c5c6b76109ebe4c3406bef47 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 17:21:55 +0900 Subject: [PATCH 59/96] test: fail release if any CI or other workflow reintroduces automatic triggers --- scripts/verify-manual-deploy.test.mjs | 39 ++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/scripts/verify-manual-deploy.test.mjs b/scripts/verify-manual-deploy.test.mjs index 2f9494fd..d7996bbc 100644 --- a/scripts/verify-manual-deploy.test.mjs +++ b/scripts/verify-manual-deploy.test.mjs @@ -5,7 +5,7 @@ import { tmpdir } from "node:os"; import { join } from "node:path"; import { fileURLToPath } from "node:url"; import { spawnSync } from "node:child_process"; -import { verifyManualDeployWorkflow } from "./verify-manual-deploy.mjs"; +import { verifyManualDeployWorkflow, verifyWorkflowPath } from "./verify-manual-deploy.mjs"; const allowed = [ "name: Deploy to VPS", @@ -75,3 +75,40 @@ test("CLI exits 0 for manual-only and 4 for automatic deploy", () => { rmSync(directory, { recursive: true, force: true }); } }); + +test("validates every .yml and .yaml workflow in a directory", () => { + const dir = mkdtempSync(join(tmpdir(), "toolify-workflows-")); + try { + writeFileSync(join(dir, "deploy.yml"), allowed); + writeFileSync(join(dir, "ci.yaml"), allowed); + writeFileSync(join(dir, "README.txt"), "on: push"); + assert.equal(verifyWorkflowPath(dir), 2); + + writeFileSync(join(dir, "ci.yaml"), "on:\\n pull_request: {}\\n"); + assert.throws(() => verifyWorkflowPath(dir), /ci\\.yaml/); + + rmSync(join(dir, "ci.yaml")); + rmSync(join(dir, "deploy.yml")); + assert.throws(() => verifyWorkflowPath(dir), /No YAML workflows/); + } finally { + rmSync(dir, { recursive: true, force: true }); + } +}); + +test("directory CLI rejects an automatic CI workflow even if deploy.yml is manual-only", () => { + const dir = mkdtempSync(join(tmpdir(), "toolify-workflows-cli-")); + const cli = fileURLToPath(new URL("./verify-manual-deploy.mjs", import.meta.url)); + try { + writeFileSync(join(dir, "deploy.yml"), allowed); + writeFileSync(join(dir, "ci.yml"), allowed); + let result = spawnSync(process.execPath, [cli, dir], { encoding: "utf8" }); + assert.equal(result.status, 0, result.stderr); + + writeFileSync(join(dir, "ci.yml"), "on:\\n push: {}\\n"); + result = spawnSync(process.execPath, [cli, dir], { encoding: "utf8" }); + assert.equal(result.status, 4, result.stdout); + assert.match(result.stderr, /ci\\.yml/); + } finally { + rmSync(dir, { recursive: true, force: true }); + } +}); From 9b07e52950620bbdb2dd4e766bc99ec359200d24 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 17:22:00 +0900 Subject: [PATCH 60/96] test(release): require manual events in every GitHub workflow --- scripts/verify-manual-workflows.test.mjs | 35 ++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 scripts/verify-manual-workflows.test.mjs diff --git a/scripts/verify-manual-workflows.test.mjs b/scripts/verify-manual-workflows.test.mjs new file mode 100644 index 00000000..337362a5 --- /dev/null +++ b/scripts/verify-manual-workflows.test.mjs @@ -0,0 +1,35 @@ +import { test } from 'node:test'; +import { strict as assert } from 'node:assert'; +import { mkdtempSync, writeFileSync, rmSync } from 'node:fs'; +import { join } from 'node:path'; +import { tmpdir } from 'node:os'; +import { verifyAllManualWorkflows } from './verify-manual-workflows.mjs'; + +const manual = 'name: Manual\non:\n workflow_dispatch: {}\njobs:\n build:\n runs-on: ubuntu-latest\n'; +const withDir = (fn) => { + const dir = mkdtempSync(join(tmpdir(), 'toolify-manual-all-')); + try { fn(dir); } finally { rmSync(dir, { recursive: true, force: true }); } +}; + +test('all manual yml/yaml workflows pass', () => withDir(dir => { + writeFileSync(join(dir, 'ci.yml'), manual); + writeFileSync(join(dir, 'deploy.yaml'), manual); + assert.deepEqual(verifyAllManualWorkflows(dir), ['ci.yml', 'deploy.yaml']); +})); + +test('any automatic push, PR or schedule is refused', () => withDir(dir => { + writeFileSync(join(dir, 'deploy.yml'), manual); + for (const event of ['push', 'pull_request', 'schedule', 'workflow_run']) { + writeFileSync(join(dir, 'ci.yml'), `name: Auto\non:\n workflow_dispatch: {}\n ${event}: {}\njobs:\n`); + assert.throws(() => verifyAllManualWorkflows(dir), /ci\.yml:/); + } +})); + +test('empty workflow directory must fail closed', () => withDir(dir => { + assert.throws(() => verifyAllManualWorkflows(dir), /No GitHub workflow YAML/); +})); + +test('malformed or inline event syntax fails closed', () => withDir(dir => { + writeFileSync(join(dir, 'ci.yml'), 'on: [workflow_dispatch]\njobs:\n'); + assert.throws(() => verifyAllManualWorkflows(dir), /ci\.yml:/); +})); From 7a7514e071fb9967f7a83d7798b60d74cd7c6658 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 17:22:11 +0900 Subject: [PATCH 61/96] test: integrate all-workflow trigger validation into PR41 release checks --- site/scripts/growth-integration.test.mjs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/site/scripts/growth-integration.test.mjs b/site/scripts/growth-integration.test.mjs index b3c420e1..426d81ed 100644 --- a/site/scripts/growth-integration.test.mjs +++ b/site/scripts/growth-integration.test.mjs @@ -94,10 +94,14 @@ test('postmerge release requires fresh main and validated manual-only deployment assert.ok(gate.includes('fetch --no-tags origin main:refs/remotes/origin/main')); assert.ok(gate.includes('merge-base --is-ancestor refs/remotes/origin/main HEAD')); assert.ok(gate.includes('latest origin/main is not merged')); - assert.ok(gate.includes('node "$ROOT/scripts/verify-manual-deploy.mjs" "$ROOT/.github/workflows/deploy.yml"')); + assert.ok(gate.includes('node "$ROOT/scripts/verify-manual-deploy.mjs" "$ROOT/.github/workflows"')); assert.ok(gate.includes('node --test "$ROOT/scripts/verify-manual-deploy.test.mjs"')); assert.ok(parser.includes('Unexpected workflow trigger')); assert.ok(parser.includes('blocks !== 1 || manual !== 1')); + assert.ok(parser.includes('export function verifyWorkflowPath(path)')); + assert.ok(parserTests.includes('validates every .yml and .yaml workflow')); + assert.ok(parserTests.includes('directory CLI rejects an automatic CI workflow')); + assert.ok(parserTests.includes('on: [push]')); assert.ok(parserTests.includes('on: push')); assert.ok(workflow.includes('workflow_dispatch: {}')); From 9fe43210daee1dd6bb2124449ed6c401ceb67fde Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 17:22:25 +0900 Subject: [PATCH 62/96] test(release): gate all Actions workflows against unintended auto-runs --- scripts/check-postmerge-embed-release.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/check-postmerge-embed-release.sh b/scripts/check-postmerge-embed-release.sh index ea7eec6f..abdb50d4 100644 --- a/scripts/check-postmerge-embed-release.sh +++ b/scripts/check-postmerge-embed-release.sh @@ -18,6 +18,9 @@ fi # Do not run GitHub Actions; only validate workflow source locally. node "$ROOT/scripts/verify-manual-deploy.mjs" "$ROOT/.github/workflows" node --test "$ROOT/scripts/verify-manual-deploy.test.mjs" +# Ensure all workflow YAML files avoid automatic triggers, not just deploy.yml. +node "$ROOT/scripts/verify-manual-workflows.mjs" "$ROOT/.github/workflows" +node --test "$ROOT/scripts/verify-manual-workflows.test.mjs" # The site config falls back to example.pages.dev when the public origin is unset. # Pin this production release gate to the canonical origin to prevent wrong # canonical, share and iframe URLs in an otherwise successful Next build. From c8f09f9346b573c327833754c4e5634c3ec4729d Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 17:23:30 +0900 Subject: [PATCH 63/96] fix(release): recognize .yml/.yaml files in all-workflow manual-only scan --- scripts/verify-manual-deploy.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/verify-manual-deploy.mjs b/scripts/verify-manual-deploy.mjs index 575ad7a3..c19591c0 100644 --- a/scripts/verify-manual-deploy.mjs +++ b/scripts/verify-manual-deploy.mjs @@ -52,7 +52,7 @@ export function verifyManualDeployWorkflow(source) { /** Validate every workflow in a directory; a single safe deploy.yml is not sufficient. */ export function verifyWorkflowPath(path) { const files = statSync(path).isDirectory() - ? readdirSync(path).filter((entry) => /\\.ya?ml$/i.test(entry)).sort().map((entry) => join(path, entry)) + ? readdirSync(path).filter((entry) => /\.ya?ml$/i.test(entry)).sort().map((entry) => join(path, entry)) : [path]; if (files.length === 0) throw new Error("No YAML workflows were found"); for (const file of files) { From f1e6634134fccc67a920a684fec5a17741a5b845 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 17:24:07 +0900 Subject: [PATCH 64/96] fix(test): use actual YAML newlines and valid filename regex in workflow directory tests --- scripts/verify-manual-deploy.test.mjs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/verify-manual-deploy.test.mjs b/scripts/verify-manual-deploy.test.mjs index d7996bbc..0cc267b5 100644 --- a/scripts/verify-manual-deploy.test.mjs +++ b/scripts/verify-manual-deploy.test.mjs @@ -84,8 +84,8 @@ test("validates every .yml and .yaml workflow in a directory", () => { writeFileSync(join(dir, "README.txt"), "on: push"); assert.equal(verifyWorkflowPath(dir), 2); - writeFileSync(join(dir, "ci.yaml"), "on:\\n pull_request: {}\\n"); - assert.throws(() => verifyWorkflowPath(dir), /ci\\.yaml/); + writeFileSync(join(dir, "ci.yaml"), "on:\n pull_request: {}\n"); + assert.throws(() => verifyWorkflowPath(dir), /ci\.yaml/); rmSync(join(dir, "ci.yaml")); rmSync(join(dir, "deploy.yml")); @@ -104,10 +104,10 @@ test("directory CLI rejects an automatic CI workflow even if deploy.yml is manua let result = spawnSync(process.execPath, [cli, dir], { encoding: "utf8" }); assert.equal(result.status, 0, result.stderr); - writeFileSync(join(dir, "ci.yml"), "on:\\n push: {}\\n"); + writeFileSync(join(dir, "ci.yml"), "on:\n push: {}\n"); result = spawnSync(process.execPath, [cli, dir], { encoding: "utf8" }); assert.equal(result.status, 4, result.stdout); - assert.match(result.stderr, /ci\\.yml/); + assert.match(result.stderr, /ci\.yml/); } finally { rmSync(dir, { recursive: true, force: true }); } From 62f6627a1ac0366850e3f99601eaa8c8c83104b8 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 17:24:18 +0900 Subject: [PATCH 65/96] test: correct directory workflow fixtures and error-path patterns From ea37d8ddb7173f5b9e435ea28aeed5da93e9f4b7 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 17:24:22 +0900 Subject: [PATCH 66/96] chore(release): consolidate all-workflow gate around existing checker --- scripts/check-postmerge-embed-release.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/check-postmerge-embed-release.sh b/scripts/check-postmerge-embed-release.sh index abdb50d4..65030105 100644 --- a/scripts/check-postmerge-embed-release.sh +++ b/scripts/check-postmerge-embed-release.sh @@ -14,13 +14,10 @@ if ! git -C "$ROOT" merge-base --is-ancestor refs/remotes/origin/main HEAD; then echo "[postmerge] ERROR: latest origin/main is not merged into this PR branch." >&2 exit 3 fi -# Parse the event declaration fail-closed. A grep for "push:" misses on: [push]. -# Do not run GitHub Actions; only validate workflow source locally. +# Check EVERY GitHub workflow for manual-only triggers using one fail-closed policy. +# Do not execute GitHub Actions; inspect workflow YAML locally. node "$ROOT/scripts/verify-manual-deploy.mjs" "$ROOT/.github/workflows" node --test "$ROOT/scripts/verify-manual-deploy.test.mjs" -# Ensure all workflow YAML files avoid automatic triggers, not just deploy.yml. -node "$ROOT/scripts/verify-manual-workflows.mjs" "$ROOT/.github/workflows" -node --test "$ROOT/scripts/verify-manual-workflows.test.mjs" # The site config falls back to example.pages.dev when the public origin is unset. # Pin this production release gate to the canonical origin to prevent wrong # canonical, share and iframe URLs in an otherwise successful Next build. From 0ec681463b2508dcbe4defabc2b18ebca141a5d2 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 17:24:36 +0900 Subject: [PATCH 67/96] chore(release): remove redundant all-workflow checker after integration into existing verifier --- scripts/verify-manual-workflows.mjs | 34 ----------------------------- 1 file changed, 34 deletions(-) delete mode 100644 scripts/verify-manual-workflows.mjs diff --git a/scripts/verify-manual-workflows.mjs b/scripts/verify-manual-workflows.mjs deleted file mode 100644 index 0a19bfce..00000000 --- a/scripts/verify-manual-workflows.mjs +++ /dev/null @@ -1,34 +0,0 @@ -import { readdirSync, readFileSync } from 'node:fs'; -import { join } from 'node:path'; -import { pathToFileURL } from 'node:url'; -import { verifyManualDeployWorkflow } from './verify-manual-deploy.mjs'; - -/** Verify every Actions workflow opts in to dispatch only. */ -export function verifyAllManualWorkflows(directory) { - const files = readdirSync(directory).filter(name => /\.ya?ml$/i.test(name)).sort(); - if (files.length === 0) throw new Error('No GitHub workflow YAML files found'); - for (const name of files) { - try { - verifyManualDeployWorkflow(readFileSync(join(directory, name), 'utf8')); - } catch (error) { - throw new Error(`${name}: ${error.message}`); - } - } - return files; -} - -if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { - const directory = process.argv[2]; - if (!directory) { - console.error('Usage: node scripts/verify-manual-workflows.mjs .github/workflows'); - process.exitCode = 2; - } else { - try { - const files = verifyAllManualWorkflows(directory); - console.log(`[postmerge] PASS: ${files.length} workflows use manual-only events`); - } catch (error) { - console.error(`[postmerge] ERROR: ${error.message}`); - process.exitCode = 4; - } - } -} From 40efc624ddcaa0bf239070d693cee0f5148d7fc8 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 17:24:39 +0900 Subject: [PATCH 68/96] chore(release): remove redundant all-workflow checker after integration into existing verifier --- scripts/verify-manual-workflows.test.mjs | 35 ------------------------ 1 file changed, 35 deletions(-) delete mode 100644 scripts/verify-manual-workflows.test.mjs diff --git a/scripts/verify-manual-workflows.test.mjs b/scripts/verify-manual-workflows.test.mjs deleted file mode 100644 index 337362a5..00000000 --- a/scripts/verify-manual-workflows.test.mjs +++ /dev/null @@ -1,35 +0,0 @@ -import { test } from 'node:test'; -import { strict as assert } from 'node:assert'; -import { mkdtempSync, writeFileSync, rmSync } from 'node:fs'; -import { join } from 'node:path'; -import { tmpdir } from 'node:os'; -import { verifyAllManualWorkflows } from './verify-manual-workflows.mjs'; - -const manual = 'name: Manual\non:\n workflow_dispatch: {}\njobs:\n build:\n runs-on: ubuntu-latest\n'; -const withDir = (fn) => { - const dir = mkdtempSync(join(tmpdir(), 'toolify-manual-all-')); - try { fn(dir); } finally { rmSync(dir, { recursive: true, force: true }); } -}; - -test('all manual yml/yaml workflows pass', () => withDir(dir => { - writeFileSync(join(dir, 'ci.yml'), manual); - writeFileSync(join(dir, 'deploy.yaml'), manual); - assert.deepEqual(verifyAllManualWorkflows(dir), ['ci.yml', 'deploy.yaml']); -})); - -test('any automatic push, PR or schedule is refused', () => withDir(dir => { - writeFileSync(join(dir, 'deploy.yml'), manual); - for (const event of ['push', 'pull_request', 'schedule', 'workflow_run']) { - writeFileSync(join(dir, 'ci.yml'), `name: Auto\non:\n workflow_dispatch: {}\n ${event}: {}\njobs:\n`); - assert.throws(() => verifyAllManualWorkflows(dir), /ci\.yml:/); - } -})); - -test('empty workflow directory must fail closed', () => withDir(dir => { - assert.throws(() => verifyAllManualWorkflows(dir), /No GitHub workflow YAML/); -})); - -test('malformed or inline event syntax fails closed', () => withDir(dir => { - writeFileSync(join(dir, 'ci.yml'), 'on: [workflow_dispatch]\njobs:\n'); - assert.throws(() => verifyAllManualWorkflows(dir), /ci\.yml:/); -})); From 502220db1c152959e48811c7cf0a531091da3c76 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 17:26:24 +0900 Subject: [PATCH 69/96] docs(release): record all 8 manual workflows and fix directory regression test --- docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md index 90f4ec83..c4a3df97 100644 --- a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md +++ b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md @@ -98,3 +98,10 @@ - GitHub readback confirmed **11/11 source wiring assertions**, including Web Share cancellation, fallback, ShareBar route-state resync, Vitest source and release-gate wiring. These checks do **not** replace React browser tests, full project Vitest or Next.js production build. - Public Toolify365 pages were accessible via web retrieval: `/en/tools/character-frequency` displayed related tools plus a Text Batch Studio link. This is evidence of **visible public navigation**, not a release SHA or evidence that PR41 has deployed. The public `/api/release` endpoint could not be verified from the available browser tool. - PR41 remains DRAFT/NO-GO: full repo checkout, npm install, app-wide typecheck/build/Vitest, desktop/mobile share sheet and locale transitions, consent/GA4, human review, merge and owner deploy remain pending. + +## 2026-11-07 17:18 JST — all-workflow manual-only gate regression +- GitHub workflow directory inspected through the repository API: **8 .yml files**. Initially `ci.yml` had push/PR auto-runs and `toolify-live-index.yml` had push/PR auto-runs; another concurrent branch update switched both to `workflow_dispatch: {}`. Re-fetched all eight from PR41 and evaluated the exact fail-closed trigger policy against each: **8/8 now manual-only**. No Actions were executed. +- An update to the existing `scripts/verify-manual-deploy.mjs` already added directory support. Found that its file-extension regexp had been double-escaped (`/\\\\.ya?ml$/i`), so `.yml`/`.yaml` files were not detected. Corrected to a single escaped dot (`/\\.ya?ml$/i`) so the directory actually scans its YAML files. +- Corrected two new directory test flaws: double-escaped newline fixture strings and double-escaped filename regexes. Reconstructed the corrected existing verifier and six checks in a local Node v22 workspace and ran `node --test`: **6 test groups passed, 0 failed**. This local test is a reconstruction; repository-wide `npm test` and Next.js build remain unrun. +- A second all-workflow checker was briefly added during overlapping changes; removed its two files and extra release-gate invocations. `verify-manual-deploy.mjs` and `verify-manual-deploy.test.mjs` remain the **only** workflow policy implementation; `scripts/check-postmerge-embed-release.sh` invokes them for the full `.github/workflows` directory. +- Do **not** claim the production deployment succeeded. PR41 remains Draft/NO-GO until full checkout tests, browser/iOS/Android share/embed checks, review and owner deployment. Current `main` may still have auto-trigger workflow definitions; PR41 must be merged after release gates before those source changes reach main. From 6f34056527323f9945a6c8960a17f8f176d5ceea Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 17:26:30 +0900 Subject: [PATCH 70/96] docs: record 8-workflow manual-only guard and executed 6/6 Node tests --- docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md index c4a3df97..1cae603c 100644 --- a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md +++ b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md @@ -105,3 +105,12 @@ - Corrected two new directory test flaws: double-escaped newline fixture strings and double-escaped filename regexes. Reconstructed the corrected existing verifier and six checks in a local Node v22 workspace and ran `node --test`: **6 test groups passed, 0 failed**. This local test is a reconstruction; repository-wide `npm test` and Next.js build remain unrun. - A second all-workflow checker was briefly added during overlapping changes; removed its two files and extra release-gate invocations. `verify-manual-deploy.mjs` and `verify-manual-deploy.test.mjs` remain the **only** workflow policy implementation; `scripts/check-postmerge-embed-release.sh` invokes them for the full `.github/workflows` directory. - Do **not** claim the production deployment succeeded. PR41 remains Draft/NO-GO until full checkout tests, browser/iOS/Android share/embed checks, review and owner deployment. Current `main` may still have auto-trigger workflow definitions; PR41 must be merged after release gates before those source changes reach main. + +## 2026-11-07 — All eight GitHub Actions workflows manually gated +- Inspected the complete `.github/workflows` directory on the PR41 branch: **8 YAML workflows**. Two had automatic event triggers that the previous deploy-only check did not cover: `ci.yml` (`push` and `pull_request`) and `toolify-live-index.yml` (`push` and `pull_request`). Changed their event declarations **on PR41 only** to `on:\n workflow_dispatch: {}`; retained their existing jobs for potential future owner-controlled use. The other six were already manual-only. +- Extended `scripts/verify-manual-deploy.mjs` with `verifyWorkflowPath(path)` to inspect all `.yml` and `.yaml` entries, reject empty directories, and name the offending file. Updated the root PR41 release gate to check the entire `.github/workflows` directory, rather than `deploy.yml` alone. +- Added two direct Node regression groups for directory traversal and CLI rejection when **CI is automatic despite a safe deployment workflow**. Updated cross-feature integration source checks. +- Reconstructed the exact current GitHub verifier and test sources in a local directory; `git hash-object` agreed with GitHub blobs `c19591c078f8e62557934da9942af0efb56ae0dd` and `0cc267b5f650395bbc1b039afb0c34f7a1228a0b`. Executed `node --test verify-manual-deploy.test.mjs` using Node 22.16.0: **6/6 passed, 0 failed**. +- Re-fetched all eight real workflow files from the PR41 branch and evaluated the same accepted `on` structure: **8/8 passed** (exactly one top-level event block, exactly one `workflow_dispatch: {}`, no unexpected event declarations). +- **Scope warning:** none of these edits changes the `main` branch or disables server-side GitHub Actions configuration immediately. Existing main workflows may still run automatically until a reviewed merge. Do not manually dispatch Actions and do not claim any deploy occurred. +- No full `npm ci`, project Vitest/Next build, mobile/share-sheet QA, GA4/consent verification, review or production deployment. PR41 stays **DRAFT / NO-GO**. From d30a608d7fda64304937cbf4bfe259d8691744aa Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 18:17:00 +0900 Subject: [PATCH 71/96] safety: fail closed on stale VPS deploy lock instead of non-atomic takeover --- ops/deploy-lock.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ops/deploy-lock.sh b/ops/deploy-lock.sh index bbf76c63..5eb3e45d 100755 --- a/ops/deploy-lock.sh +++ b/ops/deploy-lock.sh @@ -17,6 +17,7 @@ set -u cmd=${1:-}; L=${2:-}; me=${3:-}; stale=${4:-3600} [[ -n $cmd && -n $L && -n $me ]] || { echo "usage: acquire|release [stale_sec]"; exit 2; } +[[ $stale =~ ^[0-9]+$ ]] || { echo "stale_sec must be a non-negative integer" >&2; exit 2; } [[ $L == */.deploy.lock.d ]] && { echo "lockdir must be outside the deploy dir: $L"; exit 2; } now=$(date +%s) case $cmd in @@ -29,11 +30,13 @@ case $cmd in o=$(cut -d' ' -f1 "$L/owner" 2>/dev/null || true) t=$(stat -c %Y "$L/owner" 2>/dev/null || stat -c %Y "$L" 2>/dev/null || echo "$now") age=$(( now - t )) - # A deploy that died without releasing must not block forever. + # Do not take over an old lock automatically. The previous code overwrote + # the owner file without any atomic claim; two waiters could both enter a + # live deployment (or steal a lock from a slow, still-running deploy). + # A stale lock requires verification that the prior deployment has stopped. if (( age > stale )); then - echo "$me $now" > "$L/owner" - echo "TAKEOVER stale lock of ${o:-unknown} (age ${age}s > ${stale}s) by $me" - exit 0 + echo "STALE $L held by ${o:-unknown} for ${age}s; refusing unsafe automatic takeover. Verify the prior deploy is inactive before manually clearing the lock." >&2 + exit 3 fi echo "BUSY $L held by ${o:-unknown} for ${age}s" exit 3 From 3230b9302b459c4f46349f629b08246255bf4166 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 18:17:35 +0900 Subject: [PATCH 72/96] fix: require writable lock metadata, portable timestamp and verified release --- ops/deploy-lock.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ops/deploy-lock.sh b/ops/deploy-lock.sh index 5eb3e45d..fbc4eb20 100755 --- a/ops/deploy-lock.sh +++ b/ops/deploy-lock.sh @@ -23,12 +23,16 @@ now=$(date +%s) case $cmd in acquire) if mkdir "$L" 2>/dev/null; then - echo "$me $now" > "$L/owner" + if ! printf '%s %s\n' "$me" "$now" > "$L/owner"; then + rmdir "$L" 2>/dev/null || true + echo "Cannot write lock owner metadata: $L/owner" >&2 + exit 1 + fi echo "ACQUIRED $L by $me" exit 0 fi o=$(cut -d' ' -f1 "$L/owner" 2>/dev/null || true) - t=$(stat -c %Y "$L/owner" 2>/dev/null || stat -c %Y "$L" 2>/dev/null || echo "$now") + t=$(stat -c %Y "$L/owner" 2>/dev/null || stat -f %m "$L/owner" 2>/dev/null || stat -c %Y "$L" 2>/dev/null || stat -f %m "$L" 2>/dev/null || echo "$now") age=$(( now - t )) # Do not take over an old lock automatically. The previous code overwrote # the owner file without any atomic claim; two waiters could both enter a @@ -44,7 +48,11 @@ case $cmd in release) o=$(cut -d' ' -f1 "$L/owner" 2>/dev/null || true) if [[ $o == "$me" ]]; then - rm -f "$L/owner" && rmdir "$L" && echo "RELEASED $L by $me" + if ! { rm -f "$L/owner" && rmdir "$L"; }; then + echo "Failed to release lock: $L" >&2 + exit 1 + fi + echo "RELEASED $L by $me" else echo "NOT OWNER (held by ${o:-nobody}); left as is" fi From c640e55077df33ef7b35774c86eec400874b48c3 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 18:18:22 +0900 Subject: [PATCH 73/96] test: verify deploy lock exclusivity, stale refusal and concurrent acquisition without VPS --- ops/tests/deploy-lock.test.sh | 66 +++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 ops/tests/deploy-lock.test.sh diff --git a/ops/tests/deploy-lock.test.sh b/ops/tests/deploy-lock.test.sh new file mode 100644 index 00000000..3208c5ed --- /dev/null +++ b/ops/tests/deploy-lock.test.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash +# Offline, non-production regression tests for the shared VPS deploy lock. +# No remote SSH, GitHub Actions, application deployment or network access. +set -Eeuo pipefail +ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +HELPER="$ROOT/ops/deploy-lock.sh" +TMP="$(mktemp -d)" +trap 'rm -rf "$TMP"' EXIT +LOCK="$TMP/toolify.deploy.lock.d" +OUT="$TMP/out" + +expect_rc() { + local expected="$1" rc + shift + if "$@" > "$OUT" 2>&1; then rc=0; else rc=$?; fi + if [[ "$rc" -ne "$expected" ]]; then + echo "FAIL: expected exit $expected, got $rc: $*" >&2 + cat "$OUT" >&2 + exit 1 + fi +} + +# An invalid request must never take a lock. +expect_rc 2 bash "$HELPER" acquire "$LOCK" +expect_rc 2 bash "$HELPER" acquire "$LOCK" bad not-a-number +[[ ! -e "$LOCK" ]] + +# Owner exclusivity, wrong-owner release and proper cleanup. +expect_rc 0 bash "$HELPER" acquire "$LOCK" deploy-A +[[ "$(cut -d' ' -f1 "$LOCK/owner")" == "deploy-A" ]] +expect_rc 3 bash "$HELPER" acquire "$LOCK" deploy-B +expect_rc 0 bash "$HELPER" release "$LOCK" deploy-B +[[ -d "$LOCK" && "$(cut -d' ' -f1 "$LOCK/owner")" == "deploy-A" ]] +expect_rc 0 bash "$HELPER" release "$LOCK" deploy-A +[[ ! -e "$LOCK" ]] + +# An old lock must not be stolen, even when its age exceeds the threshold. +expect_rc 0 bash "$HELPER" acquire "$LOCK" deploy-old +touch -t 202001010000.00 "$LOCK/owner" +expect_rc 3 bash "$HELPER" acquire "$LOCK" deploy-new 1 +grep -q 'STALE' "$OUT" +[[ "$(cut -d' ' -f1 "$LOCK/owner")" == "deploy-old" ]] +expect_rc 0 bash "$HELPER" release "$LOCK" deploy-old + +# Concurrent invocations may admit exactly one owner. +SUCCESS="$TMP/successes" +: > "$SUCCESS" +for i in 1 2 3 4 5 6 7 8 9 10 11 12; do + ( + if bash "$HELPER" acquire "$LOCK" "worker-$i" > /dev/null 2>&1; then + printf '%s\n' "$i" >> "$SUCCESS" + fi + ) & +done +wait +[[ "$(wc -l < "$SUCCESS" | tr -d ' ')" == "1" ]] || { + echo "FAIL: simultaneous lock holders detected" >&2 + cat "$SUCCESS" >&2 + exit 1 +} +winner="$(cut -d' ' -f1 "$LOCK/owner")" +[[ "$winner" == worker-* ]] +expect_rc 0 bash "$HELPER" release "$LOCK" "$winner" +[[ ! -e "$LOCK" ]] + +echo "PASS: shared deploy lock ownership, stale refusal and 12-way concurrency" From 798f0d0e3b67993da15ee2c97180a75f69422da3 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 18:18:36 +0900 Subject: [PATCH 74/96] test: run lock exclusivity and stale-refusal regression in release gate --- scripts/check-postmerge-embed-release.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/check-postmerge-embed-release.sh b/scripts/check-postmerge-embed-release.sh index 65030105..5bf1f887 100644 --- a/scripts/check-postmerge-embed-release.sh +++ b/scripts/check-postmerge-embed-release.sh @@ -18,6 +18,8 @@ fi # Do not execute GitHub Actions; inspect workflow YAML locally. node "$ROOT/scripts/verify-manual-deploy.mjs" "$ROOT/.github/workflows" node --test "$ROOT/scripts/verify-manual-deploy.test.mjs" +# Exercise the shared VPS deploy lock safely against temporary local paths. +bash "$ROOT/ops/tests/deploy-lock.test.sh" # The site config falls back to example.pages.dev when the public origin is unset. # Pin this production release gate to the canonical origin to prevent wrong # canonical, share and iframe URLs in an otherwise successful Next build. From 265a94726e9f7139a373d8f3595155156441f407 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 18:18:50 +0900 Subject: [PATCH 75/96] fix(seo): detect robots none directive as noindex in live growth smoke --- site/scripts/growth-html-checks.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/scripts/growth-html-checks.mjs b/site/scripts/growth-html-checks.mjs index 425587a9..c1444c27 100644 --- a/site/scripts/growth-html-checks.mjs +++ b/site/scripts/growth-html-checks.mjs @@ -7,11 +7,11 @@ function renderedMarkup(html) { } export function hasNoindex(html, xRobotsTag = "") { // X-Robots-Tag may be repeated/comma-delimited, and can target a specific crawler. - if (/(?:^|[,\s:])noindex(?:$|[,\s])/i.test(xRobotsTag)) return true; + if (/(?:^|[,\s:])(?:noindex|none)(?:$|[,\s])/i.test(xRobotsTag)) return true; return [...renderedMarkup(html).matchAll(/]*>/gi)].some(([tag]) => { const name = tag.match(/\bname\s*=\s*["'](robots|googlebot)["']/i); const value = tag.match(/\bcontent\s*=\s*["']([^"']+)["']/i)?.[1] ?? ''; - return Boolean(name) && /(?:^|[,\s])noindex(?:$|[,\s])/i.test(value); + return Boolean(name) && /(?:^|[,\s])(?:noindex|none)(?:$|[,\s])/i.test(value); }); } export function canonicalHref(html) { From 960f6cf049b95ec5d35d3683e2f018ba76f6cfe4 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 18:19:05 +0900 Subject: [PATCH 76/96] test(seo): cover robots none and guard against directive prefix false positives --- site/scripts/growth-html-checks.test.mjs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/site/scripts/growth-html-checks.test.mjs b/site/scripts/growth-html-checks.test.mjs index d085727c..98a4818e 100644 --- a/site/scripts/growth-html-checks.test.mjs +++ b/site/scripts/growth-html-checks.test.mjs @@ -6,12 +6,18 @@ test('robots and googlebot directives independent of attribute order', () => { assert.equal(hasNoindex(''), true); assert.equal(hasNoindex(""), true); assert.equal(hasNoindex(''), false); + assert.equal(hasNoindex(''), true); + assert.equal(hasNoindex(''), true); + assert.equal(hasNoindex(''), false); assert.equal(hasNoindex(''), false); assert.equal(hasNoindex(''), false); assert.equal(hasNoindex("", "noindex, nofollow"), true); assert.equal(hasNoindex("", "googlebot: noindex, follow"), true); assert.equal(hasNoindex("", "noindexing"), false); assert.equal(hasNoindex("", "index, follow"), false); + assert.equal(hasNoindex("", "none"), true); + assert.equal(hasNoindex("", "googlebot: none, follow"), true); + assert.equal(hasNoindex("", "nonewhat"), false); assert.equal(hasNoindex(''), false); assert.equal(hasNoindex(''), false); }); From b9fb6ebf4412d30a8e0564c21b068f05aced0a4c Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 18:19:21 +0900 Subject: [PATCH 77/96] fix(seo): reject unexpected canonical and redirect query/fragment parameters --- site/scripts/check-live-growth.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/scripts/check-live-growth.mjs b/site/scripts/check-live-growth.mjs index 96279800..ea58d236 100644 --- a/site/scripts/check-live-growth.mjs +++ b/site/scripts/check-live-growth.mjs @@ -47,7 +47,7 @@ for (const path of paths) { const page = await get(path); if (page.status !== 200) failures.push(`${path}: HTTP ${page.status}`); const finalUrl = new URL(page.url); - if (finalUrl.origin !== base.origin || finalUrl.pathname.replace(/[/]$/, "") !== path) { + if (finalUrl.origin !== base.origin || finalUrl.pathname.replace(/[/]$/, "") !== path || finalUrl.search || finalUrl.hash) { failures.push(`${path}: unexpected redirect to ${page.url}`); } if (!page.contentType.includes("text/html")) failures.push(`${path}: not HTML (${page.contentType})`); @@ -65,7 +65,7 @@ for (const path of paths) { } else { try { const canonical = new URL(canonicalValue, base); - if (canonical.origin !== base.origin || canonical.pathname.replace(/[/]$/, "") !== path) { + if (canonical.origin !== base.origin || canonical.pathname.replace(/[/]$/, "") !== path || canonical.search || canonical.hash) { failures.push(`${path}: unexpected canonical ${canonical.href}`); } } catch { failures.push(`${path}: malformed canonical`); } From 4bdee099db66c78393862dd3582d6e82eb9e3581 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 18:20:19 +0900 Subject: [PATCH 78/96] docs: record exact-hash deploy lock concurrency tests and manual stale-lock recovery limitation --- docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md index 1cae603c..43761f40 100644 --- a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md +++ b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md @@ -114,3 +114,12 @@ - Re-fetched all eight real workflow files from the PR41 branch and evaluated the same accepted `on` structure: **8/8 passed** (exactly one top-level event block, exactly one `workflow_dispatch: {}`, no unexpected event declarations). - **Scope warning:** none of these edits changes the `main` branch or disables server-side GitHub Actions configuration immediately. Existing main workflows may still run automatically until a reviewed merge. Do not manually dispatch Actions and do not claim any deploy occurred. - No full `npm ci`, project Vitest/Next build, mobile/share-sheet QA, GA4/consent verification, review or production deployment. PR41 stays **DRAFT / NO-GO**. + +## 2026-11-07 — Shared VPS deploy-lock concurrency and stale-lock safety +- Inspected `ops/deploy-lock.sh` used by VPS deployment flows. Previously, when a lock passed `stale_sec`, **any** second acquirer overwrote the existing `owner` file and returned success, with no atomic recovery claim. Two waiting deploys could both proceed, and a genuinely slow deployment could be interrupted. +- Changed the PR41 version of the helper to **fail closed** for stale locks (exit 3, retaining the original owner), with a message to verify the old deployment is inactive before any manual cleanup. Added positive-integer input checking for `stale_sec`, fail-on-write for owner metadata, explicit release failures and GNU/BSD timestamp fallback for Linux VPS and Mac local test support. +- Added `ops/tests/deploy-lock.test.sh` (offline only, under `mktemp -d`) to verify missing/invalid arguments, ownership, refusal of second acquirer, non-owner release safety, proper cleanup, refusal to steal a deliberately aged lock, and **12 simultaneous acquisition attempts with exactly one winner**. +- Wired `bash "$ROOT/ops/tests/deploy-lock.test.sh"` into `scripts/check-postmerge-embed-release.sh` before npm dependency installation. No VPS SSH, GitHub Actions, or deployment is performed by this test. +- Retrieved exact current GitHub sources and recreated them byte-for-byte in an isolated container. `git hash-object` matched `ops/deploy-lock.sh` blob `fbc4eb20dc3c6cb7a7c86a81150fd97b14c9ff36` and `ops/tests/deploy-lock.test.sh` blob `3208c5ed37b1911e18251f424e75bf4ac41541ae`. Both `bash -n` checks passed, and the actual local Bash regression script printed **PASS** (including the 12-way concurrency case). +- **Operational tradeoff:** stale locks now require an operator to check running rsync/PM2/deployment jobs and confirm the earlier deployment has stopped before manually clearing the lock directory. This is intentional to avoid overlapping deployment corruption; it may block deployments until investigated. +- **Scope:** all modifications are on **draft PR41**, not current main or the live VPS. Full site npm/Vitest/Next build, device/browser/GA4 verification, code review, merge and owner deployment are still pending. **NO-GO**. From 609e0c38213cfcbf9fd9ceb5bcfc0f13b804325e Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 18:21:14 +0900 Subject: [PATCH 79/96] fix(seo): compare exact sitemap loc URLs instead of prefix search --- site/scripts/growth-html-checks.mjs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/site/scripts/growth-html-checks.mjs b/site/scripts/growth-html-checks.mjs index c1444c27..a200e5d1 100644 --- a/site/scripts/growth-html-checks.mjs +++ b/site/scripts/growth-html-checks.mjs @@ -30,3 +30,12 @@ export function hasSoftwareAnchor(html, slug, locale, origin = 'https://toolify3 } catch { return false; } }); } + +/** Match complete values, never URL prefixes that may identify a different page. */ +export function hasSitemapLocation(xml, target) { + return [...xml.matchAll(/]*)?>([^<]+)<\/loc\s*>/gi)].some(([, value]) => { + try { + return new URL(value.trim().replace(/&/g, '&')).href === new URL(target).href; + } catch { return false; } + }); +} From bd0ff4e62710a574230067aa0698b2be2d6bee28 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 18:21:27 +0900 Subject: [PATCH 80/96] test(seo): enforce exact sitemap location and reject misleading prefixes --- site/scripts/growth-html-checks.test.mjs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/site/scripts/growth-html-checks.test.mjs b/site/scripts/growth-html-checks.test.mjs index 98a4818e..88389e8f 100644 --- a/site/scripts/growth-html-checks.test.mjs +++ b/site/scripts/growth-html-checks.test.mjs @@ -1,6 +1,6 @@ import { test } from 'node:test'; import { strict as assert } from 'node:assert'; -import { hasNoindex, canonicalHref, hasSoftwareAnchor } from './growth-html-checks.mjs'; +import { hasNoindex, canonicalHref, hasSoftwareAnchor, hasSitemapLocation } from './growth-html-checks.mjs'; test('robots and googlebot directives independent of attribute order', () => { assert.equal(hasNoindex(''), true); @@ -38,3 +38,14 @@ test('CTA must be an anchor, not an inert script string', () => { assert.equal(hasSoftwareAnchor('Open', 'json-studio', 'en'), false); assert.equal(hasSoftwareAnchor('Open', 'json-studio', 'en', 'https://staging.example'), true); }); + +test('sitemap target requires exact loc match, not URL prefix', () => { + const target = 'https://toolify365.com/en/tools/character-frequency'; + const xml = '' + target + '-fake'; + assert.equal(hasSitemapLocation(xml, target), false); + assert.equal(hasSitemapLocation('' + target + '', target), true); + assert.equal(hasSitemapLocation('https://toolify365.com/en/tools/character-frequency?ref=x', target), false); + assert.equal(hasSitemapLocation('https://wrong.example/en/tools/character-frequency', target), false); + assert.equal(hasSitemapLocation('invalid relative address', target), false); + assert.equal(hasSitemapLocation('https://toolify365.com/en/tools/character-frequency', target), false); +}); From 1b6ae67b4f90016529a17125136041d2e63fb1a8 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 18:21:40 +0900 Subject: [PATCH 81/96] fix(seo): use exact sitemap entries for live growth smoke --- site/scripts/check-live-growth.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/scripts/check-live-growth.mjs b/site/scripts/check-live-growth.mjs index ea58d236..bc6e7fec 100644 --- a/site/scripts/check-live-growth.mjs +++ b/site/scripts/check-live-growth.mjs @@ -1,4 +1,4 @@ -import { hasNoindex, canonicalHref, hasSoftwareAnchor } from "./growth-html-checks.mjs"; +import { hasNoindex, canonicalHref, hasSoftwareAnchor, hasSitemapLocation } from "./growth-html-checks.mjs"; /** * Read-only production smoke check for growth funnel rollout. * Usage: SITE_URL=https://toolify365.com node scripts/check-live-growth.mjs @@ -84,7 +84,7 @@ for (const path of ["/robots.txt", "/sitemap.xml"]) { if (path === "/sitemap.xml") { if (!page.text.includes("")) failures.push("sitemap.xml: no URL locations"); for (const target of expectedIndexed) { - if (!page.text.includes(`${base.origin}${target}`)) failures.push(`sitemap.xml: expected indexed tool missing (${target})`); + if (!hasSitemapLocation(page.text, `${base.origin}${target}`)) failures.push(`sitemap.xml: expected indexed tool missing (${target})`); } } console.log(`${page.status} ${path}`); From d3dffcfed16456fabaebb828bb172024ac050215 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 18:21:59 +0900 Subject: [PATCH 82/96] docs: record repeated 12-worker lock test runs and accurate stale threshold validation --- docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md index 43761f40..4d21fc17 100644 --- a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md +++ b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md @@ -117,9 +117,9 @@ ## 2026-11-07 — Shared VPS deploy-lock concurrency and stale-lock safety - Inspected `ops/deploy-lock.sh` used by VPS deployment flows. Previously, when a lock passed `stale_sec`, **any** second acquirer overwrote the existing `owner` file and returned success, with no atomic recovery claim. Two waiting deploys could both proceed, and a genuinely slow deployment could be interrupted. -- Changed the PR41 version of the helper to **fail closed** for stale locks (exit 3, retaining the original owner), with a message to verify the old deployment is inactive before any manual cleanup. Added positive-integer input checking for `stale_sec`, fail-on-write for owner metadata, explicit release failures and GNU/BSD timestamp fallback for Linux VPS and Mac local test support. +- Changed the PR41 version of the helper to **fail closed** for stale locks (exit 3, retaining the original owner), with a message to verify the old deployment is inactive before any manual cleanup. Added non-negative integer input checking for `stale_sec`, fail-on-write for owner metadata, explicit release failures and GNU/BSD timestamp fallback for Linux VPS and Mac local test support. - Added `ops/tests/deploy-lock.test.sh` (offline only, under `mktemp -d`) to verify missing/invalid arguments, ownership, refusal of second acquirer, non-owner release safety, proper cleanup, refusal to steal a deliberately aged lock, and **12 simultaneous acquisition attempts with exactly one winner**. - Wired `bash "$ROOT/ops/tests/deploy-lock.test.sh"` into `scripts/check-postmerge-embed-release.sh` before npm dependency installation. No VPS SSH, GitHub Actions, or deployment is performed by this test. -- Retrieved exact current GitHub sources and recreated them byte-for-byte in an isolated container. `git hash-object` matched `ops/deploy-lock.sh` blob `fbc4eb20dc3c6cb7a7c86a81150fd97b14c9ff36` and `ops/tests/deploy-lock.test.sh` blob `3208c5ed37b1911e18251f424e75bf4ac41541ae`. Both `bash -n` checks passed, and the actual local Bash regression script printed **PASS** (including the 12-way concurrency case). +- Retrieved exact current GitHub sources and recreated them byte-for-byte in an isolated container. `git hash-object` matched `ops/deploy-lock.sh` blob `fbc4eb20dc3c6cb7a7c86a81150fd97b14c9ff36` and `ops/tests/deploy-lock.test.sh` blob `3208c5ed37b1911e18251f424e75bf4ac41541ae`. Both `bash -n` checks passed, and the actual local Bash regression script printed **PASS** (including the 12-way concurrency case). The same test passed in **10 further consecutive executions**, each including the 12-worker contention case. - **Operational tradeoff:** stale locks now require an operator to check running rsync/PM2/deployment jobs and confirm the earlier deployment has stopped before manually clearing the lock directory. This is intentional to avoid overlapping deployment corruption; it may block deployments until investigated. - **Scope:** all modifications are on **draft PR41**, not current main or the live VPS. Full site npm/Vitest/Next build, device/browser/GA4 verification, code review, merge and owner deployment are still pending. **NO-GO**. From b19523ec738dfdd76e1d607965df06488d63a828 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 18:22:46 +0900 Subject: [PATCH 83/96] fix(test): malformed sitemap loc is the negative case, not a valid URL --- site/scripts/growth-html-checks.test.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/scripts/growth-html-checks.test.mjs b/site/scripts/growth-html-checks.test.mjs index 88389e8f..1197fc44 100644 --- a/site/scripts/growth-html-checks.test.mjs +++ b/site/scripts/growth-html-checks.test.mjs @@ -47,5 +47,5 @@ test('sitemap target requires exact loc match, not URL prefix', () => { assert.equal(hasSitemapLocation('https://toolify365.com/en/tools/character-frequency?ref=x', target), false); assert.equal(hasSitemapLocation('https://wrong.example/en/tools/character-frequency', target), false); assert.equal(hasSitemapLocation('invalid relative address', target), false); - assert.equal(hasSitemapLocation('https://toolify365.com/en/tools/character-frequency', target), false); + assert.equal(hasSitemapLocation('https://toolify365.com/en/tools/character-frequency', target), false); }); From b26d347c45701901ee6b1281153558e085e5889d Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 18:25:26 +0900 Subject: [PATCH 84/96] docs(release): record exact-blob 4/4 SEO smoke and offline concurrent deploy lock PASS --- docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md index 4d21fc17..38c672e9 100644 --- a/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md +++ b/docs/PR40_POSTMERGE_FOLLOWUP_2026-11-07.md @@ -123,3 +123,10 @@ - Retrieved exact current GitHub sources and recreated them byte-for-byte in an isolated container. `git hash-object` matched `ops/deploy-lock.sh` blob `fbc4eb20dc3c6cb7a7c86a81150fd97b14c9ff36` and `ops/tests/deploy-lock.test.sh` blob `3208c5ed37b1911e18251f424e75bf4ac41541ae`. Both `bash -n` checks passed, and the actual local Bash regression script printed **PASS** (including the 12-way concurrency case). The same test passed in **10 further consecutive executions**, each including the 12-worker contention case. - **Operational tradeoff:** stale locks now require an operator to check running rsync/PM2/deployment jobs and confirm the earlier deployment has stopped before manually clearing the lock directory. This is intentional to avoid overlapping deployment corruption; it may block deployments until investigated. - **Scope:** all modifications are on **draft PR41**, not current main or the live VPS. Full site npm/Vitest/Next build, device/browser/GA4 verification, code review, merge and owner deployment are still pending. **NO-GO**. + +## 2026-11-07 — verified SEO smoke and deploy-lock regressions +- **Live growth smoke code hardened:** both HTML robots meta and HTTP X-Robots-Tag now treat `none` as noindex (as well as `noindex`), without falsely matching prefixes. Canonical and final redirect URL checks reject unexpected query/fragment suffixes. The sitemap check now parses exact `` values instead of accepting string-prefix matches against another page. +- Added Node regression cases to `site/scripts/growth-html-checks.test.mjs`. An initial new sitemap case incorrectly expected a **valid** complete URL to be rejected and failed; corrected the test to use a genuinely malformed unclosed ``. Copied the final actual GitHub files locally and verified exact Git blob SHAs: `growth-html-checks.mjs` `a200e5d15afa3b148c86f29cf398abaa76ae58d8`, test `1197fc449cf38deec8cf0d5ed1230634290e177d`. **`node --test`: 4/4 passed, zero failures.** +- **VPS deploy-lock regression executed** offline with GitHub-exact blobs: `ops/deploy-lock.sh` `fbc4eb20dc3c6cb7a7c86a81150fd97b14c9ff36`, `ops/tests/deploy-lock.test.sh` `3208c5ed37b1911e18251f424e75bf4ac41541ae`. `bash ops/tests/deploy-lock.test.sh` printed **PASS**: owner exclusivity, wrong-owner release refusal, stale-lock takeover refusal, and 12 concurrent contenders yielding one lock owner. This does not touch the VPS or perform a deployment. +- Both tests are included in the existing branch-guarded release workflow: `npm run test:smoke-html` and `bash ops/tests/deploy-lock.test.sh` within `bash scripts/check-postmerge-embed-release.sh`. +- **Release still NO-GO:** private repository git clone cannot resolve github.com in this runtime; `npm ci`, full TypeScript/Vitest, Next.js production build, desktop/mobile browser QA, merging, actual deployment and post-deploy metrics are **not verified**. Also do not interpret the public web tool's failure to fetch `/sitemap.xml` as proof of a site outage; that request was inconclusive. From 42bc78c4c1e8012c6278609e32aadeb0f6edf076 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 20:44:19 +0900 Subject: [PATCH 85/96] fix(seo): qualify distributed embed attribution links as nofollow --- site/src/lib/tools/embed-html.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/src/lib/tools/embed-html.ts b/site/src/lib/tools/embed-html.ts index fc7733a8..4dcb4ae6 100644 --- a/site/src/lib/tools/embed-html.ts +++ b/site/src/lib/tools/embed-html.ts @@ -33,5 +33,5 @@ export function buildToolEmbedSnippet(title: string, embedUrl: string, toolUrl: const safeTitle = escapeHtml(title); const safeEmbedSrc = escapeHtml(safeEmbedUrl(embedUrl, 'about:blank')); const safeToolUrl = escapeHtml(safeEmbedUrl(toolUrl, 'https://toolify365.com')); - return `\n

Free ${safeTitle} by toolify365

`; + return `\n

Free ${safeTitle} by toolify365

`; } From 6039cf00f0c450529c5a6e8ac397839ba59c884e Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 20:44:38 +0900 Subject: [PATCH 86/96] docs(embed): describe attribution as user benefit, not forced SEO backlinks --- site/src/components/tools/ShareBar.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/site/src/components/tools/ShareBar.tsx b/site/src/components/tools/ShareBar.tsx index ddfb55f7..3412e835 100644 --- a/site/src/components/tools/ShareBar.tsx +++ b/site/src/components/tools/ShareBar.tsx @@ -119,10 +119,9 @@ export function ShareBar({ url, embedUrl, title, slug }: Props) { }, [url, slug]); // Resync result-link visibility on locale or tool navigation. const enc = encodeURIComponent; - // 埋め込みコードには iframe に加えて「ホストページ側の dofollow 被リンク」を必ず付ける。 - // iframe 内の "Powered by" は toolify 自身のドキュメント内に閉じており被リンク価値が渡らないため、 - // 埋め込んだ他サイトの HTML に、ツール名をアンカーテキストにした当該ツールページへの直リンクを置く。 - // これが量産ツール(222本)を被リンク資産に変える肝(toolify は権威性不足で平均48位=page5のため)。 + // 埋め込みコードには、利用者が出典を確認できる視認可能なリンクを添える。 + // ウィジェット配布による被リンクの検索順位操作は避け、 + // HTML生成側で nofollow とセキュリティ属性を付与する。 const snippet = buildToolEmbedSnippet(title, embedUrl, url); const socials = [ From 8cbc09f59e5fd09c174bad9995a63f292b6304b0 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 20:45:23 +0900 Subject: [PATCH 87/96] fix: reject fake data-* HTML attributes in live SEO and software CTA checks --- site/scripts/growth-html-checks.mjs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/site/scripts/growth-html-checks.mjs b/site/scripts/growth-html-checks.mjs index a200e5d1..d9e8d260 100644 --- a/site/scripts/growth-html-checks.mjs +++ b/site/scripts/growth-html-checks.mjs @@ -1,3 +1,14 @@ +/** Match full HTML attributes, not data-name/data-rel/data-href or quoted text. */ +function attributeValue(tag, wanted) { + const pattern = /(?:^|\s)([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>]+)))?/g; + for (const match of tag.matchAll(pattern)) { + if (match[1].toLowerCase() === wanted) { + return match[2] ?? match[3] ?? match[4] ?? ''; + } + } + return null; +} + function renderedMarkup(html) { // Ignore comments and serialized hydration/script payloads that can contain fake tags. return html @@ -9,20 +20,20 @@ export function hasNoindex(html, xRobotsTag = "") { // X-Robots-Tag may be repeated/comma-delimited, and can target a specific crawler. if (/(?:^|[,\s:])(?:noindex|none)(?:$|[,\s])/i.test(xRobotsTag)) return true; return [...renderedMarkup(html).matchAll(/]*>/gi)].some(([tag]) => { - const name = tag.match(/\bname\s*=\s*["'](robots|googlebot)["']/i); - const value = tag.match(/\bcontent\s*=\s*["']([^"']+)["']/i)?.[1] ?? ''; - return Boolean(name) && /(?:^|[,\s])(?:noindex|none)(?:$|[,\s])/i.test(value); + const name = attributeValue(tag, 'name')?.toLowerCase(); + const value = attributeValue(tag, 'content') ?? ''; + return (name === 'robots' || name === 'googlebot') && /(?:^|[,\s])(?:noindex|none)(?:$|[,\s])/i.test(value); }); } export function canonicalHref(html) { - const tag = [...renderedMarkup(html).matchAll(/]*>/gi)].map(([v]) => v).find(t => /\brel\s*=\s*["']canonical["']/i.test(t)); - return tag?.match(/\bhref\s*=\s*["']([^"']+)["']/i)?.[1]?.replace(/&/g, '&') ?? null; + const tag = [...renderedMarkup(html).matchAll(/]*>/gi)].map(([v]) => v).find(t => (attributeValue(t, 'rel') ?? '').toLowerCase().split(/\s+/).includes('canonical')); + return attributeValue(tag ?? '', 'href')?.replace(/&/g, '&') ?? null; } export function hasSoftwareAnchor(html, slug, locale, origin = 'https://toolify365.com') { const markup = renderedMarkup(html); const destination = `/software/${slug}`; return [...markup.matchAll(/]*>/gi)].some(([tag]) => { - const href = tag.match(/\bhref\s*=\s*["']([^"']+)["']/i)?.[1]?.replace(/&/g, '&'); + const href = attributeValue(tag, 'href')?.replace(/&/g, '&'); if (!href) return false; try { const url = new URL(href, origin); From 352e4c5ae3f66cae073e47d4b1299b6b650b9d8b Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 20:45:30 +0900 Subject: [PATCH 88/96] test(seo): require nofollow on embedded widget attribution --- site/scripts/growth-integration.test.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/scripts/growth-integration.test.mjs b/site/scripts/growth-integration.test.mjs index 426d81ed..c35c7e37 100644 --- a/site/scripts/growth-integration.test.mjs +++ b/site/scripts/growth-integration.test.mjs @@ -80,7 +80,7 @@ test('embedded tool HTML escapes title and attribute values', () => { assert.ok(html.includes('const safeTitle = escapeHtml(title)')); assert.ok(html.includes("const safeEmbedSrc = escapeHtml(safeEmbedUrl(embedUrl, 'about:blank'))")); assert.ok(html.includes("const safeToolUrl = escapeHtml(safeEmbedUrl(toolUrl, 'https://toolify365.com'))")); - assert.ok(html.includes('rel="noopener"')); + assert.ok(html.includes('rel="noopener noreferrer nofollow"')); assert.ok(html.includes('if (parsed.protocol === "https:" || localDev) return value')); assert.ok(html.includes('if (parsed.username || parsed.password) return fallback')); assert.ok(html.includes('value.trim() !== value')); From 39b230daa90ae66c8b0cfc7b4c55599166f96907 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 20:45:49 +0900 Subject: [PATCH 89/96] test: reject data-* and quoted lookalike HTML attributes in growth smoke --- site/scripts/growth-html-checks.test.mjs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/site/scripts/growth-html-checks.test.mjs b/site/scripts/growth-html-checks.test.mjs index 1197fc44..e96d6e8d 100644 --- a/site/scripts/growth-html-checks.test.mjs +++ b/site/scripts/growth-html-checks.test.mjs @@ -49,3 +49,20 @@ test('sitemap target requires exact loc match, not URL prefix', () => { assert.equal(hasSitemapLocation('invalid relative address', target), false); assert.equal(hasSitemapLocation('https://toolify365.com/en/tools/character-frequency', target), false); }); + +test('SEO and CTA checks require real attribute names, never lookalike data-*', () => { + assert.equal(hasNoindex(''), false); + assert.equal(hasNoindex(''), false); + assert.equal(hasNoindex(''), false); + assert.equal(hasNoindex(''), true); + + assert.equal(canonicalHref(''), null); + assert.equal(canonicalHref(''), '/real'); + assert.equal(canonicalHref(''), null); + assert.equal(canonicalHref(''), '/real'); + + assert.equal(hasSoftwareAnchor('Open', 'json-studio', 'en'), false); + assert.equal(hasSoftwareAnchor('Open', 'json-studio', 'en'), false); + assert.equal(hasSoftwareAnchor('Open', 'json-studio', 'en'), false); + assert.equal(hasSoftwareAnchor('Open', 'json-studio', 'en'), true); +}); From f0ea009ce15143e4580c3fac4b512f24ab587ac6 Mon Sep 17 00:00:00 2001 From: appdevelopsk Date: Sat, 7 Nov 2026 20:46:03 +0900 Subject: [PATCH 90/96] test(embed): keep visible attribution while qualifying distributed widget links --- site/src/lib/tools/embed-html.test.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/site/src/lib/tools/embed-html.test.ts b/site/src/lib/tools/embed-html.test.ts index 3a9d2083..263645ff 100644 --- a/site/src/lib/tools/embed-html.test.ts +++ b/site/src/lib/tools/embed-html.test.ts @@ -13,6 +13,17 @@ describe("safe tool embed HTML", () => { expect(snippet).toContain('href="https://toolify365.com/en/tools?a=1&b=2"'); expect(snippet).toContain('>A&B "Calculator"'); }); + it("qualifies distributed widget attribution links without affecting visible citations", () => { + const snippet = buildToolEmbedSnippet("My Tool", "https://toolify365.com/embed/en/test", "https://toolify365.com/en/tools/test"); + const links = [...snippet.matchAll(/]*>/g)].map((m) => m[0]); + expect(links).toHaveLength(2); + for (const link of links) { + expect(link).toContain('rel="noopener noreferrer nofollow"'); + expect(link).toContain('target="_blank"'); + } + expect(snippet).toContain('>My Tool'); + expect(snippet).toContain('>toolify365'); + }); it("cannot inject markup through title or a quoted attribute", () => { const snippet = buildToolEmbedSnippet('">', 'https://toolify365.com/embed" onload="alert(1)', "https://toolify365.com/tool' onclick='evil()"); expect(snippet).not.toContain('