Skip to content

Category overview v2: final validation, docs and review fixes (#135) - #141

Merged
Atrium0804 merged 4 commits into
feature/102-category-overview-v2from
issue-135-final-validation-v2
Nov 17, 2026
Merged

Atrium0804 merged 4 commits into
feature/102-category-overview-v2from
issue-135-final-validation-v2

Conversation

@Atrium0804

Copy link
Copy Markdown
Owner

Closes #135. Final slice of the second build of #102. This PR targets feature/102-category-overview-v2.

Summary

The review against #102/#125 led to two changes in the bypass answer and one new input form. The rest of the PR is documentation.

 recognize_turn(message, state)
   _turn_shape
+    data_only: message has only lookup data + at least one primary input
+      ("jongen uit 2015, U12, weg", "2015, meisjes")
+      -> complete question (first message) and fragment (reply inherits filters)
 render_answer
   … rows …
-  "Stel je een vervolgvraag, dan fiets ik met je door de KNWU-informatie"
+  "Moet ik de KNWU-documenten doorzoeken voor een gedetailleerder antwoord?"
-  Bron: ALGEMENE BEPALINGEN; Hoofdstuk 1; ALGEMENE BEPALINGEN; WebsiteWTCjeugd…
+  Bron: ALGEMENE BEPALINGEN; Hoofdstuk 1; WebsiteWTCjeugd… (clubbron, oude indeling)

The human decided these during the session:

  • Every deterministische bypass answer has a Bron: line at Taalniveau B1, including the standalone 17+ answer. This is recorded as an ADR-0009 amendment.
  • The source line names each document once, and B2 merges their articles.
  • Data-only messages are recognized, both as a first message and as a reply.
  • The closing line is the question above.

Documentation:

docs/reference/categorieoverzicht.md      new: input, decisions, seasons, lookup-toestand, data, answer form
docs/explanation/vraag-routing.md         link, source rule, closing question limitation
docs/adr/0009-…                           amendment 2026-11-17: B1 source line on every bypass answer
docs/how-to/bekijk-lokale-routing-traces  lookup_state / stale_revision event
GLOSSARY.md                               new term: Peiljaar
.agents/skills/knwu-documentwissel        approved source correction: drift check fails on purpose

The ADR-0009 amendment records the exception. The source decisions stay in #102 and #125. I did not change the agent prompts: their B1 rule covers agent answers and stays correct, and a prompt change needs an agent publication, which this ticket does not authorize.

Evidence

  • Before: recognize_turn("jongen uit 2015, U12, weg") gives not_eligible. As a reply to "Welk verzet op de weg?" it gives not_eligible and clears the open question.
    After: ready with a single row: weg, jongens, U12, 2015 (on 2026-06-01). As a reply it gives ready and keeps the weg filter. The routecontract rows alleen-gegevens-* and gegevens-met-andere-woorden pass through POST /chat.
  • Before: the B1 source line names ALGEMENE BEPALINGEN twice.
    After: test_source_line_names_each_document_once_and_labels_the_club_source[B1|B2] passes.
  • Full suite .\.venv\Scripts\python.exe -m pytest app\tests tests: 562 passed, 7 skipped, 52 subtests. The 7 skips are the real-PDF tests, because the PDFs are not in git. With the local PDFs copied in temporarily, -m pdf gives 7 passed.
  • pyright: 0 errors. Node app/tests/test_*.cjs: 47/47 pass. The docs link/naming test is in the full suite and passes. git diff --check is clean.
  • The eval bypass entries replay offline at the fixed peildatum 2026-11-09 (BypassTemplateEvalsetTests). I did not run a live or paid eval, and eval/last_run.json is unchanged.

Known gap (accepted)

The spec review found three questions that still get the bypass, although #102 excludes them:

  • licence package: "Welke licentie en welk licentiepakket … geboren in 2016?" This is eval case knwu-licentie-u13-geen-pakketten, and a live run will fail it.
  • cost: "Wat kost de licentie …"
  • two riders: "mijn zoon en mijn dochter"

The cause is gaps in MEER_DAN_FEIT and MULTIPLE_RIDERS, and main has the same gaps. The human chose the closing question instead of widening the patterns. Note: a reply such as "ja" reaches the agent without the earlier question, because a bypass starts no agent conversation.

Merge Danger

Door: two-way. The changes are code and docs only, with no data migration.

Blast Radius: bypass. Answer text changes for every bypass answer: the closing line and the source line. Data-only messages now get the bypass instead of the inhoudelijke route.

Ivo Stieltjes and others added 4 commits November 17, 2026 12:23
The bypass source line listed ALGEMENE BEPALINGEN twice (age categories and licences). Each document now appears once; at B2 its articles are merged. The old-category mapping source is labelled as club source.

Co-authored-by: Copilot <[email protected]>
…tes (#135)

Add docs/reference/categorieoverzicht.md, link it from the routing explanation, record the B1 source exception for every bypass answer as an ADR-0009 amendment, add Peiljaar to the glossary, document the stale_revision trace event and the approved-correction rule for document changes.

Co-authored-by: Copilot <[email protected]>
Recognize messages that contain only lookup data, e.g. 'jongen uit 2015, U12, weg' (the #102/#125 example), as a first message and as a reply to a pending lookup; a bare year in such a message is a birth year. Routecontract rows added. Bypass answers now end with 'Moet ik de KNWU-documenten doorzoeken voor een gedetailleerder antwoord?'. Error messages in max_gear, complete_with_intake, render_answer and decide_route now state an action (CODING_PRINCIPLES).

Co-authored-by: Copilot <[email protected]>
@Atrium0804
Atrium0804 merged commit b154e21 into feature/102-category-overview-v2 Nov 17, 2026
10 checks passed
@Atrium0804
Atrium0804 deleted the issue-135-final-validation-v2 branch November 17, 2026 13:41
Atrium0804 added a commit that referenced this pull request Nov 18, 2026
) (#142)

* feat(categories): add gender-specific gearing data (#134)

Co-authored-by: Copilot <[email protected]>

* test(categories): reject unknown source gear values (#134)

Co-authored-by: Copilot <[email protected]>

* feat(lookups): typed category overview module (#137) (#139)

* feat(lookups): add typed category overview module (#137)

Co-authored-by: Copilot <[email protected]>

* fix(lookups): tighten category recognition and intake (#137)

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Ivo Stieltjes <[email protected]>
Co-authored-by: Copilot <[email protected]>

* feat(chat): integrate category overview lookups with safe state ordering (#136) (#140)

* feat(chat): integrate category overview lookups with safe state ordering (#136)

Chat, intake and eval now share recognize_turn, complete_with_intake and
render_answer. Each conversation keeps a revisioned lookup state, separate
from feedback history; a background intake job only publishes its state if
its revision is still current. Intake can complete only NeedsInformation,
never rescue rejected input. The legacy match_lookup/resolve_lookup_message
adapters are removed.

Co-authored-by: Copilot <[email protected]>

* refactor(chat): address review of lookup integration (#136)

Route becomes a tagged union with one shared route_reason for app and
eval; the accepted turn travels to the job as one LookupTurn. The eval
replay now completes an earlier incomplete beurt with the intake, like the
app. GLOSSARY no longer says the intake fills in discipline or works with
the regex lookup.

Co-authored-by: Copilot <[email protected]>

* test(chat): give every chat-test client one long-lived event loop (#136)

A bare TestClient runs each request in its own event loop, so a background
chat job could be stranded and time out (seen in CI on
test_chat_sends_language_level_context).

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Ivo Stieltjes <[email protected]>
Co-authored-by: Copilot <[email protected]>

* Category overview v2: final validation, docs and review fixes (#135) (#141)

* feat(lookups): name each source once and label the club source (#135)

The bypass source line listed ALGEMENE BEPALINGEN twice (age categories and licences). Each document now appears once; at B2 its articles are merged. The old-category mapping source is labelled as club source.

Co-authored-by: Copilot <[email protected]>

* docs(categories): reference, routing, ADR-0009 amendment and drift notes (#135)

Add docs/reference/categorieoverzicht.md, link it from the routing explanation, record the B1 source exception for every bypass answer as an ADR-0009 amendment, add Peiljaar to the glossary, document the stale_revision trace event and the approved-correction rule for document changes.

Co-authored-by: Copilot <[email protected]>

* feat(lookups): data-only lookup messages and closing question (#135)

Recognize messages that contain only lookup data, e.g. 'jongen uit 2015, U12, weg' (the #102/#125 example), as a first message and as a reply to a pending lookup; a bare year in such a message is a birth year. Routecontract rows added. Bypass answers now end with 'Moet ik de KNWU-documenten doorzoeken voor een gedetailleerder antwoord?'. Error messages in max_gear, complete_with_intake, render_answer and decide_route now state an action (CODING_PRINCIPLES).

Co-authored-by: Copilot <[email protected]>

* docs(categories): data-only input and closing question (#135)

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Ivo Stieltjes <[email protected]>
Co-authored-by: Copilot <[email protected]>

* fix((bypass): niet verwijzen naar clubsite
fix(bypass): geen bronregel in taalniveau B1

* fix(UI): liggende achtergrond t.b.v. bredere schermformaten

* chore(contributing): geen worktree aanmaken, werk altijd op een featurebranch

* chore: code-review lookups.py

* refactor(routing): beschrijvende namen voor de bypassbeslissing (#143)

Ready -> ReadyForBypass, NeedsInformation -> NeedsInputForBypass, NotEligible -> NotEligibleForBypass, LookupDecision -> BypassDecision, eligible -> eligible_for_bypass, revision -> accepted_turn_count. Trace-redenen en route_reden blijven ongewijzigd.

Co-authored-by: Copilot <[email protected]>

* test(routecontract): los gegeven na een inhoudelijke beurt (#143)

Tien regels falen bewust: een kaal jaartal, alleen gegevens of een fragment na een inhoudelijke beurt gaat nu naar de bypass in plaats van naar de agent. Twee regels bewaken bestaand gedrag (#102: los jaartal als eerste beurt; #91: zelfstandige lookupvraag midden in een gesprek).

Co-authored-by: Copilot <[email protected]>

* fix(routing): los gegeven is alleen in de eerste beurt een eigen lookup (#143)

Een kaal jaartal, alleen gegevens ("2014, meisje") of een losse oude categorie zonder open of voltooide lookup is een vervolgbericht op de vorige beurt. recognize_turn krijgt daarvoor is_first_turn, afgeleid van accepted_turn_count. Na een inhoudelijke beurt gaat zo'n bericht naar de agent; als eerste beurt en als vervolg op een lookup blijft de bypass (#102, #91/#136).

Glossary: Gesprek, Beurt, Agentgesprek en Vervolgbericht.

Co-authored-by: Copilot <[email protected]>

* test: verouderde verwachtingen na slotvraag en liggende achtergrond

B1-bypass eindigt op de slotvraag zonder Bron-regel (4cd5190); de achtergrond is sinds 2ad94d8 liggend.

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Ivo Stieltjes <[email protected]>
Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant