Repository navigation
docs(architecture): correct the ops method, the transaction types and the API list scope - #203
Merged
Merged
Conversation
… the API list scope The "current state" section of docs/architecture.md had drifted from the code in four places, all found by diffing the doc against the routes actually registered in src/routes/mod.rs::router(): - §6 stated `GET /api/ops/runtime` / `credits` / `users`, but /api/ops/credits is registered as POST (src/routes/mod.rs:569), so following the doc yields 405. - §6 omitted two whole API surfaces that §5 already documents tables for: the departments API and the raise-requests API. - §5's `transactions` row enumerated the type values as consume/earn/topup/gift, omitting `expire` (which really is written, src/gift.rs:49) and `withdraw`. - §5's table list omitted `email_verifications` and `schema_version`. Rather than re-typing rosters that rot on the next change, the doc now names the authority: the type values defer to `TX_FILTER_TYPES` (src/routes/wallet.rs), the table list gained the two missing tables with a pointer to `SCHEMA_VERSION`, and §6 is explicitly marked as an overview pointing at `router()`. README.md:58 likewise stops claiming the doc is a 「全清单」 and points at `router()`. Docs only: no production code, no i18n key, no schema change — `cargo test` stays at 190 passed.
9 of 10 tasks
argszero
added a commit
that referenced
this pull request
Sep 27, 2026
…#318) `cabe4c6` (#203) changed only the Chinese half of the sentence that says where the API list lives: `README.md` now reads "API 一览见 docs/architecture.md, 权威清单以 `src/routes/mod.rs` 的 `router()` 为准", while `README.en.md` kept its pre-#203 wording ("Full API reference: docs/architecture.md."). That sends the English reader to a document #203 was downgrading to an overview, and the Chinese reader to the code — two answers to one question, from one document whose two halves declare each other as translations on line 3. Fix the value and give the pair an enforcer: - `README.en.md`: say the same thing as the Chinese half — an overview link plus the authoritative source in code (`router()` in `src/routes/mod.rs`). - `src/readme_gate.rs` (test-only, `#[cfg(test)] mod readme_gate`): assert the two carriers hold the same facts. The compared positions are the language-independent ones only — inline code spans, markdown link targets, bare URLs, numeric literals — compared as sets, with the expected value derived from the files on both sides (no snapshot). Prose, headings, table headers, emphasis, line order and line count are deliberately not compared. Positive control: every family must be non-empty on both sides and the four together must yield enough items, so an extractor that returns empty sets cannot pass vacuously. Teeth: a fact dropped on one side is reported for each of the four families. Scope, stated where the gate is: it is lexical — it proves the two sides carry the same structural positions, not that the translation is faithful, and a "delete the Chinese sentence instead" fix would pass it. `cargo test`: 417 passed / 0 failed (baseline 413; +4 new).
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.
Summary
docs/architecture.mddescribes itself as documenting the current state, but its §5/§6 enumerations had drifted from the code in four places. This PR re-aligns the doc with whatsrc/routes/mod.rs::router()and the schema actually contain, and — following the project's preference for pointing at an authority rather than re-typing a roster that will rot on the next change — names the arbiters instead of writing new snapshots.Found by diffing the registered routes against the doc (a "reverse route matrix"), each item then confirmed against the code:
`GET /api/ops/runtime` / `credits` / `users`/api/ops/creditsis POST (src/routes/mod.rs:569) — following the doc gives 405transactionstype: consume|earn|topup|giftTX_FILTER_TYPES(6 values) —expireis written (src/gift.rs:49),withdrawis accepted by the filteremail_verifications(src/db.rs:220) andschema_versionItem 3 is the one with a copy-paste consequence: a reader implementing against the 4-value list silently drops expired-gift rows — the same bug class fixed earlier in
ops.rs.Related Issue
None — the repository carries no open issues; this is maintenance of the documented current state.
Changes
docs/architecture.mdtransactionsrow: the type values now defer tosrc/routes/wallet.rs的TX_FILTER_TYPESinstead of enumerating a stale subset.email_verifications(withusers.verified) andschema_version(pointing atSCHEMA_VERSION).GET/POST /api/admin/departments+PATCH/DELETE /api/admin/departments/:id,POST/GET /api/raise-requests+POST /api/admin/raise-requests/:id/{approve,reject}.GET /api/ops/runtime/users,POST /api/ops/credits.router()is the authority.README.md:58: 「API 全清单见 docs/architecture.md」 → 「API 一览见 …,权威清单以src/routes/mod.rs的router()为准」 (the doc is an overview, so the completeness claim was the thing making the omissions matter).Tests
cargo test全部通过 — 190 passed / 0 failed, i.e. unchanged frommain; the count staying put is itself the evidence that no behaviour moved.cargo fmt --check通过cargo clippy --all-targets -- -D warnings通过Independent verification (not just "the prose reads correctly")
A checker derives the §6 method+path claims (including its shorthand chains such as
runtime/credits/users) and compares them with the routes actually registered inrouter(), and asserts the §5 transaction-type cell againstTX_FILTER_TYPES:main(pre-change)GET /api/ops/credits(registered methods:['post']), the stale 4-value type list, both missing surfaces, and §6 not marked as an overview.route()parser only matched multi-line calls and it missed the Markdown\|escape; then it silently skipped the abbreviation chain that hid item 1). Both were caught by running it against the pre-change file, and it now self-checks its parse and aborts instead of reporting doc failures when the instrument is broken.Checklist
docs/)docs(architecture): …)