Skip to content

refactor(project): Correct resource tag lifecycle and build scope - #1679

Merged
RandomByte merged 3 commits into
mainfrom
refactor/build-tag-isolation
Oct 27, 2026
Merged

RandomByte merged 3 commits into
mainfrom
refactor/build-tag-isolation

Conversation

@RandomByte

Copy link
Copy Markdown
Member

Resource tags can behave differently across cold, cached, and incremental builds. These changes address three causes:

  1. Clear build tags when a project finishes. Pending cached operations can restore build tags after completion, and a monitor can retain the cleared store. Apply pending operations before clearing both the build tag store and its monitor. Reset all stores and monitors when initializing another build, and keep build tags separate from build-manifest storage. Project tags remain available to dependents. useResultStage() continues to reset both monitors so resource snapshots expose the final tags.

  2. Preserve current tag values during delta replay. After a step updates a tag, recordStageResult() can overwrite it by importing the previous stage's operations. Import the merged operations already used for cache persistence. Later stages then see current values while retaining tags unchanged by the delta.

  3. Scope build tags to the executing project. Routing build tags to a dependency resource's owner makes them visible to other projects and records operations against the wrong project's stage cache. Restore the v4 scope: build tags belong to the executing project, including tags on dependency resources. Project tags continue to belong to the resource owner. Tag classification avoids cached replay and monitor creation.

Regression coverage includes cold builds, persistent cache restores, dependency and consumer changes, output filtering, and serving restarts and rebuilds. Both legacy and step-based tasks are covered.

@RandomByte
RandomByte requested a review from a team October 26, 2026 14:27
Cached tag operations can remain pending when a project finishes. A later
read then replays its build tags. Output filtering can also leave a
monitor referencing the build tag store after the store is cleared.

Apply pending operations before clearing both the build store and its
monitor. Keep project tags available to dependents and retain both
result-stage monitor resets so resource snapshots expose final tags.
Reset all stores and monitors when initializing stages for another build.

Keep build tags separate from build-manifest storage. Sharing that object
with project tags allows build tags to alter manifest contents.

Add regressions for live and cached completion, output filtering,
repeated builds, final tag snapshots, and manifest isolation.
A step that reruns after a dependency changes can update a tag, then have
its value overwritten when recordStageResult imports the previous stage's
operations. Later stages see stale values even though the cache stores
the correctly merged operations.

Import the merged project and build tag operations into the live
collections. Current delta values take precedence, while tags unchanged
by the delta remain available to subsequent stages.

Extend the cache tests to check the values imported for later stages as
well as the values written to the persistent cache.
@RandomByte
RandomByte force-pushed the refactor/build-tag-isolation branch from 5a917e9 to 22bc968 Compare October 26, 2026 14:36
Tasks can tag dependency resources during a build. Routing all tags to
the resource owner exposes build tags to other projects and records tag
operations against the wrong project's stage cache.

Route build tags through the executing project's ProjectResources,
matching the v4 build-context scope. Continue to store project tags on
the resource owner. Classify tags without replaying cached operations or
creating a monitor that would capture a stage snapshot too early.

Cover cold, warm-cache, and delta builds with legacy and step-based
tasks, plus serving restarts and rebuilds. Verify dependency isolation,
project-tag visibility, and output filtering.
@RandomByte
RandomByte force-pushed the refactor/build-tag-isolation branch from 22bc968 to 4fece12 Compare October 26, 2026 14:48

@devtomtom devtomtom left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@RandomByte
RandomByte merged commit b1a31b9 into main Oct 27, 2026
77 checks passed
@RandomByte
RandomByte deleted the refactor/build-tag-isolation branch October 27, 2026 12:43
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.

2 participants