Skip to content

feat(reachability): add the pure kubo config transform - #202

Closed
Rinse12 wants to merge 2 commits into
masterfrom
feat/reachability-kubo-config
Closed

Rinse12 wants to merge 2 commits into
masterfrom
feat/reachability-kubo-config

Conversation

@Rinse12

@Rinse12 Rinse12 commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Part of #198 (step 2).

Summary

The settled signature is unchanged. planKuboConfig sits beside it and also returns an edit record for reachability/config.json. A pure function can't otherwise tell our entries from identical operator ones, or know which old address to drop after an IP change.

planKuboConfig(kubo, { wsPort, announce, kuboEdits }, enabled)
  undo previous kuboEdits (back to the operator's baseline)
  if disabled: restore AutoTLS, return { kubo, kuboEdits: undefined }
  Addresses.Swarm          += /ip4/127.0.0.1/tcp/<wsPort>/ws, udp/443 quic-v1 and webtransport (v4, v6)
  Addresses.AppendAnnounce += announce
  Swarm.AddrFilters        -= /ip4/127.0.0.0/ipcidr/8
  AutoTLS.Enabled           = false (once per enable)
  return { kubo, kuboEdits }

computeKuboConfig(kubo, reachability, enabled) = planKuboConfig(...).kuboConfig

Behaviour the issue left open:

  • If the operator flips AutoTLS back on while enabled, repairs and IP changes keep it on, and disable leaves it on.
  • Anything the operator added while enabled survives disable.
  • A loopback filter the operator puts back is removed again on the next apply, because it would block the terminator.

Evidence

  • Before: the module did not exist. An early version failed the property test on a config listing the loopback filter twice: one copy was lost on restore. Fixed before this PR.
    After: test/reachability/kubo-config.test.ts, 80+ tests, all passing.
for each of 17 config shapes (server profile, null lists, absent sections, operator duplicates, ...):
  bytes(disable(enable(x))) == bytes(x)
  bytes(enable(disable(enable(x)))) == bytes(enable(x))
  bytes(disable(enable(enable(x, new IP and ws port)))) == bytes(x)
  same round trip with the record reloaded through JSON

Merge Danger

Door: two-way

Blast Radius: none

New pure module with no callers yet.

computeKuboConfig(kuboConfig, reachabilityConfig, enabled) is the one place that
decides the kubo edits. planKuboConfig also returns a record of what changed,
which tells our entries from identical operator ones and lets disable restore
the touched fields byte for byte.
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 43 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 575d9247-ade9-43ce-8c7c-57751c25ad26
Commits

Reviewing files that changed from the base of the PR and between 6121b54 and 6ed4c24.

Files selected for processing: 2
  • src/reachability/kubo-config.ts
  • test/reachability/kubo-config.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T13:00:22.018368Z 1555fef PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1555fefe21

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/reachability/kubo-config.ts Outdated
if (config.AutoTLS?.Enabled !== false) return;
if (autoTls.enabledShape === "absent") delete config.AutoTLS.Enabled;
else config.AutoTLS.Enabled = autoTls.enabled;
if (autoTls.sectionShape === "absent" && Object.keys(config.AutoTLS).length === 0) delete config.AutoTLS;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restore top-level sections whose original shape was null

Restore the recorded "null" shape here as well as "absent". With a config containing "AutoTLS": null, enabling creates { "Enabled": false }, but disabling deletes Enabled and leaves AutoTLS: {}, violating the advertised byte-for-byte round trip. The analogous Addresses: null path at line 58 also returns {} instead of null.

Useful? React with 👍 / 👎.

@claude

claude Bot commented Nov 2, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@Rinse12

Rinse12 commented Nov 2, 2026

Copy link
Copy Markdown
Member Author

Consolidated into #208.

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