Deduplicate Shiny and researcher-app memory/UI/sanitization code and tighten inst/shiny/ boundaries
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- r
- Domain
- backend, developer-experience
Research direction
Start by mapping the duplicated memory review modules in inst/shiny/R/mod_memory.R and R/researcher-app-memory.R, then trace their callers in tempest_app() and tempest_researcher_app(). The issue also names the sanitization, rendering, worker, and asset entry points across R/ and inst/shiny/R/; tackle one scoped area at a time. Done means the acceptance criteria are met and the Shiny, researcher-app, MCP-app, and enriched-render tests pass.
Written by the indexing model from the issue text.
Description
Problem
The bundled Shiny app (inst/shiny/, ~8,945 lines), researcher app (R/researcher-app*.R, ~4,400 lines), and MCP/enriched renderers duplicate substantial UI, Graft memory, sanitization, and worker logic, embed hundreds of lines of inline JS/CSS inside R string literals, and violate the inst/shiny/ package boundary (99 calls across 61 unexported tempest::: helpers, plus direct manager$.__enclos_env__$private$sessions introspection and non-UI domain/security logic inside inst/shiny/).
Scope
- Unify duplicated Graft memory UI/server & remove R6 private access
- Consolidate the ~370-line near-verbatim duplicate review module in
inst/shiny/R/mod_memory.R(mod_memory_report_server, L295–664) andR/researcher-app-memory.R(tempest_researcher_memory_review_server, L166–536), plus the duplicated sidebar/config selector, into one shared Shiny module inR/. - Move
shiny_memory_find_selection(),shiny_memory_wrap_config()(sharing tool-wrapping withR/researcher-app-tools.R), and Graft consultation extraction (eliminatingmanager$.__enclos_env__$private$sessionsatinst/shiny/R/mod_memory.R:733–756) intoR/graft-memory.R.
- Consolidate the ~370-line near-verbatim duplicate review module in
- Consolidate duplicated sanitization, rendering, URL, provider, and redaction helpers
- Remove the 52-line verbatim duplicate
sanitize_external_citation_markers()ininst/shiny/R/utils.R:77–128in favor oftempest_shinychat_sanitize_text()(R/shinychat-adapter.R:233–284), and replace hand-rolledtempest_shinychat_escape_html()withhtmltools::htmlEscape(). - Share one Markdown → sanitized HTML allowlist pipeline across
R/enriched-render.R:119–218,R/mcp-app.R:305–383, andinst/shiny/R/utils.R:29–75/mod_report.R:158–168. - Share safe URL validation, search provider choices (
inst/shiny/R/utils.R:11–25->R/config.R:595–609), topic/stream slugifiers, and credential redaction regex (3 verbatim copies insideR/researcher-app-worker.R:88,268,684+inst/shiny/R/mod_run_review.R:732–747).
- Remove the 52-line verbatim duplicate
- Extract large inline JS/CSS literals to static assets
inst/shiny/R/utils.R:583–1013(431L inline JS settings drawer) ->inst/shiny/www/settings-drawer.js.R/researcher-app-ui.R:25–465(441L inline CSS) -> static package asset (inst/).R/enriched-render.R:711–877(167L inline CSS) -> static package asset (inst/).
- Decompose Shiny monoliths and move non-UI domain logic into
R/- Move ZIP archive path-traversal/quota enforcement (
inst/shiny/R/mod_chat.R:2017–2136), verification threshold summary (mod_chat.R:1822–1834), trajectory authority-join filtering (mod_run_review.R:852–891), and STORM background worker NDJSON plumbing (mod_storm.R:507–796) into packageR/helpers. - Split
inst/shiny/R/mod_chat.R(2,410L, 962L server),inst/shiny/R/utils.R(1,963L — also movemindmap_to_visnetwork()tomod_mindmap.R), andinst/shiny/R/mod_run_review.R(1,370L) into focused modules. - Consolidate small researcher-app UI fragments (
R/researcher-app-example.R,R/researcher-app-evidence.R,R/researcher-app-briefs.R) intoR/researcher-app-ui.R.
- Move ZIP archive path-traversal/quota enforcement (
Acceptance Criteria
- One shared Graft memory review module serves both
tempest_app()andtempest_researcher_app(), with zero.__enclos_env__$privatereaches frominst/shiny/. - Citation sanitization, HTML sanitization, search providers, and credential redaction each have a single source of truth.
- Inline JS/CSS monoliths are served from static assets and Shiny modules are cleanly factored.
- All Shiny, researcher-app, MCP-app, and enriched-render tests pass.
- Dominant language
- R
- Stars
- 1
- Forks
- 0
- Avg merge
- 19h 6m
- Merged PRs (30d)
- 12
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from JamesHWade/tempest
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
JamesHWade/tempest#211 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
JamesHWade/tempest#209 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
JamesHWade/tempest#208 · 1 comment ·
Maintainers usually reply within 1 day
-
Consolidate duplicated persistence primitives, manifest validation, and multi-pass restore checksOpen
Difficulty 5/5 Over a week Newbie friendliness 35/100
JamesHWade/tempest#207 · 1 comment ·
Maintainers usually reply within 1 day
-
Simplify Tempest external API surfaceMay be free again @JamesHWade claimed this 69 days ago, and no pull request is open. Openmigrated-from-kata
JamesHWade/tempest#83 · 3 comments · 1 assignee ·
Maintainers usually reply within 1 day
All issues in JamesHWade/tempest
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
bug dependencies R
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
enhancement needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
JamesHWade/graft#142 ·
Maintainers usually reply within 1 day