feat(rpkg): return event state as data.frame or list-of-data.frames#193
Open
CGMossa wants to merge 1 commit into
Open
feat(rpkg): return event state as data.frame or list-of-data.frames#193CGMossa wants to merge 1 commit into
CGMossa wants to merge 1 commit into
Conversation
3579d3e to
443abcb
Compare
93d5d25 to
3e882d2
Compare
3 tasks
443abcb to
79e65df
Compare
3e882d2 to
eb69167
Compare
5 tasks
dvs_add / dvs_get / dvs_status used to flatten Success and Error rows
into a single data.frame with NA columns padded between variants.
With miniextendr's new vec_to_dataframe_split helper, R callers now
get:
- a single bare data.frame when only one variant occurred (all
rows are Success, or all rows are Error)
- a named list(Success = <df>, Error = <df>) when both variants
occurred, where each per-variant data.frame contains only its
own columns
Implementation:
- Bump miniextendr pin so vec_to_dataframe_split is available.
- Per-command Serialize view enums (AddResultView, GetResultView,
FileStatusSuccessView / ErrorView) — externally tagged so the
splitter sees Success / Error as proper variants.
- dvs_status partitions manually so the Success data.frame can
carry add_time as a POSIXct column (jiff timestamps go directly
to OffsetDateTime, not through serde's RFC 3339 string form).
- R-side .dvs_finalize helper recursively applies new_dvs_bytes
to byte columns and tibble::as_tibble, preserving whichever
shape Rust returned.
- For dvs_add and dvs_get: when no glob is supplied, bypass
resolve_paths_for_* and feed user paths straight to add_files /
get_files. validate_for_add / validate_for_get already classify
each path per-row (Valid / NotFound / OutsideProject / IsDirectory
for add; Tracked / NotTracked / NotFound for get) and the
per-row machinery surfaces non-Valid statuses as Error rows.
resolve_paths_for_* stays for the directory-walk + glob case.
Depends on the companion paths.rs change so validate_for_* can
consume cwd-relative input directly.
Tests:
- test-add.R / test-get.R now assert per-row Error rows for
missing / untracked paths instead of expect_error.
UI walk-through:
- ui/main_events.sh exercises 12 cases — {all-success, all-failure,
mixed-success, mixed-failure} x {add, get, status} — and prints
class + shape for each so reviewers can eyeball the data.frame-vs-
named-list switch per scenario.
79e65df to
2270fcf
Compare
eb69167 to
4863e80
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #192. The R bindings flattened
Success/Errorrows into a single data.frame with NA-padded columns between variants — useful for nothing. With miniextendr's newvec_to_dataframe_split, callers now get a bare data.frame when only one variant occurred, or a namedlist(Success = <df>, Error = <df>)when both occurred, each carrying only its own columns. Fordvs_add/dvs_get, when there's no glob, the rpkg now bypassesresolve_paths_for_*and letsvalidate_for_*(with #192's cwd-relative support) classify each path per-row, so missing / untracked paths surface asErrorrows instead of bailing the whole call.ui/main_events.shwalks the 12 cases ({all-success, all-failure, mixed-success, mixed-failure} × {add, get, status}) so reviewers can eyeball the shape switch.AI-written details
Summary
vec_to_dataframe_splitis available.Serializeview enums (AddResultView,GetResultView,FileStatusSuccessView/ErrorView), externally tagged so the splitter seesSuccess/Erroras proper variants.dvs_statuspartitions manually so theSuccessdata.frame carriesadd_timeas a POSIXct column (jiff timestamps go directly toOffsetDateTime, not through serde's RFC 3339 string form)..dvs_finalizehelper recursively appliesnew_dvs_bytesto byte columns andtibble::as_tibble, preserving whichever shape Rust returned.dvs_add/dvs_get: when no glob is supplied, bypassesresolve_paths_for_*and feeds user paths straight toadd_files/get_files.validate_for_add/validate_for_getalready classify each path per-row (Valid/NotFound/OutsideProject/IsDirectoryfor add;Tracked/NotTracked/NotFoundfor get) and the per-row machinery surfaces non-Validstatuses asErrorrows.resolve_paths_for_*stays for the directory-walk + glob case.Test plan
cargo check -p dvs-rpkgcleandevtools::test('dvs-rpkg')passes (test-add.R / test-get.R updated to assert per-row Error rows for missing / untracked paths instead ofexpect_error)bash ui/main_events.shexercises 12 cases ({all-success, all-failure, mixed-success, mixed-failure} × {add, get, status}) and printsclassandshapeper case. Verify bare tibble for all-success/all-failure, namedlist(Error, Success)for mixed cases.Notes
fix(paths): handle cwd-relative input in validate_for_add / validate_for_get). The bypass-resolve_paths_*-when-no-glob change relies onvalidate_for_*doing its own cwd-to-repo-relative conversion.[patch."https://github.com/A2-ai/dvs2"] dvs = { path = "../../../dvs" }block indvs-rpkg/src/rust/Cargo.toml. After fix(paths): handle cwd-relative input in validate_for_add / validate_for_get #192 merges, rebase ontomainand runjust rpkg-update -p dvsto bump the rpkg'sdvspin to the new main SHA.Drafted by Claude (claude-opus-4-7). Reviewed by the author.