Iter 13e: rustdoc polish for ailang-check
Second docwriter mission. Pure rustdoc additions (no API or behaviour change) across the typechecker crate: - builtins.rs: module root expanded; EffectOpSig (struct + 3 fields) and install() got /// strings. - diagnostic.rs: Severity (+ both variants), Diagnostic (+ severity/code/message fields) and the error/with_def/with_ctx helpers got /// strings; super:: link rewritten to crate::. - lib.rs: CheckError + every variant, to_diagnostic, CheckedModule (+ symbols), check, Env (+ globals/effect_ops/types/ module_globals/current_module), CtorRef (+ type_name) got /// strings; crate-root prose upgraded with intra-doc link to check_module. Verification: cargo doc --no-deps zero warnings; cargo build --workspace green; cargo test --workspace 64/64 + 3 ignored doctests green. Diff is 188 LOC, all in /// or //! lines (verified by filtering). Findings (not fixed; orchestrator-deferred): - Env is pub but only privately constructable. - CheckError::CtorArity and ::ArityMismatch share the public diagnostic code "arity-mismatch" by design. - Diagnostic / Severity reachable via two paths because the diagnostic module is pub. JOURNAL.md updated with the Iter 13e entry. 13f (ailang-codegen + ail) and 14a (List a rewrite) remain queued. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1242,3 +1242,73 @@ After 13d there's no urgency on 13e/f — `cargo doc` is already
|
||||
warning-free. They're "polish iterations to be slotted in
|
||||
between feature iters when context budget is short". 14a
|
||||
(`List a` rewrite) remains the next-feature default.
|
||||
|
||||
## Iter 13e — rustdoc polish for `ailang-check`
|
||||
|
||||
Second docwriter mission. Same mandate as 13d, applied to the
|
||||
typechecker crate. `lib.rs` (1922 LOC) had a strong crate root
|
||||
already — covers HM-with-effects, top-level forall, the
|
||||
rigid-vs-metavar split, the `$m<id>` encoding — but its `pub`
|
||||
surface (the `Env` struct, `CheckError` + 24 variants,
|
||||
`CheckedModule`, `CtorRef`, the `check_module` entry point) was
|
||||
mostly undocumented. `builtins.rs` had a one-line module
|
||||
header and zero `///` strings on `EffectOpSig` or `install`.
|
||||
`diagnostic.rs` had a strong module header (lists every stable
|
||||
diagnostic code) but `Diagnostic`, `Severity`, and the
|
||||
construction helpers were undocumented.
|
||||
|
||||
Agent added 188 LOC of pure rustdoc across the three files; no
|
||||
non-doc lines changed (verified by filtering the diff). Each
|
||||
`CheckError` variant now carries the AST term/type that
|
||||
triggers it and the stable kebab-case `code` it maps to. `Env`
|
||||
fields (`globals`, `effect_ops`, `types`, `module_globals`,
|
||||
`current_module`) got individual `///` strings that name the
|
||||
invariants — most importantly that `module_globals` includes
|
||||
the current module, which the agent flagged as undocumented at
|
||||
field level (now fixed). Crate-root prose got an upgraded
|
||||
intra-doc link to `[`check_module`]`; `super::` reference in
|
||||
`diagnostic.rs` rewritten to `crate::` (cosmetic, but the
|
||||
canonical form).
|
||||
|
||||
**Findings reported** (judgement deferred to me):
|
||||
|
||||
- `Env` is `pub` with all-`pub` fields but `Env::new` is
|
||||
private and there's no public builder — external callers can
|
||||
only construct via field-by-field literal, which is fragile
|
||||
if a field is added later. **Not fixing**: changing this is
|
||||
an API decision, not a doc one. Worth raising next time we
|
||||
touch the crate's public surface deliberately.
|
||||
- `CheckError::CtorArity` and `CheckError::ArityMismatch` both
|
||||
serialize to the public diagnostic code `arity-mismatch`. The
|
||||
`///` strings now flag the collision per-variant; tooling
|
||||
that consumes the diagnostic JSON sees only the merged code
|
||||
and that's intentional from the iter-5b vintage. **Not
|
||||
fixing.**
|
||||
- `Diagnostic` and `Severity` are reachable both via the crate
|
||||
re-export and via `crate::diagnostic::*` because the
|
||||
`diagnostic` module is itself `pub`. Rustdoc renders both
|
||||
pages; harmless but slightly noisy. **Not fixing**: the
|
||||
re-export is the documented entry point and we don't want to
|
||||
hide the module.
|
||||
|
||||
**Process note.** Same shape as 13d: I wrote a brief naming
|
||||
the deficiencies (numbers of pub items, which files had thin
|
||||
roots), the agent did the doc additions inside its mandate,
|
||||
the orchestrator-side work was authoring DESIGN/JOURNAL and
|
||||
verifying the diff. Cost ≈ 32 tool uses for 188 LOC of doc
|
||||
across 3 files — denser than 13d (more sentences per pub item
|
||||
because the typechecker invariants need explicit
|
||||
articulation), but the per-LOC payoff for a future reader is
|
||||
also higher.
|
||||
|
||||
**Tests:** 64/64 unit + e2e (unchanged), 3 ignored doctests
|
||||
(unchanged). `cargo doc --no-deps`: 0 warnings (was 0; the
|
||||
agent introduced 4 transient broken-link warnings during the
|
||||
work and resolved all of them before reporting done). `cargo
|
||||
build --workspace` green. `cargo test --workspace` green.
|
||||
|
||||
**Plan 13f / 14a unchanged.** 13f (`ailang-codegen` + `ail`
|
||||
CLI) is the natural next polish iter; 14a (`List a` rewrite of
|
||||
`list_map`) remains the next-feature default. Auto-mode is on,
|
||||
so I'll continue into 13f directly unless context budget
|
||||
pressures a switch.
|
||||
|
||||
Reference in New Issue
Block a user