Skip to content

feat(cache): fingerprint tracked getEnv reads - #448

Merged
wan9chi merged 1 commit into
mainfrom
infra-get-env-fingerprint
Jun 14, 2026
Merged

feat(cache): fingerprint tracked getEnv reads#448
wan9chi merged 1 commit into
mainfrom
infra-get-env-fingerprint

Conversation

@wan9chi

@wan9chiwan9chi commented Jun 13, 2026

Copy link
Copy Markdown
Member

Motivation

Once tools can read env values from the runner, cached tasks must remember tracked getEnv reads. Otherwise a later run can replay stale output after a tracked env value changes.

Scope

Make the getEnv tracked option meaningful, record served single-env values in IPC reports, store tracked values in the post-run fingerprint, validate them during cache lookup, and render env-specific cache miss messages. This PR intentionally does not implement getEnvs or env glob match-set tracking.

Verification

  • cargo test -p vite_task_server --test integration
  • UPDATE_SNAPSHOTS=1 cargo test -p vite_task_bin --test e2e_snapshots fetch_env_tracked_invalidates_on_change -- --ignored
  • UPDATE_SNAPSHOTS=1 cargo test -p vite_task_bin --test e2e_snapshots fetch_env_tracks_with_explicit_inputs -- --ignored
  • cargo test -p vite_task_bin --test e2e_snapshots fetch_env_tracked_invalidates_on_change -- --ignored
  • cargo test -p vite_task_bin --test e2e_snapshots fetch_env_tracks_with_explicit_inputs -- --ignored

@wan9chiGraphite App

wan9chi commented Jun 13, 2026

Copy link
Copy Markdown
MemberAuthor

@wan9chi
wan9chiforce-pushed the infra-get-env-fingerprint branch from 5e3b5ec to 51a8c0cCompareJune 13, 2026 11:11
@wan9chi
wan9chiforce-pushed the infra-get-env-prefix-context branch 2 times, most recently from 29db327 to e9111bdCompareJune 13, 2026 14:22
@wan9chi
wan9chiforce-pushed the infra-get-env-fingerprint branch 2 times, most recently from ce0d262 to 93cfb02CompareJune 13, 2026 14:27
@wan9chi
wan9chiforce-pushed the infra-get-env-prefix-context branch 2 times, most recently from 97761ba to 4b74a2cCompareJune 13, 2026 14:36
@wan9chi
wan9chiforce-pushed the infra-get-env-fingerprint branch from 93cfb02 to b77c960CompareJune 13, 2026 14:37
@wan9chi
wan9chiforce-pushed the infra-get-env-prefix-context branch from 4b74a2c to c45b304CompareJune 13, 2026 15:58
@wan9chi
wan9chiforce-pushed the infra-get-env-fingerprint branch from b77c960 to aef9617CompareJune 13, 2026 15:58
@wan9chi
wan9chi marked this pull request as ready for review June 13, 2026 15:59
@wan9chi
wan9chiforce-pushed the infra-get-env-prefix-context branch from c45b304 to b96d1bdCompareJune 13, 2026 16:01
@wan9chi
wan9chiforce-pushed the infra-get-env-fingerprint branch from aef9617 to fee0f27CompareJune 13, 2026 16:01
@wan9chi
wan9chiforce-pushed the infra-get-env-prefix-context branch from b96d1bd to b3d0921CompareJune 13, 2026 16:03
@wan9chi
wan9chiforce-pushed the infra-get-env-fingerprint branch from fee0f27 to 67b6aa2CompareJune 13, 2026 16:03

@chatgpt-codex-connectorchatgpt-codex-connectorBot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit:aef96174a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if fingerprinted.contains_key(name_str) {
return None;
}
let value = record.value.as_ref().and_then(|value| value.to_str().map(Str::from));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Redact tracked env values before caching

When a runner-aware tool reads a secret such as GITHUB_TOKEN/NPM_TOKEN with the default tracked: true, this stores the raw value in the serialized PostRunFingerprint; on a later change SavedCacheMissReason::TrackedEnvChanged formats the same EnvMismatch, so old/new secret values can be persisted in the cache DB and emitted in the full task summary. Declared env fingerprinting hashes sensitive patterns in EnvFingerprints::resolve, but this new path bypasses that protection, so tracked envs should be hashed/redacted before storage/display.

Useful? React with 👍 / 👎.

