Skip to content

fix(importer): reject --audit-only combined with --apply in backfill-specs #1854

Closed

Description

@JOY

Goal

Ensure apps/importer/src/shopee/jobs/backfill-specs.ts fails closed when --audit-only is passed together with --apply, preserving the documented read-only contract of --audit-only and preventing unscoped writes across every FLAGSHIP_DEVICES_TO_SEED master row.

Requirements

  1. backfill-specs.ts documents --audit-only (around line 10) as a read-only mode (Run quick spec audit without writing) and parseBackfillSpecsArgs already rejects --audit-only combined with --only or --expect (lines 581-590).
  2. Currently parseBackfillSpecsArgs(["--audit-only", "--apply"]) succeeds and main() (lines 1321-1322) invokes runQuickSpecSyncAndAudit({ apply: true }), which upserts all seeded flagship devices in rate.master_products without requiring --only or --expect scope guards!
  3. Update parseBackfillSpecsArgs so combining --audit-only and --apply throws a clear validation error before any Supabase client or query runs.
  4. Add a defensive check at the entry of runQuickSpecSyncAndAudit or main so --audit-only never executes apply: true.

Approach

Add the mutual-exclusion check in parseBackfillSpecsArgs (matching the existing --audit-only + --only/--expect error style) and cover both flag orders (["--audit-only", "--apply"] and ["--apply", "--audit-only"]) in backfill-specs-scope.test.ts.

Acceptance

  • parseBackfillSpecsArgs(["--audit-only", "--apply"]) and parseBackfillSpecsArgs(["--apply", "--audit-only"]) throw a descriptive error and never return { auditOnly: true, apply: true }.
  • Valid invocations (["--audit-only"], ["--apply", "--only=...", "--expect=1"], dry-run defaults) continue to work unchanged.
  • Unit tests in apps/importer/src/shopee/__tests__/backfill-specs-scope.test.ts and monorepo CI checks pass.

Files

  • apps/importer/src/shopee/jobs/backfill-specs.ts
  • apps/importer/src/shopee/__tests__/backfill-specs-scope.test.ts

Activity

  1. added
    bugSomething isn't working
    status:readyTask ready to be picked up by an Agent
    po:antigravityDispatched by the Antigravity Product Owner
    on Nov 22, 2026
  2. added theissue type on Nov 22, 2026
  3. JOY commented on Nov 22, 2026

    @JOY
    ContributorAuthor

    🔒 [Agent: Ops] Claim lock refs/claims/1854 taken by claimant antigravity:cd885866-827d-4dee-8251-1d84c244e27f (Status: in-progress).

  4. added
    status:in-progressTask currently claimed and being worked on by an Agent
    agent:opsClaimed by Agent: Ops
    and removed
    status:readyTask ready to be picked up by an Agent
    on Nov 22, 2026
  5. self-assigned this
    on Nov 22, 2026
  6. JOY commented on Nov 22, 2026

    @JOY
    ContributorAuthor

    [Agent: Ops] Claimed #1854 on branch fix/1854-backfill-audit-only-guard (Claimant: antigravity:cd885866-827d-4dee-8251-1d84c244e27f). Implementing mutual exclusion for --audit-only + --apply in backfill-specs.ts and unit tests in backfill-specs-scope.test.ts.

  7. added
    status:in-reviewTask completed and waiting for review / PR merge
    and removed
    status:in-progressTask currently claimed and being worked on by an Agent
    on Nov 22, 2026
  8. JOY commented on Nov 22, 2026

    @JOY
    ContributorAuthor

    [Agent: Ops] Opened PR #1856 (fix/1854-backfill-audit-only-guard -> dev, commit caf488e0). Local test/typecheck/lint/build/dist checks passed; running 2 independent fresh-context reviews and CI checks.

  9. JOY commented on Nov 22, 2026

    @JOY
    ContributorAuthor

    🔓 [Agent: Ops] Claim lock refs/claims/1854 of antigravity:cd885866-827d-4dee-8251-1d84c244e27f (Agent Ops) since 2026-11-22T09:47:53Z released by claimant antigravity:def296a6-5f67-48da-bb74-ee3ede4b7061 because #1854 is closed (Status: done).

  10. added
    status:doneTask completed and verified
    and removed
    status:in-reviewTask completed and waiting for review / PR merge
    on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent:opsClaimed by Agent: Opsarea:crawlersbugSomething isn't workingpo:antigravityDispatched by the Antigravity Product Ownerstatus:doneTask completed and verified

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions