| type | Guide | |||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| title | Changing the codebase | |||||||||||||||||||||||||||||||||||||||
| description | How to plan and land a change across XYZ, MAPP and MAPP.UI - where a change belongs, the app boundaries, the order of a cross-app change, which tests and docs to update, and the branch model; use before starting a code change. Commands are in DEVELOPING.md and TESTING.md. | |||||||||||||||||||||||||||||||||||||||
| tags |
|
|||||||||||||||||||||||||||||||||||||||
| status | draft | |||||||||||||||||||||||||||||||||||||||
| sources |
|
DEVELOPING.md has the setup and Biome commands, TESTING.md the test commands and conventions, and CONTRIBUTING.md the pull request rules. This guide covers what they leave out: deciding where a change goes and what else must change with it.
Run pnpm knowledge:find <term> for the key, variable or module, and read the
concept before the code. A concept's resource and sources list the
modules and tests to read next. The bundle is incomplete; no concept does
not mean no feature.
Prefer the smallest layer which can do the job:
- Workspace configuration. Many requests are a layer, template or role change, not code. See the workspace concepts.
- A workspace query template or a plugin. Deployment-specific SQL goes
into
workspace.templates; deployment-specific UI into a plugin loaded withlocale.plugins. - Core code, when every deployment needs it:
- MAPP must not reference
mapp.uior import fromapps/ui; CI fails if it does.1 If MAPP needs a ui behaviour, give it a plain default which the ui replaces, likemapp.layer.drawLegend. - MAPP.UI uses MAPP only through the
mappglobal. - MAPP talks to XYZ only over HTTP. The client sends template and layer keys and params; SQL, connections and roles stay in the workspace.
- XYZ modules read configuration from
globalThis.xyzEnv. A new variable is added inprocessEnv.js, the Varlock schema (varlock/README.md) and an environment concept.
A feature which spans the apps is built from the server out:
- XYZ: the query template, endpoint or param, with its tests in
apps/xyz/tests. - MAPP: the library code which requests it, tested against the testhost.
- MAPP.UI: the interface, with module tests and, for a user flow, a default view test.
The three ship in one release, and MAPP is used with an XYZ of the same minor version. A change to a request param or workspace key is a breaking change for older clients and workspaces; keep the old form working and warn, or target the next major.
pnpm testviewserves the MAPP source modules with a local XYZ and the devdb, without a build; see the testhost.- Test workspaces live in
packages/testhost/workspacesand the app test directories. Add a view or workspace there for a new feature rather than relying on a private deployment. - For the full default view, build the bundles and run
pnpm dev. Don't commit the bundles; see Monorepo.
- Add or change the test file which mirrors the module path. A bug fix comes with a test which fails before the fix.2 A new feature's test must fail when the feature is removed; a test written from the implementation can only confirm what the code already does.
- Run the suite of each app you touched:
pnpm test:xyz,pnpm test:mapp,pnpm test:ui, and the coverage variants to see the touched files. - A turbo run which prints
FULL TURBOreplayed a cache and ran nothing; rerun with--forcebefore reporting a pass.2
- Signatures, params and return types go into JSDoc; see Clean code guidelines.
- A behaviour change updates its concept and source links in the same pull
request, following the authoring workflow.
Run
pnpm knowledge:check, andpnpm knowledge:changed --base origin/<base>for the concepts linking the changed modules. Label the pull requestknowledge-unaffectedwhen a change, eg. a refactor, leaves them true. apps/mapp/README.mdis the npm page; keep its usage sections in step with the package concept.
- Open or reference an issue first, keep one concern per pull request, and keep commits small, without merge commits.3
- Target the development branch for the release:
patch,minorormajor.mainonly receives releases; see RELEASING.md.4 - The
review-prskill in.claude/skillschecks a branch for whole-method correctness, repeated listener registration, scope, tests and JSDoc.