Skip to content

feat(subscribers): pin, replace, and clear a subscriber location - #26

Merged
imjohnbo merged 1 commit into
mainfrom
fix/subscriber-location
Aug 24, 2026
Merged

feat(subscribers): pin, replace, and clear a subscriber location#26
imjohnbo merged 1 commit into
mainfrom
fix/subscriber-location

Conversation

@imjohnbo

Copy link
Copy Markdown
Owner

Closes #24, and fixes the pipeline gap that let it break main unnoticed.

The three endpoints

kit subscribers location pin <id> --city --state-province --country-code \
                                  --latitude --longitude --time-zone
kit subscribers location update <id>   # same six flags, all required
kit subscribers location delete <id>

Kit infers a subscriber's location from open events. Pinning overrides that.

PATCH is a full replacement rather than a merge, so update takes the same six
required flags as pin. A test asserts the two require an identical set, so they
cannot drift apart.

There is no get. Location comes back through include=location on list and
filter, which the CLI already supports.

Client additions

patch() joins get, post, put, and del. request() already handled the
verb.

Three validators, all with one job: turn a 422 into a clear CLI error.

Validator Catches
validateFloatInRange Coordinates out of range. Zero and negatives stay valid.
validateCountryCode USA and United States. Upper-cases on the way out.
validateTimeZone See below.

The time zone check needed more care than expected. Intl on its own accepts a
UTC offset like -07:00 and an abbreviation like PST, and neither is an IANA
name:

"America/Denver"   construct: true
"-07:00"           construct: true     <- not IANA
"PST"              construct: true     <- not IANA

An offset also ignores daylight saving, which is the reason to send a zone at
all. So the validator checks Intl.supportedValuesOf('timeZone'), allows UTC,
GMT, and the Etc/* family that the list omits, and returns the canonical
spelling. america/denver becomes America/Denver.

The pipeline gap

main was red at 496/497 and no CI run said so.

The spec-check workflow commits with [skip ci]. It pushed bd00f6f, a new spec
carrying these three endpoints, and scripts/spec-coverage.test.js began failing
by design. Because of [skip ci], the Tests workflow never ran on that commit.
The only reason this surfaced at all is that a later branch failed locally.

This PR removes [skip ci]. A spec change now fails Tests on main
immediately, which is what the coverage map is for. The comment in the workflow
records why, so nobody adds it back.

Review notes

Coverage: 76 operations, all mapped, no gaps.
Surface: 107 commands, snapshot regenerated.
Tests: 497 before, 560 after.

The semver gate reports the surface change as skipped, correctly. There is no
v0.0.1 tag yet, so there is no baseline to compare against. Once a release
exists, adding commands like these would require a minor bump.

Closes #24. The spec added three endpoints for a subscriber's pinned location.

  kit subscribers location pin <id> --city --state-province --country-code \
                                    --latitude --longitude --time-zone
  kit subscribers location update <id>   # same six flags, all required
  kit subscribers location delete <id>

Kit infers a location from open events. Pinning overrides that. PATCH is a full
replacement rather than a merge, so update takes the same six required flags as
pin. A test asserts the two commands require an identical set, so they cannot
drift apart.

There is no get. Location comes back through include=location on list and filter.

## Client additions

patch() joins get, post, put, and del. request() already handled the verb.

Three validators, all with the same job: turn a 422 into a clear CLI error.

- validateFloatInRange, for coordinates, where zero and negatives are valid.
- validateCountryCode, two letters, upper-cased on the way out.
- validateTimeZone, checked against the IANA list that Intl already carries.

The time zone check needed care. Intl on its own accepts a UTC offset like
-07:00 and an abbreviation like PST, and neither is an IANA name. An offset also
ignores daylight saving, which is the reason to send a zone at all. So it checks
Intl.supportedValuesOf, allows UTC, GMT, and the Etc/* family that the list
omits, and returns the canonical spelling. So america/denver becomes
America/Denver.

## The pipeline gap that hid this

The spec-check workflow used a skip-ci directive, so it pushed a spec that broke
the suite and no CI run ever reported it. main sat red at 496/497 and only showed
up when this branch failed locally.

Dropping that directive closes the gap. A spec change now fails Tests on
main immediately, which is the point of the coverage map.

Coverage: 76 operations, all mapped. Surface: 107 commands.
Tests: 497 before, 560 after.

Note on this very message: GitHub honors a skip-ci directive anywhere in a commit
message, so naming it literally here would have skipped this commit's own CI run.
It did, on the first attempt.
@imjohnbo
imjohnbo force-pushed the fix/subscriber-location branch from 5ea38e0 to c5d0a61 Compare August 24, 2026 18:45
@imjohnbo
imjohnbo merged commit 43b2e5c into main Aug 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kit API spec update: 3 added

1 participant