Consume persisted governance intent in governance status - #104
Open
mochan-tk wants to merge 2 commits into
Open
Conversation
Add gh-fixture-driven cases to test-governance-status.sh covering persisted solo/team intent, absence, invalid values (empty, leading and trailing whitespace, case variants, arbitrary value), a malformed (missing-field and non-JSON) response, an Actions-disabled/unauthorized read failure, and explicit --profile override precedence over a persisted value. These 6 new cases fail against the current sensor, which does not yet read SCAFFOLD_GOVERNANCE_PROFILE (expected red, verified locally before this commit). Refs #101 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
governance-status.sh now sources solo/team intent from the persisted
repository Actions variable SCAFFOLD_GOVERNANCE_PROFILE
(repos/{owner}/{repo}/actions/variables/SCAFFOLD_GOVERNANCE_PROFILE)
when --profile is omitted, accepting only the exact value solo or team
(never trimmed, never case-folded). A missing variable, an
Actions-disabled target, an API/authorization failure, a malformed
response, an empty value, a whitespace or case variant, or any other
value all leave the profile unresolved, which the existing
governance.profile UNKNOWN / exit-3 path already reports. Explicit
--profile solo|team remains a one-shot override: it is checked before
the persisted lookup and short-circuits it, so the endpoint is never
read when an override is given and nothing is ever persisted. A valid
persisted value flows through the same BASE/TEAM derivation and emit
call as the equivalent explicit profile, so required controls,
source-binding requirements, output order, and exit behavior are
identical regardless of source.
Closes #101
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #101
Plan: #101 (comment)
Summary
governance-status.shnow sources solo/team intent from the persistedrepository Actions variable
SCAFFOLD_GOVERNANCE_PROFILEby default (GETrepos/{owner}/{repo}/actions/variables/SCAFFOLD_GOVERNANCE_PROFILE),accepting only the exact value
soloorteam. Explicit--profile solo|teamremains a one-shot override that short-circuits the persistedlookup entirely (the endpoint is never read when an override is given).
A valid persisted value flows through the same BASE/TEAM derivation and
emitcall as an equivalent explicit profile, so behavior is identicalregardless of source. Fixture tests were committed first and proven
expected-red before the implementation commit.
Evidence
governance-status.sh:bash .github/scripts/tests/run-tests.sh governance-status→ 132/138 passing, 6 new persisted-intent cases failed (red), reproduced locally and recorded in the implementation-release comment--profileomitted; exactsolo/teamonlygovernance-status.shlines 79-87; unit tests "persisted solo intent…", "persisted team intent…"ACTIVE, same controls/order/exit as explicitrun -R o/rwithmk_govvar solo/teamvs--profile solo/team;bash .github/scripts/tests/run-tests.sh governance-status→ 138/138UNKNOWN, exit 3'',' solo','solo ','Solo','TEAM','nonsense'), missingvaluefield, non-JSON payload, simulatedactions/variablesAPI failure — all rc=3,governance.profile UNKNOWN--profiletakes precedence, never reads the endpoint, preserves #92GH_CALLSdiff proves no call to the variables endpoint); full--profiletest matrix (solo/team/checks/usage errors) unchanged and passingbash .github/scripts/tests/run-tests.sh governance-status→ "sensor performed GET-only gh calls", "every gh invocation is a plain gh api read", "shim wall refuses mutating invocations" all pass--profile soloprobe againstmochan-tk/agentic-dev-kit-for-copilotgit diff --numstat origin/main...HEAD -- .github/scripts/governance-status.sh .github/scripts/tests/test-governance-status.sh→ 107gh auth statusbash .github/scripts/tests/run-tests.sh governance-status--profile solo)governance.profile\tACTIVE\tsolo--profile)governance.profile\tUNKNOWN\tno profile declared; pass --profile solo|team(this repository has not opted intoSCAFFOLD_GOVERNANCE_PROFILE, so UNKNOWN/exit 3 is the correct, non-guessed result)bash .github/scripts/tests/run-tests.sh(full wall)git ls-files -z ".github/*.sh" | xargs -0 shellcheck -S stylecheck-action-pins.shcheck-workflow-permissions.shcheck-escalation-wording.shcheck-template-sync.shcheck-md-links.shcheck-changelog-refs.shcheck-connectors.shcheck-copilot-surface.shDeviations
None. Implementation matches the plan of record exactly: only the two
owned files were touched,
--profileremains a one-shot override with nopersisted read, and every other sensor behavior (aggregation, bypass
qualification, source binding, exit precedence, Bash 3.2 compatibility,
line-oriented output) is unchanged.
Follow-ups
None.
Checklist
linked above.
rule, or a declared agreements wording rider).
worker protocol — session-orchestration skill — a worker never posts
the ritual/outcome comments on the Task issue; the supervisor
independently verifies this PR and posts the outcome comment.)