enhance(#4401): register workflow.compact_content as a validated config key (#4441)

* feat(#4401): register workflow.compact_content as a validated config key

- Add compact_content: false to the nested workflow object in
  gsd-core/bin/shared/config-defaults.manifest.json
- Add 'workflow.compact_content': false to SCHEMA_DEFAULTS in src/config.cts
  so an absent key resolves to false via config-get --raw
- validKeys entry in config-schema.manifest.json already present

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* test(#4401): behavioral and boundary tests for workflow.compact_content

- 19 behavioral tests covering config-set/config-get round trip, invalid-shape
  rejection (banana, 42, empty string), the corrected null-unset semantics
  (#2046), absent-key resolution against config-defaults.manifest.json,
  config-new-project wiring, and doc-row shape assertions
- Drops the install-tree fixture-parity block (and its docstring item) that
  asserted gsd-core/references/compact-content-gate.md and
  gsd-core/workflows/compact/map-codebase.md fixture entries — those paths
  belong to #4402 and do not exist on this filtered branch

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* docs(#4401): document workflow.compact_content in both config references

- One 4-cell row in docs/CONFIGURATION.md (workflow.* run)
- One 5-cell row under Workflow Fields in gsd-core/references/planning-config.md
- Both cross-reference ADR-4139

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* chore(#4401): add changeset

- Added-type fragment, pr: 4401 (issue number; backfill to the real PR number
  is a required follow-up once the PR is opened, per D-08 and CHANGESET-PR-
  FIELD-DRIFT)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* chore(#4401): backfill changeset pr field to #4441

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(#4401): derive workflow.compact_content default from CONFIG_DEFAULTS

SCHEMA_DEFAULTS['workflow.compact_content'] hardcoded the literal false
instead of deriving it from CONFIG_DEFAULTS the way 3 of its 8 sibling
entries do (smart_zone_tokens, pr_strict, inline_plan_threshold), leaving
a single-source-of-truth drift risk: a future manifest-only edit to the
default could silently diverge from this literal, only caught later by
the D-03 test if it ever happened to manifest.

Adds compact_content to CONFIG_DEFAULTS in src/config-loader.cts and
derives SCHEMA_DEFAULTS from it in src/config.cts, matching the majority
sibling pattern. Found during maintainer review (review-open-prs) of
this PR.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(#4401): map compact_content in config-field-docs NAMESPACE_MAP

The previous commit added compact_content to CONFIG_DEFAULTS in
src/config-loader.cts but missed the matching entry in
tests/config-field-docs.test.cjs's NAMESPACE_MAP, which maps flat
CONFIG_DEFAULTS keys to their namespaced doc form before checking
gsd-core/references/planning-config.md for a match. Without it, the
test looked for a bare `compact_content` doc reference instead of the
actual `workflow.compact_content` row, and failed:
"CONFIG_DEFAULTS keys missing from planning-config.md: compact_content".

Found by actually running gsd-test against the branch rather than
trusting the plausible-looking fix.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* test(#4401): register compact-content-4139 test in the docs-guard lane

tests/compact-content-4139.test.cjs's D-06 tests read docs/CONFIGURATION.md
directly (fs.readFileSync) to assert the workflow.compact_content doc row's
shape, which makes it a doc-reading test file under the #3753 docs-guard
lane. It was never added to scripts/docs-guard-registry.cjs's
DOCS_GUARD_TESTS map and carries no docs-guard-exempt marker, so
tests/ci-docs-guard-registry.test.cjs's registration lint correctly failed:
"compact-content-4139.test.cjs reads a docs/ path but is not registered in
the docs-guard lane and carries no docs-guard-exempt marker".

Registers it with ['docs/CONFIGURATION.md'] (the only real docs/-prefixed
path it reads; gsd-core/references/planning-config.md is outside this
registry's docs/ scope, matching the sibling config-field-docs.test.cjs
entry's existing convention).

Found by actually running gsd-test against the branch — this gap predates
the maintainer's config-loader.cts fix and was already present in the
original PR.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Tom Boucher <trekkie@nomorestars.com>
Co-authored-by: sim <sim@local>
This commit is contained in:
Brenden Smerbeck
2026-09-06 19:52:59 -04:00
committed by GitHub
parent 2cf119f57e
commit e54d3aa159
10 changed files with 331 additions and 0 deletions

View File

@@ -144,6 +144,7 @@ const CONFIG_DEFAULTS = {
firecrawl: _getConfigDefault('firecrawl'),
exa_search: _getConfigDefault('exa_search'),
text_mode: _getNestedConfigDefault('workflow', 'text_mode'),
compact_content: _getNestedConfigDefault('workflow', 'compact_content'),
sub_repos: _getNestedConfigDefault('planning', 'sub_repos'),
pr_strict: _getNestedConfigDefault('planning', 'pr_strict'),
resolve_model_ids: _getConfigDefault('resolve_model_ids'),

View File

@@ -104,6 +104,11 @@ const SCHEMA_DEFAULTS: Record<string, unknown> = {
// #1689: per-plan agent_hint executor routing — default-on. A no-op for plans
// without an agent_hint field, so existing dispatch is byte-identical.
'workflow.agent_hint_routing': true,
// #4401: Compact Content mode gate — derived from the defaults manifest via
// CONFIG_DEFAULTS (added in config-loader.cts) so the manifest stays the
// single source of truth, matching workflow.smart_zone_tokens /
// planning.pr_strict / workflow.inline_plan_threshold below.
'workflow.compact_content': CONFIG_DEFAULTS.compact_content,
// Derived from the defaults manifest rather than restated, so the manifest
// stays the single source of truth for the smart-zone budget (#2630).
'workflow.smart_zone_tokens': CONFIG_DEFAULTS.smart_zone_tokens,
@@ -345,6 +350,7 @@ function buildNewProjectConfig(userChoices: Record<string, unknown>): Record<str
human_verify_mode: 'end-of-phase',
context_guard_mode: 'warn',
text_mode: false,
compact_content: false,
research_before_questions: false,
discuss_mode: 'discuss',
skip_discuss: false,
@@ -858,6 +864,13 @@ function cmdConfigSet(cwd: string, keyPath: string | undefined, value: string |
}
}
// Compact Content mode gate (#4139)
if (kp === 'workflow.compact_content') {
if (typeof parsedValue !== 'boolean') {
error(`Invalid workflow.compact_content '${val}'. Must be a boolean (true or false).`);
}
}
// Per-plan executor routing via agent_hint frontmatter (#1689)
if (kp === 'workflow.agent_hint_routing') {
if (typeof parsedValue !== 'boolean') {