Skip to content

feat: surface missing coder_secret requirements on resolve-autostart#25081

Merged
zedkipp merged 1 commit into
mainfrom
zedkipp/plat-81-secrets-in-workspace-auto-update-flow
May 13, 2026
Merged

feat: surface missing coder_secret requirements on resolve-autostart#25081
zedkipp merged 1 commit into
mainfrom
zedkipp/plat-81-secrets-in-workspace-auto-update-flow

Conversation

@zedkipp

@zedkipp zedkipp commented May 8, 2026

Copy link
Copy Markdown
Contributor

Adds dynamicparameters.EvaluateSecretMismatch as a shared helper on top of the existing renderer, then wires it into the resolve-autostart handler so the UI can surface unsatisfied coder_secret requirements in a template alongside parameter mismatch.

The lifecycle executor preflight will land in a follow-up that depends on this helper. The UI changes that consume the new secret_mismatch field is also a follow-up.

Generated with assistance from Coder Agents.

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

Docs preview

📖 View docs preview for docs/reference/api/schemas.md

@zedkipp
zedkipp force-pushed the zedkipp/plat-81-secrets-in-workspace-auto-update-flow branch 2 times, most recently from 4e5a311 to 39f0526 Compare May 8, 2026 14:49
Comment thread coderd/workspaces.go Outdated
})
return
}
response.SecretMismatch = secretMismatch

@zedkipp zedkipp May 8, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like we could have a single function to evaluate autostart readiness that we call here. Something like EvaluateAutostartReadiness(version, owner, lastBuildParams) (ParameterMismatch, SecretMismatch, error). I'm inclined to tackle in a follow-up if other folks agree.

@zedkipp

zedkipp commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

/coder-agents-review

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a well-structured, cohesive PR. The new evaluateSecretMismatch function is cleanly parameterized, the error handling for forbidden callers and incomplete versions is deliberate, and the test coverage for HasSecretValidationDiagnostic (six edge cases) and the integration test (mismatch detected then cleared) are both genuine. The additive SecretMismatch field preserves backward compatibility with zero-value defaults.

Two P2 findings, six P3, two Nits. The headline items: the handler returning 500 on renderer failure discards the already-computed ParameterMismatch (the frontend gets nothing when it should at least get the parameter signal), and the evaluation function is private to coderd while the PR description claims it's a shared helper for the lifecycle executor follow-up in coderd/autobuild.

"The dashboard banner says 'secrets are fine' when the truth is 'couldn't check.'" (Zoro)

🤖 This review was automatically generated with Coder Agents.

Comment thread coderd/workspaces.go Outdated
Comment thread coderd/workspaces.go Outdated
Comment thread coderd/workspaces.go Outdated
Comment thread coderd/workspaces.go Outdated
Comment thread coderd/dynamicparameters/render.go Outdated
Comment thread coderd/parameters_test.go
Comment thread coderd/workspaces.go Outdated
Comment thread coderd/dynamicparameters/render.go Outdated
Comment thread codersdk/workspaces.go
Comment thread coderd/workspaces.go Outdated
@zedkipp
zedkipp force-pushed the zedkipp/plat-81-secrets-in-workspace-auto-update-flow branch 2 times, most recently from 8d44326 to 4ae5b5e Compare May 11, 2026 20:37
@zedkipp

zedkipp commented May 11, 2026

Copy link
Copy Markdown
Contributor Author

/coder-agents-review

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strong follow-up. Nine of ten R1 findings addressed in a single commit, all root-cause fixes. The handler error handling restructured from early-return 500 to switch/log-and-continue, preserving ParameterMismatch on renderer failure. EvaluateSecretMismatch exported to dynamicparameters/secrets.go with a proper logger parameter. Forbidden-caller test added. The result.Output == nil guard correctly replaced the dead result == nil check.

DEREM-9 (naming): panel unanimously accepts the author's defense (6/6). secret_mismatch parallels parameter_mismatch on the same struct. API-level symmetry outweighs cross-type vocabulary alignment.

Two open items remain: DEREM-8 (P3, the type assertion was moved but not changed to use ExtractDiagnosticExtra) and one new P3 from R2.

"Boring code gets silence. This code earned it." (Hisoka)

🤖 This review was automatically generated with Coder Agents.

Comment thread coderd/dynamicparameters/secrets.go Outdated
Comment thread coderd/workspaces.go
@zedkipp
zedkipp force-pushed the zedkipp/plat-81-secrets-in-workspace-auto-update-flow branch from 4ae5b5e to 56e643d Compare May 11, 2026 21:30
@zedkipp
zedkipp marked this pull request as ready for review May 11, 2026 22:00
@zedkipp
zedkipp requested a review from Emyrk as a code owner May 11, 2026 22:00
Comment thread coderd/dynamicparameters/secrets.go Outdated
defer renderer.Close()

result, diags := renderer.Render(ctx, ownerID, paramValues, IncludeSecretRequirements())
if result.Output == nil || hasSecretValidationBlockerDiagnostic(diags) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should log or return something when result.Output == nil and the diagnostics have errors. I agree with treating this as unknown and leaving SecretMismatch false, but right now this path also drops the diagnostics, so a broken preview ends up looking the same as "no secret mismatch" with no log trail.

Could this either return an error so the caller's existing warning path fires, or log the diagnostics here before returning false?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not blocking but probably worth addressing 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a fair point. There were there distinct cases being handled here. I added logging for each one.

Adds dynamicparameters.CheckSecretRequirements as a shared helper on
top of the existing renderer, then wires it into the resolve-autostart
handler so the dashboard can surface unsatisfied coder_secret requirements
in a template alongside parameter mismatch.

The lifecycle executor preflight will land in a follow-up that depends on
this helper. The dashboard banner that consumes the new missing_secret_requirements
field is also a follow-up.

Generated with assistance from Coder Agents.
@zedkipp
zedkipp force-pushed the zedkipp/plat-81-secrets-in-workspace-auto-update-flow branch from 56e643d to b931f01 Compare May 13, 2026 15:28
@zedkipp
zedkipp merged commit e0be9bf into main May 13, 2026
31 checks passed
@zedkipp
zedkipp deleted the zedkipp/plat-81-secrets-in-workspace-auto-update-flow branch May 13, 2026 20:20
@github-actions github-actions Bot locked and limited conversation to collaborators May 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants