Fixes#805.
The Data Sources editor had no way to set `generateId` or `promoteId`,
so these had to be added by hand in the style JSON. This adds a
`SourceFeatureIdFields` block under the existing fields for GeoJSON and
vector sources:
- GeoJSON (inline and URL): a **Generate feature IDs** checkbox and a
**Feature ID property** field. As the issue points out, the two are
mutually exclusive, so turning one on clears the other.
- Vector (TileJSON, tile URLs and PMTiles): a **Feature ID property**
field for a single property, and a **Feature ID properties by source
layer** JSON field for the per-layer form (`{"roads": "road_id"}`). An
object that doesn't map names to strings shows an error and isn't saved.
Edits keep the rest of the source configuration.
| Before | After |
|---|---|
|

|

|
Both show the Data Sources modal with an inline GeoJSON source and a
vector tile source, in Chromium.
**Open question:** the issue asked how the UI should look, and nobody
had decided yet. For vector sources I used two fields because
`promoteId` can be either a string or an object. Setting the single
property replaces a per-layer mapping, and the other way round. If you'd
prefer one field, for example a single JSON field, I can change that.
**Performance:** none. The fields only render inside the Data Sources
modal, for GeoJSON and vector sources.
## Launch Checklist
- [x] Briefly describe the changes in this PR.
- [x] Link to related issues: fixes#805.
- [x] Include before/after visuals or gifs if this PR includes visual
changes.
- [x] Write tests for all new functionality: three e2e tests in
`modals.spec.ts` (generate IDs for a new GeoJSON source, set a vector
source's ID property, save a per-layer mapping). I ran the GeoJSON one
against `main` and it fails; the other two look for fields that don't
exist on `main`.
- [x] Add an entry to `CHANGELOG.md` under the `## main` section.
Tested locally: `npm run lint` clean, `npx tsc --noEmit` clean, `npx
vitest run` (57 passed) and `npx playwright test e2e/modals.spec.ts` (64
passed). I also checked that focusing and leaving the empty "Feature ID
property" field keeps an existing per-layer mapping. I didn't run the
full e2e suite locally (it times out on Windows with several workers);
it passes in CI on this PR.
Assisted-By: Claude Opus 5.5 (Claude Code). It helped write the change,
the tests and this description. I've reviewed and tested the change and
can answer questions about it.
## Launch Checklist
This PR increases coverage by adding unit tests to lib folde, replace
the skipped end to end placeholder with actual tests and adds more end
to end tests.
This was mostly done by AI (Claude opus 4.8) and I reviewed it and
requested changes where needed.
- [x] Briefly describe the changes in this PR.
- [x] Link to related issues.
- [x] Include before/after visuals or gifs if this PR includes visual
changes.
- [x] Write tests for all new functionality.
- [x] Add an entry to `CHANGELOG.md` under the `## main` section.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
## Launch Checklist
This PR replaces cypress with playwright.
<img width="1907" height="933" alt="image"
src="https://github.com/user-attachments/assets/b52075b3-eb3b-45dc-93dc-8c5e9cfd35dd"
/>
I hope this will make the end-to-end debugging and fixing easier due to
the async await support of playwright which is missing in cypress.
This is a pure refactoring change.
- [x] Briefly describe the changes in this PR.
- [x] Add an entry to `CHANGELOG.md` under the `## main` section.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
## Launch Checklist
Renames the e2e test and reduces changes as a preparation step from
playwright in the following PR:
- #1988
This is to keep as much history as possible.
<img width="1907" height="933" alt="image"
src="https://github.com/user-attachments/assets/b52075b3-eb3b-45dc-93dc-8c5e9cfd35dd"
/>
- [x] Briefly describe the changes in this PR.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>