fix(safety-profile): accept the value a locked flag already sets and note it only where it is mentioned - #982
Conversation
…note it only where it is mentioned
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 11, 2026, 10:08 AM ET / 14:08 UTC. ClawSweeper reviewWhat this changesThe PR permits explicitly supplied boolean values that match baked safety-profile locks and narrows lock-origin notes to relevant usage errors. Merge readinessKeep open for a maintainer decision: this intentionally changes a documented safety-profile contract from refusing every explicit locked flag to allowing matching values. Likely related people: Peter Steinberger (high confidence) and Ronny Rentner (medium confidence). Priority: P2 Review scores
Verification
How this fits togetherBaked safety profiles constrain which gog commands and boolean options can run before a Google Workspace command executes. The CLI parser applies locks, validates the resulting invocation, and formats any usage error for stderr. flowchart LR
Profile[Baked safety profile] --> Parse[CLI flag parsing]
Args[User command arguments] --> Parse
Parse --> Locks[Locked flag enforcement]
Locks --> Validate[Command validation]
Validate --> Command[Google Workspace command]
Validate --> Errors[CLI error output]
Decision needed
Why: Current main deliberately documents and tests refusal even for matching values; changing that observable safety-profile boundary requires owner intent rather than a reviewer inference. Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the existing refusal contract while retaining the scoped error-note corrections, unless a safety-profile owner explicitly approves value-based lock semantics and its compatibility change. Do we have a high-confidence way to reproduce the issue? Yes—current main deterministically refuses any command-line occurrence of a locked flag, and the contributor supplies a before/after configured-account terminal transcript for the matching-value case. Is this the best way to solve the issue? Unclear—the implementation keeps the final boolean value immutable, but it intentionally replaces the documented refusal contract and needs explicit safety-profile owner approval. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against cd965f1d38bb. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Unfortunately, it turns out I've missed that locking a flag refuses any command line
that mentions it, including one asking for the value the profile already locks:
gog gmail get <id> --sanitize-contentfailed with exit 2 against a profile thatlocks
sanitize-content: true. Only a different value is an override now.Two note defects showed up alongside it. The note was assembled as enforcement walked
the flags, so on a refusal it named the locks applied before the failure and omitted
the flag the error itself named; the locks are recorded up front now, and a refusal
renders without a note. It also rode along on errors that had nothing to do with
locks, a missing account among them, and now attaches only where the message mentions
a locked flag.
lockUnsupported's--homecase is gone.--homeis a string flag, so the booleanrule already refuses it; the case only changed which message you got, and its premise,
that locks run too late for it, never applied.
Docs. The section described the old contract, and stated several rules more than
once:
name, so they are one bullet.
flagProvided's internals, which is not something a profile author decides.binary cannot enforce is refused at build time rather than silently ignored.
caller never asked for". They did ask for it, by running the baked binary; what is
true is that it never appeared on their command line.
Proof — run against a configured account;
$IDis a message id, held in avariable rather than printed.
The demo profile locks
no-inputandsanitize-content. Both binaries were builtfrom clean trees,
gog-beforefrommainandgog-fixedfrom this branch.Tests.
RejectsEveryFormOfSettingItasserted the old contract and is nowRejectsEveryFormOfOverridingIt, covering=false,=0,=FALSE,=no,--sanitize=falseand--safe=false. Added:AcceptsTheLockedValue(
--sanitize-content,=true,=1,=TRUE,=yes,--safe),OverrideRefusalOmitsTheNote, andUnrelatedErrorCarriesNoNote.HomeIsRefusednowasserts the boolean-rule message. Both note tests were checked against the unfixed
code to confirm they fail there.
go test ./...passes.My check originally.