Skip to content

Fix connected IPNS version pruning#19

Draft
magiccodingman wants to merge 1 commit into
masterfrom
agent/fix-ipns-connected-pruning
Draft

Fix connected IPNS version pruning#19
magiccodingman wants to merge 1 commit into
masterfrom
agent/fix-ipns-connected-pruning

Conversation

@magiccodingman

@magiccodingman magiccodingman commented Jul 25, 2026

Copy link
Copy Markdown
Owner

What changed

Fixes the narrow watched-IPNS retention issue where TGP pointer versions and their -connected application folders were not interpreted as one version pair when Keep Old was disabled.

Pair-aware retention

The updater now parses both managed forms through one shared model:

name-vNNN
name-vNNN-connected

The same parser is used for latest-version discovery, next-version allocation, and retroactive pruning so the worker has one consistent version model.

Safe pruning

When old versions are pruned, TruthGate now:

  • groups the pointer folder and connected application folder by version
  • retains the newest version that has a pointer folder
  • removes both MFS paths for each historical pair
  • resolves the historical target CID from the connected folder first
  • falls back to tgp.json.current when no connected folder is available
  • retains compatibility with the former .tgp-meta.json TargetCid sidecar
  • avoids unpinning a CID still used by the retained version
  • handles orphan historical -connected folders without allowing them to determine the active version

This protects the case where two pointer versions reference the same application CID: pruning the older pointer must not remove the explicit pin still needed by the current version.

Tests

Adds focused unit coverage for:

  • pointer and connected-name parsing
  • rejection of unmanaged folder names
  • pointer/connected version grouping
  • next-version allocation
  • pruning both historical folders
  • preserving a target shared with the retained version
  • orphan connected-folder cleanup
  • TGP v1 current parsing
  • legacy sidecar compatibility

Validation performed against the complete repository checkout:

dotnet restore TruthGate-IPFS.sln
dotnet restore TruthGate-Web/TruthGate-Web.Tests/TruthGate-Web.Tests.csproj
dotnet build TruthGate-IPFS.sln --no-restore --configuration Release
dotnet test TruthGate-Web/TruthGate-Web.Tests/TruthGate-Web.Tests.csproj --no-restore --configuration Release --filter "FullyQualifiedName~IpnsVersionRetentionTests"

The solution build and focused retention tests passed.

Scope

This PR changes only watched-IPNS version retention and its tests. It does not change PublishQueue, domain publishing, the TGP wire protocol, UI behavior, or Kubo garbage-collection policy.

@magiccodingman
magiccodingman force-pushed the agent/fix-ipns-connected-pruning branch from c14de7c to 61aa1f8 Compare July 25, 2026 22:09

Copy link
Copy Markdown
Owner Author

CI note for review:

  • The solution restores and builds successfully in Release.
  • The new IpnsVersionRetentionTests pass when run as the focused test class.
  • Docker appliance and Docker repository-migration workflows are green.
  • The existing TLS lifecycle tests workflow runs the entire TruthGate-Web.Tests project. Its full-project test command remains red after an identical rerun, despite the clean build and focused retention tests passing. On master, that project contains only the pre-existing CertificateLifecycleTests class; this PR adds the isolated retention class. I left the unrelated lifecycle behavior untouched rather than broadening this retention PR.

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.

1 participant