Skip to content

M1.11: Wire up forkguard init and forkguard ingest #11

Description

@bjcorder

Labels: type:feature, area:cli, area:ingest, priority:critical,
status:blocked, milestone:M1, phase:2

Summary

Wire the cobra subcommands init and ingest to the store and ingest
packages, producing a working end-to-end ingestion flow.

Acceptance criteria

  • forkguard init creates ~/.forkguard/state.db, runs migrations,
    optionally loads --forks <path> (loading is implemented in M2.x but
    the flag is accepted now and validated)
  • forkguard ingest --upstream <name> performs the full flow:
    1. Open the store
    2. Look up or create the Upstream record
    3. Call OSVClient.QueryByRepo
    4. Normalize each result
    5. Upsert advisories (dedupe by source + source_id)
    6. Upsert fix commits (dedupe per design)
    7. Update upstreams.last_ingested_at
  • Re-running ingest is idempotent — no duplicate advisories or fix
    commits
  • Structured logging emits a summary at the end: N advisories
    processed, M new, K fix commits, etc.

Dependencies

Depends on: #8, #10

Verification

./forkguard init
./forkguard ingest --upstream github.com/openssl/openssl
sqlite3 ~/.forkguard/state.db 'SELECT COUNT(*) FROM advisories;'
# > 0
sqlite3 ~/.forkguard/state.db 'SELECT COUNT(*) FROM fix_commits;'
# > 0

# Idempotency:
./forkguard ingest --upstream github.com/openssl/openssl
sqlite3 ~/.forkguard/state.db 'SELECT COUNT(*) FROM advisories;'
# Same as before

This completes Milestone M1.


Milestone M2: Repository Mirroring & Ancestry


Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliCLI commands, argument parsing, output formattingarea:ingestAdvisory ingestion, synthetic generation, or vendor ingestionpriority:criticalBlocks the next milestonetype:featureNew functionality

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions