Skip to content

Category overview v2: pure recognition, profile transitions and flat answers #137

Closed

Description

@Atrium0804

Goal

Build the pure lookup module for the independent second implementation of Combineer categorie, verzet en licentie in bypass met geslachtsspecifieke verzetdata: recognition, profile transitions, calculation and flat answers. Do not wire conversation storage or background jobs in this slice.

Authoritative requirements

Follow the complete feature specification, its flat-output amendment, and the confirmed recognition/state-model resolution, including its concrete follow-up and paired-category examples. Those sources hold the behavioral decisions; this ticket does not replace them.

Shared typed interface

In the existing lookup module, expose these three operations (normal implementation naming refinements are allowed if all callers/docs stay consistent):

  • recognize_turn(message, previous_state, today, rules) -> LookupDecision: pure Python recognition, positive eligibility, normalization, follow-up transition, validation and calculation. Return a tagged union of Ready, NeedsInformation, NotEligible, with the proposed next lookup state. A ready result carries validated answer data and selector identity; it is not arbitrary text to parse again.
  • complete_with_intake(needs_information, intake_result, today, rules) -> LookupDecision: accept only NeedsInformation, not Ready/NotEligible. Merge only grounded missing facts, never inferred birth years from ages, invented facts or replacement of explicit input; rerun the same validation/calculation. Preserve the request/explicit-input evidence needed for these checks.
  • render_answer(ready, language_level) -> str: render structured ready data without rerunning recognition or depending on the original raw text.

Use small dataclasses/tagged unions and literal types where helpful, not Any, dictionary-shaped success fallbacks or class hierarchies. Keep the existing rules-dictionary convention unless a narrowly necessary change proves otherwise. Internal helpers can be separate when this improves locality; do not create extra public interfaces or general frameworks. Source access remains in knwu_categories; date and rules are injected.

Required behavior

  • Preserve primary selector identity: birth year, single new category, paired category, or old-category mapping, with any additional explicit constraints. Do not flatten category/gender pairs or lose the distinction between changing a single prefix's gender and selecting a member of a combined category.
  • Profile states are none, pending incomplete, completed validated. Store validated input, not calculated seasons/answers. A new complete question inherits nothing; supported fragments replace primary constraints or change filters exactly as the state-model resolution specifies. Rejected/unrelated/substantive turns clear reuse, except a recognized pending incomplete lookup.
  • Implement the two candidate-season table, per-season age filtering 5-16, category-derived cohorts, calendar-year licence splits, old category 1, all-input consistency, U16/U17 normalization and safe standalone fallback from the feature specification. Use known rules with a future-season caveat, not a validity engine.
  • Distinguish a missing primary input from an optional gender/discipline: absent optional filters mean both. Welk verzet? then 2012 produces the full overview without waiting for a discipline. Empty matches from contradictory input do not fall through to a partial standalone answer.
  • Render the latest flat format: input heading, chronological season/gender blocks (boys before girls, then ascending birth year), flat category/gearing/licence facts, licence switches on one line, caveats/disclaimer before the single final Bron: line. B1 and B2 source/version rules apply; include B2 articles, distinguish the club mapping source, and invent no dates. Do not modify the chat renderer or add DOM behavior.
  • Keep valid existing standalone lookups reachable. Any transitional adapter for old callers must be small, explicit and removed when chat/eval migrate in the next slice; do not duplicate recognition rules.

Validation and completion

Test first through the three operations, using a few focused parametrized cases for behavior groups, not tests of trivial types/constants. Cover season boundaries, year/licence changes, gender-dependent values, source correction, age limits, supplied filters, unsupported/conflicting input, original translation synonyms, and the agreed follow-up transitions. Preserve the existing flat-format check and add combined-overview inputs to it. Run affected lookup/data tests and pyright. Actual POST /chat route-contract migration belongs to the integration slice; do not claim a pure-module pass proves chat behavior.

Work in an isolated branch/worktree from feature/102-category-overview-v2 after the source-data slice is merged there. PR back to that integration branch, never change the preserved implementation, and record tests/review/commit. This is not yet a complete runnable comparison build.

Prerequisite: Category overview v2: gender-specific source data and drift checks.

Activity

  1. added
    ready-for-agent
    on Nov 16, 2026
  2. Atrium0804 commented on Nov 17, 2026

    @Atrium0804
    OwnerAuthor

    Implemented in #139 (squash-merged into feature/102-category-overview-v2 as c227204); integrated into chat/intake/eval by #140.

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

    ready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions