fix(sound): sound module functions have no descriptions in generated docs - #920
Conversation
The doc comment describing adsr()'s public contract was sitting above the private adsrTransformer() helper instead of above adsr() itself, so anyone reading the file saw the comment attached to the wrong function.
TypeDoc documents SoundModulePlugin's @moduleMethod-decorated class methods in index.ts, since that's the sound bundle's actual public API surface - but none of its 40 methods had a doc comment, so every function on the published sound module docs page rendered with a bare signature and no explanation. The descriptions were already written, just on the wrong layer: the pure functions.ts implementations each have a full doc comment, but those aren't part of what TypeDoc treats as public. This copies each comment onto its corresponding class method (trimming internal migration-only asides like trombone's envelope quirk, and using `math_sin`/`math_PI` in @examples instead of `Math.sin`/`Math.PI`, since Source doesn't expose a global `Math` object), so the generated docs actually describe what each function does. Verified by running buildtools' own docs generation for this bundle and inspecting the resulting JSON: every one of the 40 exported functions now carries its description end-to-end.
|
@coderabbitai, do you think so that the changes in this PR when merged will fix the docs issue over at the documentation site generated by TypeDocs? |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '--- Changed files and summary ---'
git diff --stat HEAD^ HEAD
git diff --name-only HEAD^ HEAD
echo '--- Sound module public API outline ---'
ast-grep outline src/bundles/sound/src/index.ts --items all --view expanded 2>/dev/null || true
echo '--- Documentation-related workflows and configuration ---'
fd -HI -t f '.*' .github 2>/dev/null | while IFS= read -r file; do
if rg -qni 'typedoc|buildtools build docs|github-pages|pages|documentation' "$file"; then
echo "### $file"
rg -ni -C 3 'typedoc|buildtools build docs|github-pages|pages|documentation' "$file"
fi
done
echo '--- Relevant diff excerpts ---'
git diff --unified=3 HEAD^ HEAD -- src/bundles/sound/src/index.ts src/bundles/sound/src/functions.tsLength of output: 32106 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '--- GitHub Pages deployment workflow ---'
cat -n .github/workflows/pages-deploy.yml
echo '--- Root package documentation and build scripts ---'
if [ -f package.json ]; then
jq '{scripts: (.scripts // {})}' package.json
fi
echo '--- Documentation build command references outside PR checks ---'
rg -n -C 4 'buildtools build docs|build docs|typedoc|documentation/modules' \
-g 'package.json' \
-g '*.yml' \
-g '*.yaml' \
-g '*.json' \
-g '*.ts' \
. \
-g '!node_modules/**' -g '!build/**' -g '!dist/**'
echo '--- Sound bundle documentation configuration ---'
fd -HI -t f 'package.json|typedoc.*|tsconfig.*' src/bundles/sound | while IFS= read -r file; do
echo "### $file"
if [ "$(basename "$file")" = 'package.json' ]; then
jq '{name, scripts, typedoc, documentation}' "$file"
else
sed -n '1,220p' "$file"
fi
doneLength of output: 39356
TypeDoc uses After merge to The update will appear on the site after the deployment workflow completes successfully. You are interacting with an AI system. |
RichDom2185
left a comment
There was a problem hiding this comment.
LGTM with a nit: Should you use JSDoc @returns instead of "Returns"?
Addresses review nit from RichDom2185 on PR #920.
Summary
The published sound module docs (source-academy.github.io/modules/documentation/modules/sound.html) show every function with a bare signature and no explanation - reported by Martin Henz.
SoundModulePlugin's@moduleMethod-decorated class methods insrc/bundles/sound/src/index.ts, since that's the bundle's actual public API surface. None of its 40 methods carried a doc comment, so the generated docs had nothing to render per function.functions.ts's pure implementations each have a full doc comment, butfunctions.tsisn't part of what TypeDoc treats as public. This copies each comment onto its corresponding class method inindex.ts(trimming internal migration-only asides like trombone's envelope quirk, and switching@examples fromMath.sin/Math.PItomath_sin/math_PI, since Source doesn't expose a globalMathobject).adsr()'s doc comment infunctions.tswas sitting above the privateadsrTransformer()helper instead of aboveadsr()itself.Test plan
yarn workspace @sourceacademy/bundle-sound tscpassesyarn workspace @sourceacademy/bundle-sound lint- 0 errors (6 pre-existing warnings, unchanged from baseline)yarn workspace @sourceacademy/bundle-sound test- 82/82 passingbuildtools build docs .) and inspected the resultingdocs.json: all 40 exported functions now carry their description end-to-end (spot-checkedsine_sound,adsr,trombone,consecutively,stacking_adsr,record,play_in_tab)