Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions upgrade-toolkit/bin/cloud/upgrade-pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ if [ -n "$APP_DIR_ARG" ]; then
fi

APP=""; MPR=""
STEP=""; LOG="$WORK/logs/pipeline.log"
STEP=""; LOG="$WORK/logs/pipeline.log"; LOG_START=0
NJ_CODE=0; NJ_TMP="$WORK/state/nj.tmp"
APPS_UP=()

Expand Down Expand Up @@ -220,7 +220,8 @@ nj_add() { # nj_add CODE "title" "text"
nj_file() { # nj_file CODE "title" FILE [lines] [grep-pattern]: first lines of a file (optionally only lines matching)
local body="(file not found: $3)"
if [ -f "$3" ]; then
if [ -n "${5:-}" ]; then body=$(grep -E "$5" "$3" | head -n "${4:-20}" || true); else body=$(head -n "${4:-20}" "$3" || true); fi
local from=1; [ "$3" != "$LOG" ] || from=$((LOG_START + 1)) # the step's own log: only the lines of this run (WM1: a stop quoted a walk of yesterday)
if [ -n "${5:-}" ]; then body=$(tail -n "+$from" "$3" | grep -E "$5" | head -n "${4:-20}" || true); else body=$(tail -n "+$from" "$3" | head -n "${4:-20}" || true); fi
body=$(printf 'file: %s\n\n```\n%s\n```' "$3" "$body")
fi
nj_add "$1" "$2" "$body"
Expand Down Expand Up @@ -682,7 +683,9 @@ Decide, in writing: (a) wrap it in a host app (an app with a home page, a theme
rc=0; xo "$WORK/scancover.out" python3 "$B/scancover.py" "$WORK/findings.json" || rc=$?
[ "$rc" = 0 ] || note "scancover exit $rc: NO COVERAGE, scanner checked nothing for this rung: scanner rung INVALID, do the manual checks in $WORK/scancover.out"
else note "scan.py failed (exit $rc): scanner rung INVALID"; fi
else note "scanner not available at $EA: scanner rung INVALID"; fi
elif [ -z "$EA" ]; then note "scanner not configured (EA, UPG_SCANNER, or UPG_SCANNER= in ~/.config/upgrade-toolkit/local.env): scanner rung INVALID"
else note "scanner not found at $EA (no scripts/scan.py): scanner rung INVALID"
fi
if [ "$(major "$SOURCE")" -le 9 ]; then
rc=0; xo "$WORK/javafinal.out" python3 "$B/javafinal.py" "$APP" --md "$WORK/javafinal.md" || rc=$?
[ "$rc" != 1 ] || note "javafinal.py found assignments to Java action parameters: javac will fail at the build (by-hand fix, steps/repair.md row 10), see $WORK/javafinal.md"
Expand Down Expand Up @@ -1879,6 +1882,7 @@ run_step() { # run_step NAME
*" $STEP "*) if [ "$DRY" != 1 ] && [ -f "$WORK/PROPOSAL.md" ]; then proposal_recheck; fi ;;
esac
printf '%-10s %s\n' "$STEP" "running (log: $LOG)"
LOG_START=0; [ ! -f "$LOG" ] || LOG_START=$(wc -l < "$LOG" | tr -d ' ') # a step log keeps earlier runs: nj_file quotes only this run
timing_open "$STEP"
cockpit_regen # the page shows the step as running from its start, not only after it
"step_$STEP"
Expand Down
2 changes: 1 addition & 1 deletion upgrade-toolkit/bin/filecheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function compare(oldF, newF) {
if (o.compare) return compare(o.compare[0], o.compare[1]);
if (!o.url || !o.user || !o.password || !o.entity) { console.error('need --url --user --password --entity'); process.exit(2); }
const { chromium } = loadPlaywright();
const browser = await chromium.launch();
const browser = await chromium.launch({ args: ['--use-mock-keychain', '--password-store=basic'] });
let res = { ok: false, entity: o.entity, user: o.user, steps: [] };
try {
// desktop size: a field app sends screen.width <= 1280 to the Tablet profile and reloads the page
Expand Down
2 changes: 1 addition & 1 deletion upgrade-toolkit/bin/layoutwalk.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async function closeErrors(p) {
}
}
(async () => {
const args = process.env.UPG_BROWSER_SPKI ? ['--ignore-certificate-errors-spki-list=' + process.env.UPG_BROWSER_SPKI] : [];
const args = ['--use-mock-keychain', '--password-store=basic'].concat(process.env.UPG_BROWSER_SPKI ? ['--ignore-certificate-errors-spki-list=' + process.env.UPG_BROWSER_SPKI] : []);
const b = await pw.chromium.launch({ args }); let n = 0, reached = 0;
for (const [w, h] of widths) for (const s of plan) {
const dir = path.join(out, `${w}x${h}`); fs.mkdirSync(dir, { recursive: true });
Expand Down
12 changes: 10 additions & 2 deletions upgrade-toolkit/bin/smokewalk.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,16 @@ function judge(olds, results) {
const lines = [], tot = { regressions: 0, intermittent: 0, flaky_both: 0, flaky_baseline: 0, coverage_lost: 0 };
const rate = (rs, v) => rs.filter(x => x.verdict === v).length;
for (const r of results.roles) for (const s of r.steps) {
const k = stepKey(r.role, s), O = om.get(k), N = stepRuns(s);
const k = stepKey(r.role, s), N = stepRuns(s);
let O = om.get(k);
om.delete(k);
if (O === undefined) {
// the same menu entry now opens the app's own copy of the page (editroute's menu copy: same caption and document name,
// another module; cold test WM1 Accounts): judged as the same step, not a new step plus a gone one
const pre = r.role + ' | ' + s.via + ' | ' + s.caption + ' | ', doc = String(s.target).split('.').pop();
const was = s.via === 'menu' && [...om.keys()].find(x => x.startsWith(pre) && x.slice(pre.length) !== s.target && x.slice(pre.length).split('.').pop() === doc);
if (was) { O = om.get(was); om.delete(was); lines.push(` moved ${was} -> ${s.target}: the same menu entry opens the app's copy of the page`); }
}
if (O === undefined) { lines.push(' new step ' + k + ': ' + s.verdict); continue; }
const oldPass = rate(O, 'PASS');
if (!oldPass) continue; // never PASSed on the old app: a baseline defect, not a regression
Expand Down Expand Up @@ -338,7 +346,7 @@ if (require.main === module) (async () => {
} else {
const plan = JSON.parse(fs.readFileSync(o.plan, 'utf8'));
const { chromium } = loadPlaywright();
const browser = await chromium.launch({ args: process.env.UPG_BROWSER_SPKI ? ['--ignore-certificate-errors-spki-list=' + process.env.UPG_BROWSER_SPKI] : [] }); // UPG_BROWSER_SPKI: trust a test broker's key only (natsfixture.py spki)
const browser = await chromium.launch({ args: ['--use-mock-keychain', '--password-store=basic'].concat(process.env.UPG_BROWSER_SPKI ? ['--ignore-certificate-errors-spki-list=' + process.env.UPG_BROWSER_SPKI] : []) }); // UPG_BROWSER_SPKI: trust a test broker's key only (natsfixture.py spki)
results = { url: o.url, plan: o.plan, at: new Date().toISOString(), repeat: o.repeat, roles: [] };
const walks = [];
for (let walk = 0; walk < o.repeat; walk++) {
Expand Down
2 changes: 1 addition & 1 deletion upgrade-toolkit/controls/landing_guard_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const G = '.mx-name-dataView1';
(async () => {
let fail = 0;
const check = (name, got, want) => { const ok = got === want; if (!ok) fail++; console.log(`${ok ? 'ok ' : 'FAIL'} ${name}: ${got}`); };
const browser = await chromium.launch();
const browser = await chromium.launch({ args: ['--use-mock-keychain', '--password-store=basic'] });
const page = await browser.newPage();
const old = () => page.locator(G).first().isVisible({ timeout: 12000 }).catch(() => false);
const neu = (ms = 3000) => V.reached(page, page.locator(G).first(), ms);
Expand Down
24 changes: 23 additions & 1 deletion upgrade-toolkit/controls/run-controls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,10 @@ ctl pipeline-smoke-mf-off-without-baseline-pass 0 '!microflows' -- bash -c "WORK
# trap printed "unexpected failure (exit 1) at line 624 in step 'triage'" on every machine but the author's; the run went on
ctl pipeline-scanner-lookup-no-local-env-pass 0 '^EA=\[\]$' '!unexpected failure' -- bash -c "set -Eeuo pipefail; trap 'echo unexpected failure \$? >&2; exit 4' ERR; HOME=\$(mktemp -d); unset EA UPG_SCANNER; eval \"f() { \$(grep 'upgrade-toolkit/local.env\" 2>' \${PIPE:-$B/cloud/upgrade-pipeline.sh} | grep -v '^ *#'); echo \\\"EA=[\\\$EA]\\\"; }\"; f"
ctl pipeline-scanner-lookup-local-env-pass 0 '^EA=\[/opt/scan\]$' -- bash -c "set -Eeuo pipefail; trap 'echo unexpected failure \$? >&2; exit 4' ERR; HOME=\$(mktemp -d); mkdir -p \$HOME/.config/upgrade-toolkit; echo UPG_SCANNER=/opt/scan > \$HOME/.config/upgrade-toolkit/local.env; unset EA UPG_SCANNER; eval \"f() { \$(grep 'upgrade-toolkit/local.env\" 2>' \${PIPE:-$B/cloud/upgrade-pipeline.sh} | grep -v '^ *#'); echo \\\"EA=[\\\$EA]\\\"; }\"; f"
# cold CMM: with no scanner configured the note said "scanner not available at :" (an empty path); name what is missing
awk '/if \[ -f "\$EA\/scripts\/scan\.py" \]/{p=1} p{print} p&&/^ (fi$|else note "scanner not available)/{exit}' $B/cloud/upgrade-pipeline.sh > $T/scanner-rung.sh
ctl pipeline-scanner-not-configured-catch 0 '^NOTE scanner not configured \(EA, UPG_SCANNER' '!available at :' -- bash -c "note() { echo \"NOTE \$*\"; }; EA=; . $T/scanner-rung.sh"
ctl pipeline-scanner-not-found-catch 0 '^NOTE scanner not found at /nonexistent/scan \(no scripts/scan\.py\)' -- bash -c "note() { echo \"NOTE \$*\"; }; EA=/nonexistent/scan; . $T/scanner-rung.sh"
# WM1 2026-11-17: Atlas_Core 4's new module roles unmapped; every Atlas page failed for security reasons (smoke walk only)
MR="bash $B/../controls/modroles_control.sh"
ctl modroles-grant-by-name-pass 0 '^mdl: ALTER USER ROLE Administrator ADD MODULE ROLES \(Atlas_Core.Administrator\);' '^mdl: ALTER USER ROLE User ADD MODULE ROLES \(Atlas_Core.User\);' '^modroles: 3 grant' -- $MR
Expand Down Expand Up @@ -1126,14 +1130,22 @@ ctl smoke-judge-flaky-baseline-pass 0 '^ FLAKY-BASELINE Clerk \| menu \| Orders
-- $SW --rejudge $SF/new-pass.json --rejudge $SF/new-pass.json --compare $SF/old-flaky-a.json --compare $SF/old-flaky-b.json
ctl smoke-judge-partial-walk-pass 0 '^ PASS +menu +Orders -> Shop.Orders_Overview$' '^steps: PASS 4, FAIL 0, INVALID 0' 'regressions: 0$' \
-- $SW --rejudge $SF/new-pass.json --rejudge $SF/new-desk-only.json --compare $SF/old-pass.json
# the menu entry now opens the app's own copy of the page (editroute's menu copy, another module, same document name; cold test WM1
# Accounts): the same step, judged old vs new, never "step gone" plus "new step"; a page with another name is still gone (exit 2)
sed 's/"Shop\.Orders_Overview"/"Shop_Ext.Orders_Overview"/' $SF/new-pass.json > $T/smoke-moved.json
sed 's/"Shop\.Orders_Overview"/"Shop_Ext.Orders_List"/' $SF/new-pass.json > $T/smoke-other.json
ctl smoke-judge-menu-copy-same-step-pass 0 '^ moved Clerk \| menu \| Orders \| Shop\.Orders_Overview -> Shop_Ext\.Orders_Overview: the same menu entry' 'coverage lost\): 0$' 'regressions: 0$' '!step gone' -- $SW --rejudge $T/smoke-moved.json --compare $SF/old-pass.json
ctl smoke-judge-other-page-gone-catch 2 '^ step gone Clerk \| menu \| Orders \| Shop\.Orders_Overview \(was PASS\)' '!moved' -- $SW --rejudge $T/smoke-other.json --compare $SF/old-pass.json
# every browser the toolkit launches carries the mock keychain (the owner's rule: no macOS keychain dialog from an unattended run)
ctl browser-launch-mock-keychain-pass 0 '^launch files without the mock keychain: 0 of [1-9][0-9]*$' -- sh -c "n=0; t=0; for f in \$(grep -rlE 'chromium\.launch *\(|launchPersistentContext *\(' $B $here $B/../vendor $B/../research | grep -v node_modules); do t=\$((t+1)); grep -q use-mock-keychain \$f || { n=\$((n+1)); echo \"missing: \$f\"; }; done; echo launch files without the mock keychain: \$n of \$t"
# T5: --login-path (default /login.html), also through the gate (SMOKE_LOGIN_PATH)
lp() { node -e "process.argv=['node','x','--plan','p','--url','http://h:1','--rejudge','r','--compare','c'$1]; const m=require('$B/smokewalk.js'); const o=m.args(); console.log('loginPath', o.loginPath, 'url', m.loginUrl(o.url, o.loginPath))"; }
ctl smokewalk-login-path-catch 0 '^loginPath /login-without-sso.html url http://h:1/login-without-sso.html$' -- lp ",'--login-path','/login-without-sso.html'"
ctl smokewalk-login-path-default-pass 0 '^loginPath /login.html url http://h:1/login.html$' -- lp ""
ctl smokewalk-login-path-bad-catch 2 'needs a path starting with /' -- lp ",'--login-path','login.html'"
ctl smoke-rejudge-needs-compare-catch 2 'rejudge needs --compare' -- $SW --rejudge $SF/new-pass.json
ctl smokewalk-api-only-pass 0 '^ok +apiOnlyHome login page home: got true' '^ok +apiOnlyHome ordinary home: got null' '^ok +apiOnlyHome menu step to the login page: got null' '!^FAIL' -- node $here/smokewalk_predicates.js
else skip smokewalk-predicates "no node"; for n in single-regression-catch intermittent-catch flaky-both-pass flaky-new-error-catch flaky-baseline-pass partial-walk-pass; do skip smoke-judge-$n "no node"; done; skip smoke-rejudge-needs-compare-catch "no node" ; skip smokewalk-api-only-pass "no node"; fi
else skip smokewalk-predicates "no node"; for n in single-regression-catch intermittent-catch flaky-both-pass flaky-new-error-catch flaky-baseline-pass partial-walk-pass menu-copy-same-step-pass other-page-gone-catch; do skip smoke-judge-$n "no node"; done; skip smoke-rejudge-needs-compare-catch "no node" ; skip smokewalk-api-only-pass "no node"; fi

# --- safety guards: frozen DB, DB prefix, heavy lock (E1 1, E1 3, E5 F10, E5 F11) ----------------------------------------
ctl smoke-users-refuse-catch 2 'REFUSED' -- python3 $B/smoke_users.py appdb
Expand Down Expand Up @@ -1838,6 +1850,16 @@ ctl pipeline-dry-diff-gate-pass 0 'gate\.sh .*--config .*gate\.conf --only build
# the NEEDS-JUDGMENT rerun hint carries exactly one --from (the stopped step), not the run's own plus a second
NJ=$V/njrun; mkdir -p $NJ/app $NJ/tools/mxbuild-10.24.26.1 $NJ/tools/mxbuild-11.15.0.1 $NJ/tools/runtime-10.24.26.1 $NJ/tools/runtime-11.15.0.1; touch $NJ/app/App.mpr; printf '#!/bin/sh\nexit 0\n' > $NJ/tools/mxcli-linux; chmod +x $NJ/tools/mxcli-linux
ctl pipeline-nj-one-from-pass 0 'needs judgment \(exit 13\)' 'upgrade-pipeline\.sh .*--only update --from update$' '!--from update .*--from' -- bash -c "MXCLI= bash $B/cloud/upgrade-pipeline.sh --app-dir $NJ/app --source 10.24.26.1 --target 11.15.0.1 --work $NJ/work --from update --only update; cat $NJ/work/NEEDS-JUDGMENT.md"
# a step log keeps earlier runs: the stop quotes only the lines this run wrote (cold test WM1: an afterwalk stop quoted yesterday's
# failed walk under today's 9 of 9 PASS); any other file is quoted whole
printf 'FAIL old walk\nINVALID old role\n' > $T/nj-step.log; printf 'FAIL in another file\n' > $T/nj-other.log
cat > $T/nj-quote.sh <<SH
eval "\$(sed -n '/^nj_file() {/,/^}/p' $B/cloud/upgrade-pipeline.sh)"
nj_add() { echo "\$3"; }
LOG=$T/nj-step.log; LOG_START=\$(wc -l < \$LOG); echo 'FAIL new walk' >> \$LOG
nj_file 12 t "\$LOG" 40 'FAIL|INVALID'; nj_file 12 t $T/nj-other.log 40 FAIL
SH
ctl pipeline-nj-quotes-this-run-pass 0 '^FAIL new walk$' '!old walk' '!old role' '^FAIL in another file$' -- bash $T/nj-quote.sh
# F13: a 10.x to 11 run with a plan.txt and no plan-pre.txt stops before the convert (Mendix 11 refuses packages made before 10.21)
mkdir -p $NJ/w13; printf '1 1.0 Administration\n' > $NJ/w13/plan.txt
ctl pipeline-no-plan-pre-catch 0 'needs judgment \(exit 13\)' 'plan-pre.txt missing on a 10.x to 11 run' '!mx convert exit' -- bash -c "MXCLI= bash $B/cloud/upgrade-pipeline.sh --app-dir $NJ/app --source 10.24.26.1 --target 11.15.0.1 --work $NJ/w13 --from convert --only convert; cat $NJ/w13/NEEDS-JUDGMENT.md"
Expand Down
2 changes: 1 addition & 1 deletion upgrade-toolkit/controls/settle_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const check = (name, ok, detail) => { if (!ok) fail++; console.log(`${ok ? 'ok
let pw = null;
for (const d of [process.env.PLAYWRIGHT_DIR, '/opt/node-tools/node_modules/playwright', 'playwright'].filter(Boolean)) { try { pw = require(d); break; } catch (e) { /* next */ } }
let browser = null;
try { if (pw) browser = await pw.chromium.launch(); } catch (e) { browser = null; }
try { if (pw) browser = await pw.chromium.launch({ args: ['--use-mock-keychain', '--password-store=basic'] }); } catch (e) { browser = null; }
if (browser) {
const page = await browser.newPage();
const BAR = '<div class="mx-progress-line" style="position:fixed;top:0;left:0;width:100%;height:4px;background:#ddd"><div style="margin-left:40%;width:10%;height:4px;background:#3a9"></div></div>';
Expand Down
2 changes: 1 addition & 1 deletion upgrade-toolkit/controls/smokewalk_predicates.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function pwLoad() {
}
(async () => {
const pw = pwLoad(); let browser = null;
try { if (pw) browser = await pw.chromium.launch(); } catch (e) { browser = null; }
try { if (pw) browser = await pw.chromium.launch({ args: ['--use-mock-keychain', '--password-store=basic'] }); } catch (e) { browser = null; }
if (browser) {
const page = await browser.newPage();
for (const [name, [html, want]] of Object.entries(PAGES)) {
Expand Down
2 changes: 1 addition & 1 deletion upgrade-toolkit/controls/verbs_browser_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ let fail = 0;
const line = (ok, name, detail) => { if (!ok) fail++; console.log(`${ok ? 'ok ' : 'FAIL'} ${name}: ${detail}`); };

(async () => {
const browser = await chromium.launch();
const browser = await chromium.launch({ args: ['--use-mock-keychain', '--password-store=basic'] });
const page = await browser.newPage();
const rowCase = async (name, html, want) => {
await page.setContent(html);
Expand Down
2 changes: 1 addition & 1 deletion upgrade-toolkit/research/seeding/shoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { chromium } = require(process.env.PW_MODULE || 'playwright');
(async () => {
const [base, user, pass, out, ...menus] = process.argv.slice(2);
const fs = require('fs'); fs.mkdirSync(out, { recursive: true });
const b = await chromium.launch({ executablePath: process.env.PW_CHROME || undefined, args: ['--no-sandbox'] });
const b = await chromium.launch({ executablePath: process.env.PW_CHROME || undefined, args: ['--no-sandbox', '--use-mock-keychain', '--password-store=basic'] });
const p = await (await b.newContext({ viewport: { width: 1400, height: 900 } })).newPage();
const errs = []; p.on('pageerror', e => errs.push(String(e).slice(0, 160)));
await p.goto(base + '/login.html', { waitUntil: 'load' });
Expand Down
4 changes: 2 additions & 2 deletions upgrade-toolkit/vendor/e2e/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ async function launchBrowser({ videoDir = null, trace = false, viewport = null }
const launchOpts = {
headless: !cfg.headed,
slowMo: 0, // cursor animation is JS-driven; slowMo is set via script-level pauses
args: ['--use-fake-device-for-media-stream', '--use-fake-ui-for-media-stream', ...trustArgs()],
args: ['--use-fake-device-for-media-stream', '--use-fake-ui-for-media-stream', '--use-mock-keychain', '--password-store=basic', ...trustArgs()],
};
if (cfg.channel && cfg.channel !== 'chromium') launchOpts.channel = cfg.channel;
const exe = resolveExecutablePath();
Expand All @@ -98,7 +98,7 @@ async function launchBrowserAt(x, y, w, h, { videoDir = null, trace = false, mob
headless: !cfg.headed,
slowMo: 0, // cursor animation is JS-driven; pauses live in the script
args: [
'--use-fake-device-for-media-stream', '--use-fake-ui-for-media-stream', ...trustArgs(),
'--use-fake-device-for-media-stream', '--use-fake-ui-for-media-stream', '--use-mock-keychain', '--password-store=basic', ...trustArgs(),
`--window-position=${x},${y}`,
`--window-size=${w},${h}`,
// Note: --app mode was removed for mobile — it caused page context to close
Expand Down
Loading