photoncloud-monorepo/docs/por/T053-chainfire-core-finalization/task.yaml
centra 3eeb303dcb feat: Batch commit for T039.S3 deployment
Includes all pending changes needed for nixos-anywhere:
- fiberlb: L7 policy, rule, certificate types
- deployer: New service for cluster management
- nix-nos: Generic network modules
- Various service updates and fixes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 04:34:51 +09:00

114 lines
5.1 KiB
YAML

id: T053
name: ChainFire Core Finalization
goal: Clean up legacy OpenRaft code and complete Gossip integration for robust clustering
status: complete
completed: 2025-12-12
priority: P1
owner: peerB
created: 2025-12-12
depends_on: [T041]
blocks: [T039]
context: |
**Findings from T049 Audit:**
- openraft dependency still in Cargo.toml.
- Legacy code in chainfire-raft/src/storage.rs.
- cluster.rs has // TODO: Implement cluster joining via gossip.
- core.rs has // TODO: Use actual network layer instead of mock.
**User Direction (PROJECT.md Item 1):**
"Raft+Gossip." - Gossip is a core requirement for the cluster management KVS.
acceptance:
- openraft removed from all Cargo.toml files
- chainfire-raft crate cleaned of adapter code
- Cluster joining uses Gossip (foca) for discovery
- Node addition/removal flows fully implemented
- Network layer mocks replaced with real implementation where appropriate
steps:
- step: S1
name: OpenRaft Cleanup
done: Remove dependency and legacy adapter code
status: complete
completed: 2025-12-12 13:35 JST
owner: peerB
priority: P0
- step: S2
name: Gossip Integration
done: Implement cluster joining via Gossip
status: complete
completed: 2025-12-12 14:00 JST
owner: peerB
priority: P1
notes: |
- Used existing chainfire-gossip crate
- Implemented cluster.rs TODOs
- step: S3
name: Network Layer Hardening
done: Replace mocks with real network stack in core
status: complete
completed: 2025-12-12 14:10 JST
owner: peerB
priority: P1
notes: |
- Investigated core.rs for network mocks
- Found production already uses real GrpcRaftClient (chainfire-server/src/node.rs)
- InMemoryRpcClient exists only in test_client module for testing
- Updated outdated TODO comment at core.rs:479
evidence:
- item: S1 OpenRaft Cleanup
desc: |
Removed all OpenRaft dependencies and legacy code:
- Workspace Cargo.toml: Removed openraft = { version = "0.9", ... }
- chainfire-raft/Cargo.toml: Removed openraft-impl feature, changed default to custom-raft
- chainfire-api/Cargo.toml: Removed openraft-impl feature
- Deleted files: chainfire-raft/src/{storage.rs, config.rs, node.rs} (16KB+ legacy code)
- Cleaned chainfire-raft/src/lib.rs: Removed all OpenRaft feature gates and exports
- Cleaned chainfire-raft/src/network.rs: Removed 261 lines of OpenRaft network implementation
- Cleaned chainfire-api/src/raft_client.rs: Removed 188 lines of OpenRaft RaftRpcClient impl
Verification: cargo check --workspace succeeded in 3m 15s (warnings only, no errors)
files:
- Cargo.toml (workspace root)
- chainfire/crates/chainfire-raft/Cargo.toml
- chainfire/crates/chainfire-api/Cargo.toml
- chainfire/crates/chainfire-raft/src/lib.rs
- chainfire/crates/chainfire-raft/src/network.rs
- chainfire/crates/chainfire-api/src/raft_client.rs
timestamp: 2025-12-12 13:35 JST
- item: S2 Gossip Integration
desc: |
Implemented cluster joining via Gossip (foca/SWIM protocol):
- Added gossip_agent: Option<GossipAgent> field to Cluster struct
- Implemented join() method: calls gossip_agent.announce(seed_addr) for cluster discovery
- Builder initializes GossipAgent with GossipId (node_id, gossip_addr, node_role)
- run_until_shutdown() spawns gossip agent task that runs until shutdown
- Added chainfire-gossip dependency to chainfire-core/Cargo.toml
Resolved TODOs:
- cluster.rs:135 "TODO: Implement cluster joining via gossip" → join() now functional
- builder.rs:216 "TODO: Initialize gossip" → GossipAgent created and passed to Cluster
Verification: cargo check --package chainfire-core succeeded in 1.00s (warnings only)
files:
- chainfire/crates/chainfire-core/src/cluster.rs (imports, struct field, join() impl, run() changes)
- chainfire/crates/chainfire-core/src/builder.rs (imports, build() gossip initialization)
- chainfire/crates/chainfire-core/Cargo.toml (added chainfire-gossip dependency)
timestamp: 2025-12-12 14:00 JST
- item: S3 Network Layer Hardening
desc: |
Verified network layer architecture and updated outdated documentation:
- Searched for network mocks in chainfire-raft/src/core.rs
- Discovered production code (chainfire-server/src/node.rs) already uses real GrpcRaftClient from chainfire-api
- Architecture uses Arc<dyn RaftRpcClient> trait abstraction for pluggable network implementations
- InMemoryRpcClient exists only in chainfire-raft/src/network.rs test_client module (test-only)
- Updated outdated TODO comment at core.rs:479: "Use actual network layer instead of mock" → clarified production uses real RaftRpcClient (GrpcRaftClient)
Verification: cargo check --package chainfire-raft succeeded in 0.66s (warnings only, no errors)
files:
- chainfire/crates/chainfire-raft/src/core.rs (updated comment at line 479)
timestamp: 2025-12-12 14:10 JST
notes: |
Solidifies the foundation for all other services relying on ChainFire (PlasmaVMC, FiberLB, etc.)