mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
Fix #6458 completely: the reporter's host runs inside a hypervisor that masks AVX, and the old per-tool AVX wrappers (amd64-only, PATH-based) were bypassed by absolute-path mongod invocations. - New general snap-src/bin/cpu-exec: runs any binary directly when the CPU has the features it declares (--features x86_64=avx,aarch64=atomics or WEKAN_REQUIRED_CPU_FEATURES) and through same-arch qemu-user when not; plain zero-overhead exec with no declared features. Lookup order: WEKAN_QEMU_USER, qemu-<arch> next to the script (bundle/Docker), $SNAP/qemu-<arch>, the snap's migratemongo/avx one, then system qemu-user(-static). Clear error + direct run when no qemu exists, so the real SIGILL surfaces instead of hiding. - Snap: mongodb-control and migration-control run every mongod 7 through cpu-exec, so MongoDB works without AVX (slower) and migration can READ modern MongoDB data on such CPUs; completed-FerretDB switch and migration fallbacks unchanged (switch_to_completed_ferretdb extracted). - release-all.yml: every Linux bundle .zip ships cpu-exec + this-arch's static qemu-user (amd64/arm64/ppc64le/s390x/riscv64; stripped from win64/mac bundles), flowing into Docker and Snap automatically; Sandstorm .spk gets both via build-deps.sh. Bundle launcher and Docker entrypoint route node/ferretdb through cpu-exec. - Docs: mongodb-avx-qemu.md and mongodb-raspi4-qemu.md document the built-in mechanism. Tests, with negative cases, for the newest features and fixes at changelog: htmljs array-vs-attributes (#6459), description draft normalize/reset (#6455), comment draft lifecycle (#5547), attachment delete guard (#5282), rules move actions + import normalization (#6472), snap mongod-failure/migration recovery (#6458 #6466), FerretDB polling defaults (#6467 #6468), UI density guards for every #6465 fix, and a behavioral cpu-exec test against fake cpuinfo + fake qemu. All wired into test:unit:node. Go table tests for the FerretDB SQLite filter pushdown are in the wekan/FerretDB repo. Updated ChangeLog. Thanks to xet7.
88 lines
3.5 KiB
JavaScript
88 lines
3.5 KiB
JavaScript
'use strict';
|
|
|
|
// Plain-Node unit test (no Meteor) for issue #6459: the card "More" menu
|
|
// rendered completely empty (no Delete option).
|
|
// Run: node tests/htmljsArrayContent.test.cjs
|
|
//
|
|
// Root cause: a WeKan-local vm-sandbox patch in the vendored jade compiler's
|
|
// htmljs made isConstructedObject(Array) return false (upstream htmljs returns
|
|
// true), so the HTML.Tag constructor took an ARRAY first argument — the
|
|
// compiled form of a tag with multi-part inline text like
|
|
// `label {{_ 'source-board'}}:` (a [TemplateTag, ":"] array) — as the tag's
|
|
// ATTRIBUTES dictionary instead of its content. At runtime Blaze then found a
|
|
// template view object inside the attributes and threw "The basic
|
|
// TransformingVisitor does not support foreign objects in attributes",
|
|
// killing the whole cardMorePopup render.
|
|
//
|
|
// The fix makes the Tag constructor treat an array first argument as content
|
|
// (like upstream), while keeping the vm-sandbox patch's answer for
|
|
// isConstructedObject(Array) itself (flattenAttributes depends on it).
|
|
|
|
const assert = require('assert');
|
|
|
|
// The vendored file is a sloppy-mode IIFE that publishes onto a `Package`
|
|
// global (creating it when missing) — exactly how the jade loader consumes it.
|
|
require('../npm-packages/meteor-jade-loader/lib/vendor/htmljs.js');
|
|
const HTML = global.Package.htmljs.HTML;
|
|
|
|
let passed = 0;
|
|
function test(name, fn) {
|
|
fn();
|
|
passed += 1;
|
|
console.log(' ok -', name);
|
|
}
|
|
|
|
// --- POSITIVE: #6459 — an array first argument is tag CONTENT ---------------
|
|
|
|
test('array first argument becomes children, not attrs (the #6459 crash)', () => {
|
|
// Compiled shape of `label {{_ 'source-board'}}:` — inline text that is an
|
|
// array of [something-view-like, ':'].
|
|
const viewLike = { foo: 'templateTagPlaceholder' };
|
|
const tag = HTML.LABEL([viewLike, ':'], HTML.SELECT());
|
|
assert.strictEqual(tag.attrs, null, 'attrs must stay empty (prototype default)');
|
|
assert.strictEqual(tag.children.length, 2);
|
|
assert.ok(Array.isArray(tag.children[0]), 'first child is the inline-text array');
|
|
assert.strictEqual(tag.children[0][1], ':');
|
|
});
|
|
|
|
test('array-only tag keeps its content renderable', () => {
|
|
const tag = HTML.LABEL(['a', 'b']);
|
|
assert.strictEqual(tag.attrs, null);
|
|
assert.deepStrictEqual(tag.children[0], ['a', 'b']);
|
|
});
|
|
|
|
// --- NEGATIVE: everything that must keep working exactly as before ----------
|
|
|
|
test('plain object first argument is still the attributes dictionary', () => {
|
|
const tag = HTML.LABEL({ class: 'nice' }, 'text');
|
|
assert.deepStrictEqual(tag.attrs, { class: 'nice' });
|
|
assert.deepStrictEqual(tag.children, ['text']);
|
|
});
|
|
|
|
test('HTML.Attrs first argument is still unwrapped into attrs', () => {
|
|
const tag = HTML.LABEL(HTML.Attrs({ id: 'x' }), 'text');
|
|
assert.deepStrictEqual(tag.attrs, { id: 'x' });
|
|
assert.deepStrictEqual(tag.children, ['text']);
|
|
});
|
|
|
|
test('a constructed object (another tag) first argument is content', () => {
|
|
const inner = HTML.SPAN('y');
|
|
const tag = HTML.LABEL(inner, 'text');
|
|
assert.strictEqual(tag.attrs, null);
|
|
assert.strictEqual(tag.children[0], inner);
|
|
});
|
|
|
|
test('vm-sandbox patch stays: isConstructedObject(Array) is false', () => {
|
|
// flattenAttributes relies on arrays NOT being "constructed objects"; only
|
|
// the Tag constructor needed the array special-case.
|
|
assert.strictEqual(HTML.isConstructedObject([1, 2]), false);
|
|
});
|
|
|
|
test('no-argument tags still work', () => {
|
|
const tag = HTML.LABEL();
|
|
assert.strictEqual(tag.attrs, null);
|
|
assert.strictEqual(tag.children.length, 0);
|
|
});
|
|
|
|
console.log(`\n${passed} tests passed`);
|