fix(flow): never reuse the active 00000 source version

Merged
TH
3d ago
+94-1

User description

Problem

An unreleased transport exposes only the pseudo-version 00000 in the ADT versions feed. Its URI is stable, but its content is the mutable active source and keeps changing while developers work on the object under the parent request.

adt-flow treated a 00000 selection like an immutable version:

  • the exact-head fast path skipped all SAP calls when the indexed head matched the requested descriptors;
  • the indexed-components path reused the indexed source when the descriptor selection matched.

So a later checkout of the same transport (for example, after another task was released) returned the stale source captured at the first checkout. Downstream consumers then saw an empty diff even though the active code had changed.

Fix

  • isMutableVersion() marks 00000 as the active, mutable version.
  • descriptorSelectionMatches() never matches a mutable selection, so indexed reuse is skipped and the source plus metadata are re-read.
  • exactHeadFastPath() gives up when any object selection carries 00000.
  • The re-read content still goes through the normal content-hash comparison, so an unchanged active source yields no changed paths.

Tests

  • re-reads an indexed active 00000 head instead of reusing it
  • does not repeat an active 00000 head through the exact-head fast path

Both failed before the fix (indexed-components / exact-head). packages/adt-flow tests pass after it: 52/52. Prettier is clean.

Note: tsc on packages/adt-flow shows pre-existing @abapify/adk type mismatches (inventory, repositoryObject) from a stale local build. These are unrelated to this change.

๐Ÿค– Generated with Claude Code

Summary by Sourcery

Ensure active 00000 source versions are always refreshed instead of being treated as immutable indexed versions.

Bug Fixes:

  • Prevent reuse of the mutable active 00000 source version so subsequent checkouts observe current source changes.

Tests:

  • Add coverage for re-reading active 00000 sources through indexed and exact-head checkout paths.

Summary by cubic

Fixes stale checkouts of unreleased transports by never reusing the active 00000 source version. Previously, adt-flow treated 00000 as an immutable version, so the indexed-components and exact-head fast paths served the source captured at the first checkout, producing empty diffs when the active code had changed. Now 00000 selections skip indexed reuse and re-read source and metadata from SAP; the re-read still goes through the normal content-hash comparison, so unchanged sources yield no changed paths.


CodeAnt-AI Description

Refresh active source versions on every checkout

What Changed

  • Checkouts of active 00000 versions now fetch the latest source and metadata instead of reusing an earlier snapshot.
  • Changed source files are updated, while unchanged source produces no reported changes.

Impact

โœ… Current active source on every checkout
โœ… Changes between tasks appear in checkout
โœ… No false empty diffs for updated source

๐Ÿ’ก Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.