Skip to content

runctx lexicon/ignore-words loader seeds the CSV header row #856

Done

Description

@athvin

Found during #799. er-server/src/runctx.rs's load_lexicon does not skip the header row that put_lexicon / put_ignore_words write (variant_a,variant_b / word,dictionary). The dispatcher therefore seeds a bogus pair — (variant_a, variant_b) or (word, dictionary) — into the temp relation and into the run fingerprint hash.

The bogus row never changes comparison outcomes (no config names dictionary dictionary, and no real name normalizes to variant_a), but it pollutes lexicon_hash/ignore_words_hash.

Note the asymmetry: the resolve endpoint's own loader (load_lexicon_file in er-server/src/lib.rs) DOES skip the header, so probe and run currently hash the same logical file differently.

Why not fixed inline

Fixing load_lexicon changes lexicon_hash for every existing org, which the drift guard reads as a lexicon change — one promoted full rebuild per tenant on deploy. That blast radius wants its own ticket and release note, not a ride-along in an unrelated PR. ignore_words_hash is new (no production runs carry one), so the ignore-words side is free to fix whenever.

Done when

  • load_lexicon skips the header row (or both CSV writers stop writing one — pick one shape and hold it)
  • the resolve-endpoint loader and the runctx loader share one implementation
  • the PR body calls out the one-time promoted rebuild per tenant

Product context (2026-11-26)

Why this matters for the API product: Run and results. The lexicon and ignore-words hashes feed the drift guard that decides incremental vs promoted-full runs. A bogus header row makes the fingerprint disagree with the resolve probe for the same customer-uploaded file.

Current state: Still reproduces. rust/crates/er-server/src/runctx.rs:122-135 load_lexicon has no header skip, and it is used for both files (runctx.rs:191-195). The resolve loader load_lexicon_file (rust/crates/er-server/src/lib.rs:8398-8409) does .skip(1) but does not trim, while the runctx loader trims. So even after a header fix the two can disagree on padded rows. There is now a third loader: the CLI's strict, header-aware csv reader (rust/crates/er-cli/src/cli.rs:205-235). The writers still emit headers (lib.rs:3453, :3705).

Correction to the body: "ignore_words_hash is new, so the ignore-words side is free to fix" is no longer true. ignore_words_hash has been written into every run fingerprint since #853 (2026-11-08; rust/crates/er-cli/src/lib.rs:2048). Fixing that side now also costs one promoted rebuild per tenant that has an ignore-words file. Whether any production tenant has one is unverified.

Definition of done: as above, with "share one implementation" covering all three loaders, including trimming.

Dependencies / sequencing: None blocking. Ship both hash changes in one release so tenants pay one promoted rebuild, not two.

Size: about 0.5 engineer-weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions