Skip to content

fix: cascade lane updateDependents during local bit snap#10322

Open
davidfirst wants to merge 23 commits intomasterfrom
fix-update-dependents-cascade-on-snap
Open

fix: cascade lane updateDependents during local bit snap#10322
davidfirst wants to merge 23 commits intomasterfrom
fix-update-dependents-cascade-on-snap

Conversation

@davidfirst
Copy link
Copy Markdown
Member

@davidfirst davidfirst commented Apr 21, 2026

Keeps a lane internally consistent with its updateDependents without asking the user for a second action. Previously the only way to refresh updateDependents was the UI's "snap updates" button; now bit snap, bit reset, and _merge-lane main <lane> (the UI's "update lane from main" button) all handle it automatically.

What each flow does now

Local bit snap on a lane with existing updateDependents
Folds affected entries into the same snap pass: loads each from main head, re-snaps it as a direct descendant of main with dep refs rewritten to the new lane hashes. One Version per cascaded comp, one Ripple CI build per cascaded comp, not two. Cascade set is a fixed-point expansion across runtime + dev + peer + extension deps (transitive + cycle safe).

First click of "snap updates" (_snap --update-dependents)
Pulls any lane.components entry that transitively depends on the new updateDependent into the same pass and re-snaps it with the cascaded hash — so we don't end up with compA@lane -> compB@main when compB@lane.updateDependents exists.

bit reset / bit reset --head
Rewinds lane.updateDependents + overrideUpdateDependents to the state recorded in the LaneHistory entry immediately BEFORE the earliest reset batch (by date, so it correctly ignores newer history entries from a post-snap bit fetch). Orphaned cascade Version objects are cleaned from their ModelComponent.

_merge-lane main <lane> (UI "update lane")
Now includes lane.updateDependents in the merge set so their refs are refreshed against main's advanced heads instead of staying stuck at their old main-head base until someone re-snaps. The merged ids are routed back into lane.updateDependents (not promoted to lane.components) via a per-id updateDependentIds plumbed from the merge caller down through snapFromScope / VersionMaker.

How

  • New include-update-dependents-in-snap.ts / include-lane-components-for-updep-snap.ts — the cascade helpers for the two snap directions. Basing cascades on main's current head (not the prior updateDependents snap) keeps the new snap a direct descendant of main, avoiding drift when main moved on since the last "snap updates" click.
  • snapFromScope gained a per-id updateDependentIds?: string[] so a mixed snap pass (merge-snap) can route some ids to lane.components and others to lane.updateDependents.
  • merging.applyVersion.addToCurrentLane routes updates for existing updateDependent ids to addComponentToUpdateDependents + setOverrideUpdateDependents(true) instead of promoting them.
  • merge-lanes.resolveMergeContext fetches the target lane + main-side heads with includeUpdateDependents so the bare-scope merge has the Version objects it needs.
  • LaneHistory now snapshots updateDependents + overrideUpdateDependents on every write, with a getLatestEntryBeforeBatches lookup used by reset to find the prior state.
  • Export: getVersionsToExport pushes the updateDependents head directly for lane entries flagged by shouldOverrideUpdateDependents(), getLaneCompIdsToExport includes those ids in the export set, updateLanesAfterExport clears the override flag + records a post-export LaneHistory checkpoint.
  • Import: sources.mergeLane skips the updateDependents override when existingLane.shouldOverrideUpdateDependents() is true — protects a pending local cascade from being wiped by bit fetch --lanes. On the remote side of export, the flag is cleared so it never persists.

CLI output (terminology alignment with UI)

  • bit snap: cascaded updateDependents fold into the existing "auto-snapped dependents" bucket — rolled up as a scope-count in the default output, with a dedicated "auto-snapped dependents (not in workspace)" subsection in bit details.
  • bit export: the "exported updates" section renamed to "updated dependents" with a matching description.

Test coverage

