refactor: remove dead descriptor-driven mechanisms (no remaining consumer)
Drop code whose only consumer was a retired runtime: hostBehaviors readers for agentFileExtension, localTargetIsProjectRoot, sharedHooksDirName, skillsManifestPrefix and skipCodexSkillsManifest; the empty NON_REGISTRY_CONFIG_HOME_DESCRIPTORS array and live-config-guard plumbing; the empty RUNTIME_NOTE_AUDIENCE_BY_HEADING filter; the unused resolveVersionFrom export; and the WINDSURF_SESSION_ID workstream session key. Delete tests that only exercised those mechanisms.
This commit is contained in:
@@ -185,7 +185,6 @@ module.exports = {
|
||||
"tests/runtime-name-policy.test.cjs",
|
||||
"tests/security.test.cjs",
|
||||
"tests/settings-jsonc.test.cjs",
|
||||
"tests/shared-hooks-dir-resolution.test.cjs",
|
||||
"tests/shell-command-projection-dispatch.test.cjs",
|
||||
"tests/spawn-liveness-banner.test.cjs",
|
||||
"tests/state-document.test.cjs",
|
||||
|
||||
@@ -234,7 +234,6 @@ module.exports = {
|
||||
"tests/security.test.cjs",
|
||||
"tests/settings-jsonc.test.cjs",
|
||||
"tests/sh-hook-paths.test.cjs",
|
||||
"tests/shared-hooks-dir-resolution.test.cjs",
|
||||
"tests/shell-command-projection-dispatch.test.cjs",
|
||||
"tests/shell-command-projection-path-sep.test.cjs",
|
||||
"tests/ship-notes-wedged-pr.test.cjs",
|
||||
|
||||
@@ -209,19 +209,6 @@ function artifactTargets(deps = {}) {
|
||||
return derived;
|
||||
}
|
||||
|
||||
/**
|
||||
* The file MSD writes into a NON-REGISTRY config home.
|
||||
*
|
||||
* NON_REGISTRY_CONFIG_HOME_DESCRIPTORS is empty today (its former entries were
|
||||
* native `config.toml` hook homes of since-retired runtimes), so this filename
|
||||
* is currently unused. NAMED RESIDUAL: this assumes every non-registry
|
||||
* descriptor is written the same way; a future descriptor whose owned file
|
||||
* differs needs a per-descriptor mapping here. The consequence of getting it wrong
|
||||
* is under-watching (a missed leak), not a false positive, so it fails in the quiet
|
||||
* direction and is called out rather than left to be discovered.
|
||||
*/
|
||||
const NON_REGISTRY_OWNED_FILE = 'config.toml';
|
||||
|
||||
/**
|
||||
* Bounds on the recursive walk, so a pathological tree cannot stall the suite.
|
||||
*
|
||||
@@ -335,32 +322,17 @@ function resolveLiveConfigRoots(deps = {}) {
|
||||
* #2665 round 3: resolveLiveConfigRoots enumerates getGlobalConfigDir per registry
|
||||
* runtime plus grok. A live write surface that is not a config ROOT is invisible to
|
||||
* that shape, so a leak on one passed through this guard — the PR's own safety net —
|
||||
* silently. Today: $MSD_HOME/.msd, plus one config.toml per entry in
|
||||
* NON_REGISTRY_CONFIG_HOME_DESCRIPTORS (currently none):
|
||||
* silently. Today: $MSD_HOME/.msd:
|
||||
*
|
||||
* $MSD_HOME/.msd — MSD's user-owned store (consent.json, defaults.json, capability
|
||||
* overlays). Watched WHOLESALE: unlike ~/.claude this root is
|
||||
* exclusively ours, so the shared-root false-positive trap in
|
||||
* SCOPE above does not apply and an ownership filter would only
|
||||
* narrow the guard for nothing.
|
||||
* <non-registry home>/config.toml — the file MSD writes its native [[hooks]] block
|
||||
* into, one per NON_REGISTRY_CONFIG_HOME_DESCRIPTORS entry
|
||||
* (none today). The INVERSE case: those roots
|
||||
* belong to their products, so the root is never watched
|
||||
* wholesale. This is the KNOWN GAP above accepted deliberately
|
||||
* in one direction — MSD demonstrably writes these files
|
||||
* (bin/install.js resolves the hooks-toml dir at two sites), so
|
||||
* a concurrent write by those products is the only false
|
||||
* positive, and neither runs during the suite. NOT watched, and
|
||||
* it is a real residual rather than a bound: <root>/hooks/, the
|
||||
* bundle installSharedHooksBundle writes into the same roots —
|
||||
* see resolveExtraWatchTargets for why closing it is a layout
|
||||
* decision.
|
||||
*
|
||||
* @returns {string[]} absolute paths; empty if the built lib is absent.
|
||||
*/
|
||||
function resolveExtraWatchTargets(deps = {}) {
|
||||
const libDir = deps.libDir || path.join(__dirname, '..', 'msd-core', 'bin', 'lib');
|
||||
const env = deps.env || process.env;
|
||||
const homedir = (deps.os || os).homedir;
|
||||
|
||||
@@ -373,45 +345,6 @@ function resolveExtraWatchTargets(deps = {}) {
|
||||
path.resolve(path.join(homedir(), '.msd')),
|
||||
];
|
||||
|
||||
try {
|
||||
const {
|
||||
NON_REGISTRY_CONFIG_HOME_DESCRIPTORS,
|
||||
resolveConfigHomeFromDescriptor,
|
||||
} = require(path.join(libDir, 'runtime-homes.cjs'));
|
||||
|
||||
// ITERATE the descriptor array rather than naming one resolver — a
|
||||
// partial enumeration would silently miss a future entry. TEST_ENV_BASE
|
||||
// derives its keys from this array; deriving the guard's paths from it
|
||||
// keeps the two halves from drifting apart.
|
||||
//
|
||||
// Thread the SAME injected env/home used above: resolving bare would read
|
||||
// process.env and os.homedir() regardless of `deps`, leaving the seam
|
||||
// untestable and the targets resolved against different worlds.
|
||||
for (const descriptor of NON_REGISTRY_CONFIG_HOME_DESCRIPTORS) {
|
||||
// The fallback leg, per the note above: a child that blanks the
|
||||
// descriptor's env var writes to the HOME-derived root instead of the
|
||||
// ambient one.
|
||||
const fallbackDir = resolveConfigHomeFromDescriptor(descriptor, { env: {}, home: homedir() });
|
||||
if (typeof fallbackDir === 'string' && fallbackDir.length > 0) {
|
||||
targets.push(path.resolve(path.join(fallbackDir, NON_REGISTRY_OWNED_FILE)));
|
||||
}
|
||||
const dir = resolveConfigHomeFromDescriptor(descriptor, { env, home: homedir() });
|
||||
// The root belongs to the runtime, so it is never watched wholesale — only
|
||||
// the named file below.
|
||||
//
|
||||
// NAMED RESIDUAL (#2665, found pre-push while rebasing): config.toml may
|
||||
// NOT be the only thing MSD writes here — an installer may also populate
|
||||
// <root>/hooks/ with MSD's hook scripts and a CommonJS marker. That
|
||||
// subtree is UNWATCHED, so a suite-produced leak of a hook bundle into a
|
||||
// developer's real non-registry root passes this guard silently. Closing it needs a layout
|
||||
// decision, not one more path: the same reason getGlobalSkillsBase is a
|
||||
// deliberate non-target above. Under-watching fails quiet, like the
|
||||
// NON_REGISTRY_OWNED_FILE residual it sits beside.
|
||||
targets.push(path.resolve(path.join(dir, NON_REGISTRY_OWNED_FILE)));
|
||||
}
|
||||
} catch {
|
||||
// Unbuilt tree — same posture as resolveLiveConfigRoots: advisory, never fatal.
|
||||
}
|
||||
// Both legs can coincide when no override is set; the snapshot keys on path,
|
||||
// but dedupe anyway so the RV-facing target count means what it says.
|
||||
return [...new Set(targets)];
|
||||
|
||||
Reference in New Issue
Block a user