fix(plugins): the silent-degrade doors close — a broken accelerator install can never read as absent
The auto-detection "not installed" heuristic accepted any resolution failure whose message merely CONTAINED the package name, unterminated — so a missing platform-binary sibling package (what a deploy replacing node_modules mid-restart leaves behind) read as "the accelerator is not installed", and brainy silently served the default WASM engines with zero journal lines. A production restart storm paid 90 seconds of throttled WASM compile behind exactly that hole. The name must now terminate where it ends (quote, whitespace, punctuation, end) — a sibling package, an inner file path, or a dependency failure is a broken install and init() throws, as the guard's own law always stated. Second door: activate() returning false (the documented graceful decline) warned on console.warn, which `silent: true` patches away — an invisible degrade. The decline now narrates via the always-on channel. Also exports CanonicalCounts from the public surface (the coverage-ledger denominator type consumers read through getCanonicalCounts()). Pinned in tests/unit/plugin-activation-loudness.test.ts (five error shapes; the decline warn under silent: true).
This commit is contained in:
parent
18f172e098
commit
b9ba50fbec
4 changed files with 92 additions and 6 deletions
|
|
@ -9,6 +9,7 @@
|
|||
* registered manually via `brain.use()` — there is no implicit detection.
|
||||
*/
|
||||
|
||||
import { prodLog } from './utils/logger.js'
|
||||
import type {
|
||||
StorageAdapter,
|
||||
Vector,
|
||||
|
|
@ -1574,9 +1575,13 @@ export class PluginRegistry {
|
|||
this.activated.add(name)
|
||||
activated.push(name)
|
||||
} else {
|
||||
// Documented graceful decline (activate() → false). Surface it loudly so
|
||||
// a silent degrade to the default engine never goes unnoticed.
|
||||
console.warn(
|
||||
// Documented graceful decline (activate() → false). Surface it on the
|
||||
// ALWAYS-ON channel: `silent: true` patches console, and a declined
|
||||
// accelerator warned into a patched console is a silent degrade to the
|
||||
// default engines — the exact invisible-fallback class this registry
|
||||
// exists to prevent (a production storm ran the WASM engine for 90s
|
||||
// behind one suppressed warn).
|
||||
prodLog.warn(
|
||||
`[brainy] Plugin "${name}" declined activation (activate() returned false); ` +
|
||||
`the default engine is in use for its providers.`
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue