Repository navigation
feat: tap-only questionnaire and rule-based matching - #30
Merged
Merged
Conversation
One module now defines every question, its options and whether an answer
may be shared with a match or OpenAI. The questionnaire seed reads it.
Question options become { value, label } pairs; the admin
create-questionnaire validator accepts the same shape.
Tap-question rules are generated from the definitions: enum per select, exactly three distinct values for top_values, integers 1-5 for agreement items. Identity, location, birth date and consent rules are unchanged.
Age reads the new age_gap / age_direction answers with the same rules as before. A faith deal breaker now only applies when the holder's own religion is a named one, and never matches 'other' or 'prefer not to say'. Also fixes the profile validator typing left over from the previous commit.
Pairs are now scored by comparing tap answers directly across five weighted dimensions (values, lifestyle, connection, personality, goals), times the age modifier. The scorer is synchronous and total: missing or unknown answers score a neutral 0.5. The engine calls it directly and applies the children and habits filters; the embedding prepare step, the shortlist and the LLM rerank are gone from the matching path, along with the rerank eval scripts.
…sholds Deletes the OpenAI embedding provider, the embedding and rerank services, their models, collections, indexes and tests, and the EMBEDDING_MODEL setting. Matches are stored with algorithm 'rules-v1'. Rule-based scores run lower than the old rerank scores, so the portal floor moves from 0.6 to 0.5 and the default per-applicant threshold from 0.8 to 0.6.
The partner profile on a match and the profile text sent to OpenAI are now built from an allow-list (questions marked shared) instead of a block-list, so attachment, personality, partner-preference and identity answers stay private by default. Applicants see only the values, lifestyle and goals score bars; connection and personality are computed from private answers and stay admin-only. The optional free-text note is added to the ice-breaker prompt only, which runs after the Instagram handle has been revealed.
Seeded applicants now get a complete v2 answer set generated from the question definitions, with a few answers weighted so the pool looks like a plausible community. Smoke-test payloads use the v2 format. Verified on the dev database: 100 applicants reseeded, the matching job saved 93 proposals with algorithm rules-v1 in 0.2s; 67 score at or above the 0.5 portal floor and 36 at or above the 0.6 default (median 0.57, max 0.83).
Choice cards were plain buttons: a screen reader was never told which one was selected, and selection was gold text on cream. The group is now a radiogroup (or a checkbox group with an optional maximum), with a roving tab stop, arrow-key navigation, a linked error message, 52px targets and a dark border plus check mark for the selected option.
The form now types only name, Instagram, city and birth date on its first screen. Every other answer is a tap, one question per screen, rendered from the questionnaire the API serves: single choices advance by themselves after 250 ms, the values question needs exactly three, and a final screen holds the optional note and consent. Focus moves to each question heading, progress is announced as 'Question n of N', and Back keeps every answer. The profile edit form in the portal uses the same question components, grouped by section. All question strings are translated in en, fr, de and ar; tests pin the locale files to the API's question definitions. The light-mode muted text colour is darkened to pass WCAG AA contrast.
Match cards show the partner's shared answers with translated labels and three score bars (values, lifestyle, goals); the rerank reasoning quote is gone. The portal threshold slider runs from 50% with a 60% default. The admin matching page runs the rule-based algorithm, and applicant detail shows answers with translated question and option labels. Strings for the old five-step wizard are removed from all four locales.
Rewrites the matching README for the filter → score pipeline (formulas, weights, thresholds and where the numbers come from), updates the root, API and frontend READMEs and CLAUDE.md, and removes the LLM rerank design writeup.
The accent button drew page-background text on gold, about 2:1 contrast. The application form's Submit now uses ink text on gold (above 7:1).
…ng a match early Review findings on the branch: - Ice-breakers are generated when contact is requested and shown to the initiator before the other person accepts, so the optional note must not be in that prompt. It is removed from every OpenAI prompt and is instead returned on the match view only once the match is mutual (dating), the same gate as the identity reveal. - The values and lifestyle bars shown to applicants included the partner's private preferences and could be worked backwards. The scorer now also stores values_shared and lifestyle_shared, computed from shared answers only, and applicants are shown those. - The scorer could return NaN, exceed 1 or throw for malformed stored values (duplicate or oversized top_values, option values that collide with Object.prototype keys). Lookups are own-property only and list answers are de-duplicated and capped.
…t after a new question - The partner's optional note appears on a match card only once the match is mutual; the form hint now says so in all four languages. - Taps are ignored for 350 ms after a new question appears, so a slow double-tap cannot answer a question the user has not read. - The portal threshold slider's low label showed 60% while the scale starts at 50%. Docs corrected: the note is never sent to OpenAI, and applicants see breakdown bars computed from shared answers only.
…scription On laptop-size screens the form column sat against the top edge of the viewport; it now has more room above it. The lifestyle bar shown to applicants no longer mentions habits, which it does not include.
Adds a Preview section with screenshots of the form on a phone and a laptop, the applicant portal, Arabic right-to-left and dark mode (seeded demo data). Also points the quick start at api/.env.dev, the file 'bun run dev' loads, and drops a stale test count.
hono 4.13.7 has twelve known CVEs (medium and low) fixed in 4.13.11 and 4.13.16. The Trivy job builds its SARIF report at every severity, so these fail the 'Dependency scan (Trivy)' check; main has failed the same scheduled scan since late October. 4.13.16 is the newest release older than the repo's 15-day dependency cooldown. Both the workspace lockfile and the API's standalone lockfile (used by the Docker build with --frozen) are updated.
There was a problem hiding this comment.
🟡 Changes recommended
Questionnaire sharing policies can be ignored when disclosing answers to partners and OpenAI, while partner notes remain hidden after contact acceptance until the page is reloaded.
2 open issues
What changed in this PR
This PR replaces Ons’s free-text onboarding and AI-based matching pipeline with a tap-based questionnaire and deterministic scoring. It also narrows answer sharing and updates the applicant portal and admin interface.
Changes:
- Introduces shared questionnaire definitions, generated validation, and reusable choice controls.
- Replaces embeddings and reranking with weighted rule scores and additional compatibility filters.
- Updates privacy projections, portal thresholds, tests, and documentation; removes obsolete matching infrastructure.
| File | Description |
|---|---|
tests/smoke/helpers.ts |
Updates smoke submissions to v2 answers. |
scripts/eval-rerank.ts |
Removes the rerank evaluation launcher. |
README.md |
Documents the new form and matching pipeline. |
package.json |
Removes the rerank evaluation command. |
frontend/src/types/form.ts |
Simplifies identity validation and submission types. |
frontend/src/steps/Step5Final.tsx |
Removes the old final wizard step. |
frontend/src/steps/Step4Preferences.tsx |
Removes the old preferences step. |
frontend/src/steps/Step3Vibe.tsx |
Removes the free-text vibe step. |
frontend/src/steps/Step2AboutYou.tsx |
Removes the old personal-details step. |
frontend/src/steps/Step1Identity.tsx |
Adds birth date to the identity screen. |
frontend/src/pages/profile/ProfileDashboard.tsx |
Lowers portal score thresholds. |
frontend/src/pages/profile/PartnerProfileView.tsx |
Displays translated shared questionnaire answers. |
frontend/src/pages/profile/MatchCard.tsx |
Replaces rerank reasoning with mutual-reveal notes. |
frontend/src/pages/profile/matchBreakdownLabels.ts |
Maps rule-based scoring dimensions. |
frontend/src/lib/questions.ts |
Adds questionnaire types and answer helpers. |
frontend/src/index.css |
Darkens muted text for contrast. |
frontend/src/data/religions.ts |
Removes free-text religion suggestions. |
frontend/src/data/occupations.ts |
Removes occupation suggestions. |
frontend/src/components/ui/WordCountHint.tsx |
Removes the unused word-count component. |
frontend/src/components/ui/Toggle.tsx |
Removes the old toggle component. |
frontend/src/components/ui/RadioCard.tsx |
Adds accessible single- and multiple-choice controls. |
frontend/src/components/ui/ProgressBar.tsx |
Adds announced labels and reduced-motion support. |
frontend/src/components/QuestionField.tsx |
Renders tap questions generically. |
frontend/src/api/profile.client.ts |
Updates match-view fields for privacy changes. |
frontend/src/api/client.ts |
Returns the full questionnaire structure. |
frontend/src/admin/pages/Matching.tsx |
Selects the rule-based algorithm. |
frontend/src/admin/pages/ApplicantDetail.tsx |
Translates stored questionnaire answers. |
frontend/src/admin/api/client.ts |
Defaults candidate requests to rules-v1. |
frontend/src/__tests__/unit/Step4Preferences.vitest.tsx |
Removes obsolete preferences-step tests. |
frontend/src/__tests__/unit/schemas/form.schema.test.ts |
Refocuses schema tests on identity fields. |
frontend/src/__tests__/unit/ProfileDashboard.vitest.tsx |
Tests the lower score thresholds. |
frontend/src/__tests__/unit/locales.vitest.ts |
Checks translation keys and placeholders. |
frontend/src/__tests__/unit/formatAnswer.vitest.ts |
Tests stored-answer formatting. |
frontend/src/__tests__/unit/components/RadioCard.vitest.tsx |
Tests choice semantics and keyboard behavior. |
frontend/src/__tests__/integration/Matching.vitest.tsx |
Updates admin matching tests to rules-v1. |
frontend/src/__tests__/integration/ApplicantDetail.vitest.tsx |
Tests translated answer display. |
frontend/README.md |
Documents the tap-based application flow. |
CLAUDE.md |
Updates architecture and contributor guidance. |
api/src/validators/profile.validator.ts |
Derives editable fields and updates thresholds. |
api/src/validators/form.validator.ts |
Generates tap-answer validation from definitions. |
api/src/validators/admin.validator.ts |
Updates algorithm and questionnaire schemas. |
api/src/services/profile.service.ts |
Updates note handling and removes embedding operations. |
api/src/services/profile-snippet.util.ts |
Restricts AI snippets to shared answers. |
api/src/services/match.service.ts |
Stops persisting rerank reasoning. |
api/src/services/match-state.service.ts |
Applies sharing gates and new thresholds. |
api/src/services/match-rerank.service.ts |
Removes the reranking service. |
api/src/services/icebreaker.service.ts |
Uses shared-answer snippets for prompts. |
api/src/services/form.service.ts |
Updates defaults and removes embedding generation. |
api/src/services/embedding.service.ts |
Removes embedding storage and generation. |
api/src/services/ai.service.ts |
Removes obsolete rerank references from comments. |
api/src/seeds/questionnaire.seed.ts |
Seeds questionnaire v2 from shared definitions. |
api/src/scripts/eval-rerank.ts |
Removes the rerank evaluation script. |
api/src/routes/matching.routes.ts |
Updates the route comment after embedding removal. |
api/src/models/questionnaire.model.ts |
Adds option labels and sharing metadata. |
api/src/models/match.model.ts |
Removes the rerank reasoning field. |
api/src/models/match-rerank.model.ts |
Removes the rerank cache model. |
api/src/models/embedding.model.ts |
Removes the embedding model. |
api/src/models/applicant.model.ts |
Updates threshold documentation. |
api/src/matching/scoring/weights.ts |
Defines five rule-scoring weights. |
api/src/matching/scorers/numeric.scorer.ts |
Removes legacy numeric-vector scoring helpers. |
api/src/matching/proposals.ts |
Removes rerank reasoning from proposals. |
api/src/matching/filters/religion.filter.ts |
Uses v2 religion preferences. |
api/src/matching/filters/habits.filter.ts |
Adds smoking and alcohol deal-breakers. |
api/src/matching/filters/children.filter.ts |
Filters incompatible preferences about children. |
api/src/matching/filters/age.filter.ts |
Reads v2 age-gap and direction answers. |
api/src/matching/embeddings/provider.ts |
Removes the embedding API provider. |
api/src/jobs/matching.job.ts |
Persists scheduled runs as rules-v1. |
api/src/db/collections.ts |
Removes embedding and rerank collections/indexes. |
api/src/controllers/matching.controller.ts |
Identifies matching results as rules-v1. |
api/src/config/env.ts |
Removes embedding-model configuration. |
api/src/__tests__/unit/validators/form.validator.test.ts |
Tests v2 submissions and editable-answer validation. |
api/src/__tests__/unit/services/profile-snippet.util.test.ts |
Tests shared-only AI snippets. |
api/src/__tests__/unit/services/match-state.service.test.ts |
Tests disclosure gates, breakdowns, and thresholds. |
api/src/__tests__/unit/services/icebreaker.service.test.ts |
Tests prompt privacy boundaries. |
api/src/__tests__/unit/services/embedding.service.test.ts |
Removes embedding-service tests. |
api/src/__tests__/unit/services/ai.service.test.ts |
Removes obsolete rerank references from comments. |
api/src/__tests__/unit/questionnaire/questions.test.ts |
Tests questionnaire structure and sharing rules. |
api/src/__tests__/unit/questionnaire/locales.test.ts |
Checks translations against question definitions. |
api/src/__tests__/unit/matching/religion.filter.test.ts |
Tests v2 religion compatibility rules. |
api/src/__tests__/unit/matching/provider.test.ts |
Removes embedding-provider tests. |
api/src/__tests__/unit/matching/proposals.test.ts |
Updates candidate fixtures. |
api/src/__tests__/unit/matching/numeric.scorer.test.ts |
Removes legacy numeric-scoring tests. |
api/src/__tests__/unit/matching/habits.filter.test.ts |
Tests bidirectional habit deal-breakers. |
api/src/__tests__/unit/matching/children.filter.test.ts |
Tests preferences about children. |
api/src/__tests__/unit/matching/_fixtures.ts |
Adds complete v2 and legacy answer fixtures. |
api/src/__tests__/setup.ts |
Removes embedding-model test configuration. |
api/src/__tests__/routes/profile.routes.test.ts |
Updates answer and threshold route tests. |
api/src/__tests__/routes/matching.routes.test.ts |
Tests rules-v1 and retired-algorithm rejection. |
api/src/__tests__/routes/form.routes.test.ts |
Updates submission fixtures and validation cases. |
api/README.md |
Documents rule-based matching and remaining AI use. |
api/.env.example |
Removes embedding settings and clarifies sharing. |
Review effort: Balanced
…t everywhere On a phone, a long applicant name wrapped onto several lines and spilled out of the 56px portal header. The name and codename now keep to one truncated line each (full text in a tooltip), the status sits beside the codename as a translated label instead of the raw stored value, and the language button drops its globe icon below the sm breakpoint. Match card headers let the alias side shrink and the score bar narrow on phones; they overflowed a 320px screen by 10px. Fifteen physical-direction classes (ml, text-left, right-4, border-l, ...) in the admin panel, toast, auth shell, settings drawer and success page are now logical, so they flip correctly in Arabic. Checked in a browser: 7 pages at 320px and 390px in en, fr, de and ar (56 views) with no horizontal overflow or untranslated keys; the header holds 56px with a 50-character name at 320 to 1440px in all four languages.
Adds the landing page in French and the applicant portal in German on a laptop, and the form on a phone in both languages. The English portal and dark-mode previews are retaken with the fixed header.
…reveals on accept Review feedback on #30: - An admin-created questionnaire could set 'shared' differently from the code definitions, but disclosure (toMatchView, buildProfileSnippet) always uses the code. Such a questionnaire is now rejected with a message naming the question, so an admin can never believe an answer is private while it is shown to matches. The admin schema also gains the 'date' question type; without it the built-in questionnaire itself was rejected. - After a target accepted a contact request, the card kept showing the old state until a reload: the partner's note, and in fact their Instagram handle and name, were missing. The accept response now carries the reveal-gated note, and the card merges what was revealed straight away.
This was referenced Nov 19, 2026
This was referenced Nov 19, 2026
4 tasks done
Brings in #42 (hono 4.13.16), #43 (15-day minimum release age), #41 (issue and PR templates), #29 (Bun 1.4.4 everywhere), #27 (GitHub Actions updates) and #26 (Vitest 5.1.0). No conflicts; lockfiles install frozen, typecheck, 730 API and 316 frontend tests, the build and both Docker images pass, and a Trivy scan finds nothing.
- The OpenAPI spec served at /api/v1/docs still described the v1 form and the embedding + rerank pipeline. FormAnswers is now generated from the question definitions; the breakdown, run request, filters, thresholds, partner view and accept response match the code. - docker-compose.yml and the root .env.example no longer pass or document EMBEDDING_MODEL / EMBEDDING_PROVIDER. - Unused v1 test fixtures, an unused import and stale comments are gone; test data uses rules-v1 breakdown keys.
- Matching: the single-option algorithm picker is replaced by what the run actually does — the six hard filters and the five weighted dimensions. - Matches: the always-'rules-v1' algorithm column becomes a compact per-dimension breakdown; Details shows the full breakdown (including connection and personality, which applicants never see) next to notes. - Applicant detail: answers are grouped by questionnaire section and marked shared or private, and a live 'top candidates' card shows who this applicant would be matched with now and why. - 23 translation keys that nothing referenced are removed from all four locales; obsolete v1 robustness tests are replaced with v2 ones.
The smoke suites still posted algorithm 'baseline' (now 422), reported outcomes on matches that had been dating for zero days (403 since outcome reporting became time-gated), and test:smoke:all matched no files. All 100 smoke tests pass against a live API. CLAUDE.md now says where the smoke credentials live and that the API under test needs TRUST_PROXY=true.
…reens The Matches actions cell scrolled its buttons out of view at laptop width, hiding the Details toggle; let them wrap instead. The applicant's match history repeated the applicant's own alias on every row, truncating the partner's; show only the partner.
On phones the sidebar was a permanent icon rail that, with 32px page padding, left about 270px for content. It is now a drawer over the page that closes on navigation, Escape or a tap outside; from md up it stays a rail, pinned under a sticky header. Page padding scales with the screen. Match Details: breakdown and notes get matching headings and are top-aligned; the notes textarea has a real label and a compact Save (new Button size="sm").
The score slider printed its range twice (end labels and tick buttons); end labels are now opt-in. Breakdown rows put the label and percentage on one line over a full-width bar so every dimension lines up. Short answers no longer wrap while the question takes the space, and the locked birth date shows the full age instead of truncating it. The slider thumb border uses the surface token instead of white.
New admin-mobile and portal-mobile previews show the phone layouts. The dark-mode portal frame in mobile-arabic-and-dark is re-shot: it still showed the slider's duplicated range.
The age modifier is cos(π/2) at 2× age_gap, so pairs on that boundary passed the filter and were saved as proposals scored 0. The outer limit is now exclusive, and a test checks every accepted pair scores above 0. Fixes #39
…the page At 768px the sidebar is already open, leaving about 500px for a five-column table that needs up to 710px (German), so the whole page scrolled sideways. The table now starts at lg (1024px). Found in the admin QA pass for #34.
Its aria-label and tooltip were hardcoded in English in every language. Found in the admin QA pass for #34.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Closes #40
Closes #36
Closes #34
Closes #39
What changed
A tap-only questionnaire. The application form used to ask for seven typed free-text answers. It now types only name, Instagram, city and birth date on the first screen; the other 32 questions are answered by tapping, one per screen. Single choices advance by themselves, Back keeps every answer.
Rule-based matching. 78% of the old score came from OpenAI embeddings of that free text, and an LLM rerank produced the final number. With fixed-choice answers both are unnecessary: pairs are now compared directly across five weighted dimensions (values, lifestyle, connection, personality, goals), times the existing age modifier. Scoring is deterministic, free and makes no network calls. Children, smoking and alcohol join the four existing hard filters.
One source of truth.
api/src/questionnaire/questions.tsdefines every question, its ordered options and whether an answer may be shared. The seed, the Zod validator, the scorer and the OpenAI prompt snippet all read it. The frontend renders whateverGET /form/questionnairereturns and only owns the translations.Why
Faster onboarding on a phone, and cleaner input for matching. The questions are modelled on established constructs (attachment anxiety/avoidance after ECR-S, Big Five after BFI-10, Schwartz values) but written for Ons — they are not those validated scales. The research is also clear that a questionnaire cannot predict attraction between two specific people; what it can do is rule out real incompatibilities and rank the rest. The docs say so.
Privacy
sharedreach a match (toMatchView) or OpenAI (buildProfileSnippet). Attachment, personality, partner-preference, gender, orientation and birth-date answers are never shared.values_shared,lifestyle_shared,goals), so a partner's private preferences cannot be worked back from a bar.connectionandpersonalityare admin-only.dating), the same gate as the identity reveal.Accessibility
Choice cards are real radio / checkbox groups with a roving tab stop and arrow keys, 52px targets, a check mark and dark border for the selected state, visible focus, focus moved to each question heading, and progress announced as "Question n of N". Works right-to-left in Arabic. The light-mode muted text token is darkened to pass AA contrast (this affects admin and portal too).
Removed
The embedding provider, embedding and rerank services, their models, collections, indexes, tests, the
EMBEDDING_MODELsetting, the rerank eval scripts and design doc, and the old five-step wizard components. Net: about 4,500 lines added, 5,800 removed.Reviewer notes
Testing
main(Bun 1.4.4, Vitest 5.1.0, hono 4.13.16, 15-day minimum release age).Known gaps, not addressed here
locationis free text and shown to a match before the reveal (pre-existing) — City is free text and shown to matches before the mutual reveal #33.🤖 Generated with Claude Code