fix(create-chapter): Shanghai map-dot override + reposition 22 stale chapter dots - #11
Conversation
Shanghai (~121°E) sits in the map's distorted western-Pacific zone where the separable lon/lat projection can't place cities (same reason Seoul, Sydney, and Melbourne already have overrides). The linear formula lands it ~10px out to sea; pin it to the Chinese coast at pixel (833, 330). Verified against image18.png by rendering the projected dot on the map. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Self-ReviewRan all five pr-review-toolkit agents. No critical or important issues — the change is a minimal, in-convention data addition and the coordinate is internally consistent with both projection formulas ( Suggestions (4)
Strengths
Generated using hero-skills. |
- Correct the Shanghai comment (~10px -> ~8px offshore) and set it apart from the gross Oceania distortion it was spliced into - Print a Note when a city uses a fixed pixel override, so the reported Coords line isn't mistaken for where the dot lands - Add a table-wide test that every PIXEL_OVERRIDES pixel is within the map Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Self-Review — ImprovementsSuggestions (4 / 4 addressed):
Skipped:
Commits: d03691c Generated using hero-skills. |
There was a problem hiding this comment.
Pull request overview
This PR updates the aaif-create-chapter cloner’s slide-5 (“THE NETWORK”) map-dot placement logic by adding a Shanghai fixed-pixel override, improving CLI output clarity when a fixed override is used, and adding a table-wide invariant test to prevent out-of-bounds overrides.
Changes:
- Added a Shanghai
(x, y)entry toPIXEL_OVERRIDESfor slide-5 map-dot placement. - Updated
main()output to print an explicit note when a city’s dot uses a fixed pixel override (soCoords:isn’t misread as the placement driver). - Added a unit test that asserts all override pixels fall within the map image bounds.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| skills/aaif-create-chapter/scripts/create_chapter.py | Adds Shanghai override and prints a “fixed pixel override” note in CLI output. |
| skills/aaif-create-chapter/scripts/test_create_chapter.py | Adds a bounds invariant test covering all entries in PIXEL_OVERRIDES. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Copilot: fixed-pixel-override cities were gated on geocoding succeeding, so an override city (e.g. Shanghai) would fall back to San Francisco if Nominatim was unreachable — even though its dot is placed by name and never needs coordinates. - Add map_dot_latlon(): returns a sentinel for override cities when no explicit --lat/--lon is given, so they're placeable without a network lookup and skip the "stays at San Francisco" warning - main() uses it and prints a clear "fixed pixel override" coords line - Cover the new helper (placeable-without-geocode, non-override still None, explicit coords win) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Respond-to-Comments ImprovementsCode changes (1 applied):
Commits: 5ee3fe6 Remaining unresolved threads: none Generated using hero-skills. |
Summary
Slide 5 ("THE NETWORK") of each chapter's
Event Template/Slides.pptxcarries a green "you-are-here" dot + label that ships parked at San Francisco. 22 chapters created before the auto-place feature (#8) still had that dot at the SF default even though their city text was correct. This PR adds the one projection fix that was missing (Shanghai) so the cloner places it correctly going forward; the 22 stale chapters were repaired as a one-time data fix directly in Drive.Changesets
1.
fix(create-chapter): add Shanghai pixel override for slide-5 map dotFiles:
skills/aaif-create-chapter/scripts/create_chapter.pyShanghai (~121°E) is in the map's distorted western-Pacific zone. The linear formula lands it ~8px offshore; pinned to the Chinese coast at pixel
(833, 330), verified by rendering the projected dot onimage18.png.2.
fix: address self-review findingsFiles:
create_chapter.py,test_create_chapter.pymain()now prints a Note when the city uses a fixed pixel override, so the reportedCoords:line isn't mistaken for where the dot lands.test_every_override_pixel_is_within_the_map— a table-wide bounds invariant guarding all override pixels.3.
fix: address PR review feedbackFiles:
create_chapter.py,test_create_chapter.pyCopilot: fixed-pixel-override cities were gated on geocoding succeeding, so one would fall back to San Francisco if Nominatim was unreachable — despite being placed by name. Added
map_dot_latlon()(sentinel for override cities without explicit--lat/--lon), so they place without a network lookup and skip the SF warning. Covered by 3 new tests.Context (data repair, not in this diff)
The projection was validated by re-deriving the dots of already-correct chapters (London, Berlin, New York, Amsterdam, Chicago, Seoul) — reproduced to within ~65 EMU (sub-pixel). The 22 stale chapters (incl. Washington DC and Tel Aviv, which needed no code change — the existing linear projection places them correctly) were repositioned and re-uploaded to Drive, then re-read to confirm.
Test Plan
pytest test_create_chapter.py— 27 passedGenerated using hero-skills.