@wan9chi
wan9chiforce-pushed the infra-get-env-prefix-context branch 2 times, most recently from 83684b7 to 3dcd916CompareJune 13, 2026 16:09
@wan9chi
wan9chiforce-pushed the infra-get-env-fingerprint branch from 67b6aa2 to f61eaacCompareJune 13, 2026 16:09
@wan9chi
wan9chi changed the base branch from infra-get-env-prefix-context to graphite-base/448June 13, 2026 17:16
@wan9chi
wan9chiforce-pushed the infra-get-env-fingerprint branch from f61eaac to 8d340a9CompareJune 13, 2026 17:18
@wan9chi
wan9chi changed the base branch from graphite-base/448 to infra-get-env-prefix-contextJune 13, 2026 17:18
@wan9chi
wan9chiforce-pushed the infra-get-env-prefix-context branch 2 times, most recently from 0a8737d to f19e16cCompareJune 13, 2026 17:22
@wan9chi
wan9chiforce-pushed the infra-get-env-fingerprint branch from 8d340a9 to be64c57CompareJune 13, 2026 17:22
@wan9chi
wan9chi changed the base branch from infra-get-env-prefix-context to graphite-base/448June 13, 2026 17:22
@graphite-app
graphite-appBot changed the base branch from graphite-base/448 to infra-get-env-prefix-contextJune 13, 2026 17:23
@wan9chi
wan9chiforce-pushed the infra-get-env-fingerprint branch from be64c57 to 136a98bCompareJune 13, 2026 17:27
@wan9chi
wan9chi changed the base branch from infra-get-env-prefix-context to graphite-base/448June 13, 2026 17:43
@wan9chi
wan9chiforce-pushed the infra-get-env-fingerprint branch from 136a98b to 7a67801CompareJune 13, 2026 17:44
@wan9chi
wan9chi changed the base branch from graphite-base/448 to infra-get-env-prefix-contextJune 13, 2026 17:44
@wan9chi
wan9chi changed the base branch from infra-get-env-prefix-context to graphite-base/448June 14, 2026 02:21
Motivation:
Once tools can read env values from the runner, cached tasks must remember tracked getEnv reads or a later run can replay stale output after the env changes.
Scope:
Make the getEnv tracked option meaningful, record served single-env values in IPC reports, store tracked getEnv values in the post-run fingerprint, validate them during cache lookup, and render env-specific cache miss messages. This PR intentionally does not implement getEnvs or env glob match-set tracking.
Verification:
- cargo test -p vite_task_server --test integration
- UPDATE_SNAPSHOTS=1 cargo test -p vite_task_bin --test e2e_snapshots fetch_env_tracked_invalidates_on_change -- --ignored
- UPDATE_SNAPSHOTS=1 cargo test -p vite_task_bin --test e2e_snapshots fetch_env_tracks_with_explicit_inputs -- --ignored
- cargo test -p vite_task_bin --test e2e_snapshots fetch_env_tracked_invalidates_on_change -- --ignored
- cargo test -p vite_task_bin --test e2e_snapshots fetch_env_tracks_with_explicit_inputs -- --ignored
@wan9chi
wan9chiforce-pushed the infra-get-env-fingerprint branch from 7a67801 to 08b48f2CompareJune 14, 2026 02:31
@wan9chi
wan9chi changed the base branch from graphite-base/448 to mainJune 14, 2026 02:31
@wan9chiGraphite App

wan9chi commented Jun 14, 2026

Copy link
Copy Markdown
MemberAuthor

Merge activity

  • Jun 14, 2:38 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 14, 2:38 AM UTC: @wan9chi merged this pull request with Graphite.

@wan9chi
wan9chi merged commit 2055bb0 into mainJun 14, 2026
20 of 29 checks passed
@wan9chi
wan9chi deleted the infra-get-env-fingerprint branch June 14, 2026 02:38
wan9chi added a commit that referenced this pull request Jun 14, 2026
Motivation:
Revert the accidental merge of #448 so the tracked getEnv fingerprinting change can return as a normal reviewed PR instead of being landed out of order.
Scope:
This is a mechanical revert of the #448 squash commit (`2055bb0c`). It removes the tracked getEnv fingerprinting implementation and e2e coverage that #448 introduced, returning `main` to the #447 state.
Verification:
- CI
Sign up for freeto 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

@wan9chi