Skip to main content

Module gsd_config

Module gsd_config 

Source
Expand description

The single writer of GSD’s .planning/config.json in this codebase.

DevFlow does not own this file. Its other keys belong to GSD and to the operator, and a live GSD process may read it at any moment during a run. This module therefore acquires exactly ONE key of write authority — workflow._auto_chain_active, the flag GSD’s checkpoint_handling consults to decide whether an ordinary gate="blocking" checkpoint may be auto-approved — and must leave every other key, its position, and its serialized form byte-identical (35.1-01, T-35.1-02).

Three properties follow from that, and each is pinned by a test rather than left to inspection:

  1. No typed struct. The file is parsed as a bare serde_json::Value. A typed Config/Workflow round trip would silently DROP the keys this crate does not model (commit_docs, git, intel, review, model_overrides, mempalace), which is precisely the contract this module exists to honour.
  2. Key order is preserved. serde_json’s preserve_order feature is enabled in the workspace Cargo.toml for this module’s sake; without it every write re-sorts the top-level keys alphabetically and turns a tracked file into a full-file diff on every stage launch.
  3. Writing a value the file already holds is a no-op. The file’s bytes and mtime are left untouched, so an INELIGIBLE stage launch — which actively asserts false rather than merely leaving the file alone — does not dirty a tracked file every time it runs (35.1-01 F-3).

Reads are defensive (ASVS V5): a shape this module does not recognise yields the inactive default, never a panic, and a malformed or absent file is an Err the caller can log and skip rather than an abort that would kill a long unattended run.

Structs§

ClearOutcome
What force_clear_auto_chain actually did, so the CLI call sites can decide whether to be loud without re-deriving any of it.

Enums§

GsdConfigError
Errors produced while reading or writing GSD’s project config.

Functions§

auto_chain_active
Whether workflow._auto_chain_active is currently set under root.
config_path
Path of the GSD project config under a project (or worktree) root.
force_clear_auto_chain
Clear workflow._auto_chain_active under root unconditionally, repairing the branch tip too when that can be done without sweeping in anything else.
set_auto_chain_active
Set workflow._auto_chain_active under root, returning whether the file was actually changed.