Skip to content

Restore NAMESPACE exports wiped by the v1.2.5 regenerate commit - #51

Merged
vertesy merged 2 commits into
devfrom
fix-empty-namespace-export-wipe
Aug 30, 2026
Merged

vertesy merged 2 commits into
devfrom
fix-empty-namespace-export-wipe

Conversation

@vertesy

@vertesy vertesy commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Restore NAMESPACE exports wiped by the v1.2.5 "regenerate package files" commit

Commit b164f79 ("Bump to v1.2.5 and regenerate package files") reduced
NAMESPACE from 84 export()/exportPattern lines down to just the
"Generated by roxygen2" header comment - every single function in the
package stopped being exported, even though all ~80 functions in
R/Stringendo.R still carry their @export roxygen tag untouched. Nothing
in the source changed; NAMESPACE was left empty by whatever ran that day
(most likely roxygen2::document() erroring out partway through, or being
run against a build directory that failed to load, and silently writing
an incomplete file instead of failing loudly).

Impact: this doesn't just affect Stringendo's own users calling
library(Stringendo) - it's a hard, immediate crash for every downstream
@vertesy package that Depends on or Imports from Stringendo. Concretely:
CodeAndRoll2 (Depends: Stringendo) does
importFrom(Stringendo, percentage_formatter) in its own NAMESPACE; with
that export gone, requireNamespace("CodeAndRoll2") itself fails with
"object 'percentage_formatter' is not exported by 'namespace:Stringendo'"

  • so CodeAndRoll2 cannot load, which means UVI.tools (Depends:
    CodeAndRoll2) cannot load either. Confirmed this is not an isolated
    example: the diff below restores 82 export() lines that were present
    before b164f79 and match the @export tags still in R/Stringendo.R today.

Fix: ran devtools::document(roclets = c("namespace", "rd")) against the
current source (no source changes were needed or made - only NAMESPACE
was regenerated).

Verification:

  • getNamespaceExports("Stringendo") includes percentage_formatter
    again after installing this fix locally
  • Confirmed the full downstream chain: requireNamespace("CodeAndRoll2")
    now succeeds, and devtools::load_all() on UVI.tools (which Depends on
    CodeAndRoll2) now succeeds too - both were failing before this fix
  • devtools::check() run on this branch: 1 ERROR, 3 WARNINGs, 1 NOTE, none
    of which are caused by this change or touch NAMESPACE/exports - the
    ERROR is a pre-existing, unrelated bug in the deprecated parFlags()
    ("object 'namez' not found"), and the WARNINGs/NOTE are pre-existing
    Rd/documentation issues (%!in%'s Rd \name, a stale idate.Rd
    cross-reference, an undocumented parsepvalue() argument, and some
    "no visible global variable" NOTEs) that predate this commit and are
    unrelated to exports
  • lintr run on the changed file

