Skip to content

feat: allow configuring daemon with extra interests#734

Merged
smrz2001 merged 1 commit into
mainfrom
m0ar/configure-startup-interests
Aug 27, 2025
Merged

feat: allow configuring daemon with extra interests#734
smrz2001 merged 1 commit into
mainfrom
m0ar/configure-startup-interests

Conversation

@m0ar

@m0ar m0ar commented Aug 26, 2025

Copy link
Copy Markdown
Collaborator

This PR implements a new CLI flag --extra-interests (and envvar CERAMIC_ONE_EXTRA_INTERESTS) to automatically register node interests when starting the daemon, eliminating the need for manual API calls after startup.

Changes

  • New CLI argument --extra-interests, accepting comma-separated stream/model IDs
  • New startup module one/src/startup.rs to orchestrate daemon configuration tasks tangential to the startup process
  • Integration:
    • Uses the existing InterestService
    • Uses the same pattern as the /ceramic/interests API handler
    • Processes interests early in daemon startup, after services init but before P2P setup

Safety & backward compatibility

  • Optional flag with empty default
  • Stream ID format and multibase decoding validation
  • Descriptive errors for invalid inputs + handling of failures
  • Logging for registration status and debugging
  • Idempotent: Handles already-registered interests without errors

Usage

Flag

ceramic-one daemon --extra-interests model1,model2

Envvar

export CERAMIC_ONE_EXTRA_INTERESTS="model1,model2"
ceramic-one daemon

Tests

Test suite added to one/src/startup.rs, can be run with the C1 crate:

> cargo test --locked --release -p ceramic-one
[ build logs ]

running 8 tests
test http::test::expected_prom_cardinality_replacement ... ok
test http::test::should_not_replace_extra_parts ... ok
test http::test::should_not_replace_wrong_method ... ok
test startup::tests::test_process_extra_interests_invalid_stream_id ... ok
test startup::tests::test_process_extra_interests_empty ... ok
test startup::tests::test_process_extra_interests_multibase_decoding ... ok
test startup::tests::test_process_extra_interests_mixed_valid_invalid ... ok
test startup::tests::test_process_extra_interests_whitespace_handling ... ok

test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s

Other notes

It seems to work, but I can't say I fully understand what's going on with the interest builder EventID fencepost ranges. Probably a good spot to focus a review 👀

Closes #707

@m0ar m0ar marked this pull request as ready for review August 26, 2025 14:06
@m0ar m0ar requested a review from a team as a code owner August 26, 2025 14:06
@m0ar m0ar requested review from dav1do and sam701 and removed request for a team and sam701 August 26, 2025 14:06
@m0ar m0ar temporarily deployed to tnet-prod-2024 August 26, 2025 14:27 — with GitHub Actions Inactive
@m0ar m0ar requested review from dav1do and smrz2001 and removed request for dav1do August 27, 2025 08:59

@smrz2001 smrz2001 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚀

@smrz2001 smrz2001 added this pull request to the merge queue Aug 27, 2025
Merged via the queue into main with commit def2716 Aug 27, 2025
44 of 50 checks passed
@smrz2001 smrz2001 deleted the m0ar/configure-startup-interests branch August 27, 2025 23:39
@smrz2001 smrz2001 mentioned this pull request Aug 28, 2025
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.

Add --initial-interests configuration variable

2 participants