Skip to content
SEUNGWOO CHOI edited this page Nov 8, 2026 · 15 revisions

Client development

English · 한국어

Place the client in Miroven/ and the API checkout beside it in Miroven-API/. Requires Node.js 22.13 or later and npm; the combined development stack also needs Docker Compose with a Linux engine.

CI and Docker select their build runtimes in the repository's Dockerfile and .github/workflows/ci.yml; the final image serves static files with Nginx. Both application CI jobs disable setup-node automatic caching and use the explicit shared cache policy below. Check each Action's declared runtime and runner requirements when upgrading it.

The Node type declarations in web/package.json should match the CI/Docker runtime major. Type declarations do not install or upgrade Node, and passing type checks against a newer declaration set does not establish compatibility with the minimum runtime in engines.node.

Source and toolchain

For development, check out the client in Miroven/ and API beside it in Miroven-API/. For a reproducible deployment, choose a compatible tag or full commit SHA for each repository and check out those refs before building. Keep the API beside the client or adjust sibling paths used by scripts. Record both refs and any uncommitted changes in verification records.

Use web/package.json for supported runtime requirements and declared dependencies, web/package-lock.json for resolved dependency versions, and npm ci to reproduce that lockfile. Installed node_modules may be stale; a package version alone does not identify a source snapshot.

Corresponding source

npm run build packages the actual application inputs, pinned HEIC source archives, patches, build scripts, lockfile and public build settings in out/source/. Packaging checks the HEIC source/recipe/vendor hashes once on the ordinary build path. /notice links the archive, checksum and file manifest. The same process works in a Git checkout, Docker context or extracted download without .git.

The packager collects its declared source directories and required root files automatically. Added files, local modifications and deletions are reflected without a file approval list or update command. Untracked files inside included source directories are included too. Keep private material outside those directories. Dependencies, build outputs and private/generated directories are excluded; secret-named files and symlinks inside included roots are rejected. These path checks do not certify the contents of source files.

Extract the archive, restore the values from BUILD-SETTINGS.json into the build environment, then run npm ci and npm run build in web/. REBUILD.md and the included tools/heic/README.md describe application/native rebuilding and modified-library replacement. Preserve the snapshot's repository/web layout.

HEIC native checks

Ordinary builds use the stored vendor module without Docker. Native commands require Docker with Linux amd64 containers; modified-library browser checks also require Chromium (npx playwright install --with-deps chromium). Run from web/:

Command Purpose
npm run heic:rebuild Rebuild native libraries and wrapper; update vendor outputs and hashes
npm run heic:verify Compare a fresh native/wrapper rebuild with the stored output
npm run heic:verify:source Install and rebuild the downloaded application source, compare the repackaged archive, and reproduce native output
npm run heic:verify:relink Modify both native version functions in a temporary tree, rebuild/recombine, and decode real HEIC/HEIF in Chromium

The HEIC source and relinking verification Actions workflow runs on manual dispatch. General CI keeps its normal application checks; native experiments are separate. Probe output never belongs in an ordinary distribution. Native compile/link execution has no network access; building the pinned tool image and installing locked dependencies require downloads.

The builder pins Node by image digest, Emscripten by release/commit and Debian repositories by snapshot. EMCC_CORES=1 and BINARYEN_CORES=1 keep optimizer output independent of host CPU count. A dated libheif patch adapts its Embind pointer call to the pinned SDK, and the recipe replaces the generated CommonJS/AMD adapter with an ES-module export. Upstream precompiled codec inputs are removed before compiling. A temporary CA bundle from Node's public roots plus an optional proxy CA bootstraps HTTPS installation while preserving TLS verification, and is removed from the image.

For small vfs environments, export the same builder Dockerfile's root filesystem with Docker's local exporter and explicitly set HEIC_BUILDER_ROOTFS to that trusted directory. The alternate backend mounts its tool directories read-only and uses the same SDK/version/hash checks. The standard backend uses the pinned builder image. See dependency licenses and source delivery for distribution boundaries.

Local development

From the Miroven root:

cd web
npm ci
npm run dev

With NEXT_PUBLIC_MIROVEN_API_URL unset, the app uses only its local encrypted vault. npm run build creates the static export in web/out/. Use the full build command so CSP and Service Worker post-processing run. See self-hosting for build configuration.

Checks

Run these commands in Miroven/web/:

Command Scope
npm run verify:fast Secret scan, ESLint, and unit tests
npm run verify:full License inspection, fast checks, build, CSP, SW, bundle budgets, rendered HTML, browser tests, offline tests, and production A/B update tests
npm run test:offline Existing production export over local HTTPS; Chromium journeys/update scenarios and Chromium/WebKit cached photo Worker regression
npm run test:updates Build isolated A/B production fixtures and verify old-tab lazy loading after takeover in Chromium
npm run perf / npm run perf:built Opt-in startup/typing benchmark; build first / reuse a matching export
npm run api:generate Copy generated API types from the sibling API checkout
npm run api:check Verify that those types match

Prepare local test browsers with npx playwright install chromium firefox webkit. Checks for a change should cover the affected behavior. A test run is evidence for that environment, not proof of public HTTPS, real SMTP, or physical mobile compatibility. API integration requires the API checkout and a dedicated local development stack; it is separate from local-only browser tests.

The composer becomes interactive after hydration and the initial local journal read. Initial onboarding and iOS storage notices are resolved before the interactive layout is painted; local writing does not wait for account authentication or delayed draft restoration. The static HTML save button starts disabled. composer-startup.spec.ts covers notice timing and unavailable preferences in Chromium, Firefox, and iPhone-emulated WebKit. Quote tests use completed-onboarding preferences and verify quote attachment/removal before continuing; first-visit behavior remains covered separately.

Account UI, backup, and diagnostics load independently on Account open; feature controls remain disabled until their module is ready and offer independent retry. lazy-features.spec.ts runs in Chromium, Firefox, and iPhone-emulated WebKit for startup loading boundaries, errors, closing during load, lock cancellation, home profile/recovery availability, and first offline backup/diagnostic use after preparation. Its WebKit offline file case buffers only synthetic fixture text because Playwright WebKit blocks even in-memory File.text() offline; crypto, IndexedDB, and downloads still use real paths. This does not establish physical iPhone file-picker behavior. Chromium's composer-input.spec.ts exercises Korean IME composition and submission.

For complete installation, unopened features offline, shell updates, retained old chunks, cache cleanup, and the Safari Worker regression, follow PWA and updates. Those suites require OpenSSL and the relevant installed browsers; test:offline needs a current out/, while test:updates builds isolated local-only A/B outputs in .local/update-builds/ without modifying the checkout's source, .env, .next/, or out/. Both run in verify:full and its CI job. Functional success does not replace API integration or a performance comparison. The opt-in performance guide documents measurement conditions, artifacts, and failure interpretation; benchmarks are not included in verify:full.

PR #28 verification record

The final-head CI record for PR #28 tested client head af0bcc9a1ae555f88a90a6a9001153d27b7fd78c against base 990651a22269f7fb367cdf124ca7cab40efed733 using GitHub's test merge c759cfb744abf0be758cb2a60d497ca15f989665. The API checkout was cbf098e0f47c1eea589620773380b5999d5bd907. CI used checked-out sources without local source edits; these results do not cover another working tree or deployment.

  • Web verification: verify:full passed, including 344 unit tests, 9 rendered-output tests, 148 browser tests, 11 offline/Worker tests, and 1 real production A/B update test. The ordinary browser run separately skipped 16 API-configured cases. Existing license-review notices remained non-blocking.
  • API/sync CI: Chromium ran 7 tests successfully and skipped 1 separately configured administrator/plan case. A green job does not mean that skipped case ran. The PR body records an earlier separately configured 16-case API/account run; keep that distinct from this final-head CI.
  • Commit/release policy, dependency review, CodeQL analysis and the preview deployment checks completed successfully. Performance benchmarks were not rerun for the final head; historical results and offline-report failures are recorded in client performance. Physical-device and mixed-CDN deployment behavior remain outside these checks.

Same-origin development stack

In Miroven-API/:

uv run python scripts/bootstrap_local.py
docker compose -f compose.yaml -f compose.web.yaml up -d --build --wait

The app is at http://localhost:8080 and Mailpit at http://localhost:8025. Bootstrap preserves existing environment files. Stop the stack with down using the same Compose file combination; keep volumes.

Split-origin integration checks

Use only the development Mailpit stack. First stop any same-origin stack with its original Compose file combination. In PowerShell, start this from the API folder:

docker compose -f compose.yaml -f compose.split-dev.yaml up -d --build --wait

Then in Miroven/web/:

$env:NEXT_PUBLIC_APP_URL='http://127.0.0.1:3100'
$env:NEXT_PUBLIC_MIROVEN_API_URL='http://127.0.0.1:8000/api/v1'
npm run build
$env:MIROVEN_INTEGRATION_URL='http://127.0.0.1:3100'
$env:MIROVEN_INTEGRATION_API_ORIGIN='http://127.0.0.1:8000'
npm run test:integration

Playwright starts the static server. Stop the API stack with the same Compose files and down. Integration tests can leave synthetic accounts and ciphertext in the development database; Mailpit does not deliver external email.

For the Free/Pro integration case, add a synthetic email to the dedicated development API's MIROVEN_ADMIN_EMAILS and set MIROVEN_INTEGRATION_ADMIN_EMAIL to that same address when running test:integration. This case signs in both member and administrator through Mailpit and verifies server-driven trial, cancellation, expiry and quota display. Without the administrator setting it is reported separately as skipped; the existing sync/deletion cases still run.

Distinguish sandbox connection/file restrictions from application failures. If needed, point TEMP and TMP to the ignored web/.local/tmp for Vitest caches. Follow the repository's web/AGENTS.md when using coding agents.

GitHub Actions verification

