Skip to content

Commit 4fd4d2a

Browse files
authored
CRAN-ish tibblify (#105)
* CRAN tibblify I'll likely switch back to dev for tibblify soonish, but right now I don't use any dev features! I also updated AI-related things. Closes #92 * More accurate condition docs * Meh, install from dev, this isn't going to CRAN before a tibblify update. * Don't be over-specific, it caused a mistake
1 parent 499d903 commit 4fd4d2a

8 files changed

Lines changed: 175 additions & 16 deletions

File tree

.github/skills/create-issue/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ If `gh` is not authenticated, stop and ask the user to authenticate before conti
1313

1414
## Looking up IDs
1515

16-
The hardcoded IDs below are correct for this repo as of 2026-04-28 13:47:49 UTC. If they ever change, or if you're working in a fork, re-run these queries to get fresh values:
16+
The hardcoded IDs below are correct for this repo as of 2026-05-15 13:34:15 UTC. If they ever change, or if you're working in a fork, re-run these queries to get fresh values:
1717

1818
```bash
1919
# Repository node ID

.github/skills/r-code/SKILL.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: Guide for writing R code. Use when writing new functions, designing
66

77
# R code
88

9-
This skill covers how to design and write R functions — including naming conventions, signatures, API conventions, input validation, error handling, and common pitfalls. For documenting functions, use the `document` skill. For tests, use the `tdd-workflow` skill.
9+
This skill covers how to design and write R functions — including naming conventions, signatures, API conventions, input validation, condition handling, and common pitfalls. For documenting functions, use the `document` skill. For tests, use the `tdd-workflow` skill.
1010

1111
## Naming conventions
1212

@@ -184,9 +184,9 @@ Keep a function internal when:
184184

185185
Internal helpers use a dot prefix (e.g. `.parse_response()`).
186186

187-
## Error handling
187+
## Condition handling
188188

189-
Use `.pkg_abort()` (defined in `R/aaa-conditions.R`) rather than calling `cli::cli_abort()` directly. This wraps `stbl::pkg_abort()` and ensures consistent error class formatting:
189+
Use `.pkg_abort()`, `.pkg_warn()`, and `.pkg_inform()` (defined in `R/aaa-conditions.R`) rather than calling `cli::cli_abort()`, `cli::cli_warn()`, or `cli::cli_inform()` directly. These wrap `stbl` condition helpers and ensure consistent class formatting:
190190

191191
```r
192192
.pkg_abort(

.github/skills/tdd-workflow/SKILL.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,31 @@ test_that("process_data() errors on empty input (#42)", {
133133
})
134134
```
135135

136-
Pass `transform = stbl::.transform_path(path)` to scrub volatile values (e.g. temp
137-
paths) from the snapshot before comparison.
136+
**Warnings thrown by this package** (via `.pkg_warn()`) should be tested with
137+
`stbl::expect_pkg_warning_snapshot()`:
138+
139+
```r
140+
test_that("process_data() warns on dropped rows (#42)", {
141+
stbl::expect_pkg_warning_snapshot(
142+
process_data(data.frame(value = c(1, NA))),
143+
"rapid",
144+
"dropped_rows"
145+
)
146+
})
147+
```
148+
149+
**Messages thrown by this package** (via `.pkg_inform()`) should be tested with
150+
`stbl::expect_pkg_message_snapshot()`:
151+
152+
```r
153+
test_that("process_data() informs on defaults used (#42)", {
154+
stbl::expect_pkg_message_snapshot(
155+
process_data(data.frame(value = 1)),
156+
"rapid",
157+
"used_defaults"
158+
)
159+
})
160+
```
138161

139162
**Errors thrown by `stbl`** (via `stbl::to_*()` / `stbl::stabilize_*()`)
140163
should be tested with `stbl::expect_pkg_error_classes()`. Since the message

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Imports:
2424
rlang (>= 1.1.0),
2525
S7 (>= 0.2.0),
2626
snakecase,
27-
stbl (>= 0.3.0),
27+
stbl (>= 0.3.0.9000),
2828
tibble,
2929
tibblify (>= 0.4.0),
3030
xml2,
@@ -33,8 +33,8 @@ Suggests:
3333
httr2,
3434
testthat (>= 3.0.0)
3535
Remotes:
36-
stbl=wranglezone/stbl,
37-
tibblify=wranglezone/tibblify
36+
wranglezone/stbl,
37+
wranglezone/tibblify
3838
Config/roxygen2/version: 8.0.0
3939
Config/testthat/edition: 3
4040
Config/testthat/parallel: true

R/aaa-conditions.R

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#' Raise a package-scoped error
1+
#' Signal a package-scoped error
22
#'
33
#' @inheritParams .shared-params
44
#' @inheritParams stbl::pkg_abort
@@ -7,8 +7,9 @@
77
.pkg_abort <- function(
88
message,
99
subclass,
10-
call = rlang::caller_env(),
11-
message_env = rlang::caller_env(),
10+
parent = NULL,
11+
call = caller_env(),
12+
message_env = caller_env(),
1213
...
1314
) {
1415
stbl::pkg_abort(
@@ -17,6 +18,57 @@
1718
subclass,
1819
call = call,
1920
message_env = message_env,
21+
parent = parent,
22+
...
23+
)
24+
}
25+
26+
#' Signal a package-scoped warning
27+
#'
28+
#' @inheritParams .shared-params
29+
#' @inheritParams stbl::pkg_warn
30+
#' @returns `NULL`, invisibly (called for warning side effect).
31+
#' @keywords internal
32+
.pkg_warn <- function(
33+
message,
34+
subclass,
35+
parent = NULL,
36+
call = caller_env(),
37+
message_env = caller_env(),
38+
...
39+
) {
40+
stbl::pkg_warn(
41+
"rapid",
42+
message,
43+
subclass,
44+
call = call,
45+
message_env = message_env,
46+
parent = parent,
47+
...
48+
)
49+
}
50+
51+
#' Signal a package-scoped message
52+
#'
53+
#' @inheritParams .shared-params
54+
#' @inheritParams stbl::pkg_inform
55+
#' @returns `NULL`, invisibly (called for warning side effect).
56+
#' @keywords internal
57+
.pkg_inform <- function(
58+
message,
59+
subclass,
60+
parent = NULL,
61+
call = caller_env(),
62+
message_env = caller_env(),
63+
...
64+
) {
65+
stbl::pkg_inform(
66+
"rapid",
67+
message,
68+
subclass,
69+
call = call,
70+
message_env = message_env,
71+
parent = parent,
2072
...
2173
)
2274
}

man/dot-pkg_abort.Rd

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/dot-pkg_inform.Rd

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/dot-pkg_warn.Rd

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)