teambit.dot-cli/scope-commands/update-dependents-cascade.spec.ts — 34 passing, 2 pending:

  • scenarios 1, 2, 2b, 5: workspace snap cascades updateDependents (direct, with workspace dependents, transitive-only, transitive inside updateDependents).
  • scenario 3: divergence — normal per-component divergence catches concurrent edits to the same lane comp; reset/merge resolution paths pending design.
  • scenario 4: first "snap updates" click re-snaps dependent lane.components.
  • scenario 6: promote-on-import — snapping an imported updateDependent moves it cleanly to lane.components.
  • scenario 7: local cascade survives a bit fetch --lanes before export.
  • scenarios 8, 9: bit reset / bit reset --head rewind both the direct snap AND the cascaded updateDependents via LaneHistory.
  • scenario 10: _merge-lane main dev refreshes stale updateDependents when main advances, keeps them in lane.updateDependents.

Fold updateDependents entries into the same snap pass when their recorded
dependencies reference a component being snapped, so the lane stays internally
consistent without a second snap command (one Version and one Ripple CI build
per cascaded component). Handles transitive and cyclic cases via fixed-point
expansion with hashes pre-assigned before deps are rewritten.
Copilot AI review requested due to automatic review settings April 21, 2026 16:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes bit snap on lanes with updateDependents cascade those updateDependent components into the same snap pass, keeping lane heads and exported objects consistent without requiring a follow-up “snap updates” action.

Changes:

  • Add include-update-dependents-in-snap.ts to compute and load the updateDependents cascade set for a snap pass.
  • Extend SnappingMain.snap() and VersionMaker to treat cascaded updateDependents as scope-only/hidden (skip bitmap updates, linking, pre-snap hooks, build, etc.).
  • Ensure divergence/export logic includes updateDependents heads and clears the one-shot overrideUpdateDependents flag after export.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
scopes/scope/objects/models/model-component.ts Use lane head lookup that includes updateDependents for divergence/export correctness.
scopes/scope/export/export.main.runtime.ts Ensure export includes updateDependents ids when override flag is set; clear override flag post-export.
scopes/component/snapping/version-maker.ts Add updateDependentIds handling and skip workspace-only operations for cascaded updateDependents.
scopes/component/snapping/snapping.main.runtime.ts Include cascaded updateDependents in the snap seed set and pass ids through to VersionMaker.
scopes/component/snapping/include-update-dependents-in-snap.ts New helper to prefetch objects and compute cascade set via fixed-point expansion.

Comment thread scopes/component/snapping/include-update-dependents-in-snap.ts Outdated
Comment thread scopes/component/snapping/version-maker.ts
Comment thread scopes/component/snapping/snapping.main.runtime.ts
Comment thread scopes/component/snapping/include-update-dependents-in-snap.ts Outdated
Comment thread scopes/component/snapping/include-update-dependents-in-snap.ts Outdated
Copilot AI review requested due to automatic review settings April 21, 2026 17:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes bit snap on a lane with updateDependents cascade the affected updateDependents components into the same snap pass, so the lane stays internally consistent (and export/divergence logic can “see” and push the resulting Version objects without requiring an extra “snap updates” step).

Changes:

  • Add a snap-time cascade expander that loads updateDependents candidates from main head, computes the fixed-point cascade set, and injects them into the snap seeds.
  • Extend VersionMaker to treat a per-component updateDependentIds set as “updateDependents in lane” components and skip workspace-only operations for them (bitmap updates, linking, pre-snap hooks, build, etc.).
  • Ensure export/divergence paths consider lane heads that live under lane.updateDependents, and export those ids when overrideUpdateDependents is set (then clear the flag post-export).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
scopes/scope/objects/models/model-component.ts Divergence/export head calculation now considers lane updateDependents entries as valid local lane heads.
scopes/scope/export/export.main.runtime.ts Export explicitly includes updateDependents ids when the lane signals override, and clears the override flag after export.
scopes/component/snapping/version-maker.ts Adds per-component updateDependentIds handling to route cascaded components through scope-only paths and skip workspace-side operations.
scopes/component/snapping/snapping.main.runtime.ts Integrates updateDependents cascade computation into snap() and passes updateDependentIds through to VersionMaker.
scopes/component/snapping/include-update-dependents-in-snap.ts New helper to load updateDependents from main head, compute fixed-point cascade set, and return extra snap seeders.