.github/workflows/ci.yml installs Chromium, Firefox, and WebKit for local browser checks, and Chromium for the combined API/sync checks. Before Playwright installs Linux dependencies, both jobs disable APT source files in /etc/apt/sources.list.d/ that reference packages.microsoft.com on the disposable runner. These feeds are not required for the tested browsers; an unrelated Microsoft repository outage must not block Ubuntu dependency installation. APT signature verification and Playwright installation failures still fail the job.

Both jobs first rewrite the runner's /etc/apt/apt-mirrors.txt priorities to try https://archive.ubuntu.com/ubuntu/, then https://security.ubuntu.com/ubuntu/, and finally the Azure mirror. This avoids waiting for a slow Azure mirror before using the Ubuntu archives while retaining fallback mirrors. If the expected mirror list is missing, the setup step fails so a runner configuration change is visible.

The integration job collects Docker logs on failure and tears down the stack only after API bootstrap succeeds and Compose startup is attempted, including partially failed startup. Failures before that point do not run Compose against missing environment files. The Playwright integration report is uploaded only when the test step fails.

CI retries Playwright installation up to three times with 30 seconds between attempts for temporary CDN/download failures. TLS certificate verification remains enabled; installation still fails the job if all attempts fail.

Actions cache budget

GitHub Free includes 10 GiB of Actions cache storage per repository, separate from artifacts. Keep the repository's Settings → Actions → General → Cache size eviction limit at 10 GB to stay within the included storage; a higher configured limit can incur charges. GitHub normally expires caches unused for seven days and evicts the least recently accessed entries when the repository limit is reached. The workflow does not change repository storage or billing settings. See GitHub's cache limits.

The CI policy limits cache growth:

  • Only a successful verify job on the default branch saves caches. PRs, other branches, and integration jobs restore without creating additional entries.
  • Both jobs share npm's ~/.npm/_cacache, keyed by OS, architecture, Node major version, and lockfile. npm ci --prefer-offline still installs and verifies the locked dependencies on every run.
  • verify also caches only web/.next/cache, with keys covering the lockfile and build inputs. Changed sources can reuse an earlier cache with the same dependencies; exact hits are not uploaded again. Integration builds remain fresh apart from shared npm downloads.
  • Each upload is skipped if its uncompressed directory exceeds 512 MiB. Repository-wide storage is bounded by GitHub's 10 GiB eviction setting, not this per-entry check. Cache service failures do not fail verification.
  • Playwright browsers, Docker layers, Python environments, node_modules, static exports, and environment files are not added to the Actions cache.

GitHub security automation

The client uses .github/workflows/codeql.yml for JavaScript/TypeScript and GitHub Actions analysis with the security-extended query suite. It runs on pull requests, pushes to main, weekly on Monday at 03:23 Asia/Seoul, and manual dispatch. Analysis does not install application dependencies or build the app.

.github/dependabot.yml checks npm in /web, GitHub Actions, and root Dockerfile images weekly on Monday at 09:00 Asia/Seoul. npm and Actions minor/patch version updates are grouped; major updates remain separate. Security updates are controlled separately in repository settings. Updates are reviewed and verified before merging.

Dependabot major version updates for @types/node, Docker node, and GitHub Actions are ignored; review runtime and runner compatibility and upgrade them manually. Read the current lockfile for the test-runner version.

.github/workflows/dependency-review.yml runs on every pull request. It fails when a dependency change introduces a known vulnerability rated moderate or above, including runtime, development, and unknown scopes. Existing license checks remain in the main CI workflow.

To activate these files, merge them into the default branch. In Settings → Advanced Security (or Code security), enable the dependency graph, Dependabot alerts, and Dependabot security updates. Use CodeQL advanced setup for the committed workflow; disable any existing default setup to avoid duplicate/conflicting scans. After the first successful runs, require Dependency Review and the CodeQL analysis checks in the main branch ruleset if they should block merging. CodeQL findings are managed in code scanning; an analysis job completing successfully does not mean no findings exist. Use code scanning merge protection for an alert-severity gate.

Workflow configuration does not itself enable repository settings or branch protection. Confirm actual Actions runs and Security alerts after merging. See the Dependency Review action for prerequisites and check behavior.

Commit policy and automated releases

The contribution policy requires Conventional Commit PR titles and squash merge messages. Types/scopes, compatibility explanations and the independent client release process are defined in CONTRIBUTING and the bilingual release guide.

Release Please is configured to collect repository-wide changes, propose synchronized version/lockfile/CHANGELOG updates, and publish a source GitHub Release when its checked release PR is merged. Current version state and the first-run comparison ref are defined in .release-please-manifest.json and release-please-config.json; bootstrap history and recovery instructions live in the repository's release guide.

The new Commit and release policy workflow validates titles and synchronized versions using Python 3.12 standard-library scripts in .github/scripts/. GitHub App variable/secret, squash-message settings and required checks need separate activation; committed files do not configure them. The release App must not bypass checks. Initially a maintainer merges release PRs; no production deployment, environment-specific ZIP or npm publication is added. Build the selected tag with the intended public URLs. See the release guide for first-run review, tests and recovery.

Clone this wiki locally