Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

refactor([issue-3252]): address review (ollama): derive the rec gate's module from the topic registry

[._.]/ Adam Eivy2109adef8128
diff --git a/server/services/meatspacePost.js b/server/services/meatspacePost.js
index 3c4ee63d5a..a7c245b7cd 100644
--- a/server/services/meatspacePost.js
+++ b/server/services/meatspacePost.js
@@ -1117,6 +1117,19 @@ export function composePostRecommendations({
// Coarse module → config key for the enabled-drill lookup.
const MODULE_CONFIG_KEY = { 'mental-math': 'mentalMath', 'llm-drills': 'llmDrills', cognitive: 'cognitive' };
+/**
+ * The module string `isRecDrillRunnable` should be called with for a given drill
+ * type, derived from the topic registry rather than hardcoded per call site.
+ *
+ * Morse carries a null registry module (it never posts a scored POST task) but is
+ * gated by its own config block, so it maps to the `morse` pseudo-module the gate
+ * understands. `fallback` covers a drill type with no registry entry.
+ */
+function recModuleForDrillType(type, fallback) {
+ const topic = resolveTopicForDrillType(type);
+ return topic ? (topic.module || topic.id) : fallback;
+}
+
/**
* Whether a recommended drill can actually be run under the current config
* (issue #2100 review): a weak-skill / stalled rec deep-links into a session,
@@ -1213,8 +1226,7 @@ export async function getPostRecommendations({ limit = RECOMMENDATION_LIMIT } =
// isRecDrillRunnable exactly as the stalled rec for that same ladder does.
const enabledDueReviews = dueReviews.filter((review) => {
if (review.kind === 'memory') return isMemoryItemEnabled(config, memoryItemIdFromReview(review));
- const module = review.kind === 'multiplication' || review.drillType === 'multiplication' ? 'mental-math' : 'cognitive';
- return isRecDrillRunnable(config, module, review.drillType);
+ return isRecDrillRunnable(config, recModuleForDrillType(review.drillType, 'cognitive'), review.drillType);
});
// Stalled progressions — Morse runs from its own tab (so it's gated by its own
@@ -1224,11 +1236,7 @@ export async function getPostRecommendations({ limit = RECOMMENDATION_LIMIT } =
kochLevel: morse?.kochLevel,
kochLevelSet: morse?.kochLevelSet,
maxKochLevel: MAX_KOCH_LEVEL,
- }).filter(s => isRecDrillRunnable(
- config,
- s.drillType === 'morse-copy' ? 'morse' : s.drillType === 'multiplication' ? 'mental-math' : 'cognitive',
- s.drillType,
- ));
+ }).filter(s => isRecDrillRunnable(config, recModuleForDrillType(s.drillType, 'cognitive'), s.drillType));
return {
recommendations: composePostRecommendations({