Comment thread scopes/scope/export/export.main.runtime.ts
Comment thread scopes/component/snapping/version-maker.ts
Comment thread scopes/component/snapping/include-update-dependents-in-snap.ts Outdated
Comment thread scopes/component/snapping/snapping.main.runtime.ts
…snap --update-dependents

When bit _snap --update-dependents introduces a component into lane.updateDependents for the
first time, any entry in lane.components that depends on it would keep pointing at the pre-
updateDependents (usually main) version. Fold those dependents into the same snap pass so their
dep refs land on the new updateDependents hash in one shot — no second snap required.
Copilot AI review requested due to automatic review settings April 21, 2026 18:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes lane updateDependents cascading happen within the same local bit snap pass, so lanes remain internally consistent without requiring an extra “snap updates” step after every snap.

Changes:

  • Add helpers to include relevant lane.updateDependents (workspace snap) and dependent lane.components (bare-scope _snap --update-dependents) into the same snap pass via fixed-point expansion.
  • Extend snapping/version-making/export flows to treat cascaded updateDependents as “scope-only” (skip bitmap, linking, hooks, build) and ensure they’re exported when locally updated.
  • Update lane head resolution used by divergence/export to include updateDependents entries.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scopes/scope/objects/models/model-component.ts Use lane head lookup that includes updateDependents for divergence/export correctness.
scopes/scope/export/export.main.runtime.ts Ensure locally-cascaded updateDependents are included in export, and clear the one-shot override flag after export.
scopes/component/snapping/version-maker.ts Add per-component updateDependentIds handling and skip workspace-only steps for those components.
scopes/component/snapping/snapping.main.runtime.ts Fold updateDependents (workspace snap) and lane-component dependents (bare-scope snapFromScope) into the same snap pass.
scopes/component/snapping/include-update-dependents-in-snap.ts New helper: select which lane.updateDependents must be included in the snap via fixed-point expansion (based on main head).
scopes/component/snapping/include-lane-components-for-updep-snap.ts New helper: in bare-scope updateDependents snap, select lane.components that depend on the targets.
Comments suppressed due to low confidence (1)

scopes/component/snapping/version-maker.ts:235

  • harmonyCompsToTag is documented as being merged "in the original order", but the current implementation concatenates workspaceHarmonyComps then scopeHarmonyComps, which can reorder components relative to this.allComponentsToTag. If any downstream logic relies on order alignment (or if deterministic ordering is expected), this can cause subtle issues. Consider reconstructing harmonyCompsToTag by mapping over the original this.allComponentsToTag order (e.g., build a map by id and then rehydrate in order) or adjust the comment to reflect the actual ordering guarantee.
    // Cascaded updateDependents are not tracked in the workspace bitmap, so loading them via
    // `workspace.getManyByLegacy` would fail when the workspace tries to resolve their rootDir.
    // Route them through `scope.getManyByLegacy` while the real workspace components go through
    // the normal workspace path, then merge the results in the original order.
    const workspaceComps: ConsumerComponent[] = [];
    const scopeOnlyComps: ConsumerComponent[] = [];
    this.allComponentsToTag.forEach((comp) => {
      if (this.workspace && updateDependentIds?.searchWithoutVersion(comp.id)) {
        scopeOnlyComps.push(comp);
      } else {
        workspaceComps.push(comp);
      }
    });
    const workspaceHarmonyComps = workspaceComps.length
      ? await (this.workspace || this.scope).getManyByLegacy(workspaceComps)
      : [];
    const scopeHarmonyComps = scopeOnlyComps.length ? await this.scope.getManyByLegacy(scopeOnlyComps) : [];
    const harmonyCompsToTag = [...workspaceHarmonyComps, ...scopeHarmonyComps];
    // this is not necessarily the same as the previous allComponentsToTag. although it should be, because
    // harmonyCompsToTag is created from allComponentsToTag. however, for aspects, the getMany returns them from cache
    // and therefore, their instance of ConsumerComponent can be different than the one in allComponentsToTag.
    this.allComponentsToTag = harmonyCompsToTag.map((c) => c.state._consumer);

