Commit Graph
65 Commits
  • chore(deps): update frontend and Go deps
    Update Ant Design, React i18n, Zod, testing utilities, Oxc tooling, GORM Postgres, Pion transport, and sing dependencies to their latest specified versions.
  • Update deps and fix AntD Space API
    This change bumps the frontend and Go dependency set to newer patch/minor releases, including Vite, react-hook-form, zod, and the x/* Go modules. It also fixes a compatibility issue in the settings UI by switching Ant Design's Space usage from the deprecated `direction` prop to the current `orientation` prop.
  • chore(frontend): bump React and Zod deps
    Update frontend dependencies to React/ReactDOM 19.3.0, Zod 4.6.1, and matching React type packages. Also replace Storybook addon-vitest override placeholders with explicit Vitest/browser-playwright versions to keep dependency resolution stable.
  • Update deps and simplify parsing
    Bump frontend and Go dependencies, then modernize a few hot paths with newer Go string/range helpers. Also widen the client form quota/limit fields to improve the layout.
  • chore: upgrade Vitest to v5
    Update frontend dev tooling to Vitest 5 by bumping `vitest`, `@vitest/browser-playwright`, and `@vitest/coverage-v8`, plus `@types/react-dom`. Add an override for `@storybook/addon-vitest` to pin Vitest-related packages to compatible versions and avoid dependency mismatch issues. Also bump the Go toolchain patch version from `1.27.0` to `1.27.1` in `go.mod`.
  • chore(deps): bump docs and frontend deps
    Update dependency versions across `docs` and `frontend`, including Next/Fumadocs packages in docs and Ant Design, React Query, Storybook, and related tooling in frontend. Also updates lint/format tool versions (`oxlint`, `oxfmt`), bumps docs `pnpm` package manager version, and refreshes workspace release-age exclusions for the newly upgraded docs packages.
  • chore: bump dependencies and clear deprecated frontend APIs
    Routine dependency refresh: telego 1.11.2, go-sqlite3 1.14.50, grpc 1.83.1,
    miekg/dns 1.1.73, sing 0.8.14 and the usual indirect churn on the Go side;
    react-query 5.102.2, i18next 26.4.0, react-hook-form 7.86.0, Storybook
    10.5.10 and vite 8.2.2 on the frontend, which also lifts the private frontend
    package to 1.0.0.
    
    That left npm run lint:deprecated with five call sites. Zod 4 deprecates the
    ZodTypeAny alias in favour of the bare z.ZodType constraint, and react-query
    renamed queryClient.fetchQuery to queryClient.query ahead of removing the old
    name in the next major — the two share an implementation, so the swap in the
    settings test is behaviour-identical.
    
    Also untracks internal/web/dist/.gitkeep. 1872659d dropped its gitignore
    exception on the grounds that nothing under dist/ is ever meant to be
    tracked, but the file was already in the index, so the rule never applied and
    every frontend build that empties dist/ resurfaced it as a spurious deletion.
    make dist-stub and every CI job recreate it on disk.
  • fix(frontend): restore the two rolldown bindings npm dropped from the lockfile
    The from-scratch lockfile regeneration in b9eda09d bumped rolldown 1.2.4 ->
    1.2.5 but wrote back only 14 of its 16 optional platform bindings: npm
    removed the old @rolldown/binding-darwin-x64 and
    @rolldown/binding-linux-arm64-gnu entries and never added the 1.2.5 ones.
    Both are still listed in rolldown's optionalDependencies, so the packages
    section no longer matches the dependency graph.
    
    npm ci validates the whole ideal tree, not just the packages installable on
    the current platform, so it aborted with EUSAGE everywhere and took down all
    four workflows that install the frontend - CI, Release, CodeQL and Docs
    Deploy - each at its first npm ci step. The Go jobs were unaffected.
    
    Regenerated with a clean npm install --package-lock-only, which resolves from
    registry metadata alone and keeps every optional binding regardless of the
    host platform. The diff is purely additive - the two missing blocks, no
    version changes.
  • chore(frontend): update dependencies and adapt to oxlint 1.79
    npm install was failing with ERESOLVE: the lockfile pinned storybook 10.5.7
    and vitest 4.1.10 as peers while package.json asked for ^10.5.9 and ^4.1.11,
    and npm would not move either. Neither npm update, a targeted install, nor
    --package-lock-only broke the cycle, so node_modules and package-lock.json
    were regenerated from scratch (601 packages, 0 vulnerabilities).
    
    oxlint 1.79.0 then promoted five React Compiler rules into the correctness
    category, flagging 101 pre-existing sites. 1.78.0 exits 0 on the same tree,
    so nothing in our code changed - the rule set grew. They are fixed rather
    than suppressed:
    
    - refs (31): latest-value ref writes moved out of render into an effect.
      onlineClientsRef turned out to be write-only and is gone; expireDiffRef
      and trafficDiffRef were replaced by reading the values directly.
    - set-state-in-effect (55): reset-on-open modals now adjust state during
      render; where an effect mixed a synchronous reset with an async fetch, the
      reset moved to render and the effect kept only the request. useMediaQuery
      became useSyncExternalStore.
    - preserve-manual-memoization (11): optional-chained deps the compiler cannot
      match, hoisted to locals or dropped where the memo wrapped a string concat.
    - purity (3): Date.now() in render replaced by a state-backed clock, which
      also refreshes the expiry tag every 60s instead of freezing it until the
      next unrelated re-render.
    - immutability (1): applyClientStatsEvent merged websocket traffic into
      DBInbound rows in place; it now rebuilds only the rows it touches.
    
    Two things fell out of that. clientCount is derived with useMemo instead of
    an imperative rebuildClientCount() called from five sites, which also fixes a
    staleness bug where changing the expiry or traffic threshold left the counts
    alone until some later rebuild. statsVersion existed only to force a
    re-render after an in-place mutation, is meaningless now that rows are
    replaced, and nothing read it, so it is removed.
    
    Also adds a lint:fix script - oxlint --fix was previously only reachable
    through the lint-staged hook.
  • Move to TypeScript 7 and the oxc toolchain (oxlint + oxfmt) (#6262)
    * chore(frontend,docs): move to TypeScript 7 and replace ESLint with oxlint
    
    TypeScript 7 is the native Go port and ships no programmatic compiler
    API, so typescript-eslint cannot run at all: it peer-pins
    typescript >=4.8.4 <6.1.0 (canary too) and hard-crashes with
    "typescript-eslint does not support TS 7.0". Upstream support is
    tracked in typescript-eslint#10940 and targets TS >=7.1.
    
    Rather than wait, or carry Microsoft's side-by-side alias (which keeps
    a second TS 6 install alive purely to feed the linter), both projects
    move to oxlint, which never depended on the TypeScript API.
    
    Typecheck drops from ~9.7s to ~2.2s and 167 packages leave frontend/.
    
    oxlint has no no-restricted-syntax, so the #6121/#6127 cleared-
    InputNumber guard is reimplemented as a JS plugin in
    frontend/tools/oxlint/. It was verified to still fire in
    pages/settings/** and pages/xray/** and to stay exempt in *Modal.tsx.
    
    The type-aware @deprecated sweep survives too, as
    `npm run lint:deprecated`: oxlint's type-aware mode runs on
    oxlint-tsgolint, which drives the TS 7 typescript-go checker, so the
    TS 7 move is what makes it possible.
    
    Behaviour is preserved rather than tightened. jsx-a11y/prefer-tag-over-role
    is off in both configs because it was never part of the recommended sets
    ESLint actually ran, and oxlint honours the existing eslint-disable
    comments, so no source churn was needed.
    
    Two real fixes fell out of the stricter linting:
    - outbound-link-parser.test.ts used `out?.streamSettings` behind an `as`
      cast, which hid the optional chain from ESLint and would throw on a
      null parse; the rest of the file already used `out!`.
    - InputAddon's conditional role/tabIndex/onKeyDown is genuinely
      accessible but oxlint cannot evaluate it, so it gets a scoped disable.
    
    * chore(docs): replace Prettier with oxfmt
    
    oxfmt is the oxc project's Prettier-compatible formatter, so this pairs
    with the oxlint move and drops the last JS-based tool from the docs
    toolchain.
    
    The swap is behaviour-preserving. Running Prettier and oxfmt over the
    same files, with the existing .prettierrc.json settings migrated via
    `oxfmt --migrate=prettier`, produces byte-identical output on every
    file. (Comparing them outside the project directory is misleading:
    Prettier silently falls back to its defaults when it cannot find its
    config, which looks like a mismatch but is not one.)
    
    The 18 files reformatted here were already failing `pnpm format:check`
    before this change — Prettier wanted the exact same edits. The check is
    not part of docs-ci.yml, which is why the drift went unnoticed.
    
    .prettierignore becomes ignorePatterns in .oxfmtrc.json, keeping the
    deliberate MDX exclusion: reflowing MDX prose merges headings into
    paragraphs and collapses lists inside Steps/Callout components. Both
    that and the generated fumadocs-openapi reference output were verified
    untouched.
    
    oxfmt is pinned to 0.63.0 rather than latest. pnpm 11's built-in
    minimumReleaseAge policy rejects same-day releases, and 0.64.0 would
    have made pnpm silently append 20 waiver lines to pnpm-workspace.yaml.
    
    * style(frontend): adopt oxfmt and format src
    
    frontend/ has never had a formatter, so this reformats 344 of 497 files
    in src/. The change is purely whitespace, quoting and line wrapping —
    no logic is touched. It is kept in its own commit so it does not bury
    the TypeScript 7 / oxlint migration or the git blame for the code
    itself.
    
    Settings match docs/ and the code as it was already written: single
    quotes, semicolons, trailing commas, 2-space indent, 100 columns. That
    was measured rather than assumed — src/ was already uniformly
    single-quoted and 2-space indented, with p90 line length at 75.
    
    Formatting is scoped to src/ (mirroring `oxlint src`) and
    .oxfmtrc.json ignores src/generated. Both matter: `make gen-check`
    compares src/generated and public/openapi.json, and
    `make msw-worker-check` byte-compares public/mockServiceWorker.js
    against the installed MSW runtime, so reformatting any of them breaks
    the gate.
    
    Reflowing also moves `eslint-disable-next-line` comments off the line
    they guard, which broke two suppressions that had been silently
    correct before:
    - clone-inbound-modal.test.tsx: the object literal became multi-line,
      leaving `} as any;` four lines below its no-explicit-any disable.
    - ClientsPage.tsx: the useMemo dependency array moved onto its own
      line, out from under its exhaustive-deps disable.
    Both comments were relocated onto the line they actually guard, and
    verified to still suppress by removing them and watching the errors
    return.
    
    * ci: enforce formatting in CI and make verify
    
    Adding oxfmt in the previous two commits gave both projects a formatter
    but nothing that checks it, which is how docs/ had already drifted to 18
    unformatted files: docs-ci.yml runs typecheck, lint, test and build, but
    never format:check, so Prettier's complaints were only ever visible to
    whoever ran it by hand.
    
    Wire `format:check` into the frontend job in ci.yml and the docs job in
    docs-ci.yml, and add a `format-check` target to `make verify` so the
    local gate keeps mirroring CI as the Makefile header promises.
    
    Verified the step actually bites rather than passing vacuously: adding
    a badly formatted line to a source file in each project makes both
    `make format-check` and `pnpm format:check` fail, and reverting it makes
    them pass again.
    
    No workflow referenced ESLint or Prettier by name — they all invoke the
    package scripts — so the tooling swap needed no other CI changes.
    
    * ci: trigger CI on Makefile changes
    
    The path filters listed **.go, go.mod, go.sum, frontend/**, .nvmrc and
    ci.yml itself, but not the Makefile — so a change to the canonical task
    runner that ci.yml is meant to mirror could land without any job
    running. The previous commit, which edits both, only triggers because
    it happens to touch ci.yml too.
    
    * fix(frontend): replace deprecated Ant Design 6 APIs in the geo components
    
    `npm run lint:deprecated` reported five uses of props Ant Design 6 has
    deprecated. All five are gone, and the matching runtime warnings no
    longer appear in the test output.
    
    Tag `bordered={false}` becomes `variant="filled"` and Space `direction`
    becomes `orientation`; both are the one-to-one replacements named in
    antd's own deprecation messages, and `direction`/`orientation` share the
    same Orientation type.
    
    Input `addonAfter` is the one that is not a rename. It becomes a
    `Space.Compact block` wrapping the Input and the browse Button, which is
    antd's documented migration. `block` keeps the field filling its form
    row as the addon did. Note this is a deliberate visual change: the
    button used to be a borderless `type="text"` icon sitting inside the
    addon's grey box, and is now a regular button whose border joins the
    input. The tooltip, aria-label, ref, id and onBlur wiring are unchanged,
    so the react-hook-form binding in RuleFormModal and the existing tests
    still address it the same way.
    
    Only these five were deprecated. The other `bordered` props in the tree
    sit on QRCode, Table, Descriptions and Alert, where the prop is not
    deprecated, and these were the only two Space `direction` uses in the
    codebase.
    
    * fix(frontend): restore lint rules lost in the oxlint migration, and test the guard
    
    Addresses the review on #6262.
    
    The frontend config re-enabled only no-explicit-any and no-unused-vars
    and left the rest of tseslint's recommended set to oxlint's correctness
    category. It does not cover all of it. Confirmed by linting one probe
    file against both configs: docs/ (which enumerates the rules) reports
    all nine, frontend/ reported four. So ban-ts-comment,
    no-empty-object-type, no-namespace, no-require-imports and
    no-unsafe-function-type had silently stopped being enforced — a `//
    @ts-ignore` or a `namespace` block would have landed unflagged. The ten
    rules are now mirrored from docs/.oxlintrc.json, and src/ still passes.
    
    The #6121/#6127 guard was 57 lines of hand-written AST walking with no
    test. It now has one: fixtures for the three banned shapes plus an
    onNumber()-wrapped control, asserting the rule fires three times and
    that .oxlintrc.json still wires it to the right paths. Verified it fails
    for the right reason by making walk() enumerate nothing, which is the
    silent-death mode the review described — the traversal depends on
    Object.keys() seeing AST children as own enumerable properties.
    
    The fixtures deliberately violate the rule, so their oxlint config is
    named guard.oxlintrc.json rather than .oxlintrc.json: oxlint discovers
    nested configs by directory, which would otherwise turn the fixtures
    into three lint errors. The test passes it explicitly with -c.
    
    Also from the review:
    - lint and format now cover tools/ as well as src/, so the one piece of
      hand-written lint logic in the repo is no longer the least covered
      file in it.
    - lint-staged runs oxfmt before oxlint --fix. Formatting became a hard
      CI gate in this PR while the hook only ran the linter, so a commit
      could pass the hook and fail CI on formatting alone.
    - .oxfmtrc.json ignores public/, so the artefacts that make gen-check
      and make msw-worker-check byte-compare stay safe even if oxfmt is
      invoked without a path argument.
    - The MDX and generated-reference rationales that .prettierignore
      carried are back as comments in docs/.oxfmtrc.json — oxlint and oxfmt
      both accept JSONC, so relocating them was unnecessary.
    
    Not applied: the review also suggested restoring ../internal/web/dist to
    the ignore lists. Both tools reject `..` patterns outright ("patterns
    are resolved within the config file's directory"), and being outside
    frontend/ it is unreachable anyway.
  • chore(frontend): bump npm dependencies
    Refresh frontend package versions and regenerate the lockfile. This updates core UI and tooling packages including Ant Design, React Hook Form, Storybook, Vite, eslint/typescript-eslint, @noble/hashes, persian-calendar-suite, and swagger-ui-react to pick up the latest fixes and minor improvements.
  • chore(deps): bump dompurify (#6193)
    Bumps the npm_and_yarn group with 1 update in the /frontend directory: [dompurify](https://github.com/cure53/DOMPurify).
    
    
    Updates `dompurify` from 3.4.12 to 3.4.13
    - [Release notes](https://github.com/cure53/DOMPurify/releases)
    - [Commits](https://github.com/cure53/DOMPurify/compare/3.4.12...3.4.13)
    
    ---
    updated-dependencies:
    - dependency-name: dompurify
      dependency-version: 3.4.13
      dependency-type: indirect
      dependency-group: npm_and_yarn
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • chore(frontend): resolve the high-severity brace-expansion advisory (#6180)
    npm audit --omit=dev --audit-level=high is a CI gate and it currently fails on
    main: swagger-ui-react pulls @swagger-api/apidom-reference, which pins
    minimatch, which resolves brace-expansion to 5.0.8 — the range covered by
    GHSA-rgw5-rvv9-x895.
    
    Pin the patched 5.0.9 through the existing swagger-ui-react overrides block
    rather than globally: minimatch@3 under eslint-plugin-jsx-a11y still needs the
    1.x line, and a blanket override would force v5 there too.
  • chore(deps-dev): bump brace-expansion (#6172)
    Bumps the npm_and_yarn group with 1 update in the /frontend directory: [brace-expansion](https://github.com/juliangruber/brace-expansion).
    
    
    Updates `brace-expansion` from 1.1.16 to 1.1.18
    - [Release notes](https://github.com/juliangruber/brace-expansion/releases)
    - [Commits](https://github.com/juliangruber/brace-expansion/compare/v1.1.16...v1.1.18)
    
    ---
    updated-dependencies:
    - dependency-name: brace-expansion
      dependency-version: 1.1.18
      dependency-type: indirect
      dependency-group: npm_and_yarn
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • chore: bump frontend and Go dependencies
    Updates multiple frontend packages (antd, react-hook-form, storybook, vite, swagger-ui-react, playwright, typescript-eslint, etc.) and Go dependencies (gopsutil, gorm postgres driver, pion/transport, ugorji/codec, genproto, and others). Also replaces `__dirname` with `import.meta.dirname` in vite.config.js for ESM compatibility.
  • chore: refresh dependencies and modernize Go test idioms
    Frontend deps: @hookform/resolvers 5.4.3 -> 5.5.7, Storybook 10.5.4 -> 10.5.5
    across the four packages we declare, globals 17.7.0 -> 17.8.0, and jsdom
    29.1.1 -> 30.0.1. The jsdom major replaces its CSS and selector stack --
    @asamuzakjp/css-color 5 -> 6, @asamuzakjp/dom-selector 7 -> 8, undici 7 -> 8,
    nwsapi and generational-cache folded into their parents, whatwg-url 17 nested
    underneath. Nothing in the Vitest suites reaches those directly and the whole
    frontend gate (typecheck, lint, tests, build, Storybook compile) is green.
    Panel frontend version to 0.6.0.
    
    Backend deps: mattn/go-sqlite3 1.14.48 -> 1.14.49 and valyala/fasthttp
    1.72.0 -> 1.73.0, plus the golang.org/x/exp and genproto/googleapis/rpc
    indirect bumps that came with them.
    
    Go tests: modernize -fix output, covering range-over-int, sync.WaitGroup.Go
    in place of manual Add/Done pairs, maps.Copy, and Go 1.26 new(expr) for
    pointer-to-value in the forwarded-trust table. The storedAs helper is deleted
    instead of being left behind a //go:fix inline directive -- keeping it that way
    fails govet on the one call site the rewrite did not reach, and every caller now
    takes new(...) directly. Behaviour is unchanged.
    
    DnsTab: the hosts-sync effect tested dns while declaring dnsEnabled in its
    dependency array. Both carry the same truth value, so this is exhaustive-deps
    hygiene rather than a behaviour change.
  • chore: refresh dependencies, fix Linux tool tasks, modernize Go idioms
    Frontend deps: @hookform/resolvers 5.4.0 -> 5.4.3 and react-hook-form
    7.82.0 -> 7.83.0. The @typeschema/valibot override is what makes this
    installable at all. Resolvers 5.4.3 re-declares 25 optional peers for its
    validator matrix, and npm resolves them into the ideal tree even though none
    are used here; two of them contradict, since resolvers wants valibot ^1 while
    @typeschema/main -> @typeschema/valibot pins valibot ^0.39. Both target the
    same node_modules/valibot, so a plain npm update dies with ERESOLVE. The
    override settles that one edge and nothing extra lands in node_modules.
    
    Backend deps: telego 1.10.0 -> 1.11.1 (Telegram Bot API v10.2, additive
    only), klauspost/compress 1.19.1, plus the indirect bumps that came with them.
    
    VS Code tasks: the golangci-lint and modernize tasks assumed Windows PATH
    semantics, where PATH is a persistent user variable that every process
    inherits, so ~/go/bin was always visible. On Linux that directory is exported
    from ~/.bashrc, which the non-interactive `bash -c` behind a task never
    sources, and both tasks failed with exit 127. Adds linux/osx option blocks
    that prepend the Go bin directories and leaves the Windows path untouched,
    plus tasks to install the two tools; those are split because go install
    rejects packages from different modules in one invocation.
    
    Go sources: modernize -fix output, covering range-over-int, slices.Backward,
    maps.Copy, strings.CutPrefix and strings.SplitSeq. Behaviour is unchanged.
  • chore(deps): migrate to react-router 8 and refresh frontend dependencies
    react-router-dom 7 is superseded by react-router 8, which folds the DOM
    bindings back into the core package. RouterProvider now comes from
    `react-router/dom`, while the hooks and `createBrowserRouter` move to
    `react-router`. Updates the nine importing modules and the router line in
    docs/architecture.md to match.
    
    Also refreshes antd, react-i18next, storybook, eslint, lint-staged and
    playwright to current patch/minor releases, and restores alphabetical order
    in devDependencies for the @vitest/browser-playwright and playwright entries.
    
    Bumps brace-expansion to 5.0.8, the only release outside the affected range
    of GHSA-mh99-v99m-4gvg (unbounded expansion length causing an OOM crash).
    `npm audit fix` could not apply this on its own: the lockfile pinned 5.0.7
    and npm will not re-resolve a transitive-only dependency in place, so the
    entry was updated directly and reinstalled.
  • chore(deps): bump docs and frontend dependencies
    Routine minor/patch updates: Next.js 16.2.11 + eslint-config-next,
    fumadocs, React 19.2.8, Storybook 10.5.3, and assorted tooling.
    
    Docs stays on ESLint 9 (^9.39.5): eslint-config-next pulls in
    eslint-plugin-react 7.37.5, whose newest release still calls the
    context.getFilename API that ESLint 10 removed, so eslint crashes on
    every file under ESLint 10. The frontend workspace already ran ESLint
    10 without eslint-plugin-react and is unaffected.
  • chore(deps): bump react-i18next from 17.0.9 to 17.0.10 in /frontend (#5996)
    Bumps [react-i18next](https://github.com/i18next/react-i18next) from 17.0.9 to 17.0.10.
    - [Changelog](https://github.com/i18next/react-i18next/blob/master/CHANGELOG.md)
    - [Commits](https://github.com/i18next/react-i18next/compare/v17.0.9...v17.0.10)
    
    ---
    updated-dependencies:
    - dependency-name: react-i18next
      dependency-version: 17.0.10
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • chore(deps-dev): bump vite from 8.1.4 to 8.1.5 in /frontend (#5997)
    Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 8.1.4 to 8.1.5.
    - [Release notes](https://github.com/vitejs/vite/releases)
    - [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
    - [Commits](https://github.com/vitejs/vite/commits/v8.1.5/packages/vite)
    
    ---
    updated-dependencies:
    - dependency-name: vite
      dependency-version: 8.1.5
      dependency-type: direct:development
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • feat(frontend): make Storybook a validated, fully covered component workbench
    Storybook existed only as an undocumented local tool: 9 of 24 reusable components had stories, autodocs pages were bare prop tables, nothing built or tested the stories, and no contributor doc mentioned the workbench existed.
    
    Every reusable component under src/components/ now has a co-located story with enriched autodocs (component descriptions plus per-prop argTypes, kept as string metadata since the repo bans line comments). Stories double as headless Chromium tests through the Storybook vitest addon, with axe accessibility checks enforced as errors and play-function interaction tests covering the modals, the RHF field bridge, the config block, and the select-all buttons. The preview now mirrors the panel's real theme DOM (body class, shared AntD theme config, seeded theme storage) so what stories render matches production.
    
    CI and make verify gain a static Storybook build as a compile gate, and the frontend test job installs Chromium so story tests run on every PR. Contributor docs (frontend README, CONTRIBUTING, agent guides) document the workbench, the story conventions, and the Controls setup. Node engines move to 24 LTS and gen:api drops the type-stripping flags that Node 24 makes default.
  • chore(frontend): bump version and deps
    Update the frontend package version from 0.4.1 to 0.4.3 and refresh key dependencies. This includes i18next/react-i18next, Storybook packages (10.5.0), and ESLint (10.7.0), with corresponding lockfile updates to keep dependency resolution in sync.
  • chore(deps-dev): bump vite from 8.1.3 to 8.1.4 in /frontend (#5877)
    Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 8.1.3 to 8.1.4.
    - [Release notes](https://github.com/vitejs/vite/releases)
    - [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
    - [Commits](https://github.com/vitejs/vite/commits/v8.1.4/packages/vite)
    
    ---
    updated-dependencies:
    - dependency-name: vite
      dependency-version: 8.1.4
      dependency-type: direct:development
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • chore(frontend): bump dependencies
    Routine version bumps: i18next, msw, typescript-eslint, vitest and
    @vitest/coverage-v8 to their latest patch/minor releases, with the
    lockfile regenerated to match.
  • Frontend dev tooling (Husky, lint-staged, MSW, Storybook) + full React Hook Form migration (#5859)
    * chore(frontend): add husky + lint-staged pre-commit gate
    
    Wire a local pre-commit gate that runs eslint --fix on staged
    frontend TypeScript via lint-staged. Because the only package.json
    lives in frontend/ while the git root is one level up, the prepare
    script installs husky hooks at frontend/.husky from the repo root
    (cd .. && husky frontend/.husky), and the pre-commit hook cd's into
    frontend/ before invoking lint-staged so node_modules resolves.
    
    * test(frontend): add MSW request mocking
    
    Add Mock Service Worker so tests can exercise the real http-init.ts
    request pipeline (CSRF acquisition, 403 refetch-and-retry, body
    parsing) instead of only stubbing HttpUtil. A node setupServer is
    started for the vitest unit project with onUnhandledRequest bypass so
    the existing HttpUtil spies and 55 component tests are untouched; the
    browser worker is copied to public/ for Storybook and dev use.
    
    * chore(frontend): add Storybook + component stories
    
    Set up Storybook 10 on the React-Vite builder (compatible with the
    pinned Vite 8.1.3 and React 19). The preview decorator mirrors the
    vitest component harness: an Ant Design ConfigProvider with a
    light/dark toolbar toggle and an en-US i18next instance. main.ts
    neutralizes the app vite config bits that do not belong in a component
    workshop (the three-entry rollup input, renderBuiltUrl, and the shared
    dist outDir) so build-storybook can never clobber internal/web/dist.
    Seeds stories across the presentational library (viz, ui, clients,
    feedback). build-storybook is a local tool and is not wired into the
    CI gate.
    
    * feat(frontend): add React Hook Form primitives
    
    Introduce the shared RHF layer that AntD inputs bind through, ahead of
    migrating the forms off Ant Design's Form store:
    - FormField wraps a Controller in an Ant Design Form.Item shell,
      reconciling the value/onChange shapes of Input, Switch, InputNumber,
      Select and friends via normalizeAntdOnChange, with input/output
      transforms and Zod-issue-key error messages resolved through t().
    - useZodForm wires zodResolver (Zod 4) with the AntD-matching modes
      (validate on submit, then live) and shouldUnregister false so hidden
      and unmounted-tab fields keep their values.
    - rhfZodValidate covers the rare per-field rule sites.
    Covered by a FormField test exercising normalization, transforms, and
    resolver error surfacing.
    
    * refactor(frontend): migrate Pattern-B leaf forms to React Hook Form
    
    Move the controlled-useState leaf forms onto RHF via the FormField
    primitive, keeping Ant Design components and each form's exact submit
    behaviour (same safeParse, same toast on the first Zod issue, same
    payload building):
    - clients: ClientBulkAdjustModal, BulkAddToGroupModal, ClientBulkAddModal
    - xray: RuleFormModal, BalancerFormModal, WarpModal, NordModal
    
    Multi-control widgets that don't fit a single input (inbound dual
    select, subId regen, expiry branches, the balancer tag warning) stay as
    explicit Controller/setValue. Derived visibility now reads live values
    through useWatch. FormField gains a required prop so migrated fields keep
    their required-asterisk affordance.
    
    Settings tabs are intentionally excluded: they are control-panel
    components that live-patch a parent AllSetting via SettingListItem, not
    Ant Design Form submit-forms.
    
    * refactor(frontend): migrate LoginPage to React Hook Form
    
    Replace the Ant Design Form store + antdRule per-field validation with
    useForm + FormField. The AntD Form stays as the layout/submit wrapper,
    now driving methods.handleSubmit(onSubmit) via onFinish. Username and
    password validate through rhfZodValidate(LoginFormSchema.shape.*); the
    two-factor field keeps its conditional required rule (only registered
    when 2FA is enabled). Submit posts the same values to /login.
    
    * refactor(frontend): migrate ClientFormModal to React Hook Form
    
    Move the client add/edit form off controlled useState onto RHF while
    preserving exact submit behaviour (same ClientFormSchema /
    ClientCreateFormSchema safeParse, same toast, same payload + attach/
    detach diff + external-links build). expiryDate is stored as an epoch
    number (never a Dayjs) to survive RHF's value cloning, converted at the
    DateTimePicker boundary. externalLinks uses useFieldArray with stable
    ids. inboundIds and the derived show*/ss2022 visibility read live via
    useWatch. Space.Compact button-group widgets stay manual Controllers so
    the joined borders keep working.
    
    * refactor(frontend): migrate Node and DNS modals to React Hook Form
    
    Both are self-contained Pattern-A forms (no shared fragments). Replace
    Form.useForm with useForm + FormProvider, Form.useWatch with useWatch,
    setFieldValue with setValue, and partial validateFields([...]) with
    methods.trigger([...]). Per-field antdRule becomes rhfZodValidate rules;
    the Node scheme->tlsVerify cascade moves to FormField onAfterChange; the
    DNS domains/expectIPs/unexpectIPs string arrays are driven by
    useWatch + setValue. Submit runs through handleSubmit on the modal OK
    button, preserving each form's exact validation, payload build, and
    save/onConfirm behaviour.
    
    * refactor(frontend): migrate HostFormModal to React Hook Form
    
    The host external-proxy editor's outer form moves to useForm +
    FormProvider. Security/tab visibility reads via useWatch; the three
    json-form editors (HostMuxForm/HostSockoptForm/HostFinalMaskForm) are
    bound as value/onChange black boxes through a Controller (their own
    internal forms are unchanged). remark/inboundId keep their validation
    via rhfZodValidate; submit runs through handleSubmit and builds the
    same payload (isDisabled = !enable) and save call.
    
    * refactor(frontend): migrate OutboundFormModal + fragments to React Hook Form
    
    Move the outbound form cluster off Ant Design's Form store onto RHF.
    The parent uses useForm + FormProvider with a watch() subscription for
    the protocol reseed cascade and setValue-based network/security/xmux
    cascades; the JSON<->Basic bridge and the formValuesToWirePayload
    submit are preserved exactly. Every outbound transport/protocol/security
    fragment now binds through FormField/useWatch via context.
    
    The shared config editors stay untouched and are bound through small
    value/onChange adapters (src/lib/xray/forms/fields: FinalMaskField,
    SniffingField, SockoptCustomField) via Controller; HeaderMapEditor binds
    directly. The host json-form wrappers that reuse the outbound MuxForm/
    SockoptForm (HostMuxForm, HostSockoptForm, OutboundSubtreeJsonForm) move
    to a local RHF provider to match. Outbound render/link tests pass
    unchanged.
    
    * refactor(frontend): migrate InboundFormModal + fragments to React Hook Form
    
    Move the inbound add/edit form (the largest form in the panel) and its
    transport/protocol/security fragments off Ant Design's Form store onto
    RHF, mirroring the outbound migration. The parent uses useForm +
    FormProvider with a watch() subscription for the protocol reseed
    cascade (type==='change' guard so programmatic resets don't reseed) and
    setValue-based network/security cascades; useSecurityActions drives the
    TLS/Reality keypair + scan through setValue. Hidden pass-through
    Form.Items are dropped (their values ride in the reset object and
    survive via shouldUnregister:false), so getValues() still returns the
    settings.clients subtree untouched. accounts / certificates / tun lists
    use useFieldArray; the shared FinalMask/Sniffing/Sockopt editors bind
    through the value/onChange adapters.
    
    Submit keeps the manual InboundFormSchema.safeParse + formatInboundValidation
    toast + formValuesToWirePayload exactly. The golden link/full fixtures
    pass byte-for-byte, confirming identical wire output. inbound-form-blocks
    test harness rewritten from a Form.useForm harness to an RHF provider.
    
    * refactor(frontend): retire antdRule; document the RHF form pattern
    
    All forms now build on React Hook Form, so the AntD-Form Zod adapter
    antdRule (src/utils/zodForm.ts) has no remaining callers — remove it.
    Update frontend/CLAUDE.md: forms use useZodForm + FormField from
    components/form/rhf with zodResolver/rhfZodValidate validation; AntD
    <Form> is layout-only; the shared FinalMask/Sniffing/Sockopt editors
    stay AntD islands wrapped as value/onChange adapters bound via a
    Controller.
    
    * chore(frontend): cover esbuild in the allowScripts allowlist
    
    esbuild (pulled in transitively by Vite/Vitest/Storybook) ships a
    postinstall that npm's allow-scripts flags as uncovered on every
    install. Its platform binary is delivered through the @esbuild/<platform>
    optionalDependencies, so the postinstall isn't needed here; deny it like
    the other entries to silence the warning.
    
    * fix(frontend): restore label layout in Sniffing/FinalMask field adapters
    
    The value/onChange adapters that wrap the shared SniffingFields and
    FinalMaskForm editors put them in their own isolated AntD Form, but that
    Form was missing the label layout the fields used to inherit from the
    inbound/outbound parent form. Their labels rendered full-width instead
    of the compact right-aligned column, so the Sniffing tab and the TCP
    Masks / QUIC Params sections looked broken. Give both adapter forms the
    same colon=false, labelCol/wrapperCol span 8/14, labelWrap layout.
    
    * ci: add least-privilege permissions to Docs CI workflow
    
    The docs-ci workflow had no explicit permissions block, so it inherited
    the repository default for GITHUB_TOKEN. The build job only checks out
    and builds the docs, so restrict it to contents: read, resolving the
    CodeQL actions/missing-workflow-permissions alert.
  • refactor(frontend): replace recharts with uPlot for charts
    Swap the Sparkline chart component (the only chart in the panel) from recharts to uPlot, keeping its public prop API identical so the three consumers (SystemHistoryModal, XrayMetricsModal, NodeHistoryPanel) are untouched. This drops recharts and 32 transitive deps (es-toolkit, victory-vendor, d3, redux, immer), shrinking the chart vendor chunk to ~51KB (22KB gzip).
    
    The uPlot port reimplements every recharts feature on canvas: gradient area fill, spline curves, up to three series, dashed horizontal grid, formatted axes, hover tooltip and marker, reference lines, and min/max extrema dots. Because canvas cannot read CSS variables, axis and ring colors are resolved via getComputedStyle and repainted on theme changes through a MutationObserver on the body class and documentElement data-theme.
    
    Also removes the es-toolkit/compat resolver shim from vite.config.js, which existed only for recharts, and swaps the manualChunks entry to vendor-uplot.
    
    Note: repaint with redraw(false); a bare uPlot redraw() re-runs _setScale and nulls the index-based x-scale, which collapsed the series to a flat, partial line.
  • refactor(frontend): replace axios with the native Fetch API
    Drop the axios (and qs) dependencies in favor of a native fetch wrapper.
    axios only ever handled same-origin JSON/form calls, a CSRF header, a 401
    redirect, and a 403-retry, all of which the platform now provides directly.
    
    - New src/api/http-init.ts (replaces axios-init.ts) reimplements the
      request/response interceptors on fetch: base-path prefixing,
      X-Requested-With, same-origin credentials, the CSRF token on unsafe
      methods, a single 403 retry with token refresh, and the 401
      redirect-and-latch. A small encodeForm() reproduces qs's
      arrayFormat:'repeat' encoding, so the request wire format is unchanged.
    - HttpUtil (src/utils/index.ts) keeps its public signatures and the Msg
      envelope, so the ~49 API call sites are untouched. HttpOptions is now
      hand-rolled instead of extending AxiosRequestConfig.
    - PanelUpdateModal drops its lone direct axios.get in favor of HttpUtil.get
      with { silent, timeout }.
    - Add tests for the fetch core (CSRF header, form/JSON/FormData bodies,
      base-path prefix, 403 retry, 401 redirect, tolerant body parse) and for
      HttpUtil's envelope unwrap / toast / error mapping; this logic was
      previously untested.
    - Remove the vendor-axios manualChunks branch and the qs type shim, and
      reword stale "axios" mentions in docs and route comments.
  • chore(frontend): bump minor npm deps
    Update frontend dependencies to newer patch/minor versions in package.json and refresh package-lock accordingly. This includes runtime libraries (i18next, react-router-dom, recharts) and tooling updates (typescript-eslint, vite) to keep the frontend stack current and aligned.
  • feat(reality): derive a stable per-client spiderX for shared links
    The inbound's spiderX now acts as a per-client seed: exports emit
    sha256(seed|subKey) truncated to a 15-hex "/path", so a client's spx no
    longer changes on every subscription fetch (#5718) while different
    clients stop sharing one fingerprintable value. The form gains a
    regenerate button that rotates every client's path at once.
    
    The frontend link builders derive through the same function
    (lib/xray/spider-x.ts, @noble/hashes) keyed on subId-then-email like
    the Go subKey, so panel QR/copy links and subscription output agree —
    cross-language vector tests lock both sides byte-for-byte. streamData
    now tolerates malformed stored stream settings (unparseable JSON, null
    tls/reality settings) instead of panicking the subscription request.
  • chore(deps): bump antd to 6.5 and migrate deprecated component props
    Upgrade frontend deps (antd 6.4.5 -> 6.5.0, Ant Design icons, TanStack
    Query, i18next, eslint) and fasthttp 1.71 -> 1.72.
    
    AntD 6.5 deprecated several Input/Card/Space props, so adapt the panel UI:
    - Input/InputNumber addonBefore/addonAfter -> prefix/suffix
    - Card bordered -> variant="outlined"
    - Space direction -> orientation
    - swap the hand-rolled Telegram SVG for the new TelegramFilled icon
    - guard SettingListItem against cloning aria-labelledby onto a Fragment,
      which only accepts key/children
  • feat(a11y): screen-reader & keyboard accessibility across the panel (#5486) (#5652)
    * feat(a11y): label list, toolbar & dashboard actions for screen readers
    
    Phase 1 of #5486 (Android TalkBack support). Icon-only controls across
    the management surfaces previously announced only their untranslated
    icon name (e.g. "edit", "ellipsis") or nothing at all.
    
    - Add aria-label to icon-only row-action and toolbar buttons across
      inbounds, clients, groups, hosts, nodes and xray
      (outbounds/routing/dns/balancers) lists, plus the dashboard cards.
    - Make clickable bare icons and AntD Card actions keyboard-operable via
      role/tabIndex + Enter/Space (new activateOnKey helper); convert mobile
      dropdown triggers to buttons so they open from the keyboard.
    - Fix the sidebar hamburger's mislabeled aria-label (was the dashboard
      label) and translate previously-hardcoded outbound menu labels.
    
    New i18n keys in all 13 locales: sort, menu.openMenu,
    pages.xray.outbound.moveToTop.
    
    * feat(a11y): label modal, QR and copy/download controls for screen readers
    
    Phase 2 of #5486. Modal and overlay controls relied on tooltips (not a
    reliable accessible name) or were bare clickable icons with no keyboard
    or screen-reader support.
    
    - Add aria-label to copy/QR/download/info icon buttons in the inbound and
      client info modals, sub-links modal, QR panel, backup/log modals, and
      to the bare search/select inputs of the attach/detach client modals.
    - Make click-to-copy QR codes and the IP-log refresh/clear, geofile
      reload and log refresh icons keyboard-operable (role/tabIndex +
      Enter/Space) with translated labels.
    - Label the 2FA code input; drop the QrPanel download-image string
      fallback now that the key exists.
    
    New i18n key in all 13 locales: downloadImage.
    
    * feat(a11y): label form fields and shared form components for screen readers
    
    Phase 3 of #5486. Form controls and shared form widgets were largely
    unlabelled, and several remove controls were not keyboard-operable.
    
    - SettingListItem now ties its title to the control via aria-labelledby,
      giving accessible names to the ~90 settings-tab inputs at once.
    - InputAddon gains button semantics (role/tabIndex/Enter+Space) and an
      ariaLabel prop when used as an interactive remove control.
    - Sparkline charts expose a role="img" summary of their latest values.
    - Add aria-label to add/remove/regenerate icon buttons and bare
      inputs/selects across inbound, client and xray (dns/routing/balancer/
      outbound) forms; make clickable remove icons keyboard-operable; mark
      decorative help/target icons aria-hidden; label the JSON editor,
      date-time clear button, header-map remove, notification select-all and
      remark token chips.
    
    New i18n keys in all 13 locales: regenerate, jsonEditor,
    pages.xray.balancer.{costMatch,costValue,costRegexp}.
    
    * chore(a11y): add eslint-plugin-jsx-a11y harness and fix flagged interactions
    
    Phase 4 of #5486. Adds eslint-plugin-jsx-a11y (recommended ruleset,
    scoped to .tsx) so screen-reader/keyboard regressions fail lint.
    
    - Make the mobile node-card header a proper keyboard disclosure
      (role=button, aria-expanded, Enter/Space activation that ignores
      clicks on the nested action buttons) and drop the now-redundant
      stop-propagation click handlers the linter flagged on card-action
      wrappers in the node, client and inbound mobile cards.
    - Disable jsx-a11y/no-autofocus: the autofocus on the login field and
      modal primary inputs is intentional focus management that helps
      screen-reader and keyboard users land on the right control.
    
    make lint passes with the a11y ruleset enforced.
    
    * feat(a11y): cover remaining deferred spots (settings tabs, sockopt, API docs)
    
    Completes the panel sweep for #5486 by labelling the spots previously
    left out of phases 1-4:
    
    - NotifyTimeField (Telegram notifications): the mode, interval, unit and
      custom-cron inputs now carry aria-labels.
    - The Sockopt toggle in transport options.
    - Settings category tabs in icons-only (mobile) mode now expose the tab
      name as the icon's aria-label instead of the raw icon name.
    - The Swagger API-docs view is wrapped in a labelled region landmark.
    
    New i18n keys in all 13 locales: pages.settings.notifyTime.{interval,unit}.
    
    * feat(a11y): label shared xray form components and remark field
    
    Code review surfaced frontend/src/lib/xray/forms/ — shared form components
    used by the host and inbound JSON forms — which the initial audit missed.
    
    - FinalMaskForm (TCP/UDP final-mask editor): label the icon-only add and
      regenerate buttons and make all six remove icons keyboard-operable
      (role/tabIndex/Enter+Space); adds useTranslation to its sub-components.
    - CustomSockoptList: the remove icon is now keyboard-operable.
    - SniffingFields: aria-label on the otherwise label-less destOverride select.
    - RemarkTemplateField: aria-label on the remark-variable picker button.
    
    New i18n key in all 13 locales: pages.inbounds.sniffingDestOverride.
    
    * feat(a11y): label client info modal and WireGuard config block
    
    After rebasing onto the WireGuard client-config feature, re-apply the
    ClientInfoModal copy/QR/IP-log aria-labels (the modal was restructured
    upstream, so the original labels did not carry over) and label the new
    ConfigBlock component's copy/download/QR actions. ConfigBlock's action
    wrapper keeps its stop-propagation handler (a non-interactive guard for
    the Collapse header) under a scoped jsx-a11y exception.
    
    * fix(frontend): let npm install jsx-a11y under ESLint 10
    
    eslint-plugin-jsx-a11y@6.10.2 declares a peer range that stops at ESLint 9,
    but the panel is on ESLint 10, so `npm ci` aborts with ERESOLVE even though
    the plugin runs fine on ESLint 10 with flat config. Add an npm override so
    jsx-a11y accepts the project's ESLint version. This keeps normal peer
    resolution (recharts' react-is peer still auto-installs) — no global
    legacy-peer-deps and no manual react-is pin needed.
    
    * fix(a11y): size mobile row triggers and move node expand role to chevron
    
    Address automated review on #5652:
    - add size="small" to the inbound/client/node mobile-card "more" dropdown
      triggers so they match the adjacent small Switch and the established
      desktop RowActions pattern.
    - move the node card-head disclosure semantics (role/tabIndex/aria-expanded/
      keyboard) onto the chevron affordance so the expand control is no longer a
      role="button" wrapping the Switch, info button and dropdown. Mouse
      click-anywhere-to-expand is preserved on the header div.
  • chore: bump deps and modernize test loops
    - release.yml: download-artifact v7 -> v8
    - frontend: i18next 26.3.1 -> 26.3.2, qs 6.15.2 -> 6.15.3
    - go.mod: consolidate indirect requires (go mod tidy)
    - tests: adopt Go 1.22 range-over-int loops
  • Bump frontend package & deps to new patch versions
    Update frontend package version from 0.3.1 to 0.4.0 and upgrade multiple dependencies. Notable bumps include @tanstack/react-query (+devtools) to 5.101.1, antd to 6.4.5, axios to 1.18.1, recharts to 3.9.0, swagger-ui-react to 5.32.8, vite/@vitejs/plugin-react to 8.1.0/6.0.3, the @typescript-eslint suite to 8.62.0, globals to 17.7.0, rolldown/related bindings to 1.1.2, and various wasm/wasm-runtime packages. package-lock.json was updated to reflect the resolved versions and integrity hashes for these dependency changes.
  • chore: bump dompurify to 3.4.11 and expand VS Code tasks
    - override dompurify to ^3.4.11 (fixes setConfig hook-pollution XSS advisory in the transitive swagger-ui-react dep)
    - add frontend tasks (build, dev, gen, lint, test, typecheck, install, ncu) and go tasks (fmt, modernize, modernize -fix)
    - add compound tasks: build:full (frontend + go) and check:all
  • chore(deps): bump react-router-dom from 7.17.0 to 7.18.0 in /frontend (#5428)
    Bumps [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom) from 7.17.0 to 7.18.0.
    - [Release notes](https://github.com/remix-run/react-router/releases)
    - [Changelog](https://github.com/remix-run/react-router/blob/react-router-dom@7.18.0/packages/react-router-dom/CHANGELOG.md)
    - [Commits](https://github.com/remix-run/react-router/commits/react-router-dom@7.18.0/packages/react-router-dom)
    
    ---
    updated-dependencies:
    - dependency-name: react-router-dom
      dependency-version: 7.18.0
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • chore(deps): bump frontend deps and override js-yaml to patch DoS advisory
    Force swagger-ui-react's bundled js-yaml to ^4.2.0 (GHSA-h67p-54hq-rp68)
    without downgrading swagger-ui-react. Also picks up minor bumps to antd,
    axios, react-router-dom and dev deps.
  • Test-quality audit: fix 2 prod bugs, strengthen weak tests, add mutation/fuzz/CI tooling (#5345)
    * test(audit): add gremlins/rapid/coverage tooling + AUDIT.md scaffold
    
    * test(audit): hygiene sweep (race-clean except logger global; Finding #2) + smell inventory
    
    * test(audit): cover untested error/edge branches (TLS proxy+pin, migration tag cleanup=Finding #1)
    
    * test(audit): strengthen internal/sub link tests (dedup key, TLS/Reality mapping, clash well-formedness)
    
    * test(audit): property (rapid) + fuzz tests for joinHostPort/userinfo/pin/ParseLink
    
    * test(audit): tighten frontend subSortIndex rejection assertions + wire coverage
    
    * ci(audit): add shuffle gate + non-blocking race job (Finding #2) + fuzz-smoke; document mutation policy
    
    * chore(audit): gitignore frontend coverage output
    
    * test(audit): exhaustive whole-repo pass — strengthen 5 weak/fake tests (netproxy, CSP, modal per-protocol loops, schema coercions)
    
    * docs(contributing): add Testing section (conventions, race/shuffle, fuzz, mutation policy); drop AUDIT.md ledger
    
    * fix(logger,migration): guard logBuffer with mutex; execute legacy tag cleanup (tx.Exec); make CI race gate blocking
    
    * ci(mutation): add nightly scoped gremlins workflow (informational artifacts)
    
    * test(audit): strengthen runtime tests — baseURL scheme/port bounds, isNonEmptySlice, trafficReset
    
    * test(audit): strengthen clash tests — reality field mapping + tcp-header validation
    
    * test(audit): runtime — egress-proxy + content-type tests; drop redundant bp=='' branch
    
    * test(audit): strengthen link parser/helper tests (defaultPort, splitComma, base64, canonicalQuery, tls/reality/transport mapping)
    
    * test(audit): strengthen sub/xray/common/netsafe/mtproto/config/middleware tests (kill surviving mutants)
    
    * test(audit): raise timeout on protocol-iteration modal tests (heavy re-renders, slow on CI)
    
    * fix(logger): GetLogs returns at most c entries (off-by-one fix; addresses PR review)
    
    * perf(logger): snapshot logBuffer under lock so GetLogs doesn't block logging; clarify fuzz-seed docs (addresses PR review)
  • Bump Go indirect deps; update frontend lock
    Bump several Go indirect dependencies (golang.org/x/exp, golang.org/x/tools, google.golang.org/genproto) and update go.sum accordingly. Regenerate frontend/package-lock.json to record updated npm package versions (including Ant Design and related rc-component packages and other transitive updates).
  • Bump frontend version and deps
    Update frontend package.json and refresh dependencies for a new release (frontend version -> 0.3.0). Regenerated lockfile and upgraded multiple JS packages (notably @swagger-api/apidom family, @rc-component packages, codemirror, etc.) and added libc metadata where applicable. Also update Go module dependencies (go.mod and go.sum) as part of routine dependency maintenance.
  • chore(deps): bump i18next from 26.3.0 to 26.3.1 in /frontend (#4901)
    Bumps [i18next](https://github.com/i18next/i18next) from 26.3.0 to 26.3.1.
    - [Release notes](https://github.com/i18next/i18next/releases)
    - [Changelog](https://github.com/i18next/i18next/blob/master/CHANGELOG.md)
    - [Commits](https://github.com/i18next/i18next/compare/v26.3.0...v26.3.1)
    
    ---
    updated-dependencies:
    - dependency-name: i18next
      dependency-version: 26.3.1
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • refactor(frontend): reorganize source tree & break down oversized modals/tabs (#4698)
    * refactor(frontend): reorganize components & pages into feature folders
    
    No behavior change; pure file relocation + import path updates.
    
    * refactor(frontend): move shared protocol enums to schemas/protocols/shared
    
    Decouple Outbound from Inbound schemas: SSMethodSchema and VmessSecuritySchema (shared between inbound & outbound) now live in a neutral schemas/protocols/shared/ module. Outbound no longer reaches into schemas/protocols/inbound/*. Pure relocation + import rewiring; schema values identical, snapshots & golden tests unchanged.
    
    * refactor(frontend): break InboundList into helpers/types/RowActions/columns hook/stats modal
    
    InboundList.tsx 781 -> 203 lines. Extracted pure helpers (network labels, sort fns, isInboundMultiUser), shared types, the row-actions menu/cell, the table columns hook, and the mobile stats modal into the list/ folder. Code moved verbatim; no behavior change. typecheck/lint/test/build green, 337 tests pass.
    
    * refactor(frontend): extract InboundInfoModal helpers, types & buildInboundInfo
    
    InboundInfoModal.tsx 1081 -> 836 lines. Moved the pure data helpers (network host/path readers, link-protocol check, copy/download/statsColor/IP formatting) plus all shared types and the buildInboundInfo data builder into info/helpers.ts and info/types.ts. The state-coupled render body is left intact (no React render tests to guard a deeper split). Code moved verbatim; no behavior change. All gates green, 337 tests pass.
    
    * test(frontend): add React Testing Library + jsdom render-test harness
    
    - vitest projects: node unit tests stay lean; new jsdom 'components' project runs *.test.tsx
    - component setup: matchMedia/ResizeObserver/localStorage polyfills, react-i18next init, persian-calendar-suite stub (only used under jalali locale)
    - smoke + field-label structure snapshots for Inbound & Outbound form modals
    - establishes the regression net required before decomposing the oversized form modals
    - 341 tests pass (337 unit + 4 component); typecheck/lint/build green
    
    * test(frontend): per-protocol field-structure coverage for both form modals
    
    - drive the protocol Select in jsdom and snapshot rendered Form.Item labels for every protocol
    - 10 outbound + 10 inbound protocol states captured as the regression net for protocol-core extraction
    - add robust select-driving helpers (test-utils) + post-test body cleanup (setup.components)
    - 341 tests pass; typecheck/lint green
    
    * refactor(frontend): extract OutboundFormModal constants & stream helpers
    
    OutboundFormModal.tsx 2238 -> 2080. Moved the pure option arrays/sets and the stream-slice helpers (newStreamSlice, hysteriaStreamSlice, isMuxAllowed, buildAddModeValues) into outbound-form-constants.ts and outbound-form-helpers.ts. Per-protocol render snapshots unchanged -> verified no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): extract InboundFormModal advanced JSON editors
    
    InboundFormModal.tsx 3129 -> 2863. Moved AdvancedSliceEditor and AdvancedAllEditor (the in-modal JSON slice/all editors) into advanced-editors.tsx along with their adapter-helper imports. Per-protocol render snapshots unchanged -> verified no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): extract OutboundFormModal loopback/blackhole/dns field blocks
    
    Moved the outbound-only protocol field blocks (loopback, blackhole, dns) out of the modal render body into outbound-only-fields.tsx. First render-body extraction behind the per-protocol snapshot net: loopback/blackhole/dns snapshots unchanged -> verified no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): extract OutboundFormModal freedom field block
    
    OutboundFormModal.tsx 2063 -> 1753. Moved the freedom protocol field block (domainStrategy, fragment, noises, finalRules) into outbound-freedom-fields.tsx. Verbatim relocation; freedom per-protocol snapshot unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): extract OutboundFormModal wireguard field block
    
    OutboundFormModal.tsx 1753 -> 1622. Moved the wireguard protocol field block (address, keypair gen, domainStrategy, peers + allowedIPs) into outbound-wireguard-fields.tsx; dropped now-unused icon/InputAddon/WireguardDomainStrategy imports. Verbatim relocation; wireguard snapshot unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): extract OutboundFormModal core protocol fields
    
    OutboundFormModal.tsx 1622 -> 1538. Moved the shared protocol core field blocks (vmess/vless ID, vmess security, vless encryption/reverseTag, trojan/ss password, ss method/uot, socks/http user/pass) into outbound-core-fields.tsx; dropped now-unused schema/option imports. Per-protocol snapshots unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): fold OutboundFormModal server address/port block into core fields
    
    OutboundFormModal.tsx 1538 -> 1516. Moved the shared connect-target (address/port) block into OutboundCoreProtocolFields at the same render position; dropped the now-unused SERVER_PROTOCOLS import. Snapshots unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): split outbound-only protocol forms into per-protocol files
    
    Replace the grouped outbound-only-fields.tsx + outbound-freedom-fields.tsx with one file per protocol under outbounds/protocols/: freedom.tsx, blackhole.tsx, dns.tsx, loopback.tsx (+ barrel). Matches the prompt's 1-file-per-protocol structure. Outbound snapshots unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): split outbound protocol forms into per-protocol files
    
    Replace the grouped outbound-core-fields / outbound-wireguard-fields with one file per protocol under outbounds/protocols/: vmess, vless, trojan, shadowsocks, http, socks, wireguard, freedom, blackhole, dns, loopback (+ shared server-target). Matches the prompt's 1-file-per-protocol structure (per-modal). Outbound snapshots unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): split outbound transport forms into per-transport files
    
    Extract the tcp(raw)/kcp/ws/grpc/httpupgrade transport blocks into outbounds/transport/ per-file components (RawForm, KcpForm, WsForm, GrpcForm, HttpUpgradeForm). xhttp + hysteria transport remain inline for a follow-up. Verbatim relocation; outbound snapshots unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): extract OutboundFormModal xhttp transport form
    
    Move the xhttp transport block into transport/xhttp.tsx (takes form + onXmuxToggle prop); drop now-unused HeaderMapEditor and MODE_OPTIONS imports from the modal. OutboundFormModal.tsx down to ~1001 lines (from 2238 originally). Verbatim relocation; outbound snapshots unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): extract OutboundFormModal tls/reality security forms
    
    Move the TLS and Reality field blocks into outbounds/security/{tls,reality}.tsx; the none/TLS/Reality Radio.Group selector stays in the modal. Drop now-unused ALPN_OPTIONS/UTLS_OPTIONS imports. OutboundFormModal.tsx down to ~918 lines (from 2238 originally). Verbatim relocation; outbound snapshots unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): split inbound-only protocol forms (tun, tunnel) into per-file
    
    Extract the tun and tunnel protocol blocks from InboundFormModal into inbounds/form/protocols/{tun,tunnel}.tsx (presentational, declarative). First inbound-side per-protocol split. Verbatim relocation; inbound snapshots unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): split inbound wireguard & shadowsocks protocol forms
    
    Extract the wireguard and shadowsocks protocol blocks from InboundFormModal into inbounds/form/protocols/{wireguard,shadowsocks}.tsx (presentational; form + regen handlers / isSSWith2022 passed as props). Drop now-unused Divider + SSMethodSchema imports. Verbatim relocation; inbound snapshots unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): split inbound vless/http/mixed/hysteria protocol forms
    
    Extract the remaining inbound protocol blocks into inbounds/form/protocols/: vless (auth handlers/state as props), http + mixed (shared accounts-list), hysteria. Drop now-unused HysteriaMasqueradeForm/Typography/Text imports from the modal. InboundFormModal.tsx 2841 -> 2478. Inbound snapshots unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): move HysteriaMasqueradeForm to lib/xray/forms/transport
    
    The hysteria masquerade form edits streamSettings.hysteriaSettings.masquerade (a transport/stream concept) and is rendered identically by both modals, so it belongs next to FinalMaskForm in lib/xray/forms/transport/ rather than protocols/shared/. Moved the file, updated the transport barrel + both consumers (inbound hysteria protocol form, outbound modal), and removed the now-empty protocols/shared/ folder. Pure relocation; snapshots unchanged, typecheck/lint/build green.
    
    * refactor(frontend): extract inbound transport forms into transport/ folder
    
    Move the six inbound stream-transport blocks (tcp/raw, ws, grpc, xhttp,
    httpupgrade, kcp) out of InboundFormModal into presentational components
    under inbounds/form/transport/. XhttpForm takes the form instance and
    re-derives its mode/obfs/placement watches internally; the rest are
    declarative. InboundFormModal drops from 2566 to 2105 lines. No behavior
    change — per-protocol field-label snapshots unchanged.
    
    * refactor(frontend): extract inbound security forms into security/ folder
    
    Move the inbound TLS and Reality stream-security blocks out of
    InboundFormModal into presentational components under
    inbounds/form/security/. The Radio.Group security selector stays in the
    modal; TlsForm and RealityForm receive their cert/key/ECH generation
    handlers and the saving flag as props. InboundFormModal drops from 2105
    to 1708 lines.
    
    Add inbound-form-blocks.test.tsx: render-snapshot coverage for each
    extracted transport (raw/ws/grpc/kcp/httpupgrade/xhttp) and security
    (tls/reality) component in isolation inside a minimal Form. The full
    modal cannot exercise the stream/security tabs in jsdom because they are
    gated behind Form.useWatch values that do not propagate in the test
    harness, so component-level snapshots are the regression net for these
    blocks. No behavior change.
    
    * refactor(frontend): extract outbound sockopt/mux/hysteria transport blocks
    
    Move the last three oversized inline stream blocks out of
    OutboundFormModal into presentational components under
    xray/outbounds/transport/: SockoptForm (~260 lines, the worst offender),
    MuxForm, and HysteriaForm. Each takes the form instance; MuxForm also
    takes protocol/network and keeps its isMuxAllowed gate. OutboundFormModal
    drops from 962 to 621 lines and no inline section now exceeds the
    250-line guideline. Existing outbound-form-modal snapshots already cover
    sockopt/mux and stay byte-identical, confirming no behavior change.
    
    * refactor(frontend): extract inbound sockopt + external-proxy blocks
    
    Move the inbound Sockopt (~250 lines) and External Proxy stream blocks
    out of InboundFormModal into presentational components under
    inbounds/form/transport/, mirroring the outbound extraction. Each takes
    its toggle handler (toggleSockopt / toggleExternalProxy) as a prop and
    keeps its render-prop getFieldValue gate. InboundFormModal drops from
    1708 to 1332 lines.
    
    Extend inbound-form-blocks.test.tsx with isolated render-snapshot
    coverage for both (SockoptForm seeded enabled + happyEyeballs;
    ExternalProxyForm seeded with one TLS entry). No behavior change.
    
    * refactor(frontend): break down RoutingTab into sections
    
    Extract RoutingTab's presentational pieces into the routing/ folder:
    helpers.ts (arrJoin/csv/chipPreview/ruleCriteriaChips), types.ts
    (RuleRow), CriterionRow.tsx, RuleCardList.tsx (mobile card view), and
    useRoutingColumns.tsx (desktop table columns hook). RoutingTab stays the
    orchestrator holding rule state, mutate, tag-option memos and the
    pointer-drag reorder logic, and drops from 550 to 291 lines. No behavior
    change.
    
    * refactor(frontend): extract BasicsTab constants and rule helpers
    
    Move BasicsTab's geo option arrays + freedom/ipv4 outbound presets into
    basics/constants.ts and the routing-rule get/set/sync helpers into
    basics/helpers.ts. BasicsTab drops from 550 to 447 lines and keeps its
    Collapse-of-settings panels (which stay coupled to mutate + derived
    state, so splitting them into components would only add prop-drilling).
    No behavior change.
    
    * refactor(frontend): break down DnsTab columns/helpers/types
    
    Extract DnsTab's pure pieces into the dns/ folder: helpers.ts
    (STRATEGIES/DEFAULT_FAKEDNS + addr/domains/expectedIPs accessors),
    types.ts (DnsConfig/HostRow/FakednsRow), and useDnsColumns.tsx
    (useDnsServerColumns + useFakednsColumns table-column hooks taking their
    row handlers as params). DnsTab stays the orchestrator for dns state,
    mutate, hosts sync and the Collapse panels, and drops from 539 to 424
    lines. No behavior change.
    
    * refactor(frontend): break down OutboundsTab into sections
    
    Extract OutboundsTab's pieces: outbounds-tab-types.ts (OutboundRow),
    outbounds-tab-helpers.ts (address/untestable/security/breakdown +
    traffic/testing/result accessors), useOutboundColumns.tsx (desktop table
    columns hook) and OutboundCardList.tsx (mobile card view). OutboundsTab
    stays the orchestrator for outbound state, mutate, reorder and the
    toolbar, and drops from 516 to 238 lines. No behavior change.
    
    This completes plan section 2.4.5 — all four oversized Xray tabs
    (Basics/Routing/Dns/Outbounds) are now broken into sections + hooks.
    
    * refactor(frontend): fold HysteriaMasqueradeForm into the hysteria forms
    
    Inline the masquerade fields directly into both hysteria transport forms
    (inbounds/form/protocols/hysteria + xray/outbounds/transport/hysteria)
    and delete the shared lib/xray/forms/transport/HysteriaMasqueradeForm so
    each hysteria form is self-contained. The masquerade JSX is unchanged;
    form is typed as the untyped FormInstance (as the shared component was)
    so the masquerade name paths still resolve. No behavior change.
    
    * refactor(frontend): slim InboundFormModal by extracting hooks + sections
    
    Pull the modal's non-layout logic into focused files at the form root:
    - useSecurityActions.ts: TLS/Reality key + cert generation handlers and
      onSecurityChange (consumed by the security tab)
    - useInboundFallbacks.ts: fallback row state + load/save/derive/add/
      update/remove/move handlers + eligible-child options
    - FallbacksCard.tsx: the fallbacks card UI (presentational)
    - SniffingTab.tsx: the sniffing tab UI (presentational)
    
    Also drop the stale "Pattern A rewrite / sibling file" header comment and
    the imports the extractions made unused. InboundFormModal goes from 1332
    to 868 lines with no behavior change (351 tests green, snapshots
    unchanged).
  • fix(outbounds): persist optional blocks and fix stale edit reopen
    - derive XMUX toggle from saved xmux on load, seed defaults on enable,
      and drop xmux when disabled (#4654)
    - save the JSON tab straight from parsed text so sockopt, finalmask (TCP
      masks), mux, and reverse excludes round-trip instead of being dropped
      by the form-store bounce
    - remove the redundant Host/Path fields from HTTP obfuscation that fought
      the request.headers editor over the same form path
    - rebuild the outbounds table columns on row content change (rows, not
      rows.length) so a re-opened edited outbound shows fresh values
    - add adapter round-trip regression tests
    
    Closes #4654
  • fix(links): include TCP HTTP host header in share links
    The inbound form intentionally only exposes the response side of the
    TCP HTTP header object (xray-core's inbound listener reads the
    response object, not request — see the existing comment in
    InboundFormModal). But the share-link generators were still reading
    the Host header from request.headers, so the configured value ended
    up in tcpSettings.header.response.headers while the link query
    emitted host= (empty).
    
    Fix the host lookup in both code paths:
    - sub/subService.go: applyShareNetworkParams (VLESS / Trojan /
      Shadowsocks share URLs) and applyVmessNetworkParams (the VMess
      base64 JSON link) now try header.response.headers first and fall
      back to request.headers for legacy / hand-edited configs.
    - frontend/src/lib/xray/inbound-link.ts mirrors the same fallback in
      the three TCP HTTP branches (VMess obj, VLESS params, the shared
      Trojan+Shadowsocks writer) so the JS-side generator used by the
      API docs preview stays in sync with the Go output.
    
    Also restore the request-side inputs (version / method / path /
    headers) under the TCP HTTP toggle in InboundFormModal. They were
    previously removed because xray-core ignores them on the inbound
    side, but they're still useful when copying the same config out to
    an outbound or hand-tuning the share link, and they no longer
    mislead users about Host — the link now derives Host from
    response.headers.host where the response-only form writes it.