Skip to content

Resolve secrets/vars expressions at dispatch + full detection state in the UI - #33

Merged
BotCoder254 merged 1 commit into
mainfrom
feat/log-chunk-sections
Jul 16, 2026
Merged

Resolve secrets/vars expressions at dispatch + full detection state in the UI#33
BotCoder254 merged 1 commit into
mainfrom
feat/log-chunk-sections

Conversation

@BotCoder254

@BotCoder254 BotCoder254 commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Why detection appeared broken (and why pipelines didn't read secrets)

  1. Pipelines never evaluated ${{ … }} expressions. A GitHub-style workflow with env: KEY: ${{ secrets.API_KEY }} shipped the literal string ${{ secrets.API_KEY }} into the container — the secret only worked if the script read $API_KEY directly. GitHub evaluates expressions before execution and resolves unset secrets/vars to empty strings.
  2. The detection cards only showed MISSING names and hid themselves otherwise — with reserved-prefix refs (DOCKER_*, GITHUB_*) silently filtered out, a repo whose refs were all reserved or all configured showed literally nothing.
  3. The workflow detail page had no way to see what detection found (varRefs/environments arrived untyped and unrendered), and the pipeline UI never showed the job's environment: binding.

What this PR does

Dispatch-time expression resolution (workflow_parse::substitute_context_refs + scheduler::dispatch):

  • ${{ secrets.NAME }} / ${{ vars.NAME }} (dot or bracket form, single-ref expressions only) resolve in plan env values and step run strings — known secrets to their value, unknown secrets and all vars to "" (GitHub's unset semantics). Compound expressions and other contexts (github.*, matrix.*, …) pass through untouched: substitutor, not evaluator.
  • Substitution happens in dispatch memory only: stored plans keep the literals, API responses never carry resolved values, reruns re-substitute with current (rotated) secrets. Masks register after substitution and secret plaintexts remain unconditional log masks, so inline secrets still mask in logs.

Full detection state in the UI:

  • Requirements endpoints now return every detected (name, repository) pair with configured/configuredId (highest-precedence covering secret / matching environment picked in SQL).
  • The Secrets/Environments cards become repo-grouped "Detected in workflows" lists: Configured entries link to the detail page for editing, missing ones keep the one-click pre-filled Add/Create, and reserved secret names are shown with an explanation instead of hidden (shared secretNameRules module, also used by the create dialog).
  • Workflow detail Metadata tab: new "Variables referenced" and "Environments" sections + a re-sync hint when the stored parse predates detection.
  • Pipeline detail Environment tab: shows the job's deployment environment binding.

Verification

  • Backend: cargo check, cargo clippy --all-targets -- -D warnings, cargo test — 158 tests green (new substitution tests: dot/bracket, unknown→empty, compound/other contexts untouched, multiple blocks).
  • Frontend: npm run build compiles clean.

After deploying

Re-sync the connected repository once (the PARSER_VERSION bump from #32 re-parses stored workflows), then check the workflow detail Metadata tab — the detected secrets/variables/environments appear there, and the Secrets/Environments pages show the repo-grouped detection cards.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Detect referenced secrets, variables, and environments with configuration status and repository context.
    • Add or create missing requirements directly from workflow metadata.
    • Link configured requirements to their detail pages.
    • Display workflow-bound environments and pipeline deployment environments.
    • Resolve supported secret and variable expressions during job dispatch, with resolved values masked in logs.
  • Bug Fixes
    • Improved detection refresh behavior after repository syncs and parser updates.
    • Prevent invalid or reserved secret names from being offered for configuration.

…ction state

Expression resolution: workflows written GitHub-style never received their
secrets - `KEY: ${{ secrets.API_KEY }}` shipped to the container as that
literal string. dispatch now substitutes `${{ secrets.NAME }}` and
`${{ vars.NAME }}` blocks (dot or bracket form, single-ref expressions
only) in plan env values and step run strings: known secrets resolve to
their value, unknown secrets and vars to "" (GitHub's unset semantics).
Substitution lives in dispatch memory only - stored plans keep literals,
reruns pick up rotated values, masks register after substitution, and
secret plaintexts remain unconditional log masks.

Detection visibility: the requirements endpoints now return EVERY detected
(name, repository) pair with configured state and the covering secret's /
matching environment's id, not just missing names. The cards become
repo-grouped "Detected in workflows" lists - configured entries link to
their detail pages for editing, missing ones keep one-click Add/Create,
and reserved-prefix secret refs (DOCKER_*, GITHUB_*) are shown with an
explanation instead of being silently hidden (shared secretNameRules
module). The workflow detail Metadata tab gains Variables referenced and
Environments sections plus a re-sync hint when the stored parse predates
detection, and the pipeline Environment tab shows the job's deployment
environment binding.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@netlify

netlify Bot commented Jul 16, 2026

Copy link
Copy Markdown

Deploy Preview for overup-app ready!

Name Link
🔨 Latest commit e045958
🔍 Latest deploy log https://app.netlify.com/projects/overup-app/deploys/6a58f18dde1e8d000801fdce
😎 Deploy Preview https://deploy-preview-33--overup-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@vercel

vercel Bot commented Jul 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
overup Building Building Preview, Comment Jul 16, 2026 2:58pm

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Free

Run ID: 204efbbb-5c48-426c-b90f-9ad6ed626dea

📥 Commits

Reviewing files that changed from the base of the PR and between 8e2f492 and e045958.

📒 Files selected for processing (17)
  • CLAUDE.md
  • backend/src/db/workflows.rs
  • backend/src/handlers/environments.rs
  • backend/src/handlers/secrets.rs
  • backend/src/services/scheduler.rs
  • backend/src/services/workflow_parse.rs
  • src/features/environments/components/DetectedEnvironmentsCard.tsx
  • src/features/environments/pages/EnvironmentsPage.tsx
  • src/features/pipelines/components/panels/EnvironmentPanel.tsx
  • src/features/secrets/components/DetectedRequirementsCard.tsx
  • src/features/secrets/components/SecretFormDialog.tsx
  • src/features/secrets/lib/secretNameRules.ts
  • src/features/secrets/pages/SecretsPage.tsx
  • src/features/workflows/components/MetadataPanel.tsx
  • src/types/pipeline.ts
  • src/types/requirements.ts
  • src/types/workflow.ts

📝 Walkthrough

Walkthrough

The change adds configured-state requirement APIs, repository-grouped secret and environment detection UIs, shared secret-name validation, workflow metadata surfaces, and dispatch-time substitution for supported secret and variable expressions.

Changes

Requirement detection and dispatch behavior

Layer / File(s) Summary
Requirement state queries and API contracts
backend/src/db/workflows.rs, backend/src/handlers/..., src/types/requirements.ts
Requirement responses now include repository identity, configured status, configured IDs, and capped workflow references. Secret and environment queries return configured and missing states.
Repository-scoped detection UI
src/features/secrets/..., src/features/environments/..., src/features/secrets/lib/secretNameRules.ts
Detection cards group entries by repository, link configured resources, and provide Add/Create actions for valid missing names.
Dispatch-time expression substitution
backend/src/services/workflow_parse.rs, backend/src/services/scheduler.rs
Supported ${{ secrets.NAME }} and ${{ vars.NAME }} expressions are substituted during dispatch in environment values and step commands.
Workflow metadata and execution surfaces
src/features/workflows/..., src/features/pipelines/..., src/types/workflow.ts, src/types/pipeline.ts
Workflow metadata displays variables, environments, and stale detection state; pipeline plans and panels expose the deployment environment binding.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

Requirement detection flow

sequenceDiagram
  participant WorkflowMetadata
  participant RequirementsEndpoint
  participant RequirementStateQueries
  participant DetectionCard
  WorkflowMetadata->>RequirementsEndpoint: expose detected references
  RequirementsEndpoint->>RequirementStateQueries: query configured states
  RequirementStateQueries-->>RequirementsEndpoint: repository and configuration data
  RequirementsEndpoint-->>DetectionCard: grouped requirement entries
  DetectionCard->>DetectionCard: render links or Add/Create actions
Loading

Dispatch substitution flow

sequenceDiagram
  participant Scheduler
  participant SecretStore
  participant WorkflowParser
  participant JobProtocol
  Scheduler->>SecretStore: decrypt referenced secrets
  SecretStore-->>Scheduler: resolved secret values
  Scheduler->>WorkflowParser: substitute environment and run expressions
  WorkflowParser-->>Scheduler: resolved strings
  Scheduler->>JobProtocol: submit substituted job
Loading

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands.

@BotCoder254
BotCoder254 merged commit 1bd9e51 into main Jul 16, 2026
5 of 8 checks passed

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This PR successfully implements dispatch-time expression resolution for secrets and variables, along with comprehensive UI improvements for detection state visibility. The implementation is well-designed with proper security considerations:

Key Strengths:

  • Expression substitution is properly isolated to dispatch memory, keeping stored plans as literals
  • Comprehensive test coverage for the new substitute_context_refs function (158 tests green)
  • Secure handling: secrets are registered as log masks before payload dispatch
  • Proper separation of concerns between parsing (metadata only) and dispatch (value resolution)
  • UI improvements make detection state fully transparent (configured/missing/reserved states)

Architecture:

  • The substitution only handles single-ref expressions (secrets.NAME / vars.NAME), passing through compound expressions untouched - this is the correct security-conscious design
  • Unknown secrets resolve to empty strings, matching GitHub's behavior
  • Reruns automatically pick up rotated secrets since stored plans keep the literals

The code is production-ready with no blocking issues identified.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

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.

1 participant