fix(corpus): anchor the docs/ ignore rule and commit the fixture's docs (#73)
The unanchored docs/ rule also matched inst/extdata/fixture_corpus/docs/, so the four reference docs the fixture manifest points at were never tracked and cog_mirror(include = "docs") copied nothing from a fresh clone. The docs are restored from the old Nextcloud working copy, written by the same 2026-08-03 build as the fixture's manifest. Scanned for hostnames, home paths and tokens first: the only URL is the public Hugging Face dataset. Two tests now fail if the docs go missing again: one checks every docs path the fixture manifest names, the other mirrors the fixture's docs. Closes #73 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
7 files changed
+2189
-1
No files matched your search
@@ -110,3 +110,26 @@ test_that("every flow code carrying dollars has a category, J-prefix included",
|
||||
expect_true(all(j$spend_subtype == "assistance"))
|
||||
expect_false(any(is.na(j$category)))
|
||||
})
|
||||
|
||||
test_that("every doc the fixture manifest names is in the fixture (#73)", {
|
||||
skip_if_no_corpus()
|
||||
# .gitignore once excluded docs/ at any depth, so a fresh clone had a
|
||||
# manifest pointing at files that were never committed, and
|
||||
# cog_mirror(include = "docs") copied nothing without saying so.
|
||||
m <- jsonlite::fromJSON(
|
||||
file.path(fixture_corpus_path(), "manifest.json"), simplifyVector = FALSE
|
||||
)
|
||||
named <- c(m$schema$data_dictionary, m$series_breaks_ref, m$reader_spec_ref)
|
||||
expect_length(named, 3L)
|
||||
for (rel in named) {
|
||||
expect_true(file.exists(file.path(fixture_corpus_path(), rel)), info = rel)
|
||||
}
|
||||
# The four docs data-raw/regenerate_fixture_corpus.R copies, which
|
||||
# cog_mirror(include = "docs") expects to find.
|
||||
for (doc in c("README.md", "data_dictionary.md",
|
||||
"series_breaks.md", "reader-specification.md")) {
|
||||
expect_true(
|
||||
file.exists(file.path(fixture_corpus_path(), "docs", doc)), info = doc
|
||||
)
|
||||
}
|
||||
})
|
||||
@@ -65,3 +65,17 @@ test_that("cog_mirror reads back via a fresh session against the mirror", {
|
||||
expect_gt(nrow(r), 0L)
|
||||
expect_equal(unique(r$canonical_govid), "121011212191")
|
||||
})
|
||||
|
||||
test_that("cog_mirror(include = 'docs') copies the fixture's four docs (#73)", {
|
||||
skip_if_no_corpus()
|
||||
tmp <- tempfile("uscogmirror_"); dir.create(tmp)
|
||||
on.exit(unlink(tmp, recursive = TRUE))
|
||||
|
||||
# .mirror_docs() skips a missing local doc without a message, so this is
|
||||
# the only thing that notices when the fixture loses its docs/.
|
||||
cog_mirror(tmp, include = "docs", progress = FALSE)
|
||||
for (doc in c("README.md", "data_dictionary.md",
|
||||
"series_breaks.md", "reader-specification.md")) {
|
||||
expect_true(file.exists(file.path(tmp, "docs", doc)), info = doc)
|
||||
}
|
||||
})
|
||||
Reference in new issue
Block a user