← Back to Pull requests

fix(ingestion): treat password-locked and maintenance stores as closed, not failed #550

Closed
unknown closed this pull request without merging on Nov 26, 2026 07:13 UTC
View on GitHub
unknown unknown commented on Nov 26, 2026 04:51 UTC
Author

Refs #529, #532 (not closing: shipped to dev only).

Why


On the 2026-11-25 65-source bulk run, 5 jobs failed only because the store had locked itself: Clionadh, Kathleen & Co, Penelope Luz and Bee's Knees answered /products.json with 401 (and / with a 302 to /password), and Colores de Carol's Big Cartel API answered 403 {"reason":"Store is under maintenance"}. Each fired ingestion.job_failed and so the prod alert. With the nightly refresh (#532 / #546) every routine lock would turn into a nightly failure email. Owner decision: a closed store is not an error. Leave the catalog alone and try again next run. Never try to get past the lock.

What


  • Detect (lib/connectors/store-closed.ts): a typed StoreClosedError (source, reason password_page | maintenance, httpStatus, url, detail).

  • - ShopifyGenericConnector and HoloTacoShopifyConnector: a 401 on the catalog request, or a redirect ending on /password, throws it after that one request. No retry.
    - BigCartelConnector: a 403 whose JSON reason mentions maintenance throws it. The 403 body is now kept so it can be read.
    - Any other 401/403 is still an ordinary failure. That includes Cloudflare challenges (cf-mitigated: challenge, or an HTML 403 on Big Cartel).
  • Worker (functions/ingestion.ts): catches it and ends the job succeeded at metrics.pipeline.stage = "store_closed" (INGESTION_STORE_CLOSED_STAGE in shared). The reason goes in metrics.storeClosed and a warn line in the job log. It ends the job through the new markIngestionJobStoreClosed(), which emits ingestion.store_closed and never ingestion.job_failed.

  • - Nothing is written to the catalog: the pull never returned, so no listing is marked missing and nothing is pruned.
    - Nothing is re-queued, and the poison handler already ignores finished jobs.
    - The next run starts normally.
    - No status was added (ingestion_job.status has no CHECK constraint), so there is no migration.
  • Surface: GET /api/reference-admin/jobs returns each job's stage, and sources-admin lastJob returns stage. The admin Job Runs tab, the Admin Jobs table and the Sources tab's Last job column show these runs as "Store closed" (violet badge or lock icon, with hover text).

  • Docs: functions README (ingestion + poison trigger + jobs endpoint), docs/observability-plan.md, docs/agents/ingestion-sources.md, docs/agents/auth-telemetry-backups.md, a CLAUDE.md rule line, and the shared and web READMEs.
  • Tests


  • tests/store-closed.unit.test.cjs (new) covers:

  • - the detectors
    - Shopify 401 and redirect to /password (one request, project User-Agent)
    - Holo Taco 401
    - Big Cartel maintenance 403
    - a Cloudflare-style 403 on Shopify and on Big Cartel staying a normal failure
    - a Big Cartel 403 with another reason staying a normal failure
  • Worker outcome (ingestion-worker-continuation):

  • - status succeeded, stage store_closed
    - no failed write
    - nothing materialized, no freshness marking, nothing enqueued
    - the next run completes normally
    - a poisoned copy is ignored
  • markIngestionJobStoreClosed emits only ingestion.store_closed. Sources-admin carries lastJob.stage. Web ingestion-job-status.test.ts covers the label.

  • npm run typecheck is clean. npm run lint shows only pre-existing warnings. Functions 3975 pass (2 skipped, as before), web 893, shared 261.
  • Not covered


  • No alert listens to ingestion.store_closed. Query AppEvents to see which stores were closed on a run.

  • The WooCommerce and sitemap connectors are unchanged.

  • Not checked against a live locked store. The test responses copy the ones recorded on 2026-11-25.
  • 🤖 Generated with Claude Code

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    New Features
    Recognized locked or closed Shopify and Big Cartel storefronts now finish ingestion successfully with a “Store closed” status instead of being reported as failures.
    Admin job and source views show the “Store closed” status with a dedicated badge or icon. Job details include pipeline stage information.
    Pending AI batches can finish processing before a closed-store job completes.
    Other access errors, including Cloudflare challenges, continue to be treated as failures.
    Documentation
    * Updated guidance on closed-store handling, job statuses, and related telemetry.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 573 lines (+429 / -144) across 7 files Reviewer: mattmck Review duration: 142m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.50) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 573 lines diff across 7 files
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.380
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #550"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 49.8% (MEDIUM) · Higher = larger blast radius
    49.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 21.5% · Safe to merge
    21.5%