Skip to content

session-start hook: gate local-source load on Package == 'saber'#31

Merged
TroyHernandez merged 1 commit into
mainfrom
fix-hook-local-load-guard
Jun 7, 2026
Merged

session-start hook: gate local-source load on Package == 'saber'#31
TroyHernandez merged 1 commit into
mainfrom
fix-hook-local-load-guard

Conversation

@TroyHernandez

Copy link
Copy Markdown
Contributor

Summary

The session-start hook's local-load fallback (intended so saber developers iterating on saber itself see their changes immediately) sources every R/*.R file in the current git repo and looks up the named function. From any repo that happens to export a function with the same name as a saber export, this picked up the wrong function.

Concretely, from ~/cerebro the hook found cerebro::briefing(name, ...) (a different beast — the daily-briefing capability) instead of saber::briefing(project, scan_dir, ...). The hook's briefing_fun(project, scan_dir = scan_dir) call then failed with "unused argument (scan_dir = scan_dir)" and the SessionStart briefing degraded to the "saber not available:" fallback.

Fix: guard the local-load dance on the local DESCRIPTION's Package: field being saber. Everywhere else, fall through to the installed saber namespace as before.

Test plan

  • From ~/cerebro (which has cerebro::briefing): hook now produces a normal briefing instead of the "saber not available" fallback.
  • From ~/saber (the local-dev case): hook still sources locally and produces the briefing.
  • tinypkgr::check() clean.

Release plan

No version bump in this PR. Bundle into the next saber release whenever there's something else to ship — the impact is narrow (only fires when (a) saber is installed AND (b) the current repo exports a function with the same name as a saber export).

The hook's local-load fallback (intended for saber developers iterating
on saber itself) sources every R/*.R in the current git repo and looks
up the named function. From any repo that exports a function with the
same name as a saber export but a different signature, this picked up
the wrong function. Concretely: cerebro::briefing(name, ...) was
loaded instead of saber::briefing(project, scan_dir, ...), and the
hook's scan_dir = scan_dir call blew up.

Guard the local-load path on the local DESCRIPTION's Package field
being 'saber'. Everywhere else, fall through to the installed
saber namespace as before.
@TroyHernandez TroyHernandez merged commit 2cc3e0b into main Jun 7, 2026
4 checks passed
@TroyHernandez TroyHernandez deleted the fix-hook-local-load-guard branch June 7, 2026 02:46
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.

1 participant