fix(config): honor settings.commandAuthorization in .gittensory.yml - #2385
Conversation
FocusManifestSettings never included commandAuthorization and parseSettingsOverride never read it, so a maintainer setting settings.commandAuthorization in .gittensory.yml had it silently dropped — the DB-stored (possibly more permissive) policy stayed in effect with no warning, contradicting this repo's yml > DB > defaults config-as-code convention for every other settings field. Add commandAuthorization to FocusManifestSettings and parse it with the existing normalizeCommandAuthorizationPolicy, folding its warnings into the manifest output. The normalizer always fills unset or invalid sub-fields from the secure built-in default, so once the key is present in yml it always yields a complete policy that overlays the DB value the same way autoMaintain already does.
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-01 22:55:11 UTC
⏸️ Suggested Action - Manual Review Review summary Nits — 5 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2385 +/- ##
=======================================
Coverage 95.88% 95.88%
=======================================
Files 224 224
Lines 25136 25142 +6
Branches 9139 9141 +2
=======================================
+ Hits 24102 24108 +6
Misses 421 421
Partials 613 613
🚀 New features to boost your workflow:
|
…e the DB policy normalizeCommandAuthorizationPolicy falls back to the built-in default policy (with a warning) when the top-level shape isn't a mapping, but focus-manifest.ts unconditionally wrote that fallback result into the parsed settings override. Since the resolver overlays manifest settings on top of DB settings, a malformed .gittensory.yml value (e.g. a string instead of an object) silently overwrote a stricter DB-persisted commandAuthorization policy with the built-in default. Only apply the normalized policy when the raw value is actually a mapping; otherwise warn and leave the override unset so the resolver preserves whatever the DB already has.
… in the example The example still described the pre-fix behavior (invalid shape falls back to the built-in default). Update it to match the actual contract: an invalid top-level shape is ignored with a warning, preserving any existing DB-stored policy instead of overwriting it.
What
.gittensory.yml.exampledocumentedsettings.commandAuthorizationas settable config-as-code, butFocusManifestSettingsnever included the field andparseSettingsOverridenever read it — it was silently dropped, no warning, nothing. The field only actually took effect via the dashboard/API route (DB-persisted). This fails toward the safe side (DB/default policy silently continues), but it's a real parity gap against this repo's own.gittensory.yml> DB > defaults convention, and it's security-relevant: a maintainer restricting who can invoke/gate-overridevia yml would believe the restriction was live when it silently wasn't.Fix
commandAuthorizationto thePick<RepositorySettings, ...>union inFocusManifestSettings(src/signals/focus-manifest.ts).settings.commandAuthorizationintoparseSettingsOverrideusing the existingnormalizeCommandAuthorizationPolicy(src/settings/command-authorization.ts), folding its warnings into the manifest'swarningsoutput. The normalizer always fills any unset/invalid field fromDEFAULT_COMMAND_AUTHORIZATION_POLICY— the same secure default used when the DB has none — so once the key is present in yml it always yields a complete, safe policy, mirroring howsettings.autoMaintainalready works ("declares the full policy, defaults fill any unset field").resolveEffectiveSettings's existing{...dbSettings, ...manifest.settings}spread needed no change — onceout.commandAuthorizationis set, it wholesale-overlays the DB value the same way every other settings field does; leaving the yml key unset leaves it untouched (DB stays authoritative)..gittensory.yml.example's doc comment for the field with a concrete example and a note on the invalid-shape fallback behavior.settingsOverrideToJson(the cache round-trip serializer) needed no change — it's a generic spread of whatever's onFocusManifestSettings.Tests
settings.commandAuthorizationparses, overlays a DB-stored policy viaresolveEffectiveSettings, and an unset key leaves the DB policy untouched (never resets to defaults).pr_authorongate-override) is clamped back to the default for that command specifically, with its own warning — the maintainer-only invariant survives a partially-valid override.npx tsc --noEmitclean.focus-manifest.test.ts— 138 passed.src/signals/focus-manifest.ts— 373 passed.src/signals/focus-manifest.ts: fully covered.npm run test:coverage: 5602 passed, 4 skipped (pre-existing/unrelated), 0 failed.npm audit --audit-level=moderate: 0 vulnerabilities.Advances #1936. Closes #2268.