Skip to content

feat: add guild.host importer#58

Open
ghostdevv wants to merge 5 commits into
flo-bit:mainfrom
ghostdevv:guild
Open

feat: add guild.host importer#58
ghostdevv wants to merge 5 commits into
flo-bit:mainfrom
ghostdevv:guild

Conversation

@ghostdevv

Copy link
Copy Markdown

Adds a direct integration with guild.host for a slightly better import result

Comment thread apps/web/src/lib/import/guild.ts
Comment thread apps/web/src/lib/import/index.ts
@tompscanlan

Copy link
Copy Markdown
Collaborator

Hey, This mostly looks good, Thanks for contributing! Just a couple of gotchas I think need to be addressed and this one:

description, endAt, timeZone, generatedSocialCardURL are all required/non-nullable, so one missing field (an event with no description or end time) throws and fails the whole import, where raco/jsonld degrade gracefully. Didn't hit a counterexample in the events I sampled, but loosening the non-essential fields would match the codebase norm.

ghostdevv and others added 2 commits July 5, 2026 04:47
Co-authored-by: Tom Scanlan <3408465+tompscanlan@users.noreply.github.com>
Co-authored-by: Tom Scanlan <3408465+tompscanlan@users.noreply.github.com>
@ghostdevv

Copy link
Copy Markdown
Author

description, endAt, timeZone, generatedSocialCardURL are all required/non-nullable, so one missing field (an event with no description or end time) throws and fails the whole import, where raco/jsonld degrade gracefully. Didn't hit a counterexample in the events I sampled, but loosening the non-essential fields would match the codebase norm.

ah! description is a good call, fixed it here 070ae78. The other stuff is still required though as far as I'm aware - I can change it to be looser if you like, I otherwise often lean towards strictness

Comment thread apps/web/src/lib/import/guild.ts Outdated
Guild returns `uploadedSocialCard: null` (not absent) for events with no
uploaded card — e.g. the live event London GraphQL Spring 2026 — which
`v.optional` rejects, throwing and 502-ing the whole import. `v.nullish`
accepts null and undefined; the existing `?? generatedSocialCardURL`
fallback then covers it.
Add src/lib/import/test-support.ts, a source-agnostic fetch-mock harness
(ordered route table; unmatched URLs throw so no test escapes to the
network) with jsonReply / imageReply / textReply / fetchedPage /
importContext / blockRealFetch helpers, and use it to cover every importer:

- guild: real captured API fixtures, host-match accept matrix, a pipeline
  test proving a guild URL routes straight to the JSON API with no wasted
  HTML-page fetch, and a regression test for the null-uploadedSocialCard
  generated-card fallback.
- raco: GraphQL POST body/header assertions + venue-zone offset mapping.
- ical: text/calendar and BEGIN:VCALENDAR content sniffing, TZID-aware
  start/end mapping, and full-pipeline routing.
- webpage: JSON-LD extraction, OpenGraph fallback, offset -> IANA-zone guess.

blockRealFetch() installs a throwing fetch before each test, so a test that
forgets stubFetch() fails loudly instead of hitting the internet. Adding a
new importer's tests is: capture a real response as a fixture, list its
routes, assert the mapped prefill. Each importer test was checked against an
injected regression via mutation testing.
@tompscanlan

Copy link
Copy Markdown
Collaborator

Pushed two commits directly (maintainer edit) rather than leaving you to hand-apply — shout if you'd rather I back either out:

  • 6a54fa9 fix(import): accept null uploadedSocialCard — takes the v.nullish suggestion above. Guild returns uploadedSocialCard: null (not absent) for card-less events like London GraphQL Spring 2026, which v.optional rejected → the whole import 502'd. Now falls back to generatedSocialCardURL.
  • 611b731 test(import): import-pipeline test harness + coverage — a source-agnostic fetch-mock harness (test-support.ts) plus tests for the guild importer (real captured API fixtures) and the existing raco / ical / webpage importers, so this and future importers have a regression net. 35 tests, npm test green; no network (a blockRealFetch guard makes an unstubbed fetch throw). Each importer test was checked against an injected regression via mutation testing.

Adding the next importer's tests is: capture a real response as a fixture, list its routes, assert the mapped prefill.

@ghostdevv

Copy link
Copy Markdown
Author

ty! assuming this will be squashed merged perhaps your LLM should move the unrelated tests should be in a seperate PR?

@tompscanlan

Copy link
Copy Markdown
Collaborator

You caught me :) I was hoping to smuggle the whole thing in one merge to save a step, but I can do better :) I'll split it out when I get a minute

tompscanlan added a commit that referenced this pull request Jul 7, 2026
A source-agnostic fetch-mock harness (test-support.ts) stubs the global
fetch with an ordered route table, so an importer can be driven against
captured fixtures with zero live network — an unstubbed fetch throws
(blockRealFetch). On top of it, regression tests for the pre-existing
raco / ical / webpage importers.

This is the reusable test infrastructure factored out of #58 so the
guild.host importer PR carries only its own code and tests. Land this
first; #58 rebases onto it and keeps just the guild importer + its tests.

19 tests, `npm test` green, no network.
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.

2 participants