mirror of
https://github.com/HeyPuter/puter.git
synced 2026-11-23 14:17:06 +00:00
* feat(bench): backend benchmarks that fail a PR for waterfalled or uncached I/O A scenario runs a request against the in-memory backend and records every SQL, key-value, Redis and object-storage round trip on a modeled clock, then reports round trips per destination, serial stages and modeled latency. tools/bench.mjs runs the scenarios on a base commit and on the head and fails on a regression the pull request description does not accept; benchmarks.yaml runs that on every pull request. Also adds npm run check (lint, type check, related tests and the benchmark comparison for the files a branch changed) and describes the distributed deployment in AGENTS.md. * test(bench): scenarios for fs, kv, auth, apps, permissions, sharing and hosted sites * test(puter-js): count the SDK unit tests in the coverage report Only the bundle the API runners load was instrumented, so the unit tests next to the SDK source never counted. In coverage mode the vitest config now instruments SDK source for them and writes one shard per test file. * test(puter-js): unit tests for ui messaging, dialogs, components, uploads, peer and smaller modules * test(backend): cover fs, permission, app, worker, sharing, broadcast and user edge cases * fix(backend): fs write flags are stored as booleans, app stats weeks are ISO weeks - A write's boolean flags reach the store only once read as booleans; any positive number reads as true. - App open stats grouped by week use ISO 8601 weeks for both the buckets and their labels on every database engine, so the two agree across a year boundary. * fix(puter-js): dialog token source, legacy upload cancel, submenu state, typed-array views - The sign-in dialog takes the token only from the popup it opened, and stops listening when it leaves the page. - Cancelling a legacy upload rejects with `upload_aborted` and no longer runs the `error` callback. - A context menu's submenu stays in step with its parent when the parent item is pressed or the submenu closes itself. - The FileReader polyfill reads a typed-array view through its own offset and length. * ci(bench): benchmark a pull request as merged into its base The comparison ran the branch's own head against the tip of the base branch, so a branch behind its base was charged for (or credited with) what the base gained since. The head side is now the merge commit and the base side its first parent. Shards also get a 15 minute timeout. * test(broadcast): shutdown drain tests send boot's own events first Boot queues cache updates that flush 10 ms later. A test body that started after that flush counted it as its own request, which failed 'bounds a hung flush in onServerShutdown' on a slow runner.
132 lines
3.4 KiB
JavaScript
132 lines
3.4 KiB
JavaScript
import js from '@eslint/js';
|
|
import tseslintPlugin from '@typescript-eslint/eslint-plugin';
|
|
import tseslintParser from '@typescript-eslint/parser';
|
|
import prettierPlugin from 'eslint-plugin-prettier';
|
|
import prettierConfig from 'eslint-config-prettier';
|
|
import { defineConfig } from 'eslint/config';
|
|
import globals from 'globals';
|
|
|
|
// typescript-eslint's flat/recommended preset is an array of configs (base +
|
|
// eslint-recommended overrides + recommended rules). Flatten its rules so we
|
|
// can apply them via our own `files`-scoped blocks.
|
|
const tsRecommendedRules = tseslintPlugin.configs['flat/recommended'].reduce(
|
|
(acc, cfg) => ({ ...acc, ...(cfg.rules ?? {}) }),
|
|
{},
|
|
);
|
|
|
|
const prettierRules = {
|
|
...prettierConfig.rules,
|
|
'prettier/prettier': 'error',
|
|
};
|
|
|
|
const unusedVarsOptions = {
|
|
args: 'after-used',
|
|
argsIgnorePattern: '^_',
|
|
varsIgnorePattern: '^_',
|
|
caughtErrorsIgnorePattern: '^_',
|
|
destructuredArrayIgnorePattern: '^_',
|
|
ignoreRestSiblings: true,
|
|
};
|
|
|
|
const preferConstOptions = {
|
|
destructuring: 'all',
|
|
ignoreReadBeforeAssign: false,
|
|
};
|
|
|
|
const lintedGlobals = {
|
|
...globals.node,
|
|
extension: 'readonly',
|
|
config: 'readonly',
|
|
global_config: 'readonly',
|
|
};
|
|
|
|
const jsFiles = [
|
|
'src/backend/**/*.{js,mjs,cjs}',
|
|
'extensions/**/*.{js,mjs,cjs}',
|
|
];
|
|
|
|
const tsIgnores = [
|
|
'**/*.test.ts',
|
|
'**/*.test.mts',
|
|
'**/*.spec.ts',
|
|
'**/*.spec.mts',
|
|
'**/*.bench.ts',
|
|
'src/backend/test/**',
|
|
'src/backend/tools/**',
|
|
'src/backend/vitest.config.ts',
|
|
'src/backend/vitest.bench.config.ts',
|
|
];
|
|
|
|
const createTsConfig = ({ files, project }) => ({
|
|
files,
|
|
ignores: tsIgnores,
|
|
languageOptions: {
|
|
parser: tseslintParser,
|
|
globals: lintedGlobals,
|
|
parserOptions: {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'module',
|
|
projectService: { defaultProject: project },
|
|
tsconfigRootDir: import.meta.dirname,
|
|
},
|
|
},
|
|
plugins: {
|
|
'@typescript-eslint': tseslintPlugin,
|
|
prettier: prettierPlugin,
|
|
},
|
|
rules: {
|
|
...tsRecommendedRules,
|
|
...prettierRules,
|
|
'@typescript-eslint/no-unused-vars': ['error', unusedVarsOptions],
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
'prefer-const': ['error', preferConstOptions],
|
|
},
|
|
});
|
|
|
|
export default defineConfig([
|
|
{
|
|
ignores: [
|
|
'**/*.dbmig.js',
|
|
'dist/**',
|
|
'build/**',
|
|
'volatile/**',
|
|
'node_modules/**',
|
|
'puter.js/**',
|
|
'apps/**',
|
|
'experiment/**',
|
|
'workers/**',
|
|
'src/public/**',
|
|
'src/gui/**',
|
|
'src/docs/**',
|
|
'src/puter-js/**',
|
|
'src/worker/**',
|
|
'submodules/**',
|
|
'tests/**',
|
|
'tools/**',
|
|
],
|
|
},
|
|
{
|
|
files: jsFiles,
|
|
ignores: ['**/*.test.js'],
|
|
plugins: {
|
|
js,
|
|
prettier: prettierPlugin,
|
|
},
|
|
extends: ['js/recommended'],
|
|
languageOptions: {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'module',
|
|
globals: lintedGlobals,
|
|
},
|
|
rules: {
|
|
...prettierRules,
|
|
'no-unused-vars': ['error', unusedVarsOptions],
|
|
'prefer-const': ['error', preferConstOptions],
|
|
},
|
|
},
|
|
createTsConfig({
|
|
files: ['src/backend/**/*.ts', 'extensions/**/*.ts'],
|
|
project: './tsconfig.json',
|
|
}),
|
|
]);
|