Skip to content

Commit 6976bb9

Browse files
committed
fix(spec): write the warn-once dedupe separator as an escape, not a raw NUL byte
`check:nul-bytes` (#3127) caught two literal U+0000 bytes in the `warnDeprecatedAliases` key. A raw NUL makes ripgrep treat the whole file as binary and silently return zero matches, so `stack.zod.ts` would have dropped out of code search and every grep-based lint. Written as the unicode escape it is byte-identical at runtime. Same separator in `deprecated-aliases.ts`'s dedupe key, with a note on why it must stay an escape, and regenerate the spec API-surface snapshot for the four new exports (0 breaking, 4 added). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JqC9ckaLbmhmytt65Gxi96
1 parent afdb83c commit 6976bb9

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

packages/spec/api-surface.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
".": [
3+
"ACTION_TARGET_EXECUTE_CONFLICT (const)",
34
"ADMIN_FULL_ACCESS (const)",
45
"ALL_CONVERSIONS (const)",
56
"AUDIENCE_ANCHOR_POSITIONS (const)",
@@ -35,6 +36,7 @@
3536
"DatasourceMappingRule (type)",
3637
"DatasourceMappingRuleSchema (const)",
3738
"DefineStackOptions (interface)",
39+
"DeprecatedAliasFinding (interface)",
3840
"EVERYONE_POSITION (const)",
3941
"EvalUser (type)",
4042
"EvalUserInput (type)",
@@ -144,11 +146,13 @@
144146
"expandViewContainerWithDiagnostics (function)",
145147
"expression (function)",
146148
"findClosestMatches (function)",
149+
"formatDeprecatedAliasFinding (function)",
147150
"formatSuggestion (function)",
148151
"formatZodError (function)",
149152
"formatZodIssue (function)",
150153
"isAggregatedViewContainer (function)",
151154
"isKnownPlatformCapability (function)",
155+
"lintDeprecatedAliases (function)",
152156
"mapMembershipRole (function)",
153157
"normalizeMetadataCollection (function)",
154158
"normalizePluginMetadata (function)",

packages/spec/src/shared/deprecated-aliases.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ export function lintDeprecatedAliases(stack: AnyRec): DeprecatedAliasFinding[] {
112112
if (target === execute) return;
113113

114114
const actionName = typeof action.name === 'string' && action.name ? action.name : '(unnamed)';
115-
const dedupeKey = `${actionName} ${describeHandler(target)} ${describeHandler(execute)}`;
115+
// `\u0000` written as an escape, never as a raw byte: a literal NUL makes
116+
// ripgrep treat the whole file as binary and silently drop it from every
117+
// grep-based lint (`scripts/check-nul-bytes.mjs` enforces this).
118+
const dedupeKey = `${actionName}\u0000${describeHandler(target)}\u0000${describeHandler(execute)}`;
116119
if (seen.has(dedupeKey)) return;
117120
seen.add(dedupeKey);
118121

packages/spec/src/stack.zod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ const warnedAliasFindings = new Set<string>();
10611061
*/
10621062
function warnDeprecatedAliases(normalized: Record<string, unknown>): void {
10631063
for (const finding of lintDeprecatedAliases(normalized)) {
1064-
const key = `${finding.rule}
1064+
const key = `${finding.rule}\u0000${finding.where}\u0000${finding.message}`;
10651065
if (warnedAliasFindings.has(key)) continue;
10661066
warnedAliasFindings.add(key);
10671067
console.warn(`defineStack: ${formatDeprecatedAliasFinding(finding)}`);

0 commit comments

Comments
 (0)