Include LeetCode problem numbers in metadata
SE
3h ago+911+911+012345678901234567890123456789-357-357-012345678901234567890123456789
Candidates benefit from seeing standard LeetCode problem numbers alongside titles to cross-reference practice material.
Update problem ingestion, schema validation, and metadata generation to capture questionFrontendId from LeetCode, enforce strict type constraints, and propagate the formatted source ("<number>. <title>") across Rust runtime structures, per-page bundles, and frontend tests.
Key Changes
-
Ingestion & Validation:
scripts/problem_bank/fetch.py: CapturequestionFrontendIdas an integernumberduring problem scaffolding.scripts/problem_bank/bank.py: Enforce strict positive integer validation fornumber(type(num) is int and num > 0), properly rejecting booleans, non-positive numbers, and string values.problem-bank/problems.json: Add LeetCode question numbers to imported exercises while preserving original JSON formatting and multi-line array layout.
-
Metadata Generation & Rust Runtime:
scripts/problem_bank/emit.py: Prepend problem number tosource(f"{number}. {title}") for imported exercises, and emitsource: Option<&'static str>in generated Rust definitions.src/agent.rs: Keepsource_title()returning the bare published title for report leakage checks. Addsource_label()to return the number-prefixed source label, and use it when comparing generated public metadata.src/agent/problem_rubrics.rs: Regenerate rubric tables with static source string references.web/problems/*.json&web/problem-pages.json: Regenerate 150 per-page scenario files and the client mapping table.
-
Frontend & Documentation:
web/app.js&web/render.js: Update internal documentation regarding map-loaded names and numbers, keeping initial lobby HTML free of published problem identifiers until candidate opt-in.
-
Test Coverage:
tests/test_gen_problems.py: Addtest_rejects_invalid_numberscovering-1,0,True, and"20"; update projection assertions for numbered sources.tests/browser/leetcode-import.test.js: Update expectations to assert${source.number}. ${source.title}.
Fixes #507
Screenshots
Before
After