_spectoraJobId).beta-online-scheduler-attik), the online UI calls inspection/book-job only—it does not call spectora/create-job on the same booking. Spectora jobs for those bookings are created by barebones sync after the Attik inspection is saved.POST inspections and full createSpectoraJob both use that path). Online Attik bookings that sync to Spectora use barebones sync with scheduled_by: attik-standalone on the Spectora payload._spectoraJobId is persisted—e.g. async sync on inspection insert while a follow-up inspection update (or a second sync trigger) still sees no linked id. createInspection performs a second save to attach events immediately after the first save; the change stream also fires barebones sync on later updates when status, charges, datetime, inspectors, or address change.attik-frontend/src/app/scheduler/summary/BookingJobLoader.tsx: when company.attikStandalone or beta-online-scheduler-attik is enabled, it posts to inspection/book-job with scheduledLocation: 'online' (not spectora/create-job).hasBookedRef guards against double-submit in the loader; if duplicate Spectora jobs appear, investigation should include server-side duplicate creates, not only UI double-click.POST /inspection/book-job in attik-backend/src/routes/inspection.ts calls createInspection in src/util/functions/inspection/createInspection.ts, which sets jobCreationType: 'attik' and scheduledLocation: 'online' (default when not internal).createBookedJobsAsConfirmed); that affects whether later confirm updates also qualify for barebones sync.attik-backend/src/events/streamHandlers/inspectionStream.ts invokes syncBarebonesSpectoraJob from src/util/functions/spectora/syncBarebonesSpectoraJob.ts for jobCreationType === 'attik'.POST inspections when _spectoraJobId is missing, then updates when present. There is a late re-read for _spectoraJobId before create, but no distributed lock—concurrent runs can still double-create; only one id is typically saved on Attik.src/routes/webhooks/spectora/syncInspection.ts skip upsert when scheduled_by === 'attik-standalone' or when an Attik inspection already owns the Spectora job id—so the duplicate is unlikely to be webhook-created Attik rows; focus on duplicate API creates.src/routes/spectora.ts → createSpectoraJob) is out of scope for this repro unless investigation shows the company was not on standalone at book time.1008592205: compare _spectoraJobId to both Spectora job ids; review AutomationEventHistory / logs for [SpectoraBarebonesSync] create vs create_success (timing, count).attikStandalone, scheduler feature flags) and inspection fields (jobCreationType, scheduledLocation, initial status).POST, or stricter queue dedupe) and whether orphan Spectora jobs need operational cleanup tooling.attik-frontend/src/app/scheduler/summary/BookingJobLoader.tsx; attik-backend/src/util/functions/inspection/createInspection.ts; attik-backend/src/util/functions/spectora/syncBarebonesSpectoraJob.ts; attik-backend/src/events/streamHandlers/inspectionStream.ts; attik-backend/src/routes/webhooks/spectora/syncInspection.tsPlease authenticate to join the conversation.
Planned
Main App
13 days ago
Linear
Get notified by email when there are changes.
Planned
Main App
13 days ago
Linear
Get notified by email when there are changes.