Comment thread scopes/component/snapping/include-update-dependents-in-snap.ts Outdated
Comment thread scopes/component/snapping/include-lane-components-for-updep-snap.ts Outdated
Comment thread scopes/component/snapping/include-update-dependents-in-snap.ts
…ting setLaneHeadLocal

Reverts the setLaneHeadLocal change to getCompHeadIncludeUpdateDependents (which broke
bit import <updDep>) and pushes the updDep head straight from getVersionsToExport instead.
Cascaded updateDependents still get their Version objects exported; lane-level behaviors
that rely on laneHeadLocal being empty for updateDependents are back to normal.
Copilot AI review requested due to automatic review settings April 21, 2026 20:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Ensures lanes remain internally consistent when snapping with updateDependents by cascading the affected components in the same snap pass (both from workspace bit snap and bare-scope _snap --update-dependents), and by exporting the cascaded updateDependents heads reliably.

Changes:

  • Cascade lane.updateDependents into workspace bit snap and pass per-component updateDependentIds into VersionMaker.
  • When running _snap --update-dependents in a bare scope, also include affected lane.components dependents in the same snap pass.
  • Export path now explicitly includes/exports locally-cascaded updateDependents heads and clears the one-shot override flag after successful export.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scopes/scope/export/export.main.runtime.ts Explicitly exports locally-cascaded updateDependents heads and clears overrideUpdateDependents after export.
scopes/component/snapping/version-maker.ts Adds per-component updateDependentIds and skips workspace-only steps (bitmap/link/build/pre-snap/autotag) for scope-only cascades.
scopes/component/snapping/snapping.main.runtime.ts Seeds cascaded updateDependents into workspace snaps, and pulls lane dependents into _snap --update-dependents runs.
scopes/component/snapping/include-update-dependents-in-snap.ts Computes the fixed-point cascade set for lane.updateDependents during workspace snap using main head as the base.
scopes/component/snapping/include-lane-components-for-updep-snap.ts Computes fixed-point dependents set from lane.components that depend on _snap --update-dependents targets.

Comment thread scopes/component/snapping/version-maker.ts
Comment thread scopes/component/snapping/snapping.main.runtime.ts
Comment thread scopes/component/snapping/include-lane-components-for-updep-snap.ts Outdated
Copilot AI review requested due to automatic review settings April 22, 2026 15:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes lane updateDependents behavior internally consistent by cascading affected components into the same snap pass (both for workspace bit snap and bare-scope _snap --update-dependents), and ensuring the resulting objects are exportable without requiring a second user action.

Changes:

  • Add cascade helpers to compute fixed-point snap sets for lane.updateDependents (workspace snap) and for lane.components that depend on updateDependent targets (bare-scope _snap --update-dependents).
  • Extend VersionMaker to support per-component “updateDependent” handling (skip bitmap updates/linking/build hooks for those ids, but still snap them and update lane state).
  • Update export logic to explicitly include cascaded updateDependent versions/ids when exporting from a lane, and clear the override flag after export.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scopes/scope/objects/models/lane.ts Updates docs around the one-shot overrideUpdateDependents flag semantics.
scopes/scope/export/export.main.runtime.ts Ensures cascaded updateDependent versions are included in export and clears the override flag post-export.
scopes/component/snapping/version-maker.ts Adds updateDependentIds to mix lane.components + lane.updateDependents in one snap pass and skips workspace-only steps for updateDependent ids.
scopes/component/snapping/snapping.main.runtime.ts Seeds cascade sets for both workspace snap and bare-scope snap-from-scope flows.
scopes/component/snapping/include-update-dependents-in-snap.ts New helper to fold relevant lane.updateDependents into a workspace snap (main-head based fixed-point expansion).
scopes/component/snapping/include-lane-components-for-updep-snap.ts New helper to fold affected lane.components into _snap --update-dependents (fixed-point expansion on recorded deps).