Note: there are several other open PRs against this repo (#43-#50)
addressing narrower, unrelated bugs in individual functions - this PR is
scoped only to restoring the wiped NAMESPACE and doesn't overlap with
any of them.

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com

…es" commit

Commit b164f79 ("Bump to v1.2.5 and regenerate package files") reduced
NAMESPACE from 84 export()/exportPattern lines down to just the
"Generated by roxygen2" header comment - every single function in the
package stopped being exported, even though all ~80 functions in
R/Stringendo.R still carry their `@export` roxygen tag untouched. Nothing
in the source changed; NAMESPACE was left empty by whatever ran that day
(most likely roxygen2::document() erroring out partway through, or being
run against a build directory that failed to load, and silently writing
an incomplete file instead of failing loudly).

Impact: this doesn't just affect Stringendo's own users calling
`library(Stringendo)` - it's a hard, immediate crash for every downstream
@vertesy package that Depends on or Imports from Stringendo. Concretely:
`CodeAndRoll2` (Depends: Stringendo) does
`importFrom(Stringendo, percentage_formatter)` in its own NAMESPACE; with
that export gone, `requireNamespace("CodeAndRoll2")` itself fails with
"object 'percentage_formatter' is not exported by 'namespace:Stringendo'"
- so CodeAndRoll2 cannot load, which means UVI.tools (Depends:
CodeAndRoll2) cannot load either. Confirmed this is not an isolated
example: the diff below restores 82 export() lines that were present
before b164f79 and match the `@export` tags still in R/Stringendo.R today.

Fix: ran `devtools::document(roclets = c("namespace", "rd"))` against the
current source (no source changes were needed or made - only NAMESPACE
was regenerated).

Verification:
- `getNamespaceExports("Stringendo")` includes `percentage_formatter`
  again after installing this fix locally
- Confirmed the full downstream chain: `requireNamespace("CodeAndRoll2")`
  now succeeds, and `devtools::load_all()` on UVI.tools (which Depends on
  CodeAndRoll2) now succeeds too - both were failing before this fix
- devtools::check() run on this branch: 1 ERROR, 3 WARNINGs, 1 NOTE, none
  of which are caused by this change or touch NAMESPACE/exports - the
  ERROR is a pre-existing, unrelated bug in the deprecated `parFlags()`
  ("object 'namez' not found"), and the WARNINGs/NOTE are pre-existing
  Rd/documentation issues (`%!in%`'s Rd \name, a stale idate.Rd
  cross-reference, an undocumented parsepvalue() argument, and some
  "no visible global variable" NOTEs) that predate this commit and are
  unrelated to exports
- lintr run on the changed file

Note: there are several other open PRs against this repo (#43-#50)
addressing narrower, unrelated bugs in individual functions - this PR is
scoped only to restoring the wiped NAMESPACE and doesn't overlap with
any of them.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0e8b2a86b8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread NAMESPACE
@@ -1,2 +1,84 @@
# Generated by roxygen2: do not edit by hand

export("%!in%")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Repair generation before restoring NAMESPACE

Problem: This commit restores only the generated NAMESPACE; it does not fix the generation path that erased every export in b164f79. Trigger: The next run of PackageTools::document_and_create_package() in Development/Create_the_Stringendo_Package.R can overwrite these entries again, leaving all public Stringendo functions unavailable to dependent packages. Fix: Correct the upstream generation step, then regenerate and commit NAMESPACE from the roxygen annotations.

AGENTS.md reference: AGENTS.md:L34-L38

Useful? React with 👍 / 👎.

@vertesy

vertesy commented Aug 30, 2026

Copy link
Copy Markdown
Owner Author

@claude
could you please address if u agree"

1
address comment:
" Repair generation before restoring NAMESPACE
Problem: This commit restores only the generated NAMESPACE; it does not fix the generation path that erased every export in b164f79. Trigger: The next run of PackageTools::document_and_create_package() in Development/Create_the_Stringendo_Package.R can overwrite these entries again, leaving all public Stringendo functions unavailable to dependent packages.
Fix: Correct the upstream generation step, then regenerate and commit NAMESPACE from the roxygen annotations."

2
review The PR is still relevant since many things have changed in the repository.

@claude

claude Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Claude finished @vertesy's task in 3m 17s —— View job


Summary

  • Gather context (PR diff, AGENTS.md, generation script, current dev/main state)
  • Address Codex review comment: add a fail-loud safeguard in the build script
  • Check whether the PR is still relevant given repo changes
  • Push changes

1. Codex comment — "Repair generation before restoring NAMESPACE"

I agree with the underlying concern, but with a scope caveat:

  • The actual generation call, PackageTools::document_and_create_package(), lives in the PackageTools package — a separate repo, not part of Stringendo. It isn't checked out here, so I can't inspect or fix its internals from this PR.
  • What is in this repo is the call site: Development/Create_the_Stringendo_Package.R, which invokes that function twice (lines 38 and 112) with no check afterward — so a silent partial failure (the actual root cause per the PR body: roxygen2::document() erroring out or running against a build dir that failed to load) just writes an empty NAMESPACE and the script carries on to git add commit push.

Since I can't touch the upstream package, I added the next best thing directly in this repo: a stopifnot() guard right after each document_and_create_package() call that fails loudly if the regenerated NAMESPACE has zero export() lines, e.g.:

PackageTools::document_and_create_package(repository.dir, config_file = 'config.R')
namespace.lines <- readLines(file.path(repository.dir, "NAMESPACE"))
stopifnot("NAMESPACE regeneration produced no exports (roxygen2::document() likely failed silently) - fix before committing" = any(grepl("^export", namespace.lines)))

This directly targets the "Trigger" Codex flagged — the next run of that script can no longer silently overwrite all exports; it will stop before the commit step. Pushed as 6822e04.

(Note: I could not run lintr or R itself in this sandbox — no R installation is available here — so this wasn't linted in this session. Please double check syntax before merging.)

2. Is this PR still relevant?

I checked the current tips of both target branches (fetched as part of the checkout, timestamps ~2026-08-30 22:4x, i.e. very recent):

  • origin/dev (this PR's actual base): NAMESPACE already has 84 lines, and it is byte-identical to what this PR's branch contains. Whatever fixed it there, dev is currently not broken.
  • origin/main: NAMESPACE is still just the 2-line roxygen2 header — i.e. main still has the wiped/empty NAMESPACE, same broken state as b164f79.

So: as opened (base = dev), this PR's diff would currently be a no-op against dev — the fix already landed there some other way. The real remaining gap is on main, not dev. Worth deciding explicitly:

  • if dev → main gets released/merged normally, this PR may simply be safe to close as superseded, or
  • if main needs an immediate, independent fix (e.g. it's what gets released to CRAN/users directly), this PR should probably be retargeted at main instead of dev.

I did not close or retarget the PR myself — that's a call for you to make, and retargeting/closing isn't something I can do here.

Branch: fix-empty-namespace-export-wipe

…cript

Addresses PR #51 review feedback: a future document_and_create_package()
run (the same call that produced the empty NAMESPACE in b164f79) will now
stop with an error instead of silently writing an export-less NAMESPACE.

Co-authored-by: Abel Vertesy <5101911+vertesy@users.noreply.github.com>
@vertesy
vertesy merged commit a00e78a into dev Aug 30, 2026
@vertesy
vertesy deleted the fix-empty-namespace-export-wipe branch August 30, 2026 20:55
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