Skip to content

test(ci): scope trusted-publishing guards to the owning job (#332) - #364

Merged
phmatray merged 4 commits into
devfrom
feat/332-scope-trusted-publishing-guards-to-job
Sep 23, 2026
Merged

phmatray merged 4 commits into
devfrom
feat/332-scope-trusted-publishing-guards-to-job

Conversation

@phmatray

Copy link
Copy Markdown
Owner

Closes #332.

Summary

TrustedPublishingWorkflowTests asserted its claims against the whole
release-please.yml file, even though the file has two jobs
(release-please, nupkg). #255 already gave the sibling
TestReportingTests job-scoping through WorkflowSource.JobsOf for exactly
this reason — a file-wide scan can't tell which job a matched step belongs
to, and since #302 made an ambiguous match loud, a legal duplicate id: or
name: across the two jobs would redden the suite on a valid workflow. This
PR gives TrustedPublishingWorkflowTests the same scoping.

  • Added JobOf(workflowFile, jobName), resolving a job's slice via
    WorkflowSource.JobsOf and asserting it exists.
  • StepWithId/StepCondition now take a jobName and hold every claim
    against that job's slice, naming the "<workflow> / <job>" pair on
    failure.
  • All five call sites pass "nupkg" — the job carrying id: login.
  • Added ReleaseWorkflow_Step_Lookup_Should_Be_Scoped_To_The_Owning_Job,
    pinning that the release-please job's id: release step is not
    reachable when the scope is nupkg.
  • Manually verified the scoping bites: temporarily added a second
    id: login step to the release-please job — the suite stayed green
    (the duplicate is outside the nupkg scope) — then reverted.
  • Repointed the misdirected #198 cross-references in WorkflowSource.cs
    (TryStepNamed, StepWithId remarks) at TrustedPublishingWorkflowTests still asserts file-wide, so a claim can be answered by the wrong job #332, since Prove NuGet Trusted Publishing end-to-end and retire the long-lived NUGET_API_KEY #198 never owned
    this work despite being cited three times.

No workflow file, build/Build.cs, or library code changed — test
infrastructure only, and every existing assertion's claim is unchanged;
only the text it is held against is scoped.

Test plan

  • dotnet build -c Release — 0 warnings, 0 errors
  • FormCraft.UnitTests Ci namespace (103 tests) — green
  • ./build.sh Format — clean (CI gate)
  • dotnet test -c Release — all three assemblies green (888 + 163 + 588,
    1 skipped, 0 failed)

🤖 Generated with Claude Code

phmatray and others added 3 commits September 23, 2026 20:04
…e step

TrustedPublishingWorkflowTests still read StepWithId/StepCondition against
the whole workflow file, so a claim about the nupkg job's login step could
be answered by the release-please job and a legal duplicate id/name across
the two jobs would redden the suite (#302). Give it the job scoping #255
already gave TestReportingTests: JobOf resolves the owning job via
WorkflowSource.JobsOf, and the step helpers hold every claim against that
slice, naming the (workflow, job) pair on failure.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
TryStepNamed and StepWithId's remarks pointed the "a whole-file scope can
see two legitimate matches from two different jobs" caveat at #198, which
never accepted the job-scoping work — it created this test file but does
not own scoping it. #332 finished that scoping, so repoint both remarks at
it and note that no in-repo caller now passes a whole file to either step
scan.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@phmatray
phmatray marked this pull request as ready for review September 23, 2026 18:10
TryStepNamed's remark said "no in-repo caller passes a whole file to
either step scan any more" and then, one sentence later, "WorkflowSourceTests
does pass whole files" — contradicting itself. Scope the first claim to
guard suites (WorkflowSourceTests exists to test the reader directly, not
to guard a workflow, so it deliberately keeps the whole-file risk). Also
fixes a garbled clause in the same paragraph and tightens
TrustedPublishingWorkflowTests' overload description.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@phmatray
phmatray merged commit cc234af into dev Sep 23, 2026
2 checks passed
@phmatray
phmatray deleted the feat/332-scope-trusted-publishing-guards-to-job branch September 23, 2026 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TrustedPublishingWorkflowTests still asserts file-wide, so a claim can be answered by the wrong job

1 participant