#5169·gsd-core

chore(#5056): the runtime descriptor owns every runtime-specific fact, and an unknown id refuses — Phase 10

Author: trek-eCreated Oct 1, 2026Updated Oct 1, 2026
Labelsarea: coreneeds-triagetype: chore

Pre-submission checklist

  • This does not change user-facing behavior (commands, output, file formats, config)
  • I have searched existing issues — this has not already been filed

Scope note on the first checkbox: installer and hook output is pinned across the move except where a derivation was wrong. That exception is a class, stated in the ADR: an unknown runtime id refuses instead of falling through to Claude Code defaults (#4632 measured getGlobalConfigDir('gemini') returning ~/.claude). It ships with a Fixed changeset.

What is the maintenance task?

Phase 10 of epic #5056 (ADR-5057 §5, first three bullets): the runtime descriptor owns every runtime-specific fact, and an unknown id refuses. One accessor serves a runtime's host behaviors, one resolver serves which runtime is this install, and no install or hook code compares a runtime-name literal. Must precede Phases 11 and 12.

Type of maintenance

Refactoring / code quality

Current state

  • _hostBehaviors is duplicated in src/install-engine.cts:263 and src/runtime-artifact-conversion.cts:103.
  • src/install-engine.cts special-cases runtime === 'hermes', and other install and hook code compares runtime-name literals instead of reading a descriptor field.
  • Descriptor accessors fall through to Claude Code defaults for an id they do not know (#4632 comment: getGlobalConfigDir('gemini') returned ~/.claude).
  • The shell launcher's candidate list and the JS resolver are maintained separately, and consumers of which runtime is this install read the runtime without the install-time marker (#4690, #4347).

Proposed work

  • Census every runtime === '…' literal in install and hook code, every duplicated host-behavior accessor, and every runtime resolver that skips the install-time marker; publish the counts in the PR and drive them to zero.
  • Move each runtime-specific fact (including the Hermes bare-stem cleanup) into the runtime descriptor as a field; delete the second _hostBehaviors copy.
  • Every descriptor accessor refuses a runtime id it does not know.
  • One function reads the install-time marker; the launcher candidate list and the JS resolver derive from the same source.
  • A drift guard fails on a runtime-name literal outside the descriptor, with a positive control; a fast-check property over arbitrary non-canonical ids asserts that every accessor refuses.

Done when

  • Census published in the PR and driven to zero
  • One host-behaviors accessor; the duplicate is deleted
  • No runtime-name literal in install or hook code outside the descriptor
  • Every descriptor accessor refuses an unknown id (property test)
  • One install-time-marker reader; launcher and JS resolver share a source
  • A drift guard fails on a new runtime-name literal, with a positive control
  • Tests pass under gsd-test

Area affected

Multiple areas

Additional context

Epic: #5056. Design lock: ADR-5057 §5 and Phase 10. Phases 11 and 12 depend on this phase. Evidence (Refs): #4690, #4347, #4438, #4332.