Skip to content

Dev - #38

Merged
vertesy merged 11 commits into
mainfrom
dev
Sep 2, 2026
Merged

Dev#38
vertesy merged 11 commits into
mainfrom
dev

Conversation

@vertesy

@vertesy vertesy commented Sep 2, 2026

Copy link
Copy Markdown
Owner

No description provided.

vertesy and others added 9 commits August 6, 2025 11:52
…-documentation

Polish function documentation
* Annotate code; flag 3 pre-existing bugs (not fixed)

* Fix 3 bugs flagged in PR #30 review

- read.simple.ssv(): add missing `asTibble` parameter (was referenced
  but never defined, erroring whenever wRownames = TRUE, the default).
- write.simple.xlsx(): assignRownames() now uses its own argument `x`
  instead of the undefined `df`, fixing has_row_names = FALSE.
- qs.2.table(): fix `qs:qread` -> `qs::qread`, use the real
  `stringi::stri_detect_regex` function, and define `base_filename`/
  `out_path` on every branch so the function actually runs. Also adds
  `stringi` to Imports/NAMESPACE since it's now genuinely used.

Co-authored-by: Abel Vertesy <5101911+vertesy@users.noreply.github.com>

* Fix qs.2.table()'s excel branch crashing on a bare data.frame

write.simple.xlsx() requires a list of sheets; qs.2.table() was
passing the loaded table directly, which fails its
is.data.frame(x)-per-element assertion. Wrap it in a list first.

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

---------

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Abel Vertesy <5101911+vertesy@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
# Conflicts:
#	DESCRIPTION
#	R/ReadWriter.R
#	R/list.of.functions.in.ReadWriter.md
#	README.md
#	man/column.2.row.names.Rd
#	man/read.simple.csv.named.vector.Rd
#	man/read.simple.ssv.Rd

Co-authored-by: vertesy <5101911+vertesy@users.noreply.github.com>
…on xlsx export

- DESCRIPTION: add stringi to Imports, since R/ReadWriter.R now calls
  stringi::stri_detect_regex() and NAMESPACE already declares the importFrom.
- write.simple.xlsx(): when has_row_names = FALSE, the identifier column is
  moved into row names via column.2.row.names() before writing. The final
  write.xlsx() call still passed the original has_row_names (FALSE) as
  rowNames, so those converted identifiers were dropped from the workbook.
  Track the post-conversion state separately (write_row_names) and pass that
  to write.xlsx() instead.

Co-authored-by: Abel Vertesy <5101911+vertesy@users.noreply.github.com>
Replaces the per-file file.remove() call with a single call that matches every generated list.of.functions.in.*.det.md report by pattern (this repo generates 2: ReadWriter and Deprecated.Functions -- only the first was ever cleaned up before). The old line is commented out, not deleted.

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: bbf2f15489

ℹ️ 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 R/ReadWriter.R
ReadWriter::write.simple.xlsx(data, out_path)
}
# Base name (without extension) shared by all output formats
base_filename <- sub("\\.qs$", "", path)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the directory of absolute input paths

When path is absolute, base_filename remains absolute and is passed as manual_file_name, while manual_directory is left unset. construct.file.path() therefore selects getwd() as the output directory and combines it with the absolute-looking filename, so conversions can target a malformed cwd-prefixed path (and the reported out_path does not match it). Pass dirname(path) as manual_directory and the extensionless basename(path) as manual_file_name for every output branch.

Useful? React with 👍 / 👎.

@vertesy

vertesy commented Sep 2, 2026

Copy link
Copy Markdown
Owner Author

@claude
could you please address:

"Preserve the directory of absolute input paths

When path is absolute, base_filename remains absolute and is passed as manual_file_name, while manual_directory is left unset. construct.file.path() therefore selects getwd() as the output directory and combines it with the absolute-looking filename, so conversions can target a malformed cwd-prefixed path (and the reported out_path does not match it). Pass dirname(path) as manual_directory and the extensionless basename(path) as manual_file_name for every output branch."


Also qs.2.table Has some massive edits to its codebase. Could you please double-check it to see if it is indeed correct and does not change the output in an unexpected way? Thank you!

@claude

claude Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

Claude finished @vertesy's task in 1m 27s —— View job


Claude finished @vertesy's task

Todo list:

  • Gather context (read qs.2.table, construct.file.path)
  • Fix: preserve directory of absolute input paths in qs.2.table
  • Double-check qs.2.table rewrite for correctness/output changes
  • Commit & push

1. Fixed: absolute paths in qs.2.table

R/ReadWriter.R:1148 — as Codex flagged, base_filename (derived from path) was passed as manual_file_name with manual_directory left unset. Since construct.file.path() falls back to getwd() when manual_directory is NULL, an absolute path produced a malformed cwd-prefixed output path that didn't match the reported out_path.

Fixed for every output branch (tsv, csv, csv2, excel) by splitting base_filename into:

out_dir  <- dirname(base_filename)
out_name <- basename(base_filename)

and passing manual_directory = out_dir, manual_file_name = out_name to write.simple.tsv() / write.simple.xlsx(). This preserves the directory of absolute paths and is a no-op for relative paths (dirname() returns ".", same as the previous getwd()-based default).

Pushed as d9efb0b.

2. Review of the qs.2.table rewrite

I compared the new version against the one from before this PR (visible in the diff context of the Codex review comment). The old code was actually non-functional — it had several bugs that would have thrown errors or written to the wrong place:

  • qs:qread(path) — invalid R syntax (single colon instead of ::), would fail to parse/run.
  • Stringendo::ppp(base_filename, out_file) was called with base_filename before it was ever defined, and its result was discarded (not assigned to path_out/out_path).
  • The excel branch called ReadWriter::write.simple.xlsx(data, out_path) where out_path was never assigned — would error with "object not found".
  • stringi::stri_detect(...) — not a real stringi function (should be stri_detect_regex), so the stopifnot guard would have errored on the very first call.

The rewrite in this PR fixes all of these: it defines base_filename once, correctly builds out_path per format, wraps bare data frames/matrices into a list for write.simple.xlsx() (which expects a list of sheets), and uses the correct stri_detect_regex. So the "massive edit" is a legitimate bug fix rather than a behavioral regression — the previous code could not have produced correct output for any input. With the directory fix above added on top, the function should now work correctly for both relative and absolute .qs paths across all four output formats.

Note: I wasn't able to run the R test suite or devtools::check() in this environment (no Rscript available), so this review is based on static code reading rather than executed tests. It'd be good to smoke-test qs.2.table() with an absolute path locally before merging.
|

github-actions Bot and others added 2 commits September 2, 2026 09:41
Pass dirname(path) as manual_directory and the extensionless
basename(path) as manual_file_name for every output branch, so
construct.file.path() no longer prepends getwd() to an already
absolute filename (Codex review feedback on #38).

Co-authored-by: Abel Vertesy <5101911+vertesy@users.noreply.github.com>
@vertesy
vertesy merged commit 1e67e4c into main Sep 2, 2026
vertesy added a commit that referenced this pull request Sep 2, 2026
* docs: remove duplicate title

* Fix documentation typos and metadata (#17)

* Add AGENTS guide for repository (#19)

* Add defensive stopifnot checks to file path builder (#18)

* Annotate code: explain the non-obvious operations (#30)

* Annotate code; flag 3 pre-existing bugs (not fixed)

* Fix 3 bugs flagged in PR #30 review

- read.simple.ssv(): add missing `asTibble` parameter (was referenced
  but never defined, erroring whenever wRownames = TRUE, the default).
- write.simple.xlsx(): assignRownames() now uses its own argument `x`
  instead of the undefined `df`, fixing has_row_names = FALSE.
- qs.2.table(): fix `qs:qread` -> `qs::qread`, use the real
  `stringi::stri_detect_regex` function, and define `base_filename`/
  `out_path` on every branch so the function actually runs. Also adds
  `stringi` to Imports/NAMESPACE since it's now genuinely used.

Co-authored-by: Abel Vertesy <5101911+vertesy@users.noreply.github.com>

* Fix qs.2.table()'s excel branch crashing on a bare data.frame

write.simple.xlsx() requires a list of sheets; qs.2.table() was
passing the loaded table directly, which fails its
is.data.frame(x)-per-element assertion. Wrap it in a list first.

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

---------

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Abel Vertesy <5101911+vertesy@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>

* Address Codex review: declare stringi dependency, preserve row names on xlsx export

- DESCRIPTION: add stringi to Imports, since R/ReadWriter.R now calls
  stringi::stri_detect_regex() and NAMESPACE already declares the importFrom.
- write.simple.xlsx(): when has_row_names = FALSE, the identifier column is
  moved into row names via column.2.row.names() before writing. The final
  write.xlsx() call still passed the original has_row_names (FALSE) as
  rowNames, so those converted identifiers were dropped from the workbook.
  Track the post-conversion state separately (write_row_names) and pass that
  to write.xlsx() instead.

Co-authored-by: Abel Vertesy <5101911+vertesy@users.noreply.github.com>

* Consolidate list-of-functions cleanup into one file.remove() call (#34)

Replaces the per-file file.remove() call with a single call that matches every generated list.of.functions.in.*.det.md report by pattern (this repo generates 2: ReadWriter and Deprecated.Functions -- only the first was ever cleaned up before). The old line is commented out, not deleted.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>

* Fix qs.2.table to preserve directory of absolute input paths

Pass dirname(path) as manual_directory and the extensionless
basename(path) as manual_file_name for every output branch, so
construct.file.path() no longer prepends getwd() to an already
absolute filename (Codex review feedback on #38).

Co-authored-by: Abel Vertesy <5101911+vertesy@users.noreply.github.com>

* Fix Excel output path for QS conversion

---------

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Abel Vertesy <5101911+vertesy@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
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.

2 participants