Revision: 2 Last modified: 2026-12-04T21:12:29Z
config.py loads and validates .workable-items-sync.yaml, the declaration that turns the Issues mirror on
(anchor §11.4.300(A)).
It is fail-closed: any problem is an error string, and an invalid declaration is never treated as "on". That is the safe direction for a mechanism that writes to external trackers.
But it is deliberately not fail-closed about absence: a missing file means the mechanism is OFF (default-OFF), and that is not an error. Not opting in is a legitimate state, not a fault — so a project that has never configured the mirror does not get a red build for it.
- Duplicate mapping keys are refused. A plain
yaml.safe_loadlets the last key win silently, soenabled: falsefollowed byenabled: truewould quietly enable the mirror._StrictLoaderrefuses the ambiguity instead. - Only true/false are booleans. A YAML
yes/on/1is not silently coerced into a boolean decision about whether to write to external trackers.
python3and PyYAML (yamlis imported directly; its absence is an import failure, not a soft disable).- A
.workable-items-sync.yamlin the project root if the mechanism is to be enabled. - No credentials are read here; the module imports
redactfor its primitives.
from issue_sync import config as cfgmod
result = cfgmod.load(path) # UNCONFIRMED: exact loader name
if isinstance(result, str):
# an error string -- fail closed
raise SystemExit(2)
if result is None or result.disabled:
pass # default-OFF, not an errorUNCONFIRMED: the exact loader/validator entry-point names were not read while writing this guide.
Inspect them first:
python3 -c "import issue_sync.config as c; print([n for n in dir(c) if not n.startswith('_')])".
| Name | Kind | Contract |
|---|---|---|
_StrictLoader |
class | yaml.SafeLoader subclass that (1) refuses a duplicate mapping key and (2) reads only true/false as booleans. |
load(...) / validator |
function | Returns a validated config, or an error string on any problem. A missing file ⇒ mechanism OFF, not an error. |
A library. Callers map its two outcomes onto the package's convention:
| Outcome | Effect |
|---|---|
| Missing file | Mechanism OFF — callers exit 0 (disabled). |
| Valid config | Proceed. |
| Any validation error | Fail closed — callers report 2 (cannot determine) rather than enabling a partially understood configuration. |
- No config file. Default-OFF, exit
0. Not an error. - A duplicate key. Refused — this is how "
enabled: falsethenenabled: true" is prevented from silently enabling writes. enabled: yes/on/1. Not coerced to a boolean decision; strict reading applies.- A malformed YAML document. An error string; fail closed.
- A config with an unknown key. Validation is the seam where an unrecognised declaration is caught rather than ignored.
- PyYAML missing. Import failure — cannot determine, never a silent "disabled".
- A config that enables the mirror but names no targets. Valid-but-empty scope; nothing to mirror, and the caller must not report success for work it did not do.
- Checks whether the config file exists; absent ⇒ mechanism OFF (not an error).
- Parses with
_StrictLoader: duplicate keys refused, booleans restricted totrue/false. - Validates the declared structure and values; any problem returns an error string.
- Returns the validated configuration for
mode.py,cli.pyandpipeline.pyto act on.
Imported by mode.py, cli.py, pipeline.py, registry.py (indirectly) and the rest of the package.
Related: redact.py (imported here for its primitives), mode.py (the one-word effective mode, decided
by this same validator).
See also docs/scripts/mode.md, docs/scripts/cli.md and docs/scripts/redact.md.
The §11.4.18 ratchet keys a guide on the script's BASENAME, so docs/scripts/config.md is the one guide the
tool credits to every config.{sh,py} in the tree. The pull-request delivery engine's scripts/pr/lib/config.sh
is a DIFFERENT program and is documented here so that credit is not misleading.
scripts/pr/lib/config.sh loads and validates config/delivery.conf, the §11.4.297(A) delivery declaration:
- Key set is closed and typed. 32 keys, each declared
Rrequired,S:<a|b>closed set,Ipositive integer,Nnon-negative,Lcomma list,Tfree text,Bon|offorMnone|<positive int>. - Fail-closed on anything it cannot read: an absent or unreadable file (
config_absent), a line without=, a bad key shape or an empty key (config_malformed_line:<n>), an unknown key (config_unknown_key), a repeated key (config_duplicate) and a value outside its closed set (config_invalid_value:<key>) are all refusals with exit 6 — never a silently ignored line. - Closed-set membership is exact: the set is matched as
|a|b|against|value|, so a substring test can never acceptprinsideprerelease. - Typed refinements:
pr_repositorymust beowner/repo,basea legal branch name,branch_prefixone path component,review_fanout_minat most 8, andapproval_mode=approve-eventrequires an approver distinct frompr_assignees(config_invalid_combination:approval_mode). pr_cfg_auditprints every key with its closed set, so the data can be reviewed without reading code:bash scripts/pr/pr_deliver.sh config --audit.
Full reference: docs/manuals/pr_delivery_engine_manual.md §5.
2026-12-04 — python3 -c "import ast;ast.parse(open('scripts/issue_sync/config.py').read())" → exit 0.
python3 -c "import issue_sync.config as c; print(c._StrictLoader.__name__)" prints _StrictLoader.