pumuki 6.3.157 → 6.3.159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/facts/detectors/text/ios.test.ts +13 -2
- package/core/facts/detectors/text/ios.ts +65 -4
- package/integrations/git/runPlatformGate.ts +17 -4
- package/package.json +1 -1
- package/scripts/framework-menu-system-notifications-env.ts +8 -0
- package/scripts/framework-menu-system-notifications-gate.ts +9 -2
|
@@ -659,17 +659,28 @@ let text = "XCTUnwrap(optionalValue)"
|
|
|
659
659
|
});
|
|
660
660
|
|
|
661
661
|
test('hasSwiftWaitForExpectationsUsage detecta waits legacy y excluye await fulfillment', () => {
|
|
662
|
-
const
|
|
662
|
+
const legacyAsyncWait = `
|
|
663
|
+
func testLegacyAsync() async {
|
|
663
664
|
let expectation = expectation(description: "Done")
|
|
664
665
|
wait(for: [expectation], timeout: 1)
|
|
665
666
|
waitForExpectations(timeout: 1)
|
|
667
|
+
}
|
|
668
|
+
`;
|
|
669
|
+
const legacySyncWait = `
|
|
670
|
+
func testLegacySync() {
|
|
671
|
+
let expectation = expectation(description: "Done")
|
|
672
|
+
wait(for: [expectation], timeout: 1)
|
|
673
|
+
}
|
|
666
674
|
`;
|
|
667
675
|
const modernWait = `
|
|
676
|
+
func testModernAsync() async {
|
|
668
677
|
let expectation = expectation(description: "Done")
|
|
669
678
|
await fulfillment(of: [expectation], timeout: 1)
|
|
679
|
+
}
|
|
670
680
|
`;
|
|
671
681
|
|
|
672
|
-
assert.equal(hasSwiftWaitForExpectationsUsage(
|
|
682
|
+
assert.equal(hasSwiftWaitForExpectationsUsage(legacyAsyncWait), true);
|
|
683
|
+
assert.equal(hasSwiftWaitForExpectationsUsage(legacySyncWait), false);
|
|
673
684
|
assert.equal(hasSwiftWaitForExpectationsUsage(modernWait), false);
|
|
674
685
|
});
|
|
675
686
|
|
|
@@ -100,6 +100,63 @@ const hasSwiftSanitizedRegexMatch = (source: string, regex: RegExp): boolean =>
|
|
|
100
100
|
return regex.test(sanitizeSwiftSourceForMultilineRegex(source));
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
+
type SwiftFunctionDeclaration = {
|
|
104
|
+
signature: string;
|
|
105
|
+
body: string;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const collectSwiftFunctionDeclarations = (source: string): readonly SwiftFunctionDeclaration[] => {
|
|
109
|
+
const lines = source.split(/\r?\n/);
|
|
110
|
+
const functions: SwiftFunctionDeclaration[] = [];
|
|
111
|
+
|
|
112
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
113
|
+
const firstLine = stripSwiftLineForSemanticScan(lines[index] ?? '');
|
|
114
|
+
if (!/\bfunc\b/.test(firstLine)) {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const signatureLines: string[] = [];
|
|
119
|
+
let cursor = index;
|
|
120
|
+
let openingLineIndex = -1;
|
|
121
|
+
for (; cursor < lines.length && cursor < index + 24; cursor += 1) {
|
|
122
|
+
const line = stripSwiftLineForSemanticScan(lines[cursor] ?? '');
|
|
123
|
+
signatureLines.push(line);
|
|
124
|
+
if (line.includes('{')) {
|
|
125
|
+
openingLineIndex = cursor;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
if (line.includes('}')) {
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (openingLineIndex < 0) {
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const bodyLines: string[] = [];
|
|
138
|
+
let braceDepth = 0;
|
|
139
|
+
for (let bodyCursor = openingLineIndex; bodyCursor < lines.length; bodyCursor += 1) {
|
|
140
|
+
const line = stripSwiftLineForSemanticScan(lines[bodyCursor] ?? '');
|
|
141
|
+
braceDepth += countTokenOccurrences(line, '{');
|
|
142
|
+
braceDepth -= countTokenOccurrences(line, '}');
|
|
143
|
+
bodyLines.push(line);
|
|
144
|
+
if (bodyCursor > openingLineIndex && braceDepth <= 0) {
|
|
145
|
+
cursor = bodyCursor;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
functions.push({
|
|
151
|
+
signature: signatureLines.join('\n'),
|
|
152
|
+
body: bodyLines.join('\n'),
|
|
153
|
+
});
|
|
154
|
+
index = cursor;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return functions;
|
|
158
|
+
};
|
|
159
|
+
|
|
103
160
|
const hasSwiftUiModernizationSnapshotMatch = (source: string, entryId: string): boolean => {
|
|
104
161
|
const entry = getIosSwiftUiModernizationEntry(entryId);
|
|
105
162
|
if (!entry) {
|
|
@@ -855,10 +912,14 @@ const hasSwiftConfirmationUsage = (source: string): boolean => {
|
|
|
855
912
|
};
|
|
856
913
|
|
|
857
914
|
export const hasSwiftWaitForExpectationsUsage = (source: string): boolean => {
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
915
|
+
const legacyWaitPattern = /\bwait\s*\(\s*for\s*:|\bwaitForExpectations\s*\(/;
|
|
916
|
+
return collectSwiftFunctionDeclarations(source).some((declaration) => {
|
|
917
|
+
if (!/\basync\b/.test(declaration.signature)) {
|
|
918
|
+
return false;
|
|
919
|
+
}
|
|
920
|
+
legacyWaitPattern.lastIndex = 0;
|
|
921
|
+
return legacyWaitPattern.test(declaration.body);
|
|
922
|
+
});
|
|
862
923
|
};
|
|
863
924
|
|
|
864
925
|
export const hasSwiftLegacyExpectationDescriptionUsage = (source: string): boolean => {
|
|
@@ -461,7 +461,7 @@ const isSkillsEnforcementRemediationDiff = (
|
|
|
461
461
|
return false;
|
|
462
462
|
}
|
|
463
463
|
|
|
464
|
-
const normalizedPaths = paths.map((path) => toNormalizedPath(path));
|
|
464
|
+
const normalizedPaths = paths.map((path) => toNormalizedPath(path).toLowerCase());
|
|
465
465
|
const touchesDetectorSurface = normalizedPaths.some((path) =>
|
|
466
466
|
path.startsWith('core/facts/') ||
|
|
467
467
|
path.startsWith('core/rules/presets/heuristics/') ||
|
|
@@ -1494,17 +1494,30 @@ export async function runPlatformGate(params: {
|
|
|
1494
1494
|
stagedCodePathSet
|
|
1495
1495
|
)
|
|
1496
1496
|
: [];
|
|
1497
|
+
const previousIosTestsQualityFinding =
|
|
1498
|
+
previousFactsForStagedPaths.length > 0 &&
|
|
1499
|
+
iosTestsQualityFinding === undefined &&
|
|
1500
|
+
isStrictEnforcementStage(params.policy.stage)
|
|
1501
|
+
? toIosTestsQualityBlockingFinding({
|
|
1502
|
+
stage: params.policy.stage,
|
|
1503
|
+
facts: previousFactsForStagedPaths,
|
|
1504
|
+
})
|
|
1505
|
+
: undefined;
|
|
1506
|
+
const previousRemediationBlockingFindings = [
|
|
1507
|
+
...previousBlockingFindingsForStagedPaths,
|
|
1508
|
+
...(previousIosTestsQualityFinding ? [previousIosTestsQualityFinding] : []),
|
|
1509
|
+
];
|
|
1497
1510
|
const remediationProgressFinding =
|
|
1498
|
-
|
|
1511
|
+
previousRemediationBlockingFindings.length > currentBlockingFindingsForStagedPaths.length &&
|
|
1499
1512
|
currentBlockingFindingsForStagedPaths.length === 0
|
|
1500
1513
|
? toRemediationProgressAllowedFinding({
|
|
1501
1514
|
stage: params.policy.stage as Exclude<GateStage, 'STAGED'>,
|
|
1502
1515
|
currentBlockingCount: currentBlockingFindingsForStagedPaths.length,
|
|
1503
|
-
previousBlockingCount:
|
|
1516
|
+
previousBlockingCount: previousRemediationBlockingFindings.length,
|
|
1504
1517
|
paths: stagedCodePaths,
|
|
1505
1518
|
ruleIds: [
|
|
1506
1519
|
...new Set(
|
|
1507
|
-
|
|
1520
|
+
previousRemediationBlockingFindings.map((finding) => finding.ruleId)
|
|
1508
1521
|
),
|
|
1509
1522
|
].sort(),
|
|
1510
1523
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pumuki",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.159",
|
|
4
4
|
"description": "Enterprise-grade AST Intelligence System with multi-platform support (iOS, Android, Backend, Frontend) and Feature-First + DDD + Clean Architecture enforcement. Includes dynamic violations API for intelligent querying.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -5,3 +5,11 @@ export const isTruthyEnvValue = (value?: string): boolean => {
|
|
|
5
5
|
const normalized = value.trim().toLowerCase();
|
|
6
6
|
return normalized === '1' || normalized === 'true' || normalized === 'yes' || normalized === 'on';
|
|
7
7
|
};
|
|
8
|
+
|
|
9
|
+
export const isFalsyEnvValue = (value?: string): boolean => {
|
|
10
|
+
if (!value) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
const normalized = value.trim().toLowerCase();
|
|
14
|
+
return normalized === '0' || normalized === 'false' || normalized === 'no' || normalized === 'off';
|
|
15
|
+
};
|
|
@@ -3,14 +3,21 @@ import type {
|
|
|
3
3
|
SystemNotificationEmitResult,
|
|
4
4
|
SystemNotificationsConfig,
|
|
5
5
|
} from './framework-menu-system-notifications-types';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
isFalsyEnvValue,
|
|
8
|
+
isTruthyEnvValue,
|
|
9
|
+
} from './framework-menu-system-notifications-env';
|
|
7
10
|
|
|
8
11
|
export const resolveSystemNotificationGate = (params: {
|
|
9
12
|
config: SystemNotificationsConfig;
|
|
10
13
|
nowMs: number;
|
|
11
14
|
env?: NodeJS.ProcessEnv;
|
|
12
15
|
}): SystemNotificationEmitResult | null => {
|
|
13
|
-
if (
|
|
16
|
+
if (
|
|
17
|
+
isTruthyEnvValue(params.env?.PUMUKI_DISABLE_SYSTEM_NOTIFICATIONS) ||
|
|
18
|
+
isFalsyEnvValue(params.env?.PUMUKI_SYSTEM_NOTIFICATIONS) ||
|
|
19
|
+
isFalsyEnvValue(params.env?.PUMUKI_NOTIFICATIONS)
|
|
20
|
+
) {
|
|
14
21
|
return { delivered: false, reason: 'disabled' };
|
|
15
22
|
}
|
|
16
23
|
if (!params.config.enabled) {
|