Comment thread scopes/scope/objects/models/lane.ts Outdated
Comment thread scopes/scope/export/export.main.runtime.ts
Copilot AI review requested due to automatic review settings April 22, 2026 17:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes lane graph inconsistencies around lane.updateDependents by folding the required cascaded re-snaps into the same bit snap / bit _snap --update-dependents pass, and ensuring the resulting updateDependents heads are correctly exported and merged remotely.

Changes:

  • Add cascade seed discovery for workspace bit snap (pulling affected lane.updateDependents in from main head) and for bare-scope _snap --update-dependents (pulling affected lane.components dependents into the same pass).
  • Extend VersionMaker with per-component updateDependentIds so one pass can write to both lane.components and lane.updateDependents while safely skipping workspace-only operations for cascaded scope-only comps.
  • Update export + merge behavior to reliably push/merge cascaded updateDependents via the one-shot overrideUpdateDependents flag, and clear it locally after successful export.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
scopes/scope/objects/models/lane.ts Clarifies and documents the one-shot overrideUpdateDependents contract and its round-tripping behavior.
scopes/scope/export/export.main.runtime.ts Ensures cascaded updateDependents versions are included in the export set, pushes their heads explicitly, and clears the override flag after export.
scopes/component/snapping/version-maker.ts Adds updateDependentIds and routes cascaded updateDependents through scope-only paths (skipping bitmap, linking, pre-snap steps, build, auto-tag triggers).
scopes/component/snapping/snapping.main.runtime.ts Seeds cascade sets for both workspace snap and bare-scope _snap --update-dependents, passing updateDependentIds into VersionMaker.
scopes/component/snapping/include-update-dependents-in-snap.ts New helper: fixed-point cascade expansion for lane.updateDependents during workspace bit snap, basing parents on main head.
scopes/component/snapping/include-lane-components-for-updep-snap.ts New helper: fixed-point cascade expansion for lane.components dependents during bare-scope _snap --update-dependents.
components/legacy/scope/repositories/sources.ts Adjusts import/export merge semantics so pending local updateDependents cascades aren’t overwritten by imports, while export override remains explicit.

Copilot AI review requested due to automatic review settings April 22, 2026 19:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes lane updateDependents cascades occur within the same local snap/update-dependents snap pass, keeping lane graphs consistent without requiring a second user action, and adds safeguards so local cascades aren’t lost before export.

Changes:

  • Cascade relevant lane.updateDependents into bit snap and re-snap affected lane.components during _snap --update-dependents.
  • Extend VersionMaker to support per-component routing into lane.updateDependents while skipping workspace-only steps (bitmap/linking/build hooks) for hidden cascaded components.
  • Adjust export/import behavior and CLI output to correctly include/push cascaded updateDependents and present them as “updates”.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
scopes/scope/objects/models/lane.ts Updates JSDoc for overrideUpdateDependents semantics.
scopes/scope/export/export.main.runtime.ts Ensures cascaded updateDependents are exported and avoids misleading bitmap warnings; clears override flag after successful export.
scopes/scope/export/export-cmd.ts Splits CLI output into regular exported components vs exported updates (updateDependents).
scopes/component/snapping/version-maker.ts Adds updateDependentIds to mix lane.components and lane.updateDependents in one pass; skips workspace-only steps for hidden comps.
scopes/component/snapping/snapping.main.runtime.ts Seeds cascades for bit snap and for _snap --update-dependents dependents in lane.components.
scopes/component/snapping/snap-cmd.ts Displays cascaded updateDependents separately as “snapped updates”.
scopes/component/snapping/include-update-dependents-in-snap.ts New helper: fixed-point expansion to include relevant updateDependents (based on main head).
scopes/component/snapping/include-lane-components-for-updep-snap.ts New helper: fixed-point expansion to include lane.components affected by _snap --update-dependents targets.
components/legacy/scope/repositories/sources.ts Adds import-side guard to avoid wiping pending local cascades.
Comments suppressed due to low confidence (1)

