Skip to content

spec 1.7: question manifests say where a question appeared (provenance) - #48

Merged
sawradip merged 2 commits into
mainfrom
feat/question-provenance
Nov 1, 2026
Merged

sawradip merged 2 commits into
mainfrom
feat/question-provenance

Conversation

@sawradip

@sawradip sawradip commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Adds an optional provenance field to question manifests (spec 1.7 §2.1): the exam papers a question appeared in, for readers to show as short tags with the full name on hover.

"provenance": [
  { "kind": "board_exam", "code": "DHA", "name": "ঢাকা বোর্ড", "year": 2023 },
  { "kind": "institution_exam", "code": "VNSC", "name": "ভিকারুননিসা নূন স্কুল এন্ড কলেজ, ঢাকা", "year": null }
]
  • kind: board_exam | institution_exam; open (lower-case, _), so later kinds are not a new version. Readers must not reject an unknown kind.
  • code: 2 to 8 of A-Z0-9.
  • name: a string, or one per language, like other texts.
  • year: an integer, or null (or absent) when not known.
  • One entry per paper; writers SHOULD list the newest year first. checkQuestion reports the same paper twice.
  • source is now documented as something a publisher may leave out (chalkbook will stop publishing the guide a question was copied from).

Additive only: manifests without provenance are unchanged, and manifestVersion stays 1. The PathshalaX reader is being built against exactly this shape.

Changes: packages/model/src/question-manifest.ts (questionProvenanceSchema, PROVENANCE_KINDS), the regenerated schema/question-manifest.schema.json, tests, the creative-question example now carries provenance, and spec text.

Checks: pnpm typecheck and pnpm test pass. Lint has 0 errors (the 4 warnings were there before). Two tests, reader gather.test.ts and library-server adopt.test.ts, failed once under the full parallel run. Both pass alone and on a re-run, and this change doesn't touch them.

🤖 Generated with Claude Code

…on was set in (spec 1.7 §2.1)

An optional array of {kind, code, name, year}: kind board_exam | institution_exam (open), code 2-8 of A-Z0-9, name a string
or one per language, year an integer or null. checkQuestion reports the same paper listed twice. The spec says source may be
left out by a publisher that must not name the book it took a question from.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sawradip

sawradip commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Codex review — round 1 (Codex CLI output, relayed by Claude Code under this account)

STATUS: CHANGES_NEEDED

  • [severity: medium] packages/model/src/question-manifest.ts:67 — The regex requires a leading letter and limits kinds to 40 characters, restrictions absent from §2.1, so both validators reject otherwise permitted unknown kinds such as 2026_exam.
  • [severity: medium] packages/model/src/question-manifest.ts:73 — The 1900–2200 year restriction, also emitted in the JSON schema, rejects integer years such as 1899 that §2.1 permits.
  • [severity: medium] packages/model/src/question-manifest.ts:100 — The undocumented 100-entry limit, also emitted as maxItems in the JSON schema, rejects a spec-valid manifest containing 101 distinct papers.

…n, year range, at most 100 entries

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sawradip

sawradip commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Fixes after Codex round 1 (commit e2c13ed)

All three were the same mismatch: the schema checked limits the spec text didn't state. The limits are deliberate (a kind that is an identifier, a plausible year, a bounded list), so the spec now states them rather than the schema dropping them:

  • kind: a lower-case letter, then up to 39 lower-case letters, digits and _.
  • year: an integer from 1900 to 2200, or null or absent.
  • at most 100 entries.

No change to the model or schema. Conformance tests pass (54).

@sawradip

sawradip commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Codex review — round 2 (Codex CLI output, relayed by Claude Code under this account)

STATUS: LGTM
FINDINGS: (none)

@sawradip
sawradip merged commit f11f642 into main Nov 1, 2026
1 check passed
This was referenced Nov 2, 2026
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