Skip to content

Latest commit

 

History

History
67 lines (44 loc) · 6.19 KB

development.md

File metadata and controls

67 lines (44 loc) · 6.19 KB

Development

Setup

Install the Bun version pinned in package.json and run bun install --frozen-lockfile. Server code and the separate repository analyzer use bun:sqlite.

bun run dev listens on all interfaces at port 5173. Use bun run dev -- --host 127.0.0.1 for loopback. Before enabling LAN access, disable unauthenticated access and set a unique bootstrap password. See configuration.

The development server explicitly reads the optional root .env. Shell settings take precedence. Restart after editing the file because Vite does not watch dotenv files. During an in-process Vite restart the old instance detaches migrations, drains profiles and releases the directory lock. Startup recovery uses saved checkpoints. If detaching times out after five seconds, restart the process. Production shutdown drains profiles and classifies interrupted migrations.

Tests

For a direct test in a fresh checkout, generate SvelteKit aliases first. Replace the example path with the affected suite.

bunx --bun svelte-kit sync
bun test --no-env-file src/lib/server/migrate/runs/recovery.test.ts

Package test, coverage and mutation commands disable automatic dotenv loading. Exported shell variables still apply. Use isolated fixtures, real in-memory SQLite, and existing dependency hooks for I/O and time. Restore test overrides. See the development policy for schema changes.

Change Focused verification
Migration lifecycle Affected executor, database, queue/recovery and API tests
Auth or scope Request handler, self-service, route and scoped-dashboard tests
Provider Colocated client/parser and matching tests under tests/providers/. Run bun run verify provider-fixtures for offline fixture validation. Scheduled live contracts use dedicated disposable runners.
Svelte or TypeScript Nearest tests, bun run typecheck for app and scripts, bun run check for Svelte diagnostics
UI Affected configured Playwright workflow, keyboard and state checks, desktop and 390px visual inspection
Imports and policy bun run verify function-limits config-reads boundaries provider-rules deadcode and bun run verify cycles for import changes
Generated Octicons bun scripts/packaging/generate-icons.ts, then bun run verify icons
GitLab profile metric files bun scripts/packaging/generate-gitlab-metrics.ts, then bun run verify gitlab-metrics
Runtime packaging Build both production images and run CI's container smoke path

On the Linux Docker host with both stock exporter images installed, run bun run test:exporter-ca to check private source HTTPS. The fixture uses a temporary CA, a local HTTPS server and read-only sandboxed exporters.

Playwright starts its own server with seeded .e2e-data. Preserve project dependencies, including scoped-dashboard after chromium. Use an environment that supports the configured POSIX server command. Set a different E2E_PORT per parallel worker. Use isolated development data for seed or reset commands. For six months of synthetic migration fixtures, use bun run seed --migrations-only and start with MIGRATION_RETENTION_DAYS=190 to retain them.

Quality Gates

Follow the submission rules. The local and CI manifest lives in scripts/gates.ts. Run bun run verify for the full suite, or bun run verify docs format when every change is Markdown or under docs/. Select individual gates during development.

Coverage enforces 90% lines and functions. Keep thresholds and architecture checks intact. The mutation configuration gate checks the manifest. Run the separate mutation suite with bun run mutation --force. CI also builds both production container targets, runs scripts/packaging/container-smoke.sh DASHBOARD_IMAGE ANALYZER_IMAGE and scans the images. Report checks actually run and any limitation.

After upgrading Biome, update its schema with bunx --bun biome migrate --write if needed. Regenerate affected assets and review the diff.

Architecture Rules

  • Routes own HTTP transport and UI composition. Application services compose core and domains. Use domain-owned ports and concrete implementations in application/adapters/.
  • Core cannot import domains or application. Domains cannot import application or sibling domains. Neither may import the schema composition root, src/lib/server/schemas.ts, the sole root-level production server module.
  • Keep provider-specific comparisons in provider implementations and client-safe source policy. Providers cannot import other providers. Keep shared target protocols provider-neutral and read provider rules through the adapter registry.
  • Keep browser DTOs in client-safe domain modules. Browser code cannot import server modules, including type re-exports.
  • Only core/config/ reads environment variables. Catalog each setting with section, default and secret flag, then read through its typed section when needed. Configuration issues identify the variable and rule without the value. Update configuration docs and .env.example and run bun run verify config-reads docs.
  • Validate rows with Zod and the query helpers in core/db.ts. InvalidRowError identifies the schema without stored values. Use core/retention.ts for shared windows and child-first deletes.

Migration list pagination

Count and paginate rows in SQLite using the request's filters and access scope. An unreadable row occupies its original position and is omitted from the response, so even an empty page can have later results.

Svelte Work

Follow the frontend skill and Migration Workbench. For reference pages, live specimens and font roles use the design system skill.

Documentation

Edit the owning production contracts or table metadata for support matrix, lifecycle, GHES phase or durable table changes. Run bun run docs:sync, inspect the generated sections in docs/architecture.md, update affected manual prose and run bun run docs:check. The check also covers Markdown links and anchors, API operations, configuration and package scripts.