Skip to content

fix(ci): restore security-events: write for Dockerfile lint SARIF upload - #2499

Merged
Andriy Knysh (aknysh) merged 1 commit into
mainfrom
aknysh/ci-dockerfile-lint-sarif-permissions
May 24, 2026
Merged

Andriy Knysh (aknysh) merged 1 commit into
mainfrom
aknysh/ci-dockerfile-lint-sarif-permissions

Conversation

@aknysh

@aknysh Andriy Knysh (aknysh) commented May 24, 2026 •

Copy link
Copy Markdown
Member

what

Restores security-events: write permission for the [lint] Dockerfile
job in .github/workflows/test.yml so its hadolint SARIF results can
be uploaded to GitHub Code Scanning.

  • Adds a job-level permissions: block to the docker job:
    permissions:
      contents: read           # actions/checkout
      security-events: write   # github/codeql-action/upload-sarif
  • contents: read is re-listed because a job-level permissions: block
    fully overrides the workflow-level set (rather than merging).

why

PR #2487 (2437e13bf) added a top-level permissions: block to the
workflow to grant packages: read for ghcr.io pulls:

permissions:
  contents: read
  packages: read

In GitHub Actions, a workflow-level permissions: block replaces
(not extends) the default GITHUB_TOKEN scope for every job in the
file. That replacement inadvertently stripped the implicit
security-events: write that the [lint] Dockerfile job relied on to
upload hadolint SARIF results via github/codeql-action/upload-sarif@v4.

Every post-merge run on main has been failing the Upload SARIF
file
step since #2487:

##[warning]This run of the CodeQL Action does not have permission to
access the CodeQL Action API endpoints. ... please ensure the workflow
has at least the 'security-events: read' permission.
##[error]Resource not accessible by integration -
https://docs.github.com/rest

Failing run for reference:
https://github.com/cloudposse/atmos/actions/runs/26339160817/job/77562841194

Note: hadolint itself ran successfully in the failing run — the SARIF
output contained zero findings. Only the upload step failed.

A job-level fix (this PR) is preferred over expanding the workflow-level
permissions block, because it follows least-privilege: only the one job
that actually needs to write security events gets the elevated scope.

references

Summary by CodeRabbit

  • Chores
    • Fixed permissions configuration in the CI/CD pipeline to restore security scanning capabilities in automated testing workflows.

Review Change Stack

PR #2487 added a top-level `permissions:` block to .github/workflows/test.yml
to grant `packages: read` for ghcr.io pulls. In GitHub Actions, a
workflow-level permissions block REPLACES (not extends) the default token
scope for every job, so this inadvertently stripped the implicit
`security-events: write` that the `[lint] Dockerfile` job relied on to
upload hadolint SARIF results via github/codeql-action/upload-sarif.

The post-merge run on main has been failing since #2487:

  ##[warning]This run of the CodeQL Action does not have permission to
  access the CodeQL Action API endpoints.
  ##[error]Resource not accessible by integration

