qaify-playwright-reporter 0.9.2 → 0.9.4
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/dist/fix.d.ts +4 -0
- package/dist/fix.js +19 -3
- package/package.json +1 -1
package/dist/fix.d.ts
CHANGED
|
@@ -136,11 +136,13 @@ export declare function fixContext(client: IngestClient, fixId: string, dir: str
|
|
|
136
136
|
* Advisory dependensi tanpa AI: update paket di lockfile saja (tanpa install / script), cek ulang dengan audit, lalu
|
|
137
137
|
* tulis hasilnya ke <dir>/.qaify/claude.json dalam bentuk keluaran `claude -p` (model qaify-deps, token 0) agar
|
|
138
138
|
* fix-diff / fix-submit tidak berubah. npm: npm update dulu, npm audit fix bila paket masih rentan.
|
|
139
|
+
* Paket yang sudah aman di ujung branch (mis. ikut naik lewat PR temuan lain) tidak di-update: already_fixed.
|
|
139
140
|
*/
|
|
140
141
|
export declare function fixDeps(dir: string, exec?: Exec): Promise<{
|
|
141
142
|
fixed: boolean;
|
|
142
143
|
summary: string;
|
|
143
144
|
reason?: string;
|
|
145
|
+
already_fixed?: boolean;
|
|
144
146
|
}>;
|
|
145
147
|
/**
|
|
146
148
|
* Paket di composer.lock yang me-require pkg secara langsung. `--with-all-dependencies` hanya memperbarui dependensi
|
|
@@ -181,6 +183,8 @@ export interface ParsedFix {
|
|
|
181
183
|
summary: string;
|
|
182
184
|
reason: string | null;
|
|
183
185
|
tests_run: string | null;
|
|
186
|
+
/** fix-deps: paket sudah aman sebelum di-update (bukan dari Claude, FIX_SCHEMA tidak memuatnya). */
|
|
187
|
+
already_fixed: boolean;
|
|
184
188
|
usage: ClaudeUsage | null;
|
|
185
189
|
}
|
|
186
190
|
/** Output `claude -p --output-format json --json-schema FIX_SCHEMA`; null = tidak ada hasil terstruktur. */
|
package/dist/fix.js
CHANGED
|
@@ -191,6 +191,7 @@ export async function fixContext(client, fixId, dir, opts = {}) {
|
|
|
191
191
|
* Advisory dependensi tanpa AI: update paket di lockfile saja (tanpa install / script), cek ulang dengan audit, lalu
|
|
192
192
|
* tulis hasilnya ke <dir>/.qaify/claude.json dalam bentuk keluaran `claude -p` (model qaify-deps, token 0) agar
|
|
193
193
|
* fix-diff / fix-submit tidak berubah. npm: npm update dulu, npm audit fix bila paket masih rentan.
|
|
194
|
+
* Paket yang sudah aman di ujung branch (mis. ikut naik lewat PR temuan lain) tidak di-update: already_fixed.
|
|
194
195
|
*/
|
|
195
196
|
export async function fixDeps(dir, exec = defaultExec) {
|
|
196
197
|
const started = Date.now();
|
|
@@ -202,7 +203,19 @@ export async function fixDeps(dir, exec = defaultExec) {
|
|
|
202
203
|
const composer = target.manager === 'composer';
|
|
203
204
|
const manifest = composer ? 'composer.json' : 'package.json';
|
|
204
205
|
const auditCmd = composer ? 'composer audit --locked' : 'npm audit --package-lock-only';
|
|
206
|
+
const audit = () => composer
|
|
207
|
+
? report('composer', ['audit', '--locked', '--format=json', '--no-interaction', `--working-dir=${repo}`])
|
|
208
|
+
: report('npm', ['audit', '--json', '--package-lock-only', '--prefix', repo]);
|
|
205
209
|
const steps = [];
|
|
210
|
+
// tanpa cek ini update dependennya (mis. laravel/framework) tetap mengubah lockfile → PR yang tidak diperlukan
|
|
211
|
+
if (!stillVulnerable(await audit(), target.manager, pkg)) {
|
|
212
|
+
return writeDeps(dir, started, {
|
|
213
|
+
fixed: false,
|
|
214
|
+
already_fixed: true,
|
|
215
|
+
summary: `${pkg} sudah aman di branch ini.`,
|
|
216
|
+
reason: `${auditCmd} di ujung branch tidak lagi melaporkan advisory ${pkg} (kemungkinan ikut diperbarui lewat perubahan lain). Lockfile tidak diubah.`,
|
|
217
|
+
});
|
|
218
|
+
}
|
|
206
219
|
let vulnerable;
|
|
207
220
|
try {
|
|
208
221
|
if (composer) {
|
|
@@ -210,12 +223,11 @@ export async function fixDeps(dir, exec = defaultExec) {
|
|
|
210
223
|
const packages = [pkg, ...(await composerDependents(repo, pkg))];
|
|
211
224
|
steps.push(`composer update ${packages.join(' ')} --with-all-dependencies --no-install`);
|
|
212
225
|
await exec('composer', ['update', ...packages, '--with-all-dependencies', '--no-install', '--no-scripts', '--no-interaction', '--no-progress', `--working-dir=${repo}`]);
|
|
213
|
-
vulnerable = stillVulnerable(await
|
|
226
|
+
vulnerable = stillVulnerable(await audit(), 'composer', pkg);
|
|
214
227
|
}
|
|
215
228
|
else {
|
|
216
229
|
steps.push(`npm update ${pkg} --package-lock-only`);
|
|
217
230
|
await exec('npm', ['update', pkg, '--package-lock-only', '--no-fund', '--no-audit', '--prefix', repo]);
|
|
218
|
-
const audit = () => report('npm', ['audit', '--json', '--package-lock-only', '--prefix', repo]);
|
|
219
231
|
vulnerable = stillVulnerable(await audit(), 'npm', pkg);
|
|
220
232
|
if (vulnerable) {
|
|
221
233
|
steps.push('npm audit fix --package-lock-only');
|
|
@@ -369,6 +381,7 @@ export function parseFixOutput(raw) {
|
|
|
369
381
|
summary: out.summary,
|
|
370
382
|
reason: typeof out.reason === 'string' && out.reason ? out.reason : null,
|
|
371
383
|
tests_run: typeof out.tests_run === 'string' && out.tests_run ? out.tests_run : null,
|
|
384
|
+
already_fixed: out.already_fixed === true,
|
|
372
385
|
usage: parseClaudeUsage(parsed),
|
|
373
386
|
};
|
|
374
387
|
}
|
|
@@ -399,6 +412,9 @@ export async function fixSubmit(client, fixId, claudeOutput, patch, workDir, opt
|
|
|
399
412
|
const stats = patchStats(patch);
|
|
400
413
|
const usage = parsed.usage ? { ...parsed.usage, files_changed: stats.files.length, lines_changed: stats.changedLines } : undefined;
|
|
401
414
|
const summary = [parsed.summary, parsed.tests_run ? `Verifikasi: ${parsed.tests_run}` : null].filter(Boolean).join('\n\n');
|
|
415
|
+
// no_change + already_fixed: backend lama tetap menerimanya (gave_up), backend baru menutup temuannya
|
|
416
|
+
if (parsed.already_fixed)
|
|
417
|
+
return send({ status: 'no_change', already_fixed: true, summary, reason: parsed.reason ?? parsed.summary, usage });
|
|
402
418
|
if (!parsed.fixed)
|
|
403
419
|
return send({ status: 'failed', summary, reason: parsed.reason ?? parsed.summary, usage });
|
|
404
420
|
if (!patch.trim())
|
|
@@ -453,7 +469,7 @@ export async function fixSubmit(client, fixId, claudeOutput, patch, workDir, opt
|
|
|
453
469
|
step = 'di-commit';
|
|
454
470
|
await git(['commit', '-q', '--no-verify', '-m', `fix(qaify): ${grant.title}`.slice(0, 200), '-m', parsed.summary], commitEnv);
|
|
455
471
|
step = 'di-push';
|
|
456
|
-
await git(['push', '-q', '--no-verify', url,
|
|
472
|
+
await git(['push', '-q', '--no-verify', url, `${grant.force ? '+' : ''}HEAD:refs/heads/${grant.branch}`], auth);
|
|
457
473
|
}
|
|
458
474
|
catch (e) {
|
|
459
475
|
await revokeTokens([grant.token], opts.fetch);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qaify-playwright-reporter",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
4
4
|
"description": "Reporter Playwright untuk QA Factory (Qaify): kirim hasil test dan artefak ke /api/ingest, tanpa pernah menggagalkan test.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ahmdkenz",
|