components/legacy/scope/repositories/sources.ts:752

  • In mergeLane(), the import-side guard prevents overwriting existingLane.updateDependents when the local lane has overrideUpdateDependents set. However, on the export path when the lane does not already exist on the remote (existingLane is undefined), the incoming lane (with overrideUpdateDependents=true) will be returned and then persisted by mergeObjects(). This would unintentionally store the one-shot flag on the remote lane object. Consider clearing overrideUpdateDependents on the lane object that will be persisted (e.g. before returning from mergeLane() when isExport), even when there is no existingLane.
    if (isImport && existingLane && !existingLane.shouldOverrideUpdateDependents()) {
      existingLane.updateDependents = lane.updateDependents;
    }
    if (isExport && existingLane && lane.shouldOverrideUpdateDependents()) {
      await Promise.all(

Comment thread scopes/scope/objects/models/lane.ts Outdated
Store lane.updateDependents + overrideUpdateDependents in each LaneHistory
entry so bit reset can rewind to the newest remaining entry after removing
the reset batches. Also ensures every state transition (fetch/import/export)
writes a history entry so there's always a baseline to restore from.

bit reset --head rewinds one snap at a time; bit reset --all rewinds all the
way back to the pre-cascade state. overrideUpdateDependents is recomputed
from the restored entry so a partial reset that leaves one cascade pending
keeps the flag true.
…s stored lane so it never persists across a first-time push
Copilot AI review requested due to automatic review settings April 23, 2026 18:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves lane consistency around lane.updateDependents by cascading affected components into the same snap pass (both workspace bit snap and bare-scope _snap --update-dependents), and by ensuring export/import/reset flows preserve and correctly merge the resulting lane state.

Changes:

  • Add workspace-side cascade so bit snap re-snaps relevant lane.updateDependents in the same pass, keeping their dependency refs aligned to the lane’s new hashes.
  • Add bare-scope _snap --update-dependents cascade in the opposite direction by also re-snapping lane.components that depend on the updated targets.
  • Persist/merge/export/reset support: snapshot updateDependents state into LaneHistory, guard import-side merges from overwriting pending local cascades, and ensure export pushes cascaded updateDependents heads and clears the override flag.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
scopes/scope/objects/models/lane.ts Adds a helper to restore updateDependents + override flag together; updates override flag contract docs.
scopes/scope/objects/models/lane-history.ts Stores updateDependents and overrideUpdateDependents snapshots per history entry; adds helper to find latest entry excluding keys.
scopes/scope/importer/importer.main.runtime.ts Always attempts to record lane history on fetch/import paths to provide reset baselines.
scopes/scope/importer/import-components.ts Always attempts to record lane history on lane import/merge saves.
scopes/scope/export/export.main.runtime.ts Ensures cascaded updateDependents versions/ids are included in export decisions; clears override flag after successful export; avoids bitmap “not tracked” warning for updateDependents.
scopes/scope/export/export-cmd.ts Splits CLI output into “exported components” vs “exported updates” (lane updateDependents).
scopes/component/snapping/version-maker.ts Introduces per-component updateDependentIds handling; skips bitmap/link/build/pre-snap for cascaded updateDependents.
scopes/component/snapping/snapping.main.runtime.ts Seeds cascade sets for both workspace snap and bare-scope updateDependents snap; updates reset to restore updateDependents from lane history.
scopes/component/snapping/snap-cmd.ts Distinguishes cascaded updateDependents in snap output as “snapped updates”.
scopes/component/snapping/include-update-dependents-in-snap.ts New helper to compute fixed-point cascade set for workspace bit snap using main-head parenting.
scopes/component/snapping/include-lane-components-for-updep-snap.ts New helper to include affected lane.components when running _snap --update-dependents.
components/legacy/scope/repositories/sources.ts Adds import-side guard to avoid overwriting pending local cascaded updateDependents; clears override flag on remote after export merge.

Comment thread scopes/component/snapping/snapping.main.runtime.ts Outdated
…ate)

Copilot flagged that 'latest non-excluded' would pick up newer entries
whose content captures the post-cascade state — e.g. a 'bit fetch --lanes'
entry recorded after the snap. Switched to 'latest entry with date <
earliest excluded batch date', which deterministically lands on a
pre-reset state.

Also reverted the unconditional 'save history on fetch' change — the
initial baseline from persistIfNotExists is enough, and spam entries on
every no-op fetch created the stale-state problem this fix now defends
against.
Copilot AI review requested due to automatic review settings April 23, 2026 20:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes lane updateDependents cascading consistent across local bit snap, bare-scope _snap --update-dependents, export/import, and reset flows—so users don’t need a second “snap updates” action to repair lane graph consistency.

Changes:

  • Cascade lane.updateDependents into the same workspace bit snap pass (and cascade affected lane.components during _snap --update-dependents) using fixed-point dependency expansion.
  • Persist/restore updateDependents + overrideUpdateDependents via LaneHistory, and rewind them correctly during bit reset.
  • Harden export/import semantics: explicitly export locally-cascaded updateDependents when overrideUpdateDependents is set, and prevent import from overwriting pending local cascades.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scopes/scope/objects/models/lane.ts Adds an atomic restore setter for updateDependents + override flag; updates override flag JSDoc/contract.
scopes/scope/objects/models/lane-history.ts Extends lane history entries to snapshot updateDependents and override flag; adds helper to find the “prior” entry for reset.
scopes/scope/importer/importer.main.runtime.ts Ensures an initial lane history baseline exists when first fetching a lane object from remote.
scopes/scope/export/export.main.runtime.ts Ensures cascaded updateDependents are exported when needed and avoids bitmap “not tracked” warnings for them; clears override after successful export and records history.
scopes/scope/export/export-cmd.ts Splits CLI output into exported “components” vs exported “updates” (updateDependents).
scopes/component/snapping/version-maker.ts Adds per-component updateDependentIds handling; skips workspace-only steps (bitmap updates/link/build/pre-snap/autotag triggers) for cascaded updateDependents.
scopes/component/snapping/snapping.main.runtime.ts Seeds cascade sets for both workspace and bare-scope snap flows; updates reset to rewind updateDependents state using lane history.
scopes/component/snapping/snap-cmd.ts Updates snap reporting to separately list “snapped updates” (cascaded updateDependents).
scopes/component/snapping/include-update-dependents-in-snap.ts New helper to include relevant updateDependents in workspace snap (main-head based, fixed-point expansion).
scopes/component/snapping/include-lane-components-for-updep-snap.ts New helper to include lane.components dependents during _snap --update-dependents (fixed-point expansion).
components/legacy/scope/repositories/sources.ts Import-side guard to avoid wiping pending local cascades; clears override flag on remote after honoring it on export.

Comment thread scopes/component/snapping/include-lane-components-for-updep-snap.ts Outdated
Comment thread scopes/scope/export/export-cmd.ts Outdated
Copilot AI review requested due to automatic review settings April 24, 2026 13:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes lane updateDependents cascades happen within the same local snap / update-dependents snap pass, keeping a lane’s internal dependency graph consistent without requiring an extra “snap updates” action, and safeguards those local cascades from being overwritten by import/fetch before export.

Changes:

  • Cascade lane.updateDependents during workspace bit snap, and cascade affected lane.components during bare-scope _snap --update-dependents.
  • Extend VersionMaker to support per-component routing into lane.updateDependents vs lane.components, while skipping workspace-only steps for hidden updateDependents.
  • Persist/restore updateDependents + override flag via LaneHistory, adjust export/import merge behavior, and improve CLI reporting for cascaded/hidden snaps.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
scopes/scope/objects/models/lane.ts Adds a reset-focused setter for restoring updateDependents + override flag; updates override flag documentation.
scopes/scope/objects/models/lane-history.ts Snapshots updateDependents/override flag into history and adds helper to find the correct pre-batch restore point for reset.
scopes/scope/importer/importer.main.runtime.ts Records an initial lane-history entry when fetching a new lane to enable correct resets.
scopes/scope/export/export.main.runtime.ts Ensures updateDependents cascades are exported and avoids misleading bitmap warnings; clears override after successful export.
scopes/scope/export/export-cmd.ts Splits export output into regular components vs “updated dependents” (hidden lane updateDependents).
scopes/component/snapping/version-maker.ts Adds updateDependentIds to route specific components into lane.updateDependents and skip workspace-only operations for them.
scopes/component/snapping/snapping.main.runtime.ts Seeds cascades for workspace snap and bare-scope update-dependents snap; rewinds updateDependents on reset using lane-history.
scopes/component/snapping/snap-cmd.ts Improves snap output to account for cascaded updateDependents separately from user-changed components.
scopes/component/snapping/include-update-dependents-in-snap.ts New helper that selects which lane updateDependents to cascade into a workspace snap (fixed-point over full dep set).
scopes/component/snapping/include-lane-components-for-updep-snap.ts New helper that pulls affected lane.components into _snap --update-dependents (fixed-point + concurrency cap).
components/legacy/scope/repositories/sources.ts Adds import-side guard to avoid overwriting local cascaded updateDependents; clears override flag on remote after honoring it.

Comment thread scopes/component/snapping/snapping.main.runtime.ts Outdated
Copilot AI review requested due to automatic review settings April 24, 2026 18:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes lane updateDependents snapping/exporting consistent in a single pass (both for workspace bit snap and bare-scope _snap --update-dependents), and protects locally-cascaded updateDependents from being overwritten by an import/fetch before export.

Changes:

  • Cascade lane updateDependents into workspace bit snap, and cascade affected lane.components into _snap --update-dependents, keeping lane graphs internally consistent without extra user actions.
  • Extend VersionMaker/snap pipelines to support per-component “goes to lane.updateDependents” behavior and skip workspace-only steps (bitmap/linking/build/hooks) for hidden updateDependents.
  • Persist/rewind updateDependents + overrideUpdateDependents via LaneHistory and add an import-side guard + export handling for the one-shot override flag.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
scopes/scope/objects/models/lane.ts Adds setUpdateDependentsAndOverride() and updates override flag contract/docs.
scopes/scope/objects/models/lane-history.ts Snapshots updateDependents + override flag and adds “latest entry before batches” helper for reset.
scopes/scope/importer/importer.main.runtime.ts Records initial LaneHistory entry when fetching a lane for the first time.
scopes/scope/export/export.main.runtime.ts Ensures cascaded updateDependents versions are exported, suppresses misleading bitmap warning, and clears override flag post-export.
scopes/scope/export/export-cmd.ts Splits CLI output between regular exported components vs hidden “updated dependents”.
scopes/lanes/merge-lanes/merge-lanes.main.runtime.ts Fetch/merge logic optionally includes updateDependents objects/heads for main↔lane flows.
scopes/component/snapping/version-maker.ts Adds updateDependentIds to route specific components into lane.updateDependents and skip workspace-only steps for them.
scopes/component/snapping/snapping.main.runtime.ts Seeds cascades for both workspace snap and scope snap; reset now rewinds lane updateDependents state using LaneHistory.
scopes/component/snapping/snap-cmd.ts Updates snap report to distinguish cascaded updateDependents and adjust auto-snapped counts/sections.
scopes/component/snapping/include-update-dependents-in-snap.ts New helper: fixed-point expansion to include relevant lane.updateDependents in a workspace snap pass.
scopes/component/snapping/include-lane-components-for-updep-snap.ts New helper: fixed-point expansion to include affected lane.components when snapping updateDependents in bare scope.
scopes/component/merging/merging.main.runtime.ts Merge-snap preserves updateDependent status by passing explicit updateDependentIds into snap-from-scope.
components/legacy/scope/repositories/sources.ts Import-side guard to not overwrite local cascaded updateDependents; clears override flag on remote merge result.

Comment thread scopes/component/snapping/snapping.main.runtime.ts Outdated
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.

3 participants