Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

education tests: derive the open-ended entry-level sweep from OPEN_ENDED_ALT instead of restating four of its six forms

Chiusa Adatta ai principianti
#992 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
84/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
testing-qa

Direzione di ricerca

Inizia in src/lib/heuristics/extract/education.test.ts, nello sweep a livello di entry all’interno di describe("isInlineDatedProgram: a date word must be a whole word (#925)"), e ispeziona lo sweep del predicato adiacente di #952. Leggi OPEN_ENDED_ALT in src/lib/heuristics/regex.ts, poi fai in modo che entrambi gli sweep derivino da quella costante o che proteggano esplicitamente dal drift rispetto a essa. Esegui npm run verify; il lavoro è completato quando tutte e sei le forme superficiali attuali sono coperte e il commento aggiornato non descrive più quattro parole.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

refactor testing

What

src/lib/heuristics/extract/education.test.ts pins the extractEducation-level behaviour of an open-ended date range with a hand-written list of four words:

it.each(["Presently", "Currently", "Ongoing", "Now"])(
  "does not let a season-led open-ended range ending in %s reach an education entry",
  ...

The production strip it guards is not a four-word list. inlineDatedProgramText composes the shared constant:

// src/lib/heuristics/extract/education.ts
String.raw`\b(?:${SEASON}s?|(?:${OPEN_ENDED_ALT})(?:ly)?|${STRICT_MONTH})\b`

and OPEN_ENDED_ALT (src/lib/heuristics/regex.ts:151) is "Present|Current|Now|Ongoing", so with the (?:ly)? inflection the strip recognises six surface forms: Present, Presently, Current, Currently, Now, Ongoing.

Two consequences:

  1. Bare Present and bare Current are unpinned at the entry level. They are covered at the predicate level by the #952 describe, but the whole premise of #987 item 1 is that a predicate pin is not enough — the damage shows up one level higher, as a field on the next school. That argument applies to Present and Current exactly as it applies to Now and Ongoing.
  2. The list is a drifted copy waiting to happen. Adding a fifth word to OPEN_ENDED_ALT updates the production strip and silently leaves both the entry-level sweep and the #952 predicate sweep behind. This repo has already paid for that shape twice: #931 (a 19th hardcoded copy of the open-ended vocabulary in parseDateRange) and #952 (this very strip spelling present as a literal and omitting the rest of OPEN_ENDED_ALT).

Evidence it is a gap and not a deliberate exclusion

Extending the sweep to all six forms is green today — on gh-04-987-education-entry-pins, changing the list to

it.each(["Presently", "Currently", "Ongoing", "Now", "Present", "Current"])(

runs 136 passed (136) (was 134 passed (134)). So the two missing words are not omitted because they fail; they are omitted because the list was written out by hand.

The in-code comment above the sweep says Present, Presently and Current "came out clean" before #985, which is true and is a good reason not to claim them as regression pins. It is not a reason to leave them unpinned going forward — a future edit to the strip can break them, and nothing at the entry level would notice.

Where

  • src/lib/heuristics/extract/education.test.ts — the it.each([...]) entry-level sweep inside describe("isInlineDatedProgram: a date word must be a whole word (#925)") (no line number: #989 is unmerged and the squash will move it).
  • Same file — the #952 predicate describe hand-writes the vocabulary a second time, in its "Fall 2013 - Current" / "- Ongoing" / "- Now" rows.
  • src/lib/heuristics/regex.ts:151 — OPEN_ENDED_ALT, the constant both copies should derive from.

Proposed fix

Derive the sweep from the shared constant rather than restating it, e.g.

import { OPEN_ENDED_ALT } from "../regex.ts";

/** Every surface form the strip's `(?:${OPEN_ENDED_ALT})(?:ly)?` recognises.
 *  Derived, not restated, so a new open-ended word cannot ship unpinned. */
const OPEN_ENDED_FORMS = OPEN_ENDED_ALT.split("|").flatMap((w) =>
  w === "Present" || w === "Current" ? [w, `${w}ly`] : [w],
);

and iterate that. If the ly branch reads as too clever, an explicit six-element list plus a one-line assertion that OPEN_ENDED_ALT.split("|") has the expected members is enough to make drift fail loudly.

Update the adjacent comment at the same time — it currently explains a four-word choice.

Acceptance criteria

  • The extractEducation-level open-ended sweep covers every word in OPEN_ENDED_ALT, including the bare Present and Current forms
  • Adding a word to OPEN_ENDED_ALT without touching education.test.ts either extends the sweep automatically or fails a test — it does not silently pass
  • The #952 predicate sweep in the same file is covered by the same rule, or an explicit comment says why it stays literal
  • The comment above the sweep no longer describes a four-word list
  • npm run verify green

Provenance

Found while reviewing #989 (which closes #987). Not blocking there: #987's acceptance criterion names those exact four words, so #989 implements its spec correctly. This is the spec being narrower than the invariant.

Lingua principale
TypeScript
Stelle
11
Fork
4
Merge medio
18h 56m
PR unite (30g)
92

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di offlinecv/OfflineCV

Tutte le issue di offlinecv/OfflineCV

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.