Skip to content

Document the _PACKAGE sentinel - #34

Merged
TroyHernandez merged 2 commits into
mainfrom
docs/package-sentinel
Aug 4, 2026
Merged

TroyHernandez merged 2 commits into
mainfrom
docs/package-sentinel

Conversation

@TroyHernandez

Copy link
Copy Markdown
Contributor

Addresses #30.

Digging into #30 turned up that the requested feature already exists and meets every acceptance criterion in the issue. What was missing is documentation: neither README nor CLAUDE.md mentions the sentinel, which is why it read as unsupported.

Verified against the issue's own example (a subtitles-shaped test package, tinyrox 0.4.0.2):

  • "_PACKAGE" parses as package documentation, not an ordinary object (R/parse.R, since 302b484)
  • document() deterministically generates man/subtitles-package.Rd with package docType
  • Aliases subtitles and subtitles-package are emitted, so ?subtitles resolves
  • Re-documenting is byte-identical and prune_rd = TRUE leaves the file alone
  • NAMESPACE is untouched (sentinel not exported)
  • inst/tinytest/test_rd.R already carries _PACKAGE fixtures

One deliberate divergence from the issue text: title and description are not copied from the block. Since #11 (Dirk's preferred RAD style), they come from DESCRIPTION at render time via \packageTitle{} / \packageDescription{} macros, with block paragraphs 3+ (or @details) filling \details{}. The new README section states this, including that the block's description paragraph is intentionally dropped.

Docs-only, so no version bump per convention.

The feature has existed since 302b484 and gained the base-R macro style
in #11, but neither README nor CLAUDE.md mentioned it, so #30 was filed
requesting a feature tinyrox already had. Docs-only; no version bump.
…w, document()-level test

- The README example's prose contained a literal \details{} which, once
  the example is copied and documented, sits inside the generated
  \details section and makes tools::parse_Rd() warn about an unexpected
  section header. Reworded; the copied example now parses clean.
- The @author table row claimed package-level support, but every
  generator ignores tags$author in favor of the DESCRIPTION macros.
  Row now says so.
- New tinytest fixture runs the full tinyrox::document() flow on a
  _PACKAGE package: docType and both aliases present, NAMESPACE carries
  only the real export, re-document is byte-identical, and prune_rd
  leaves the package topic alone.
@TroyHernandez

Copy link
Copy Markdown
Contributor Author

All three review findings addressed in cf9a707:

  1. Blocking (Rd command in example): reworded the example prose to say "become the details section" instead of the literal \details{}. Verified by copying the fixed example verbatim into a fresh package, running document(), and parsing the generated Rd with tools::parse_Rd(): clean, no warnings.

  2. Acceptance gap: added test_package_sentinel_document() to inst/tinytest/test_rd.R. It runs the full tinyrox::document() flow on a _PACKAGE fixture and asserts docType, both aliases, details content, NAMESPACE containing exactly the one real export with no sentinel traces, byte-identical re-documenting, and an empty prune list. Suite is now 239 results, all passing.

  3. @author contradiction: the table row now reads "Accepted for roxygen2 compatibility; ignored (authors come from DESCRIPTION)", which matches what the generators actually do with tags$author.

Still docs+tests only, so no version bump.

@TroyHernandez
TroyHernandez merged commit ca35198 into main Aug 4, 2026
2 checks passed
@TroyHernandez
TroyHernandez deleted the docs/package-sentinel branch August 4, 2026 21:37
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