Repository navigation
fix(engine): name a notice's section once, and report what a refused entry left unattempted - #592
Conversation
…entry left unattempted A section's own lines already lead with its key, and the section loop prefixed them again, so a run printed "teams: teams: ...", "repository: repository.enable_git_lfs: ...", and "environments: environments[alpha]: not applied - ...". The rule that prefixes a line once was private to the snapshot flow. It now sits beside the section-outcome functions as underKey, and every site that prefixes a section's line calls it: notes, change lines, and failure lines, in apply, check, and snapshot. The first failed operation ends its section's plan, since a later operation can depend on an earlier one, and nothing said what that cost: a refused environment entry dropped every later entry's writes without a word. The stop stays. The executor now returns the operations it never reached, each named by its own description, else by the drift it would have resolved, else by its role. The failed outcome prints the count as a warning, then one log line and one summary row per operation. A section skipped under on-missing-permission: warn lists nothing, because the skip covers every operation of the section. The embedded-reference error quoted the text it matched, which in a literal such as "Pa$$W0RD_SECRET9" is part of the secret. It now names the entry and the rule and echoes no part of the value.
File size check0 over a hard cap (fails), 6 warning(s).
Split the file, wrap the line, shorten or exempt the comment, or list the path in 5 managed file(s) skipped; repo-platform owns them. |
Member shape check1 finding(s).
Add the blank lines, make the comment one line directly above the item, comment every field or none, or list the path in 4 generated file(s) skipped. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the failure-reporting and secret-redaction changes.
No open issues 🎉
What changed in this PR
This PR improves failure reporting in the settings engine by naming operations left unattempted, removing repeated section prefixes, and preventing secret fragments from appearing in validation errors.
Changes:
- Report remaining operations after a failure without changing stop-on-failure behavior.
- Share section-prefix handling across apply, check, and snapshot reporting.
- Remove embedded secret fragments from validation errors and add regression coverage.
| File | Description |
|---|---|
test/sections/branches/branches.test.ts |
Update failed-execution expectations with unattempted operations. |
test/engine/validate.test.ts |
Expect secret validation errors without echoed fragments. |
test/engine/snapshot.test.ts |
Cover single-prefix snapshot failures. |
test/engine/secret-refs.test.ts |
Verify rejected secret values are not echoed. |
test/engine/orchestrate.test.ts |
Cover prefixes, unattempted reporting, permission skips, and redaction. |
test/engine/execute.test.ts |
Verify remaining-operation names, ordering, and stopped execution. |
src/engine/snapshot.ts |
Reuse shared section-prefix handling. |
src/engine/secret-refs.ts |
Stop echoing embedded reference fragments in errors. |
src/engine/orchestrate.ts |
Centralize prefixes and report unattempted operations in logs and outcomes. |
src/engine/execute.ts |
Capture remaining operation names when execution fails. |
Review effort: Balanced
Before
After
How
underKeyholds the rule, and every site whose line may already lead with the key calls it.describe, else its drift lines, else its role.Proof
bun test test/engine, 404 pass, 0 fail. Seven cases are new, each seen failing first.unattempted.bun test/e2e/run.ts --sections environments,rulesets,teams,repository,actions_secrets,branches,collaborators,workflows, 182/182.Technical details
parseScenarioandrunScenario, Before on the branch's base commit, After on this branch.alphawithwait_timer: 30, livebetawith no protection rules.repository.enable_git_lfs: true, one team, one Actions secret,owner_kind: user....: cuts a line whose tail is the same in both states./repo/settings.yml: stands for the runner's temporary settings file.not attempted - ...line is also one line of the section's Detail cell.SectionOutcome.detailgains rows, not members.preflightProbe,secretFailure,reportUnattempted, and theskipped - ...,not applied - ..., andnot snapshotted - ...wrappers inorchestrate.tsandsnapshot.ts.underKeylives:src/engine/orchestrate.ts, beside the outcome functions, imported bysnapshot.ts.test/engine/orchestrate.test.tspinnednotice: workflows: workflows[missing.yml]twice.test/engine/{secret-refs,validate}.test.tspinned the echoed fragment.test/engine/execute.test.tsand one intest/sections/branches/branches.test.ts.<key>: <key>overtest/anddocs/, the 372 scenario files included, hit four lines and no scenario.branchesmessage below, and one sentence that is no prefix (repository.custom_properties: custom_properties is reported ...).branchessection writes its ownbranches: branches[main]: ...message in section code.src/engine/{execute,orchestrate,snapshot,secret-refs}.ts,test/engine/{execute,orchestrate,snapshot,secret-refs,validate}.test.ts,test/sections/branches/branches.test.ts.