Repository navigation
Description
Summary
SahajCloud stores the Mapbox feature ids a client sends with a proposal, so its client contract now says those ids must be Geocoding v6 ids obtained with permanent=true (docs/rules/api-clients.md, sydevs/SahajCloud#893). This widget asks for neither place: MapSearch's <Geocoder> and reverseGeocode both run without permanent, which is temporary-use data Mapbox's terms do not allow anyone to keep.
Nothing here is broken today, because the widget sends no ids yet. #147 is the flow that will, and its PR #318 still mounts the geocoder without the option.
Approach
Permanence is a prop, not a constant inside the control: only the lookups whose answer is submitted ask for it (decision 1 below). One component serves both plain map browsing and the submit flow, so the two rules cannot live in one place.
1. Thread permanent through MapSearch — src/components/organisms/Mapbox/MapSearch.tsx:28 and :172-178
Add permanent?: boolean to MapSearchProps (:28) and spread it into the <Geocoder options> block (:172-178), beside language, country, proximity and types. options is typed Partial<GeocodingOptions> (@mapbox/search-js-react/dist/components/Geocoder.d.ts:43), and GeocodingOptions declares permanent?: boolean (@mapbox/search-js-core/dist/geocode/GeocodingCore.d.ts:86), so no cast is needed and a renamed option fails to compile.
Leave it absent by default. The header field — SearchField, src/views/shared.tsx:258-288 — passes nothing and stays temporary.
2. Set it on the submit flow's mounts — on #318's branch
claude/feat-147-submit-a-class has both mounts behind one module-private wrapper: PlaceField, src/components/organisms/ProposalForm/WhereStep.tsx:100-107, used for the offline address (types="address") and the online city (types="place"). PlaceField is that flow's only geocoder, so permanent goes on its single <MapSearch> rather than on each call site.
Those are exactly the values SahajCloud writes into user-submissions.location and matches against regions.mapboxId: proposed.address.mapboxId, plus the place, region and country context ids onRetrieve reads (#147 § The flow, step 1).
That branch has already widened MapSearchProps with types, proximity, value and onChange; permanent joins them. On main the props are still onSelect and label alone, so whichever of the two lands first adds the prop and the other consumes it.
3. The reverse lookup stays temporary — src/lib/geocode.ts:79-85
reverseGeocode keeps the options it has (language, limit, types). Its one caller is src/hooks/use-geolocate.ts:96, which fills the search field and the ?cc query parameter — a URL a visitor can share, never a row SahajCloud stores. Decision 1 leaves it billed at the temporary rate: add no permanent here, and no prop that could reach it.
4. A spec that holds it
Nothing pins the option. The type catches a renamed one; only a spec catches a dropped one. ProposalForm.pick.test.tsx on #318's branch already has the harness — renderToStaticMarkup in the node lane, with @mapbox/search-js-react mocked so the test captures what Geocoder is handed. Capture options the same way and assert both directions: permanent: true from the submit-flow mount, and no permanent from the header SearchField.
Decisions
- 1. Which of the widget's Mapbox lookups become permanent? → A — only the lookups whose answer is submitted. The add-a-class and correction steps pass
permanent: true; map browsing andreverseGeocodestay temporary. (Ardnived, 2026-11-13)
Acceptance criteria
- Every Mapbox lookup whose answer the widget sends to SahajCloud —
proposed.address.mapboxIdandlocation.placeId/regionId/countryId— is made withpermanent: true. - The header search field and
reverseGeocodesend nopermanent, so plain browsing stays billed at the temporary rate. - No call site reaches
permanentthrough a cast or a hand-written props type. - A unit spec fails when a submit-flow geocoder mounts without the option, and when the header field mounts with it.
-
docs/embedding.mdneeds no change: the host-facing CSP and the origins called are unchanged.
Verification checklist
-
pnpm lint && pnpm typecheck && pnpm test:runpass. - Remove
permanentfrom the submit-flow mount, watch the new spec fail, then restore it. - On a deployed preview, open the add-a-class address step and confirm the request to
api.mapbox.com/search/geocode/v6/forwardcarriespermanent=true. - On the same preview, type in the header search field and confirm its
forwardrequest carries nopermanent.
Notes
- The contract line this answers is
docs/rules/api-clients.mdin sydevs/SahajCloud, written in fix(mapbox): move every stored geocode to Geocoding v6 permanent SahajCloud#1150 (closing fix(mapbox): move every stored geocode to Geocoding v6 permanent SahajCloud#893). - The consumer work is feat(widget): submit or correct a class, and opt into a mailing list #147, under the goal Anyone can submit a class or suggest a correction, safely #257. Not filed as a child of either: feat(widget): submit or correct a class, and opt into a mailing list #147 is in flight on feat(widget): submit or correct a class, and opt into a mailing list #318, and its scope is what was already approved. If feat(widget): submit or correct a class, and opt into a mailing list #318 merges first, this is its follow-up; if this is decided first, feat(widget): submit or correct a class, and opt into a mailing list #147 can carry it.
- Mapbox's own statement of the rule is in the
GeocodingFeaturedocblock of@mapbox/search-js-core(dist/geocode/types.d.ts:175-180): results must usepermanent=trueif they are to be cached or stored. - SahajCloud's producer-side spec is
tests/unit/mapbox-geocoder.spec.ts, which assertspermanent: 'true'on the params its geocoder sends (src/lib/mapbox/geocoder.ts:394). Its shape does not carry over — that one stubsfetch, and this widget's lookups go through a React component.
🤖 Written by the sydevs autonomous loop — see what this is
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Hold Until
Projects
- StatusShow more project fieldsDone
Activity
Ardnived commentedon Nov 13, 2026
@sydevs-bot revise 1A
sydevs-bot commentedon Nov 13, 2026
🤖 no session running
approved by Ardnived
recent dispatches
Written by the sydevs dispatcher. Sessions never edit this comment.
sydevs-bot commentedon Nov 13, 2026
Answered 1A: only the lookups whose answer is submitted go permanent. The body says it now.
Permanence is a prop on
MapSearchProps, not a constant in the control — one component serves both map browsing and the submit flow.permanent?: booleanjoins the<Geocoder options>block (MapSearch.tsx:28,:172-178).optionsisPartial<GeocodingOptions>, which declares it, so no cast.PlaceFieldon feat(widget): submit or correct a class, and opt into a mailing list #318's branch (WhereStep.tsx:100-107) wraps both the address and the city mount.reverseGeocode(geocode.ts:79-85) and the headerSearchFieldstay temporary. A new criterion holds that direction too.ProposalForm.pick.test.tsx's mockedGeocoderand asserts both directions.Two corrections from source:
permanent?: booleanisGeocodingCore.d.ts:86, not:97, and SahajCloud's spec istests/unit/mapbox-geocoder.spec.ts— the name the body carried does not exist.@sydevs-bot implementstarts the work.🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
Ardnived commentedon Nov 13, 2026
@sydevs-bot implement
1 remaining item
sydevs-bot commentedon Nov 13, 2026
Nothing is left to implement in this repo. The seam is on #407, open and awaiting review.
Built there:
MapSearchtakespermanent, absent by default; the header field andreverseGeocodestay temporary;MapSearch.permanent.test.tsxpins both directions. Criteria 2, 3 and 5 are met. Criterion 1 holds vacuously — no lookup here sends an id yet.Criterion 1 and criterion 4's first half need
PlaceField(ProposalForm/WhereStep.tsx), which exists only on #318's branch. A session may not push to a PR it does not hold, and no PR is based on another PR's branch. So #147 carries them, which § Notes already allows.This ticket outlives #407's merge for that reason. It is answered once #318 sets
permanentonPlaceField.🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
Ardnived commentedon Nov 14, 2026
@sydevs-bot implement, or close this ticket if there's nothing left to implement
sydevs-bot commentedon Nov 14, 2026
Closing: this repo has nothing left to build.
#407 merged the seam.
MapSearchtakespermanent, absent by default, andMapSearch.permanent.test.tsxpins the header field andcountryboth ways. Criteria 2, 3 and 5 are met, and criterion 4's second half. Criterion 1 holds vacuously — no lookup onmainsends a Mapbox id anywhere.Criterion 1's positive direction and criterion 4's first half need
PlaceField(ProposalForm/WhereStep.tsx), which exists only on #318's branch. A session pushes to no PR it does not hold, and opens none based on another PR's branch.#147 carries them now, as § Notes allows — I have written the criterion there.
docs/rules/mapbox.mdonmainstates the rule for whoever mounts the next geocoder.🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
fix(widget): ask Mapbox for a permanent answer in the Where step (#404)