Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data-raw/example_context_fwcp_peace.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Fetch spatial context layers for FWCP Peace vignette from fwapg
#
# Same recipe as example_context_kotl.R but tuned for the much larger
# Same recipe as example_context_kootenay_lake.R but tuned for the much larger
# Peace region: bigger lake threshold, higher minimum stream order to
# keep map density reasonable, town list relevant to the Peace.
#
Expand Down
107 changes: 0 additions & 107 deletions data-raw/example_context_kotl.R

This file was deleted.

Binary file removed inst/extdata/context_kotl.gpkg
Binary file not shown.
14 changes: 14 additions & 0 deletions planning/archive/2026-10-issue-112-context-kotl/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Outcome

`inst/extdata/context_kotl.gpkg` shipped in every install with no reader. Its only consumer, the KOTL vignette, was removed in #50, and `context_kootenay_lake.gpkg` (#57) holds the same five layer kinds plus wsgs and ecoregions over an area that contains KOTL. The file was deleted. Its producer `data-raw/example_context_kotl.R` was deleted too, rather than marked superseded, so nothing can recreate it; git history keeps the recipe. `example_aoi_kotl.gpkg` and its producer stay because the README quick-start reads them. Three code-check rounds came back Clean: code readers, including an org-wide `gh` code search; the build/publish file set; and the supersession claim and doc truth. One leftover: the two remaining `data-raw/example_context_*` headers now cite each other as "same recipe". Both reviewers who noticed judged it harmless.

## Measurement

R 4.5.2. `R CMD build --no-build-vignettes --no-manual` on `git archive` of `048f93a` vs the change, each installed with `R CMD INSTALL -l` into a scratch library:

- **Tarball:** 7,146,394 → 3,830,880 B (−46%), 101 → 100 files.
- **Installed `cd/`:** 12,776 → 7,948 KB (−38%).

The issue's "loses 4.9 MB" holds for installed size. The gpkg compresses, so the download shrinks by 3.3 MB. After-tarball `R CMD check --no-manual --ignore-vignettes`: Status OK, 0 NOTEs. `devtools::test()`: PASS 436, FAIL 0. The reproduce commands are in `findings.md`.