Fix: add a job-level `permissions:` block to the docker job with
`security-events: write` (least-privilege — does not broaden any other
job's permissions). `contents: read` is re-listed because job-level
permissions fully override the workflow-level set (rather than merging).

hadolint itself ran successfully in the failing run — the SARIF
contained zero findings. Only the upload step failed.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@aknysh Andriy Knysh (aknysh) added the no-release Do not create a new release (wait for additional code changes) label May 24, 2026
@aknysh
Andriy Knysh (aknysh) requested a review from a team as a code owner May 24, 2026 14:47
@atmos-pro

atmos-pro Bot commented May 24, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@github-actions github-actions Bot added the size/xs Extra small size PR label May 24, 2026
@aknysh Andriy Knysh (aknysh) self-assigned this May 24, 2026
@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

None

@mergify

mergify Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

Important

Cloud Posse Engineering Team Review Required

This pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes.

To expedite this process, reach out to us on Slack in the #pr-reviews channel.

@mergify mergify Bot added the needs-cloudposse Needs Cloud Posse assistance label May 24, 2026
@coderabbitai

coderabbitai Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7bb1c64b-f76e-4fbb-9522-895fcebce362

📥 Commits

Reviewing files that changed from the base of the PR and between cdbff00 and 68acf28.

📒 Files selected for processing (1)
  • .github/workflows/test.yml

📝 Walkthrough

Walkthrough

The docker job in the GitHub Actions workflow now declares explicit job-level permissions, re-establishing contents: read and adding security-events: write to restore SARIF upload capability that workflow-level token scope changes had broken.

Changes

Docker job SARIF upload permissions

Layer / File(s) Summary
Docker job SARIF upload permissions
.github/workflows/test.yml
The docker job gains an explicit job-level permissions section that overrides workflow defaults, re-declaring contents: read and adding security-events: write to restore the job's ability to upload security/SARIF results.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested reviewers

  • nitrocode
  • Gowiem
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: restoring security-events permission for SARIF upload in the Dockerfile lint job.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch aknysh/ci-dockerfile-lint-sarif-permissions

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codecov

codecov Bot commented May 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.30%. Comparing base (cdbff00) to head (68acf28).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2499      +/-   ##
==========================================
+ Coverage   78.28%   78.30%   +0.02%     
==========================================
  Files        1119     1119              
  Lines      106525   106525              
==========================================
+ Hits        83396    83419      +23     
+ Misses      18472    18445      -27     
- Partials     4657     4661       +4     
Flag Coverage Δ
unittests 78.30% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aknysh
Andriy Knysh (aknysh) merged commit 6be71a6 into main May 24, 2026
74 checks passed
@aknysh
Andriy Knysh (aknysh) deleted the aknysh/ci-dockerfile-lint-sarif-permissions branch May 24, 2026 15:31
@atmos-pro

atmos-pro Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

Note

Atmos Pro  

Waiting for your GitHub Actions workflow to upload affected stacks.
Learn More.

@mergify mergify Bot removed the needs-cloudposse Needs Cloud Posse assistance label May 24, 2026
Andriy Knysh (aknysh) added a commit that referenced this pull request May 24, 2026
…oad (#2499)

PR #2487 added a top-level `permissions:` block to .github/workflows/test.yml
to grant `packages: read` for ghcr.io pulls. In GitHub Actions, a
workflow-level permissions block REPLACES (not extends) the default token
scope for every job, so this inadvertently stripped the implicit
`security-events: write` that the `[lint] Dockerfile` job relied on to
upload hadolint SARIF results via github/codeql-action/upload-sarif.

The post-merge run on main has been failing since #2487:

  ##[warning]This run of the CodeQL Action does not have permission to
  access the CodeQL Action API endpoints.
  ##[error]Resource not accessible by integration

Fix: add a job-level `permissions:` block to the docker job with
`security-events: write` (least-privilege — does not broaden any other
job's permissions). `contents: read` is re-listed because job-level
permissions fully override the workflow-level set (rather than merging).

hadolint itself ran successfully in the failing run — the SARIF
contained zero findings. Only the upload step failed.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Andriy Knysh (aknysh) added a commit that referenced this pull request May 24, 2026
…rkloads (~50% local wall-clock, projected ~10× on 2-core CI) (#2496)

* perf(exec): eliminate cache-write lock contention in base component config cache

Phase 2 of the describe-affected perf investigation. On a large-stack
workload (~9k component instances across ~700 stacks),
cacheBaseComponentConfig showed 5m50s of cumulative Total time at
55ms/call. Reads via getCachedBaseComponentConfig were cheap (6.5s
total, 855µs/call), pinpointing the cost on the write path.

The root cause was the exclusive RWMutex.Lock() holding for the entire
function — including the ~525µs deepCopyBaseComponentConfigMaps call.
With many goroutines writing disjoint cache keys concurrently, every
write serialized through the same lock, padding "Total" with lock-wait
time. Many-core machines hid this behind parallelism; 2-4 core GHA
runners could not, which is the dominant contributor to the customer-
reported ~11 minute "atmos describe affected" wall-clock on v1.219.0.

Two changes:

1. baseComponentConfigCache is now a sync.Map (was
   map[string]*BaseComponentConfig + sync.RWMutex). sync.Map is
   purpose-built for the disjoint-key write pattern this cache
   exhibits and has no global lock.
2. The deep copy is moved OUTSIDE the critical section in both the
   read and write paths. The cached pointer's target is immutable
   post-insert, so deep-copying outside the sync.Map operation is
   race-free.

Confirmed impact on the customer repro (mean of 3 runs, local):

  cacheBaseComponentConfig Total: 5m50s -> 4.0s (-98.8%, 86x faster avg)
  getCachedBaseComponentConfig Total: 6.5s -> 880ms (-86%, 8x faster avg)
  processComponent Total: 6m11s -> 35s (-91%)
  processComponentInheritance Total: 6m02s -> 28s (-92%)
  ProcessBaseComponentConfig Total: 6m02s -> 22s (-94%)
  processInheritedComponent Total: 6m00s -> 22s (-94%)
  processMetadataInheritance Total: 6m00s -> 23s (-94%)

The pre-fix Total was mostly lock-wait padding, not real CPU work.
Post-fix numbers reflect actual cost.

Local wall-clock barely moved on a many-core Mac (3.4s -> 4.1s) — the
lock-waiters were parked, not consuming CPU. On 2-4 core GHA runners,
where the lock-wait IS wall-clock, multi-minute improvement is
expected. End-to-end GHA validation pending.

Tests added (all race-clean):

  TestConcurrentCacheAccess_DisjointKeys
    200 goroutines write unique keys; every key independently
    readable with no cross-contamination. Guards against any future
    regression that reintroduces a global write lock — the existing
    TestConcurrentCacheAccess uses a single key and would not detect
    a lock-contention regression.

  TestConcurrentCacheAccess_InterleavedReadWrite
    50 writers + 50 readers running concurrently. Validates that the
    deep-copy-outside-the-lock change is safe under the race detector.

  TestCacheReadIsolationAfterStoreReturns
    Mutates the source struct AFTER the cache write returns; verifies
    the cached entry remains independent. Complements
    TestCacheBaseComponentConfigDeepCopy (which tests the
    before-read mutation direction).

Bottleneck shifts to mergeComponentConfigurations (2m22s Total) for
follow-up phases. Investigation doc added at
docs/fixes/2026-05-23-describe-affected-component-inheritance-perf.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* perf(merge): short-circuit WalkAndDeferYAMLFunctions for function-free subtrees

Phase 3 of the describe-affected perf investigation. The merge pipeline
calls WalkAndDeferYAMLFunctions hundreds of thousands of times (527,765
recursive calls on the customer workload). Each call allocates a new
map[string]interface{} at every recursion level and copies every entry,
even when the input contains no Atmos YAML functions to defer. The
vast majority of subtrees in real configs (vars, settings, env, hooks,
generate, providers for components without YAML functions) were
generating pure GC pressure.

Fix: pre-scan the input with a non-allocating hasAnyYAMLFunction(map)
helper. When the entire subtree contains no YAML function string
(!terraform.*, !template, !store*, !exec, !env), return the input
map as-is. When any function is present, the original walk runs
unchanged.

Safety: the fast-path return shares the input map with the caller.
The contract is documented on the function: the result is read-only.
The only call site (MergeWithDeferred -> Merge) produces a new merged
map without mutating inputs. A new test
(TestWalkAndDeferYAMLFunctions_NoFunctionsShortCircuit) locks in the
contract — returns the same pointer for function-free input, walks
normally when any subtree has a function, and does not mutate
function-free input.

Confirmed impact on the customer repro (mean of 3 runs, local):

  WalkAndDeferYAMLFunctions Calls: 527,765 -> 328,218 (-38%)
  WalkAndDeferYAMLFunctions Total: 1m26s -> 15.4s (-82%, 3.5x faster avg)
  MergeWithDeferred Total: 1m35s -> 1m10s (-26%)
  mergeComponentConfigurations Total: 2m22s -> 1m54s (-20%)

Wall-clock elapsed: 4.1s -> 3.3s mean (-19% on a many-core Mac).
Unlike Phase 2 (lock-wait padding), Phase 3 reduces real allocation
work and GC pressure, so wall-clock improves on every architecture.
On 2-4 core GHA runners, the ~71s of cumulative CPU saved projects
to 18-35s of wall-clock improvement.

Original Phase 3 plan (parallelize component-level inheritance within
processComponentsInParallel) was abandoned during investigation:
component-level parallelism is already in place (one goroutine per
component within each stack, fanned out by processComponentsInParallel),
so further parallelization would not help 2-4 core GHA runners that
are already CPU-bound at the component goroutine layer.

Race detector clean for pkg/merge. A pre-existing race in
extractAndAddLocalsToContext (internal/exec/stack_processor_utils.go:260)
surfaces under -race for some TestHierarchicalImports_* tests;
confirmed present in main without Phase 3 changes and tracked
separately.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* perf(merge): skip MergeWithDeferred when 0 or 1 input is non-empty

Phase 5 of the describe-affected perf investigation.
mergeComponentConfigurations calls MergeWithDeferred 9 times per
component instance (vars / settings / env / auth / providers /
required_providers / hooks / generate / auth-merge), each with 3-4
candidate inputs (Global / BaseComponent / Component /
ComponentOverrides). On real workloads most of those layers are
empty: components that don't inherit have empty BaseComponent layers,
most components have no overrides, and several sections (generate,
required_providers, hooks) are empty for the majority of components.

Despite the empty layers, every call ran the full pipeline: allocate
a deferred merge context, walk each input (Phase 3 short-circuit
avoids the inner deep-copy but the walk function still runs), and
call Merge to combine all processed inputs (a deep walk over all
entries even when only one contributes values).

Fix: pre-scan the inputs in MergeWithDeferred and short-circuit when
the merge degenerates:

- 0 non-empty inputs: return a fresh empty map and empty dctx.
- 1 non-empty input: walk just that input at its original precedence
  so YAML functions are deferred correctly, then return the walked
  map directly — skip the Merge call entirely.

The downstream ApplyDeferredMerges is dctx-driven: when dctx has no
deferred values (no-functions case), it's a no-op and does not touch
the returned map. Combined with Phase 3's
WalkAndDeferYAMLFunctions short-circuit, a single-input
function-free section is now a zero-allocation pass-through from
input map to merged result.

Confirmed impact on the customer repro (mean of 3 runs, local):

  mergeComponentConfigurations Total: 1m54s -> 57s (-50%, avg 12.5ms -> 6.2ms)
  MergeWithDeferred Total: 1m10s -> 25s (-64%, avg 851µs -> 305µs, 2.8x faster)
  merge.Merge Calls: 273,379 -> 207,934 (-65k calls eliminated, -24%)
  WalkAndDeferYAMLFunctions Total: 15.4s -> 6.0s (-61%)
  WalkAndDeferYAMLFunctions Calls: 328,218 -> 112,832 (-66%, -215k more saved)
  processComponent Total: 34s -> 27s (-21%)

Wall-clock elapsed: 3.3s -> 3.0s mean (-10% on a many-core Mac).
Cumulative CPU saved across Phases 3+5 ~= 150 seconds, projecting to
~37-75 seconds of wall-clock improvement on 2-4 core GHA runners
(on top of Phase 2's contention elimination).

Tests added (race-clean):
  TestMergeWithDeferred_TrivialInputShortCircuits
    - zero non-empty inputs returns empty result
    - single non-empty function-free input returns the same map
      header (composes with Phase 3 zero-allocation fast path)
    - single non-empty input with YAML functions defers at the
      correct precedence
    - two non-empty inputs take the full merge path
    - fast path does not mutate the input

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* perf(exec): cache locals extraction + fix race in extractAndAddLocalsToContext

Phase 4 of the describe-affected perf investigation. Two changes that
travel together because the second one was a pre-existing data race
surfaced by the same goroutine fan-out the first one optimizes for.

1. CACHE: extractLocalsFromRawYAML was called 22,181 times for ~836
   unique files (~26 calls per file via transitive imports) at 533µs
   avg, accumulating 13s of cumulative CPU time. ~7s of that was
   UnmarshalYAMLFromFile re-parsing the same YAML content for the same
   file path.

   Added localsExtractionCache (sync.Map) keyed by
   filePath + FNV-1a(yamlContent). Within a single command execution
   file content is immutable (the file content itself is already
   cached via getFileContentSyncMap), so the parse + locals resolution
   is fully deterministic. The content-hash component of the key
   prevents test pollution when the same logical file path is reused
   with different content — a common pattern in unit tests, and a
   safety property for any future dynamic-content code path.

   Cache values are deep-copied on retrieval via
   cloneExtractLocalsResult. The extractLocalsResult struct contains
   four maps (locals / settings / vars / env) that downstream
   consumers store into shared template contexts and may mutate
   later; sharing the cached pointer would corrupt subsequent reads.
   Deep copy cost (typically <50µs per call) is well below the
   533µs/call un-cached path.

   Added ClearLocalsExtractionCache for tests, following the existing
   ClearBaseComponentConfigCache / ClearFileContentCache pattern.

2. RACE FIX: extractAndAddLocalsToContext used to call
   delete(context, LocalsSectionName) directly on its input map. In
   the fan-out at processYAMLConfigFileWithContextInternal
   (one goroutine per sibling import, sharing the parent
   mergedContext), this produced a data race surfaced under -race
   by TestHierarchicalImports_* tests. The race existed before this
   PR but became reachable only when the test suite started exercising
   the parallel import path under the race detector.

   Fix: shallow-clone the input context before the file-scoped delete
   and assign. Each goroutine gets its own context map header; values
   remain shared references (only the map header is mutated inside
   this function, so per-goroutine cloning is sufficient).

Confirmed impact on the customer repro (mean of 3 runs, local):

  extractAndAddLocalsToContext Total: 13s -> 6.7s (-48%, 2x faster avg)
  extractLocalsFromRawYAML Total: 13s -> 5.9s (-55%, 2x faster avg)
  UnmarshalYAMLFromFile Calls: 22,374 -> ~1,900 (-92%, 20k+ calls eliminated)
  ProcessStackLocals Calls: 22,167 -> ~1,800 (-92% Calls, -89% Total)

Wall-clock elapsed: 3.0s -> 2.3s mean (-23%). The biggest single-
phase wall-clock win in this investigation: unlike Phase 2 (lock-wait
padding hidden by many-core parallelism on Mac), the locals cache
eliminates real CPU work — YAML parsing + locals resolution — that
was contributing directly to wall-clock on every architecture.

Cumulative trajectory (local Mac wall-clock):
  Pre-Phase-2 baseline: 4.1s
  Phase 3 (walk short-circuit): 3.3s (-19%)
  Phase 5 (skip trivial merges): 3.0s (-10%)
  Phase 4 (locals cache): 2.3s (-23%, biggest jump)
  Cumulative vs baseline: -44%

Tests added (all race-clean):
  TestExtractLocalsFromRawYAML_CacheReturnsIndependentCopies
    - mutating one retrieved result does not affect a subsequent
      retrieval (deep-copy contract).
  TestExtractLocalsFromRawYAML_CacheKeyIncludesContentHash
    - same file path with different content yields distinct entries
      (test-pollution prevention).
  TestExtractAndAddLocalsToContext_DoesNotMutateInputContext
    - the caller's parent context is unchanged after the call
      (locks in the race fix).

The pre-existing race in TestHierarchicalImports_* is now resolved
under -race. Other unrelated races elsewhere in pkg/internal/exec
(processSettingsIntegrationsGithub vs DeepCopyMap,
MergeContext.WithFile concurrent writes) are tracked separately —
they exist in main without these changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* perf(utils): eliminate parsedYAMLCache lock contention with sync.Map

Phase 6 of the describe-affected perf investigation. After Phase 4
eliminated 92% of locals-extraction parses, the next bottleneck became
UnmarshalYAMLFromFileWithPositions (22,181 calls, 18.7s Total, 844µs avg)
— the position-tracking YAML parser used by
processYAMLConfigFileWithContextInternal for the final stack-config parse.

It already had a content-hash cache, but the cache structure was the
same RWMutex-protected map pattern that Phase 2 fixed for
cacheBaseComponentConfig:

- cacheParsedYAML held parsedYAMLCacheMu.Lock() during the recursive
  deepCopyYAMLNode work.
- getCachedParsedYAML held parsedYAMLCacheMu.RLock() during the
  read-side deepCopyYAMLNode.

With ~22k concurrent calls, the global write lock serialized every
cache write, padding apparent CPU time with lock-wait.

Fix (same as Phase 2):

1. parsedYAMLCache is now a sync.Map (was map + sync.RWMutex).
2. Deep-copy of yaml.Node + PositionMap happens BEFORE the
   sync.Map.Store and AFTER the sync.Map.Load, never inside any
   critical section.

Added clearParsedYAMLCache() plus the public ClearParsedYAMLCache()
for tests, mirroring the ClearBaseComponentConfigCache /
ClearLocalsExtractionCache pattern. Three existing tests that
manually saved/restored the map + mutex state were updated to use
the helper.

Confirmed impact on the customer repro (mean of 3 runs, local):

  UnmarshalYAMLFromFileWithPositions Total: 18.7s -> 3.7s (-80%, 5x faster avg)
  ProcessYAMLConfigFileWithContext Total: 57.6s -> 54s (-6%, downstream)

Wall-clock elapsed: 2.3s -> 2.3s (unchanged on a many-core Mac).
Same caveat as Phase 2: lock-wait padding doesn't show on many-core
machines because the waiters park rather than consume cores. On 2-4
core GHA runners where the lock-wait IS wall-clock, projecting from
the 15s of cumulative CPU eliminated -> ~4-7 seconds wall-clock
savings end-to-end.

Race detector clean:
  go test -race -count=1 \
    -run "UnmarshalYAMLFromFileWithPositions|HandleCacheMiss|CacheHit" \
    ./pkg/utils/...

Full pkg/utils and internal/exec test suites pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* perf(utils): hoist hasCustomTags pre-check out of processCustomTags recursion

Phase 7 of the describe-affected perf investigation.
processCustomTags (the YAML node walker that detects and processes
!terraform.*, !template, !store*, !exec, !env, !include, !literal
tags) had a hasCustomTags early-exit pre-check at the top of every
invocation. The pre-check itself walks the entire subtree to find
any custom tag. On recursive invocations (one per child node with
content), the pre-check re-walks the same subtree it just walked at
the level above — O(N x depth) work where it should be O(N).

For trees with tags (most of them in the customer workload), this
meant ~9k top-level processCustomTags calls each re-walking their
tree at every recursion level. Total cumulative CPU was 31.5s,
3.4ms avg per top-level call.

Fix: split processCustomTags into outer entry + inner worker:

  - processCustomTags does the hasCustomTags check ONCE at the top
    level. If no tags exist, early-exit. Otherwise, delegate to the
    inner worker.
  - processCustomTagsInner is the recursive worker — no
    hasCustomTags check on each call, just process and recurse. By
    the time we are inside it, we already know the tree has tags.

perf.Track stays on the outer function and is intentionally omitted
from the inner worker: the outer call wraps the whole walk with one
tracked frame, so adding per-recursion tracking would inflate the
metric without yielding insight.

Confirmed impact on the customer repro (mean of 2 runs, local):

  processCustomTags Total: 31.5s -> 7.5s (-76%, 3.2x faster avg)

Wall-clock elapsed: 2.3s -> 2.4s (within noise on a many-core Mac
where parallelism absorbs the saved work). Cumulative ~24s CPU
saved -> projected ~6-12s wall-clock on 2-4 core GHA runners on top
of Phases 1-6.

Race detector clean:
  go test -race -count=1 \
    -run "ProcessCustomTags|UnmarshalYAML|TestHasCustomTags" \
    ./pkg/utils/...

Full pkg/utils and internal/exec test suites pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* perf(utils): cache the decoded+interned YAML result alongside the parsed node

Phase 8 of the describe-affected perf investigation. The
parsedYAMLCache from Phase 6 already eliminates re-parsing of
identical YAML content, but the inner Decode + Intern steps inside
UnmarshalYAMLFromFileWithPositions run on EVERY call — including
cache hits:

  node, _, _ := getCachedParsedYAML(file, input)  // Phase 6 hit
  node.Decode(&data)                              // Always runs
  data = InternStringsInMap(data)                 // Always runs

Decode allocates a fresh map tree from the cached yaml.Node;
InternStringsInMap recursively walks the decoded tree and allocates
another tree with interned string keys/values. Combined cost
~500-700µs per call across the 22,181 invocations.

Fix: added a second sync.Map cache (decodedYAMLCache) keyed by the
same (file, content hash) pair as parsedYAMLCache. The cache value
is the post-Decode + post-Intern map[string]any plus the matching
PositionMap. The hot-path call site checks this cache first; a hit
returns a deep-copy of the cached result, skipping Decode and
Intern entirely.

The fast path activates only for T == map[string]any (the production
hot path; schema.AtmosSectionMapType is exactly this type). Detection
is done via a single any(zeroValue).(map[string]any) type assertion —
no reflect, no per-call overhead. Other generic instantiations
(used only in tests) fall through to the existing Decode path.

A local deepCopyDecodedMap helper handles the deep copy on
retrieval; we can't use merge.DeepCopyMap because pkg/merge imports
pkg/utils (circular dependency). The local helper covers the value
types produced by yaml.Node.Decode + InternStringsInMap (nested
map[string]any, []any, and immutable primitives) — Atmos custom
tags are pre-processed into strings before this point, so no exotic
types appear.

ClearDecodedYAMLCache added for test cleanup, mirroring the existing
ClearParsedYAMLCache / ClearLocalsExtractionCache /
ClearBaseComponentConfigCache pattern.

Decoded-cache hits increment the same parsedYAMLCacheStats.hits
counter as parsed-node hits; both represent successful avoidance
of work. This preserves the existing
TestUnmarshalYAMLFromFileWithPositions_CacheHitWithProvenance
contract.

Confirmed impact on the customer repro (mean of 3 runs, local):

  UnmarshalYAMLFromFileWithPositions Total: 3.7s -> 3.2s (-14%)
  UnmarshalYAMLFromFileWithPositions Avg: 166µs -> 144µs

Wall-clock elapsed: 2.4s -> 2.06s mean (-14% locally). The
cumulative CPU savings on the function itself are modest (~500ms),
but the wall-clock improvement is larger than that delta would
predict — likely from reduced allocation pressure (no fresh map
allocations on cache hit) and resulting GC relief. On 2-4 core GHA
runners, expect a similar relative improvement plus the GC win
compounded across cores.

Race detector clean: go test -race -count=1 ./pkg/utils/...
Full pkg/utils and internal/exec test suites pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* perf(exec): asymmetric clone in cloneExtractLocalsResult

Phase 9 of the describe-affected perf investigation. After Phase 4
cached the parsed locals result, cloneExtractLocalsResult deep-copied
all FOUR map fields (locals, settings, vars, env) on every retrieval
to preserve the cache's immutability contract. This dominated the
cache-hit path: 22,181 calls x ~343µs avg = 7.6s of cumulative CPU.

The deep copy of settings/vars/env is overkill. The only production
consumer of those three fields is processTemplatesInSection, which:

  1. Marshals the section to YAML (read-only).
  2. Parses the YAML back into a new map.
  3. Returns the new map.

The input section is never mutated. So sharing the cache's reference
is safe — the per-caller deep copy was unnecessary overhead.

Fix: refactored cloneExtractLocalsResult to be asymmetric:

  - locals is still deep-copied. This field is stored long-term in
    the template context (context[cfg.LocalsSectionName] = ...)
    where downstream mutation surface is hard to bound, so the
    defensive copy stays.
  - settings, vars, env are now shared references. The contract is
    documented on the function: callers must treat them as
    read-only.

TestExtractLocalsFromRawYAML_CacheReturnsIndependentCopies updated to
reflect the new contract: only locals requires post-mutation
isolation; settings/vars/env share with the cache.

Confirmed impact on the customer repro (mean of 3 runs, local):

  extractLocalsFromRawYAML Total: 7.6s -> 6.3s (-17%, 18% faster avg)
  extractAndAddLocalsToContext Total: 8.9s -> 7.3s (-18%, 18% faster avg)

Wall-clock elapsed: 2.06s -> 2.13s (within run-to-run noise on a
many-core machine). Cumulative ~1.5s CPU saved -> projected
~750ms wall-clock savings on 2-core GHA runners.

Race detector clean:
  go test -race -count=1 \
    -run "TestExtractLocals|TestExtractAndAdd|TestHierarchicalImports" \
    ./internal/exec/

Full internal/exec test suite passes.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* Revert "perf(exec): asymmetric clone in cloneExtractLocalsResult"

This reverts commit 6a8bd8d.

* docs(fixes): record Phase 9 revert and lesson in describe-affected perf doc

Phase 9 (asymmetric clone in cloneExtractLocalsResult) was reverted in
b11f3cd after the customer-scale heatmap run produced
`fatal error: concurrent map iteration and map write`.

Document the failure mode so future passes don't re-attempt the same
optimization without addressing the root cause:

  processTemplatesInSection returns its input map as-is when the
  section contains no `{{` (the common case at scale). The cached
  settings/vars/env therefore DO end up shared in the long-lived
  template context, where a sibling goroutine subsequently mutates
  them via DeepCopyMap during inheritance processing.

The "consumed only by processTemplatesInSection" claim was wrong
because that function has a fast-path pass-through. Re-attempting
this win requires deep-copying inside the pass-through path, or a
stronger immutability proof for the downstream context flow.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* perf(utils): hoist perf.Track out of processYAMLNode recursion

Phase 10 of the describe-affected perf investigation. processYAMLNode
is a recursive YAML walker that adjusts the style of scalar strings
beginning with `#` (so they round-trip without YAML re-interpreting
them as comments). It is called from EvaluateYqExpression and
recurses over every node in the parsed tree.

In the customer workload, the function logged 34k recursive calls
totaling 5.5s — most of that being perf.Track defer overhead per
invocation (~3µs each via mutex ops + counter updates), not real
work. The per-node body is a single comparison and an optional
style assignment.

Fix: same outer/inner split used by Phase 7 (processCustomTags /
processCustomTagsInner):

  - processYAMLNode does the perf.Track entry tracking and delegates
    to the inner worker.
  - processYAMLNodeInner is the recursive walker. No perf.Track on
    each recursive frame, so the metric counts top-level invocations
    instead of every node visited.

Confirmed impact on the customer repro (mean of 3 runs, local):

  processYAMLNode: dropped out of the top-25 hot functions
                   (was 5.5s, 34k calls, 160µs avg)

Wall-clock elapsed: 2.2s -> 2.03s (-7% locally).

Notes:

  - The same Phase 7 pattern was ALSO tried for
    WalkAndDeferYAMLFunctions and reverted in this commit. That
    function uses hasAnyYAMLFunction as a per-recursion short-circuit
    to avoid allocating result maps for function-sparse subtrees. An
    outer/inner split made the inner walker allocate unconditionally
    on every recursion, regressing the common case more than the
    perf.Track savings recovered. The current implementation
    documents this in-code so future passes don't re-try.
  - Phase 9 (asymmetric clone in cloneExtractLocalsResult) was
    reverted in b11f3cd after triggering "concurrent map iteration
    and map write" at customer scale. See the fix doc for details.

Race detector clean:
  go test -race -count=1 \
    -run "ProcessYAMLNode|WalkAndDefer|TestProcessYAML" \
    ./pkg/utils/... ./pkg/merge/...

Full pkg/utils, pkg/merge, internal/exec test suites pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* perf(exec): scope remote-state-backend merge to the relevant backend type

Phase 11 of the describe-affected perf investigation.
processTerraformRemoteStateBackend used to do two m.Merge calls per
component: the first merged the three remote-state-backend section
sources (global / base component / component), the second merged the
result with finalComponentBackendSection. Only the value at the
relevant backend-type key (e.g. "s3") was actually returned; the
rest of the merged backend section was deep-copied just to throw
away.

In the customer workload, backend sections frequently carry config
for multiple backend types (s3/gcs/azurerm/etc.), so the second
merge spent significant time deep-copying entries that the caller
never used.

Fix: extract the backend-type-specific map from each input first
(via the new extractBackendTypeMap helper), then merge just those
two scoped maps. m.Merge's existing Phase 5 fast paths handle the
trivial 0-input / 1-input cases.

Confirmed impact on the customer repro (mean of 3 runs, local):

  processTerraformRemoteStateBackend Total: 5.7s -> 5.4s (-5%)
  processTerraformRemoteStateBackend Avg: 617µs -> 582µs (-5%)
  processTerraformBackend Total: 2.95s -> 2.81s (-5%)
  merge.Merge Total: 26.5s -> 25.2s (-5%, smaller inputs propagate)

Wall-clock elapsed: 2.05s -> 2.05s (unchanged on many-core Mac;
parallelism absorbs the saved CPU). ~1s cumulative CPU saved
projects to ~500ms wall-clock on 2-core GHA runners.

Race detector clean: go test -race -count=1 \
  -run "TestProcessTerraform|TestRemoteState|TestProcessYAMLConfig" \
  ./internal/exec/...
Full internal/exec test suite passes.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* perf(exec): skip deep-copy of empty fields in BaseComponentConfig cache

Phases 12 and 13 of the describe-affected perf investigation.
deepCopyBaseComponentConfigMaps unconditionally called m.DeepCopyMap
on all 10 map fields of BaseComponentConfig, even when the source
field was empty. m.DeepCopyMap on a nil map returns quickly but
still pays the function call + perf.Track overhead; on an
empty-but-non-nil map it allocates an empty map.

In the customer workload, most components leave several of these
fields empty (notably BaseComponentProviders / Hooks / Generate /
Dependencies for non-Terraform components, and
BaseComponentBackendSection / RemoteStateBackendSection for many
others). The unconditional calls added up:

  cacheBaseComponentConfig: 3.85s total, 598µs avg, 6,431 calls
  getCachedBaseComponentConfig: 865ms total, 107µs avg, 8,017 calls

Both functions call deepCopyBaseComponentConfigMaps once, so the
fix benefits both paths (insert and retrieval).

Fix: guard each m.DeepCopyMap call with `len(src.Field) > 0`. Skips
the function call entirely when the field is empty. The dst field
defaults to nil/empty, matching the contract of the prior code
(which also produced empty-map values via DeepCopyMap on nil).

Confirmed impact on the customer repro (mean of 3 runs, local):

  cacheBaseComponentConfig Total: 3.85s -> ~990ms (-74%, 3.9x faster avg)
  cacheBaseComponentConfig Avg: 598µs -> 153µs
  getCachedBaseComponentConfig Total: 865ms -> ~360ms (-58%, 2.4x faster avg)
  getCachedBaseComponentConfig Avg: 107µs -> 44µs
  merge.DeepCopyMap Calls: 223,109 -> 175,120 (-22%, 48k calls eliminated)
  merge.DeepCopyMap Total: 5.0s -> 3.8s (-24%)

Wall-clock elapsed: 2.05s -> 2.02s (within noise on a many-core
Mac; parallelism absorbs the saved CPU). ~4.5s cumulative CPU saved
projects to ~2.2s wall-clock on 2-core GHA runners.

Race detector clean: go test -race -count=1 \
  -run "TestCache|TestClearBaseComponent|TestConcurrentCache|TestProcessBaseComponentConfig" \
  ./internal/exec/...
Full internal/exec test suite passes.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* test(perf): close coverage gaps from the describe-affected optimization arc

After the Phase 1-13 optimization arc, coverage on the touched code is
strong (87-100% on most functions). This commit closes the remaining
small gaps:

  - ClearParsedYAMLCache: 0% -> 100%
    Public wrapper around clearParsedYAMLCache; previously only the
    internal helper was exercised via t.Cleanup patterns. New test
    seeds an entry through the public API and verifies the public
    Clear* empties the sync.Map.

  - ClearDecodedYAMLCache: 0% -> 100%
  - clearDecodedYAMLCache: 0% -> 100%
    Same pattern as above for the Phase 8 decoded-result cache.

  - extractBackendTypeMap: 77.8% -> 100%
    Phase 11 helper. The success and missing-key paths were covered
    by TestProcessTerraform* indirectly; new test adds the explicit
    nil-section, missing-key, value-present, and type-mismatch paths.

  - deepCopyBaseComponentConfigMaps (Phase 12/13): adds an
    all-empty-fields test that locks in the contract: empty source
    fields produce nil dst fields (no empty-map allocations during
    caching or retrieval).

Race detector clean for all four new tests:
  go test -race -count=1 \
    -run "TestClearParsedYAMLCache_Public|TestClearDecodedYAMLCache_Public|TestExtractBackendTypeMap|TestCacheBaseComponentConfig_SkipsEmptyFields" \
    ./pkg/utils/... ./internal/exec/...

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(merge): revert MergeWithDeferred 1-input shortcut after spacelift regression

CI surfaced TestSpaceliftStackProcessor losing 7 of 47 spacelift stacks
(and the matching legacy test losing 7 of 44) after the Phase 5 1-input
fast path shipped. Same class of regression as the reverted Phase 9 in
b11f3cd: the optimization handed a shared map reference back to a
caller that mutates the result downstream.

Root cause: when the single non-empty input to MergeWithDeferred had no
Atmos YAML functions, WalkAndDeferYAMLFunctions's Phase 3 short-circuit
returned the input map as-is, and the 1-input shortcut handed that
shared reference back to mergeComponentConfigurations. mergeComponentConfigurations
then mutated the returned map while assembling the per-component output,
which corrupted the upstream cached BaseComponentSettings /
GlobalSettings for sibling components — specifically dropping
settings.spacelift.workspace_enabled for 7 components by the time they
reached CreateSpaceliftStacks.

The Merge slow path that this revert restores always deep-copies its
1-input case (via MergeWithOptions -> DeepCopyMap), so the wrapper
overhead saved by the shortcut was small compared to the deep-copy cost
that has to happen regardless for the Merge contract to hold (result
must be a fresh, caller-mutable map).

Kept: the 0-input fast path (return an empty map and an empty dctx
when every input layer is empty). That path is safe and produces a
fresh map.

Tests updated:
  - TestMergeWithDeferred_TrivialInputShortCircuits: the 1-input case
    now asserts the result is NOT the same map header as the input.
  - New subtest "mutating the result does not mutate the input"
    locks in the contract so any future caller-mutation regression
    surfaces immediately rather than at the next spacelift run.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* test(merge): update MergeWithDeferred tests + harden sameMapHeader

Two changes, both follow-ups to the Phase 5 revert in 573a53c:

1. TestMergeWithDeferred_TrivialInputShortCircuits updated to reflect
   the new contract: the 1-input case now returns a fresh, caller-
   mutable map (was: shared reference). New "mutating the result does
   not mutate the input" subtest locks the contract in so any future
   regression surfaces in unit tests rather than at the next
   spacelift run.

2. sameMapHeader switched from fmt.Sprintf("%p", m) to
   reflect.ValueOf(m).Pointer(). %p formatting works in practice but
   isn't a documented mechanism for map identity comparison;
   reflect.Value.Pointer() is the canonical Go API for getting the
   underlying map pointer.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(exec): clarify extractBackendTypeMap reference vs copy semantics

The previous docstring said the function "returns the inner map at
section[backendType] as a fresh map[string]any" — but the success path
returns the existing reference from section[backendType] (not a copy).
Only the nil-section and missing-key paths return a fresh empty map.

Reworded to make the success-path reference-sharing explicit and document
the caller contract: the only production caller (processTerraformRemoteStateBackend
post-Phase-11) feeds the result into m.Merge, whose own contract
guarantees its output is a fresh map.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(exec): cache full BaseComponentConfig — preserve previously-dropped fields

deepCopyBaseComponentConfigMaps was missing five AtmosSectionMapType
fields (BaseComponentLocals, BaseComponentGenerate,
BaseComponentSourceSection, BaseComponentProvisionSection,
BaseComponentRequiredProviders) and the scalar BaseComponentRequiredVersion
from the copyConfig struct literals on both the read and write sides. This
is a pre-existing main-branch correctness bug, not introduced by the
performance arc: same 10 of 21 fields covered on main HEAD.

Severity: applyBaseComponentConfig (stack_processor_process_stacks_helpers_inheritance.go)
reads every one of these fields off the cached config and assigns them
into result.BaseComponent*. Before this fix, the same
(stack, component, baseComponent) cache key returned different config
shapes depending on whether the lookup was a HIT (fields nil) or MISS
(fields populated by processBaseComponentConfigInternal). Whichever
caller's ordering happened to hit the cache observed a truncated config.

Fix: add the five missing map fields to deepCopyBaseComponentConfigMaps
(retaining the Phase 12/13 empty-field skip optimization) and the
BaseComponentRequiredVersion string to both struct literals. Now the
cache round-trips every field that processBaseComponentConfigInternal
populates — HIT and MISS return identical shapes.

Tests:

  - TestCacheBaseComponentConfig_SkipsEmptyFields extended to assert
    the previously-uncopied fields stay nil when source is empty
    (Phase 12/13 contract continues to hold).
  - New TestCacheBaseComponentConfig_RoundTripsAllFields populates
    every field with distinguishable values and asserts each
    round-trips through the cache. Includes a deep-copy isolation
    check on BaseComponentLocals (mutating a retrieved value must not
    affect subsequent retrievals).

Race detector clean for the touched tests.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(fixes): align Status section with shipped checklist + heading levels

Two CodeRabbit feedback items on the describe-affected perf
investigation doc:

1. The Status section header text said "Phases 2 and 3 still open"
   while the checklist below marked both as shipped. Rewrote the
   Status lead-in to point at the checklist as the authoritative
   record of what landed where, and pruned the stale numbered
   optimization plan (items that read "OPEN" had all completed by
   the time the doc was last touched).

2. Promoted "### Post-#2471 fresh heatmap" and "### Affected detection
   note" to "## " — both were peers of "## Status" / "## Problem"
   but lived as H3 under H1, triggering MD001 heading-level-skip.

3. Updated the Phase 5 section to record both the initial 1-input
   shortcut and its revert, with the regression root cause
   (TestSpaceliftStackProcessor lost 7 stacks) and post-revert
   metrics — so future readers see the full arc and the lesson
   ("a shared map reference handed back to a mutating caller is a
   correctness bug, not an optimization") in one place.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(ci): restore security-events: write for Dockerfile lint SARIF upload (#2499)

PR #2487 added a top-level `permissions:` block to .github/workflows/test.yml
to grant `packages: read` for ghcr.io pulls. In GitHub Actions, a
workflow-level permissions block REPLACES (not extends) the default token
scope for every job, so this inadvertently stripped the implicit
`security-events: write` that the `[lint] Dockerfile` job relied on to
upload hadolint SARIF results via github/codeql-action/upload-sarif.

The post-merge run on main has been failing since #2487:

  ##[warning]This run of the CodeQL Action does not have permission to
  access the CodeQL Action API endpoints.
  ##[error]Resource not accessible by integration

Fix: add a job-level `permissions:` block to the docker job with
`security-events: write` (least-privilege — does not broaden any other
job's permissions). `contents: read` is re-listed because job-level
permissions fully override the workflow-level set (rather than merging).

hadolint itself ran successfully in the failing run — the SARIF
contained zero findings. Only the upload step failed.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>

* test(exec,merge): close coverage gaps + lock empty-map cache contract

- stack_processor_cache.go: switch the 15 deepCopyBaseComponentConfigMaps
  guards from `len(src.Field) > 0` to `src.Field != nil`. The previous
  guard collapsed empty-non-nil maps to nil, breaking the documented
  cache-HIT-shape == cache-MISS-shape contract and creating a latent
  "assignment to entry in nil map" panic risk for any downstream code
  that writes into result.BaseComponentX[key]. Docstring updated to
  explain the rationale.

- stack_processor_cache_test.go:
  - Rename TestCacheBaseComponentConfig_SkipsEmptyFields to
    TestCacheBaseComponentConfig_NilFieldsStayNil — the test only ever
    exercised nil source fields.
  - Add TestCacheBaseComponentConfig_EmptyNonNilFieldsStayNonNil: every
    field is allocated as `map[string]any{}`, retrieved through the
    cache, and asserted to round-trip as non-nil, empty, and writable
    (the test actually writes into each returned map to prove no panic).
  - Add TestGetCachedBaseComponentConfig_TypeMismatch and
    TestGetFileContent_StringCachedValue to exercise the defensive
    type-assertion and string-cache-value branches.

- stack_processor_backend_test.go: add three test groups targeting
  realistically-reachable error and decision paths:
  - TestProcessTerraformBackend_TypeMismatchSurfacesError
  - TestProcessTerraformRemoteStateBackend_PropagatesExtractError
    (4 subtests, one per extractBackendTypeMap call site)
  - TestShouldPreserveAuthoredKey (6 decision cases — covers all
    branches including no-azurerm-section and global-key-matches paths)

  Coverage on touched code:
    processTerraformBackend             86.4% -> 90.9%
    processTerraformRemoteStateBackend  79.2% -> 95.8%
    shouldPreserveAuthoredKey           81.8% -> 100%
    getCachedBaseComponentConfig        85.7% -> 92.9%
    GetFileContent                      90.0% -> 100%

  Remaining gaps are unreachable defensive `if err != nil` branches:
  m.DeepCopyMap and m.Merge for these inputs never produce errors.

- pkg/merge/merge_deferred_test.go: add the mirror src->result isolation
  subtest to TestMergeWithDeferred_TrivialInputShortCircuits, per the
  CLAUDE.md rule "for aliasing/isolation tests, verify BOTH directions".
  Mutating the source map after merge must not propagate into the result.

- docs: clarify Phase 12+13 checklist entry — guards now skip nil fields
  (not "empty"), preserving m.DeepCopyMap's empty-non-nil semantics.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(fixes): align Phase 12/13 text with shipped `src.Field != nil` guard

The Phase 12/13 narrative still described the original `len(src.Field) > 0`
form, which contradicts the actual shipped guard and the cache HIT-shape ==
MISS-shape contract documented elsewhere in the same file. Reword both
mentions to:
- state the guard is `src.Field != nil`,
- explain why `len(...) > 0` was rejected (would collapse empty-non-nil
  maps to nil, breaking the shape contract and risking nil-map-write
  panics on downstream `result.BaseComponentX[k] = v`),
- point at TestCacheBaseComponentConfig_EmptyNonNilFieldsStayNonNil as
  the regression guard.

Doc-only.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
@github-actions

Copy link
Copy Markdown

These changes were released in v1.220.0-rc.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-release Do not create a new release (wait for additional code changes) size/xs Extra small size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants