fix(#4482): strip Copilot notes from OpenCode artifacts (#4532)

* fix(#4482): strip Copilot notes from OpenCode artifacts

* chore: add changeset for #4532

* fix(#4482): filter runtime notes across emitted surfaces

* fix(#4482): make runtime note filtering runtime-neutral

* test(#4482): keep ack fixture outside registered provenance

---------

Co-authored-by: Tom Boucher <trekkie@nomorestars.com>
This commit is contained in:
Michel Moreira
2026-09-10 16:29:08 -03:00
committed by GitHub
parent 1e47560e34
commit 93ba63aeff
7 changed files with 184 additions and 26 deletions

View File

@@ -182,6 +182,18 @@ const ZCODE_BODY_TRANSFORM_SRCS = [
'bin/install.js',
];
// #4482: every non-Copilot runtime filters audience-specific notes through the
// conversion module and the published installer copy path.
const RUNTIME_NOTE_FILTER_TRANSFORM_SRCS = [
'src/runtime-artifact-conversion.cts',
'bin/install.js',
];
const RUNTIME_NOTE_FILTERED_FAMILIES = new Set(
MANIFEST_FAMILIES
.filter(({ runtime }) => runtime !== 'copilot')
.map(({ name }) => name),
);
/**
* A `sources` entry ending in `/` is a PREFIX, not a file: it means "any repo path
* under this directory legitimately explains this emitted path". Used where an
@@ -266,13 +278,22 @@ const PROVENANCE_RULES = [
// ── Verbatim engine payload ────────────────────────────────────────────────
{
id: 'gsd-core-verbatim',
kind: 'identity',
// Markdown payloads pass through copyWithPathReplacement's audience
// filter for non-Copilot runtimes. Non-Markdown payloads remain byte-for-
// byte copies, but one rule has one kind; the match-specific transform
// list below keeps the causal attribution precise.
kind: 'derived',
roots: ['gsd-core'],
// Enumerated subdirs, NOT `.+`: a new gsd-core/<subdir> must fail totality
// loudly rather than being absorbed silently. Also keeps this mutually
// exclusive with the two synthesized gsd-core top-level files below.
pattern: /^(workflows|references|templates|contexts|bin)\/.+$/,
sources: (m) => [`gsd-core/${m[0]}`],
transforms: (m, ctx) => (
m[0].endsWith('.md') && RUNTIME_NOTE_FILTERED_FAMILIES.has(ctx.runtime)
? RUNTIME_NOTE_FILTER_TRANSFORM_SRCS
: []
),
},
{
id: 'gsd-core-commands-corpus',
@@ -525,6 +546,7 @@ const PROVENANCE_RULES = [
// ZCODE_BODY_TRANSFORM_SRCS), so the converter change explains theirs too.
transforms: (_m, ctx) => {
if (ctx.runtime === 'antigravity') return ANTIGRAVITY_SKILL_TRANSFORM_SRCS;
if (RUNTIME_NOTE_FILTERED_FAMILIES.has(ctx.runtime)) return RUNTIME_NOTE_FILTER_TRANSFORM_SRCS;
if (ctx.runtime === 'zcode') return ZCODE_BODY_TRANSFORM_SRCS;
return [];
},
@@ -540,7 +562,11 @@ const PROVENANCE_RULES = [
sources: (m) => [`${COMMANDS_SRC}/${stripSkillPrefix(m[2])}.md`],
// #4002: zcode's nested router children pass through the same rewrite pass
// as its flat skills — see ZCODE_BODY_TRANSFORM_SRCS.
transforms: (_m, ctx) => (ctx.runtime === 'zcode' ? ZCODE_BODY_TRANSFORM_SRCS : []),
transforms: (_m, ctx) => {
if (RUNTIME_NOTE_FILTERED_FAMILIES.has(ctx.runtime)) return RUNTIME_NOTE_FILTER_TRANSFORM_SRCS;
if (ctx.runtime === 'zcode') return ZCODE_BODY_TRANSFORM_SRCS;
return [];
},
},
{
id: 'flat-commands-from-commands',
@@ -548,9 +574,14 @@ const PROVENANCE_RULES = [
roots: ['commands', 'command'],
pattern: /^gsd-([^/]+)\.md$/,
sources: (m) => [`${COMMANDS_SRC}/${m[1]}.md`],
// #4482: OpenCode command bodies pass through its command converter.
// #4002: zcode command bodies pass through _applyRuntimeRewrites with
// converter: null — see ZCODE_BODY_TRANSFORM_SRCS above.
transforms: (_m, ctx) => (ctx.runtime === 'zcode' ? ZCODE_BODY_TRANSFORM_SRCS : []),
transforms: (_m, ctx) => {
if (RUNTIME_NOTE_FILTERED_FAMILIES.has(ctx.runtime)) return RUNTIME_NOTE_FILTER_TRANSFORM_SRCS;
if (ctx.runtime === 'zcode') return ZCODE_BODY_TRANSFORM_SRCS;
return [];
},
},
// ── Descriptor-declared native plugin / extension ─────────────────────────
@@ -920,6 +951,7 @@ module.exports = {
SKILLS_ROOTS,
KIMI_ROOT_AGENT_SRC,
AGENT_TRANSFORM_SRCS,
RUNTIME_NOTE_FILTER_TRANSFORM_SRCS,
SOURCE_PREFIX_SUFFIX,
HOOKS_ROOTS,
COMMANDS_SRC,