Repository navigation
Conversation
…e missing city regions A dry run of a Karnataka class file showed Mapbox v6 answering most Indian addresses with a `street` of the same name in another town — Bidar's class in Bengaluru, 550 km off — which the import accepted as is. v6 grades only an `address` answer, so the import now keeps an answer only when v6 graded it a match, its postcode is the row's, or (with no postcode) its town is the row's. Otherwise the row's postcode stands in, pinned at its centre, and only if it lies in the row's town; a refusal quotes what Mapbox gave. A town with no city region under the target now gets one, created as the uploader under the target (or the matching state under a country target), named as Mapbox names it, and only when the answer's own state or country is the target's. The import page lists the regions a run created beside its classes, and the summary email counts them. Also: the help row is recognised when a dash or quote in it was re-typed, a too-long address names Mapbox's word limit, a column's message is not repeated per bad list item, and an approximate pin is no longer described as "at the street" when it sits at a postcode or town centre. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Shows the import page's New City Regions table on every preview. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- One memoised geocoder per run replaces the town-only memo on ImportRun, so rows sharing a postcode fallback ask Mapbox once. - "v6 doubts this address" is one predicate beside the geocoder, which `addressFeatureMapboxId` reads, instead of nulling the id in the import. - Each lookup kind has its own argument type. - `planCity` answers a city or null; `createCities` skips its own failed rows, checks every slug in one query, and words a refusal by field label. - `createdRegions` takes the generated type and drops the unread `parentId`; the import page reads regions beside the classes and counts them from the stored rows, with no region populate. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A city whose create fails now ends "create it first" and carries `missingCity`, so the import page offers to create it by hand. - An address lookup with only a postcode is a miss again, as before the per-kind arguments: a postcode alone is the postcode lookup's question. - A parent whose name slugifies to nothing no longer leaves a trailing hyphen. - The planner's header no longer claims a refused create leaves no city. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🚅 Deployed to the SahajCloud-pr-1261 environment in sahajcloud
1 service not affected by this PR
|
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The premise is measured and the shape follows it: v6 grades only an address answer, so a coarser one must prove it is the row's town. Trust check, city creation and csv fixes share one verification run, so one PR is right.
What the aggregate buys is less clear: the two new modules add 16 top-level pieces, four restating what this repo owns — a request memo, the import's region read, a punctuation key, a field table.
One gap, not style: a created city is stored with no latitude, longitude or radius — what the Atlas places a city by.
Findings
- should-fix — created city has no point —
cities.ts:106 - should-fix —
memoiseGeocodeduplicatesmemoizeOnRequest—locate.ts:35 - should-fix —
regionsWhereis a third region read —cities.ts:160 - should-fix —
queryFieldsfolds intolookupUrl—geocoder.ts:217 - should-fix —
helpKeylists punctuationstreetKeydrops —template.ts:41 - should-fix —
liveRegions/regionRowshave one caller —ImportResultsField.tsx:219 - should-fix — the slug ladder bounds an unhit collision —
cities.ts:144 - consider — the fallback pair doubles geocodes in flight —
locate.ts:72
What was checked
Read whole on the branch: every touched file under eventImport/, lib/mapbox/, admin/EventImport/, plus unchanged Regions.ts, slugField.ts, refuseDuplicateClass.ts and requestMemo.ts.
Regions' point fields are required only under isManualLocation — why the create above passes. findDuplicateClass returns null on a null region, so a pending city asks nothing.
Preview: three on-host fixture.link links, both ids on the branch. 1024005 names cityEmpty, event 1025999 absent — so 0 classes and "Deleted after the import", as claimed.
Streamliner: 34 pieces, 26 kept, 6 flagged and checked.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`memoizeOnRequest` already collapses a promise per key, stampede-safe, and `planRows` holds the req — so the hand-rolled Map was a second copy of it. Kept as a one-line named seam so the per-run memo keeps its unit test. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVJbsHongazRfUgRsa
`regions.ts` owns the region reads an import makes, and `cityIndex`, `stateIndex` and the city creates each spelled the same elevated find. `regionsWhere` is now that one spelling, exported from there. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVJbsHongazRfUgRsa
`queryFields` had one caller and existed only to narrow the union. One flat table spells all three kinds in one place, and the loop already skips blanks. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVJbsHongazRfUgRsa
Enumerating dash and quote codepoints breaks again on the next re-typed character. `streetKey` is this repo's shape for the same job: keep letters and digits. The new case fails against the enumerated version. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVJbsHongazRfUgRsa
`-2…-5` and the `Date.now()` suffix bounded a collision nobody has hit: three towns of one name under one parent in one run. The namesake case `[base, qualified]` covers, and `refusalOf` already answers the rest. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVJbsHongazRfUgRsa
`liveRegions` and `regionRows` had one caller each, a line apart. The read joins the two beside it in the same `Promise.all`, and the rows are built where the skipped ones are, off the live map rather than a loose `ReadonlyMap<number, unknown>`. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVJbsHongazRfUgRsa
The constant bounds rows, not requests, and the fallback pair put up to 8 lookups in flight — so the note's "four never approaches 600 a minute" no longer reasoned about the right number. The per-run memo is what does. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVJbsHongazRfUgRsa
|
7 of the critic's 8 adopted, one rebutted, a commit each. Net −38 lines; the threads carry why. Adopted
Rebutted, resolved
Gate green: 3910 unit, 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
@sydevs-bot approve |
One conflict, `src/migrations/index.ts`: both sides added migrations, so all three are kept, ordered by timestamp — `20261124_042718_import_created_regions`, then main's `20261125_152923_atlas_drop_compact_tab` and `20261125_191844_merge_snapshot_heal`. That order leaves this PR's column outside the newest snapshot, because main's two migrations were generated on a branch that never saw it. The next `migrate:create` would re-emit `ALTER TABLE "imports" ADD COLUMN "created_regions"` and abort the boot migration on a database that already ran it (#566). `20261125_194859_merge_snapshot_heal` is the generated snapshot of the merged tree with its DDL emptied, as main's own heal migration did a few hours earlier. A probe `migrate:create` on the merged tree now writes nothing. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjV8Ni4qzPr9kDTZ95a
|
Merged That order leaves this PR's column outside the newest snapshot, because main's two migrations were generated on a branch that never saw it. The next Lean gate green. Int specs 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
One conflict, src/migrations/index.ts: both sides only appended. Kept all three new entries in timestamp order. main's 20261125_213000 and 20261125_230000 carry later timestamps than this branch's own heal, so the newest snapshot on disk no longer described "imports"."created_regions" (#566). Healed again with 20261126_035749_merge_snapshot_heal: its .json was generated on the merged tree, and its DDL is emptied because 20261124_042718_import_created_regions already ships the one statement. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWK4S8phM2CBbS7jvu
|
Merged
🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
The session for resolve-conflicts did not finish after 3 attempts. I have stopped retrying. A mention ( 🤖 sydevs dispatcher |
Summary
Change outline
Flow — placing a row
Every row now has to show its pin is in its own town, and the cities a file needs are created once every row is checked, before the managers and the classes.
Contract —
importsA run's created regions are stored on the import, rendered by the Result field, and counted in the summary email.
imports src/plugins/eventImport/importCollection.ts results json, update: false + createdRegions json, update: false, hidden # [{ regionId, name, parentName, rows[] }] rows json, hidden targetRegion description: "…gets one, listed on the import once it has run"Types — the geocoder
The geocoder returns what the trust check compares, each lookup kind takes only the fields it sends, and v6's doubt is one predicate that also decides which address ids are stored.
Components — the import page
The created regions render as their own table above the classes, from the stored row and each region's live name.
ImportResultsField src/components/admin/EventImport/ImportResultsField.tsx readAsRequestUser(imports, { results, targetRegion, + createdRegions }) - events + versions + Promise.all(events + versions, the created regions by id) + one row per created region # live name, deleted?, its rows' classes that still exist ImportResultsTable + New City Regions: City (drawer) | Filed under | Classes | Status Result: … # "approximate" now reads "near the address"Behaviour — smaller fixes
Preview
imports1024005 (new): the New City Regions table, listing Fixture Wellspring under Fixture Vasanta with 0 classes; its one class row reads "Deleted after the import" on purposeimports1024003: an import that created no regions, so no regions table above its classesThe Karnataka file this came from, and the dry run
A volunteer's 61-row Karnataka file, run read-only against production on the deployed commit (Payload booted through
loadPayloadWithoutSchemaChanges, Postgres sessiondefault_transaction_read_only=on, the pipeline stopped before any write):The 7 still skipped each quote what Mapbox gave: two postcodes Mapbox doesn't hold, one wrong city (Bangarpet written as Kolar), and four where Mapbox files the postcode under a neighbouring taluk, kept strict on purpose.
Email previews
Migration
src/migrations/20261124_042718_import_created_regions.tsimports.created_regions; no data toucheddowndrops the columnsrc/migrations/20261125_194859_merge_snapshot_heal.ts, from the merge of main: no DDL, its snapshot alone, so the nextmigrate:createdoes not re-emit the column (feat(regions): country slug = ISO alpha-2 code #566)Test results
tests/int/event-imports.int.spec.ts38 passed (5 new),tests/int/fixture-load.int.spec.ts7 passed; new unit specevent-import-locateManual verification
Notes for reviewer
mapboxId. Production holds 36 countries and 100 states with v6 ids, and 4 hand-entered states, which keep "create it first".Review findings dismissed, and why
/simplify(4 lenses) and/code-review highran;pr-review-toolkitis not installed here. Security review: no findings.req. As the class creates do: each commits on its own, so one refusal costs that city alone.addressFeatureMapboxIdnow drops doubtful ids for every caller. It has one caller,eventData.ts.regionpath is ignored for a city still to create. A new city lists no class to repeat, and twins inside the file are keyed by place id.createdRegionsis written only at the finish, likeresults: a run lost with its container leaves its cities unlisted.createdRegionsaccepts a value at create, asresultsalready does; the job overwrites both, and it names regions only.latitude,longitudeorradius(adversarial review). Nothing reads them: the Atlas's region read selects none of the three and derivesbounds/centerfrom a region's events' points. They are required only underisManualLocationbecause a Mapbox-identified node resolves geometry from its id.🤖 Generated with Claude Code