Closed by: commit 1d17163 / PR #115
46 changes: 46 additions & 0 deletions planning/archive/2026-10-issue-112-context-kotl/findings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Findings — inst/extdata/context_kotl.gpkg (4.9 MB) ships but nothing reads it (#112)

## Issue context

**If we do it:** the installed package loses 4.9 MB, about 40% of its 12.5 MB installed size. **If we never do:** every install carries a file nothing reads.

## Problem

`inst/extdata/context_kotl.gpkg` is 4.9 MB. Nothing in `R/`, `tests/`, `vignettes/` or `README.md` references it. The only mention is its producer, `data-raw/example_context_kotl.R`, plus a comment in `data-raw/example_context_fwcp_peace.R`. It dates from `3ece27c` (2026-04-07, before the Kootenay Lake vignette). The vignette added in #57 uses `context_kootenay_lake.gpkg`, which appears to supersede it. `example_aoi_kotl.gpkg` is still used by the README example, so keep it.

Found by a code-check reviewer while verifying #100's tarball contents, and confirmed with `git grep -n context_kotl`.

## Proposed Solution

- Confirm `context_kootenay_lake.gpkg` supersedes it. Then delete `inst/extdata/context_kotl.gpkg`, and either delete `data-raw/example_context_kotl.R` or mark it superseded.
- Rebuild and compare the tarball size before and after.

## Supersession (plan-mode exploration, 2026-10-02)

- `git grep context_kotl` outside `planning/` hit only the producer and one comment in `data-raw/example_context_fwcp_peace.R`.
- The file's consumer, the KOTL vignette, was removed in #50 (NEWS.md, v0.2.x entry). That entry's "KOTL polygon assets stay" refers to `example_aoi_kotl.gpkg`, used at README.md:23 and kept.
- `context_kootenay_lake.gpkg` (#57) layers: lakes, rivers, streams, highways, wsgs, ecoregions, towns over KOTL+LARL+DUNC+SLOC. `context_kotl.gpkg` layers: towns, lakes, rivers, streams, highways over KOTL only. Superset.
- Code-check round 1 widened this: no `list.files()` over `inst/extdata`, no pattern-built filenames, and an org-wide `gh` code search found no other repo reading the file.

## Measurement

R 4.5.2, `R CMD build --no-build-vignettes --no-manual` on `git archive` of HEAD (`048f93a`) vs the staged tree (`git write-tree`), then `R CMD INSTALL -l` into a scratch library:

| | before | after | change |
|---|---|---|---|
| tarball | 7,146,394 B | 3,830,880 B | −3.3 MB (−46%) |
| tarball files | 101 | 100 | only `inst/extdata/context_kotl.gpkg` gone |
| installed `cd/` | 12,776 KB | 7,948 KB | −4.7 MB (−38%) |
| installed `extdata/` | 11,796 KB | 6,968 KB | −4.7 MB |

The gpkg compresses in the tarball (4.9 MB raw → ~3.3 MB of tarball), so the issue's "loses 4.9 MB" holds for the installed size, not the download.

After-tarball `_R_CHECK_FORCE_SUGGESTS_=false R CMD check --no-manual --ignore-vignettes`: **Status: OK** (0 NOTEs; #111 had already cleared the last two). `devtools::test()`: FAIL 0 | WARN 6 | SKIP 0 | PASS 436. `system.file("extdata", "example_aoi_kotl.gpkg", package = "cd")` resolves in the installed after-library and reads 1 feature.

Reproduce (per side; `<tree>` is `HEAD` or `$(git write-tree)`):

```bash
git archive <tree> | tar -x -C src && R CMD build --no-build-vignettes --no-manual src
wc -c < cd_0.5.8.tar.gz; tar -tzf cd_0.5.8.tar.gz | wc -l
R CMD INSTALL -l lib cd_0.5.8.tar.gz && du -sk lib/cd lib/cd/extdata
```
13 changes: 13 additions & 0 deletions planning/archive/2026-10-issue-112-context-kotl/progress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Progress — inst/extdata/context_kotl.gpkg (4.9 MB) ships but nothing reads it (#112)

## Session 2026-10-02

- Plan-mode exploration — phases approved by user (delete producer script too, not mark superseded)
- Created branch `112-inst-extdata-context-kotl-gpkg-4-9-mb-shi` off main
- Scaffolded PWF baseline from issue #112 with approved phases
- Next: start Phase 1
- Phase 1: baseline tarball 7,146,394 B / installed 12,776 KB from `git archive HEAD`
- Phase 2: `git rm` of `inst/extdata/context_kotl.gpkg` + `data-raw/example_context_kotl.R`; repointed `example_context_fwcp_peace.R:3` to `example_context_kootenay_lake.R`; `git grep context_kotl` outside planning/ empty
- Phase 3: after tarball 3,830,880 B / installed 7,948 KB; R CMD check Status OK; `devtools::test()` PASS 436 FAIL 0; README AOI resolves (numbers in findings.md)
- /code-check: 3 rounds (code readers, build/publish file set, supersession + doc truth), all Clean — `review-round{1,2,3}.md`
- Next: /planning-archive, /gh-pr-push
14 changes: 14 additions & 0 deletions planning/archive/2026-10-issue-112-context-kotl/review-round1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Code-check review round 1 — #112 (staged diff)

## Clean
No issues found.

### What was verified
- `git grep -i kotl` outside `planning/archive/`: no reader of `context_kotl` in `R/`, `tests/`, `vignettes/`, `scripts/`, `.github/`, `README.md`, `_pkgdown.yml`, `DESCRIPTION`, `.Rbuildignore`, or other `inst/` files. Remaining `kotl` hits are `example_aoi_kotl.gpkg` (README.md:23, kept), its kept producer `data-raw/example_aoi_kotl.R`, WSG code strings, and NEWS history.
- Indirect readers: every `list.files()` in `R/` and `scripts/` targets cache / grib / cog / monthly dirs, never `inst/extdata`; all `system.file("extdata", ...)` calls use literal names of files that still exist; no `paste0("context_", ...)` style construction anywhere.
- Ecosystem: local grep over `~/Projects/repo` and `gh` code search (`org:NewGraphEnvironment context_kotl`, default branches) find only cd's own producer, the edited comment, and planning/archive + sred evidence dumps (history). No external package reads `system.file(..., "context_kotl.gpkg", package = "cd")`.
- Edited comment (`data-raw/example_context_fwcp_peace.R:3`): `example_context_kootenay_lake.R` exists, uses the same recipe (frs_db_query towns/lakes/rivers/streams/highways/wsgs/ecoregions, same st_write layering), and its thresholds (lakes > 200 ha, stream order >= 5) are lower than Peace's (> 1000 ha, >= 7), so "bigger lake threshold, higher minimum stream order" remains accurate. That file's header reciprocally says "Same recipe as example_context_fwcp_peace.R".
- Deleting the producer removes the only writer of `inst/extdata/context_kotl.gpkg`; nothing left can regenerate the deleted file.

### Pre-existing, not introduced by this diff (FYI only)
- `data-raw/example_context_fwcp_peace.R:8` lists output layers as "towns, lakes, streams, highways" but the script also writes rivers, wsgs, ecoregions. Untouched line; not a failure.
15 changes: 15 additions & 0 deletions planning/archive/2026-10-issue-112-context-kotl/review-round2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Review round 2 — #112 (build/publish side)

## Clean
No issues found.

Checked:
- `.github/workflows/pkgdown.yaml`: no step copies, size-checks, globs or uploads `inst/extdata`. The allowed-pages gate looks at root markdown pages, not extdata.
- `.github/workflows/climate-update.yml`, `update-citation-cff.yaml`: no extdata references.
- Vignettes: `kootenay-lake.Rmd` loads `example_aoi_kootenay_lake.gpkg` and `context_kootenay_lake.gpkg`, and `peace-fwcp.Rmd` loads the fwcp_peace files and the commentary CSV. Both are still present. Neither vignette uses `kotl`.
- `R/cd_stac_catalog.R:37` lists only `\.tif$` in `cog_dir`. The `tests/testthat/test-cd_stac_catalog.R` expectations are `>= 1` row/item checks over `example_climate.tif`, so removing a gpkg cannot change them.
- `list.files` / `dir_ls` across R/, tests/, vignettes/, data-raw/ and scripts/: none of them point at extdata as a directory, apart from the tif-filtered STAC call above.
- No reference to `context_kotl` or `example_context_kotl` is left outside planning/ and .git. README still uses `example_aoi_kotl.gpkg`, which is kept.
- The new referent `data-raw/example_context_kootenay_lake.R` exists and describes the same fwapg recipe.

Note (not a defect): `example_context_kootenay_lake.R:3` and `example_context_fwcp_peace.R:3` now each say "same recipe as" the other. The pointer is circular but both files exist, so it is harmless.
22 changes: 22 additions & 0 deletions planning/archive/2026-10-issue-112-context-kotl/review-round3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Review round 3 — #112 supersession claim and documentation truth

## Clean
No issues found.

Checked (outside planning/archive/ and docs/):

- (a) Supersession: `context_kootenay_lake.gpkg` writes towns, lakes, rivers, streams,
highways (the deleted file's five layers) plus wsgs and ecoregions, over an AOI
(KOTL+LARL+DUNC+SLOC) that contains KOTL. Nothing — README, CLAUDE.md, vignettes,
data-raw headers, .github, tests, R/, man/, _pkgdown.yml — promises a KOTL context
layer. No `research/` directory exists.
NEWS.md:169 ("KOTL polygon assets stay in inst/extdata/ because the README quick-start
still uses them") is a v0.1.4 release-history entry; its premise still holds for the
asset the README uses (README.md:23 reads `example_aoi_kotl.gpkg`, which is kept). Not
made false in any way a reader would act on; history is immutable per repo convention.
- (b) No live doc or comment names `context_kotl.gpkg` or `example_context_kotl.R`
(only NEWS.md:149 lists `context_kootenay_lake.gpkg`, which exists).
- (c) `example_context_fwcp_peace.R:3` and `example_context_kootenay_lake.R:3` now cite
each other as "same recipe". Both scripts are self-contained and the comparisons
("much larger" Peace, ~73,000 vs ~24,200 km^2) are true; the mutual reference conveys
a sibling relationship and would not lead a reader into wrong action.
38 changes: 38 additions & 0 deletions planning/archive/2026-10-issue-112-context-kotl/task_plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Task: inst/extdata/context_kotl.gpkg (4.9 MB) ships but nothing reads it (#112)

`inst/extdata/context_kotl.gpkg` is 4.9 MB. Nothing in `R/`, `tests/`, `vignettes/` or `README.md` references it. The only mention is its producer, `data-raw/example_context_kotl.R`, plus a comment in `data-raw/example_context_fwcp_peace.R`. It dates from `3ece27c` (2026-04-07, before the Kootenay Lake vignette). The vignette added in #57 uses `context_kootenay_lake.gpkg`, which appears to supersede it. `example_aoi_kotl.gpkg` is still used by the README example, so keep it.

Found by a code-check reviewer while verifying #100's tarball contents, and confirmed with `git grep -n context_kotl`.

## Context (from plan-mode exploration)

`inst/extdata/context_kotl.gpkg` ships in every install and nothing reads it. Exploration confirmed the issue's claim and the supersession it asked about:

- `git grep context_kotl` outside `planning/` hits only its producer `data-raw/example_context_kotl.R` and a "Same recipe as example_context_kotl.R" comment at `data-raw/example_context_fwcp_peace.R:3`. Nothing in `R/`, `tests/`, `vignettes/`, `README.md`.
- Its consumer, the KOTL vignette, was removed in v0.2.x (#50, NEWS.md:169). That NEWS line says the KOTL *polygon* assets stay for the README — that is `example_aoi_kotl.gpkg` (README.md:23), which this work keeps.
- `context_kootenay_lake.gpkg` (2.2 MB, #57) covers the KOTL+LARL+DUNC+SLOC superset with the same layer kinds (towns, lakes, rivers, streams, highways) plus wsgs and ecoregions. Superseded.
- The only test touching `extdata` as a directory (`test-cd_stac_catalog.R`) lists `*.tif` only, so removing a gpkg cannot affect it.

**Decision taken in this plan (recommended): delete the producer script too**, rather than mark it superseded. A kept script for a deleted output is a trap — running it recreates the 4.9 MB file under `inst/extdata/` — and git history keeps the recipe. `example_aoi_kotl.R` stays (README asset).

## Phase 1: Baseline measurement
- [x] Build tarball from `git archive HEAD` (`R CMD build --no-build-vignettes --no-manual`), record tarball size and installed `inst/extdata` size — same method as #100's archive README

## Phase 2: Remove the asset and its producer
- [x] `git rm inst/extdata/context_kotl.gpkg data-raw/example_context_kotl.R`
- [x] `data-raw/example_context_fwcp_peace.R:3`: repoint "Same recipe as example_context_kotl.R" at `example_context_kootenay_lake.R` (the live sibling)
- [x] `git grep -n context_kotl -- ':(exclude)planning'` returns nothing

## Phase 3: Verify
- [x] Rebuild tarball, compare size before/after; record both in `findings.md`
- [x] `devtools::test()` passes
- [x] `R CMD check --no-manual --ignore-vignettes` on the tarball (`_R_CHECK_FORCE_SUGGESTS_=false`) — no new NOTEs vs v0.5.8
- [x] README example still resolves `example_aoi_kotl.gpkg` via `system.file()`

## Validation
- [x] Tests pass
- [x] `/code-check` clean on each commit
- [x] PWF checkboxes match landed work
- [x] `/planning-archive` on completion (README carries the before/after measurement)

NEWS line and version bump are left to `/gh-pr-merge` (patch release).
Loading