Skip to content

[OP-18657] Publish JS/TS API docs - #21688

Open
myabc wants to merge 13 commits into
devfrom
code-maintenance/70566-tsjs-api-docs
Open

[OP-18657] Publish JS/TS API docs#21688
myabc wants to merge 13 commits into
devfrom
code-maintenance/70566-tsjs-api-docs

Conversation

@myabc

@myabc myabc commented Jan 15, 2026

Copy link
Copy Markdown
Contributor

Ticket

https://community.openproject.org/wp/OP-18657

What are you trying to accomplish?

Add a generated reference for Stimulus controllers, helpers, mixins and support modules so contributors and plugin authors can discover their source-level contracts. This complements Lookbook's component usage examples and establishes the infrastructure for a supported frontend API reference.

  • Generate documentation with TypeDoc through npm run generate-docs; output is git-ignored.
  • Correct 30 TSDoc syntax violations and enable syntax linting for Stimulus sources.
  • Give controller pages their real class names, exclude external symbols, and remove misleading source links into node_modules.
  • Build edge from the development tip and stage from the latest protected release branch. CI pins source links to the exact checkout commit and validates output before publication.
  • Add a Node-side Vitest harness for documentation tooling, run through npm run test:tooling and in CI.

Screenshots

CheckableController ExternalLinksController
CheckableController screenshiot ExternalLinksController screenshot

What approach did you choose and why?

TypeDoc initially covers src/stimulus; including the legacy Angular tree would overwhelm the reference. TSDoc linting targets the same directory. Generated files stay out of the repository.

CI installs pinned TypeDoc tooling and copies its configuration into each source checkout, allowing release branches that predate this tooling to build. Validation checks representative edge pages and rejects spec modules and APIs outside the intended scope. The inferred base path determines both page names and source-link paths; widening the entry points must update the link template alongside them.

PRs build and validate the site but skip GitHub Pages deployment. Outbound links from Lookbook and the frontend guide remain deferred until the site is published.

Follow-up work will define the supported API boundary, present controller identifiers and target/value/outlet attributes, and extend coverage to reusable code in src/common and src/turbo. These decisions are required before treating every generated symbol as a supported plugin API.

Validation: all three tooling tests pass, full TypeDoc generation succeeds, and the current PR checks are green. Generation still emits 26 warnings, including unresolved references; syntax linting alone does not validate links.

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds TypeDoc as a documentation generation tool for the frontend JavaScript/TypeScript code, replacing the previously unused Compodoc configuration.

Changes:

  • Adds TypeDoc v0.28.16 as a dev dependency with appropriate configuration
  • Removes the obsolete tsconfig.compodoc.json configuration file
  • Configures documentation generation via npm run generate-docs

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
frontend/typedoc.json New TypeDoc configuration targeting TypeScript files in app, stimulus, react, and turbo directories
frontend/tsconfig.compodoc.json Removes unused Compodoc TypeScript configuration
frontend/package.json Adds TypeDoc dependency and generate-docs npm script
frontend/package-lock.json Locks TypeDoc and its transitive dependencies (lunr, mini-shiki, markdown-it, yaml)
frontend/.gitignore Ignores generated documentation output directory
Files not reviewed (1)
  • frontend/package-lock.json: Language not supported

Comment thread frontend/typedoc.json
Comment thread frontend/package.json Outdated
@myabc myabc changed the title [#70566] Publish JS/TS API docs [OP-18657] Publish JS/TS API docs Jun 2, 2026
@myabc
myabc force-pushed the code-maintenance/70566-tsjs-api-docs branch 3 times, most recently from 663f4fd to ffd282a Compare September 4, 2026 12:20
TypeDoc renders the reference, its GitHub theme matches the surface the
docs are linked from, and eslint-plugin-tsdoc keeps the doc comments
parseable by the generator.
Scopes TypeDoc to the Stimulus entry points, excluding specs and the
application bootstrap, so the reference describes reusable controllers,
helpers and mixins rather than the whole frontend.

Output is ignored rather than committed; `npm run generate-docs` builds
it locally.
@myabc
myabc force-pushed the code-maintenance/70566-tsjs-api-docs branch from a5bcc84 to e5b7fd3 Compare September 4, 2026 21:10
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./modules/documents/spec/features/attachment_upload_spec.rb[1:1:1:1]
  • rspec ./modules/documents/spec/features/attachment_upload_spec.rb[1:3:2:1:1]
  • rspec ./modules/documents/spec/features/attachment_upload_spec.rb[1:3:2:3:1]
  • rspec ./modules/gantt/spec/features/timeline/timeline_dates_spec.rb[1:2:1]
🤖 Ask Copilot to investigate

Copy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer.

@copilot The following spec(s) are flaky in CI (first seen on PR #21688, linked for reference only):

- `rspec ./modules/documents/spec/features/attachment_upload_spec.rb[1:1:1:1]`
- `rspec ./modules/documents/spec/features/attachment_upload_spec.rb[1:3:2:1:1]`
- `rspec ./modules/documents/spec/features/attachment_upload_spec.rb[1:3:2:3:1]`
- `rspec ./modules/gantt/spec/features/timeline/timeline_dates_spec.rb[1:2:1]`

Treat this as a standalone task, unrelated to PR #21688. Create a new branch from origin/dev and open a new pull request targeting dev — do not stack it on PR #21688 or reuse that branch.

Follow the playbook in docs/development/testing/handling-flaky-tests/README.md to find the root cause and fix the underlying race — do not skip, delete, or weaken the spec to make it pass; disabling is a last resort per the playbook, and only with a bug ticket. Verify the fix by running the spec(s) repeatedly (e.g. `script/bulk_run_rspec --run-count 10`).

If you cannot reproduce the flake or are not confident in a fix after reasonable investigation, do not fabricate a change or skip the spec to force CI green. Instead, leave the pull request in draft and document what you tried, the suspected cause, and any leads in its description, then assign @myabc to take over.

Once the fix is verified, title the PR after the spec(s) it fixes, and use the PR description to explain the root cause, how the change resolves it, and the before/after results. Label the PR `flaky-spec`, assign @myabc, and request a review from @myabc.
On every commit, set @myabc as the sole co-author with a `Co-authored-by:` trailer (use their GitHub no-reply email so it links to their account), so it is traceable who dispatched the fix.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A newly added dependency chain introduces a TypeScript peer-range conflict (eslint-plugin-tsdoc → nested @typescript-eslint/* requiring TS <6.0.0 while the repo uses TS 6.0.3), which should be resolved or explicitly addressed to avoid toolchain breakage.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Files not reviewed (1)

  • frontend/package-lock.json: Generated file
  • Files reviewed: 23/24 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread frontend/package.json
@myabc
myabc marked this pull request as ready for review September 5, 2026 14:27
TypeDoc parses doc comments as TSDoc, not JSDoc, so a missing `@param`
hyphen, a `{Type}` after `@throws` or an unfenced code sample is dropped
or mangled in the generated output without warning.

Relocating the `@see` in CheckAllController also keeps the two
paragraphs that followed it out of the link.
Scoped to the `entryPoints` of `typedoc.json` rather than all of `src`,
since the legacy Angular tree carries several hundred JSDoc comments
that TypeDoc never renders.
Builds the reference for both the development tip and the latest release
branch, so the published site can describe either. TypeDoc is installed
ad-hoc rather than from the source checkout, letting release branches
that predate this tooling still build.

The generated output is validated before publishing, so a scope or
naming regression fails the build rather than reaching the site.
test:tooling covered doc-generation tooling but no workflow
called it, so a regression there would go undetected. Run it
once per matrix job, on the chromium leg only.
Trigger paths omitted the tooling directory and tsdoc.json, so
changes there would not rerun the build. Page-name assertions
ran for the stage channel too, which tracks a release branch
this workflow does not control. The out-of-scope module check
passed vacuously when the modules directory was missing. And
edge_ref/stage_ref could carry workflow_dispatch input into
GITHUB_OUTPUT unescaped.

Add the missing trigger paths, restrict exact page-name checks
to edge, require the modules directory to exist, and switch
edge_ref/stage_ref to the GITHUB_OUTPUT heredoc form.
The suite exercised the plugin through a fixture harness that omits
`TypeDocReader`, so nothing asserted against the configuration actually
shipped: dropping a plugin from `typedoc.json` left every test green.

Adds a helper that converts real sources through that file, and two
tests over it. Both were confirmed to fail under the mutation they
guard — the plugin removed, and the source-link template corrupted.

https://community.openproject.org/wp/OP-18657
@myabc
myabc force-pushed the code-maintenance/70566-tsjs-api-docs branch from bb54167 to f32d782 Compare September 5, 2026 14:58
@myabc myabc added this to the 17.9.x milestone Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants