feat(seed): backfill HNC bulk flags onto already-seeded Greek entries #22

Closed
raisondetredev wants to merge 1 commit from refs/pull/22/head into main
raisondetredev commented 2026-07-01 22:01:45 +02:00 (Migrated from codeberg.org)

What

Adds backfill_hnc_bulks, a CLI that sets the hnc_lemma_words_<N> frequency-bulk flags on Greek dictionary_entries that are already in the catalog — no source JSONL needed.

Why

#21 taught seed_bilingual --hnc-bulk-dir to tag rows at seed time, but the Greek entries are already seeded and re-seeding needs the source JSONL (the pending PONS-scraper output). This backfills the flags onto the existing rows directly.

How

  • Fetches each existing entry's id, language, expression via PostgREST (paged), filtered by --language (default el, comma-separated / repeatable).
  • Computes bulk membership with the same tested HncLemmaBulks used by the seeder (identical case/accent/final-sigma folding — no risk of divergence).
  • Upserts {id, language, ...hnc_lemma_words_<N>} via the existing merge-on-(id, language) helper, so only the flag columns change — meanings/senses/expression are untouched.
  • Idempotent and re-runnable (e.g. when the bulk lists change). --dry-run reports match counts + sample matches without writing. Service-role key from the environment, never argv.

Verification

  • dart analyze clean; --help / arg-validation exercised.
  • Flag computation is unit-tested (hnc_lemma_bulks_test.dart) and was dry-run-validated against the real 47-file corpus in #21.

Usage

export SUPABASE_SERVICE_ROLE_KEY=ey...   # local: from `supabase status`
dart run halkyon_curator:backfill_hnc_bulks \
  --supabase-url http://127.0.0.1:54321 \
  --hnc-bulk-dir ../halkyon-infra/supabase/bulk_lists \
  --language el --dry-run     # drop --dry-run to write
## What Adds `backfill_hnc_bulks`, a CLI that sets the `hnc_lemma_words_<N>` frequency-bulk flags on Greek `dictionary_entries` **that are already in the catalog** — no source JSONL needed. ## Why #21 taught `seed_bilingual --hnc-bulk-dir` to tag rows *at seed time*, but the Greek entries are already seeded and re-seeding needs the source JSONL (the pending PONS-scraper output). This backfills the flags onto the existing rows directly. ## How - Fetches each existing entry's `id, language, expression` via PostgREST (paged), filtered by `--language` (default `el`, comma-separated / repeatable). - Computes bulk membership with the **same tested `HncLemmaBulks`** used by the seeder (identical case/accent/final-sigma folding — no risk of divergence). - Upserts `{id, language, ...hnc_lemma_words_<N>}` via the existing merge-on-`(id, language)` helper, so **only the flag columns change** — meanings/senses/expression are untouched. - Idempotent and re-runnable (e.g. when the bulk lists change). `--dry-run` reports match counts + sample matches without writing. Service-role key from the environment, never argv. ## Verification - `dart analyze` clean; `--help` / arg-validation exercised. - Flag computation is unit-tested (`hnc_lemma_bulks_test.dart`) and was dry-run-validated against the real 47-file corpus in #21. ## Usage ``` export SUPABASE_SERVICE_ROLE_KEY=ey... # local: from `supabase status` dart run halkyon_curator:backfill_hnc_bulks \ --supabase-url http://127.0.0.1:54321 \ --hnc-bulk-dir ../halkyon-infra/supabase/bulk_lists \ --language el --dry-run # drop --dry-run to write ```

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
project-halkyon/halkyon-curator!22
No description provided.