mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 18:10:06 -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.
47 lines
1.7 KiB
JavaScript
47 lines
1.7 KiB
JavaScript
'use strict';
|
|
|
|
// Plain-Node regression guard (no Meteor) for issue #5282: deleting an
|
|
// attachment could log a client-side "Removed nonexistent document" exception
|
|
// even though the delete itself succeeded — the same publication-churn class
|
|
// as the fixed #3252 for comments and checklists, whose guards attachments
|
|
// never got.
|
|
// Run: node tests/attachmentDeleteGuard.test.cjs
|
|
|
|
const assert = require('assert');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const repoRoot = path.resolve(__dirname, '..');
|
|
const read = rel => fs.readFileSync(path.join(repoRoot, rel), 'utf8');
|
|
|
|
const attachments = read('client/components/cards/attachments.js');
|
|
const comments = read('client/components/activities/comments.js');
|
|
|
|
let passed = 0;
|
|
function test(name, fn) {
|
|
fn();
|
|
passed += 1;
|
|
console.log(' ok -', name);
|
|
}
|
|
|
|
test('attachment delete only removes when the doc is still in the local cache', () => {
|
|
assert.ok(
|
|
/if \(this\._id && ReactiveCache\.getAttachment\(this\._id\)\) \{\s*\n\s*await Attachments\.removeAsync\(this\._id\);/.test(attachments),
|
|
'removeAsync must be guarded by a Minimongo presence check',
|
|
);
|
|
});
|
|
|
|
test('negative: no unguarded removeAsync remains in the delete handler', () => {
|
|
const handler = attachments.match(/'click \.js-confirm-delete'[\s\S]*?\n \}\),/);
|
|
assert.ok(handler, 'delete handler found');
|
|
const body = handler[0];
|
|
const removes = body.match(/Attachments\.removeAsync/g) || [];
|
|
assert.strictEqual(removes.length, 1, 'exactly one remove call, inside the guard');
|
|
});
|
|
|
|
test('the sibling #3252 guard for comments is still in place (same bug class)', () => {
|
|
assert.ok(/CardComments\.findOne\(commentId\)/.test(comments));
|
|
});
|
|
|
|
console.log(`\n${passed} tests passed`);
|