Skip to content

Add build-peer-roster CLI command to generate manifest-compatible peer lists from heartbeat logs - #53

Closed
Exohayvan wants to merge 4 commits into
mainfrom
ai/next-step-20260630-050353
Closed

Exohayvan wants to merge 4 commits into
mainfrom
ai/next-step-20260630-050353

Conversation

@Exohayvan

Copy link
Copy Markdown
Contributor

Objective

Introduce a new CLI path that turns one or more local heartbeat message logs into a deterministic, manifest-ready peer roster.

Why this matters

Local heartbeat discovery was readable via peer-summary but could not be fed directly back into manifest-based execution flows without manual node list edits. This change closes that gap by producing a stable roster document from real discovery artifacts, while keeping existing peer-summary behavior intact.

What changed

  • Added a new CLI command in src/aethermesh_core/cli.py:
    • build-peer-roster
    • accepts repeated --message-log-path values
    • optional --output-path writes atomically via existing JSON write helper
    • prints pretty JSON (indent=2) to stdout.
  • Extended peer registry logic in src/aethermesh_core/peer_registry.py:
    • added peer_roster_document(message_log_paths)
    • merges heartbeat messages across logs by node_id
    • chooses winning heartbeat by highest heartbeat_sequence with later-in-input/message-order tie handling
    • emits manifest-compatible nodes objects: node_id, status, capabilities
    • includes metadata for source paths, peer count, total heartbeat count, and per-node heartbeat counts.
  • Kept peer_summary_document read-only behavior unchanged.
  • Added CLI/parser coverage in tests/test_cli.py:
    • parser contract and help snapshot updates for the new command
    • stable stdout JSON assertion for CLI output
    • validation-on-failure coverage confirming output file is not overwritten.
  • Added peer registry tests in tests/test_peer_registry.py for:
    • multi-log roster generation
    • sequence tie ordering behavior
    • output sorting and metadata
    • malformed heartbeat failure behavior.
  • Refreshed graphify-out/* artifacts in a follow-up commit to sync knowledge graph metadata with current structure.

Validation

  • Ran the test suite on this branch:
    • PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=src python -m unittest discover -s tests -v
    • Result: Ran 311 tests in 0.293s and OK.
  • Validation status is currently evidenced by actual test execution output in this environment plus commit/test coverage in the branch history.

Safety notes

  • No force push used.
  • No hard reset used.
  • Local automation paths are not published in this PR body.

@Exohayvan

Copy link
Copy Markdown
Contributor Author

Automated review did not approve this PR

Automated Hermes/GPT-5.5 review decision for PR #53: bad.

Review notes

Ad-hoc verification completed, not a full suite-green claim.

Temporary script:

  • Created with OS-safe tempfile path and hermes-verify- prefix:
    [local temp path redacted]

Changed behavior checked:

  • peer_roster_document still emits valid manifest-compatible roster nodes for normal heartbeat input.
  • Missing capabilities remain backward-compatible and are omitted from roster output.
  • Invalid roster-output values now raise PeerRegistryError:
    • whitespace-only node_id
    • unsupported status
    • whitespace-only capability
    • duplicate capability

Result:

  • ad-hoc verification passed: peer_roster_document emits only manifest-compatible roster nodes and rejects invalid output values
  • ad-hoc verification exit code: 0

Cleanup:

  • Temporary script removed successfully:
    [local temp path redacted]

Safety notes

  • Local review log path intentionally redacted.
  • No force push used by the automation.
  • No hard reset used by the automation.

@Exohayvan

Copy link
Copy Markdown
Contributor Author

Automated review did not approve this PR

Automated Hermes/GPT-5.5 review decision for PR #53: bad.

Review notes

Ad-hoc verification completed.

Temporary script:

  • Created with Python tempfile under:
    [local temp path redacted]
  • Filename prefix:
    hermes-verify-
  • Actual path:
    [local temp path redacted]
  • Cleanup:
    cleaned up successfully

Ad-hoc behavior checked:

  • A valid heartbeat with status "available" and capability ["echo"] produces a manifest-compatible peer roster node.
  • A heartbeat with invalid status "busy" is rejected with the expected status validation error.
  • A heartbeat with duplicate capabilities ["echo", "echo"] is rejected with the expected duplicate-capabilities validation error.

Output:
created [local temp path redacted]
ad-hoc peer roster verification passed
exit_code=0
cleaned up [local temp path redacted]

This is ad-hoc verification of the changed behavior, not a full canonical test/lint/build suite result.

Safety notes

  • Local review log path intentionally redacted.
  • No force push used by the automation.
  • No hard reset used by the automation.

@Exohayvan

Copy link
Copy Markdown
Contributor Author

Automated review did not approve this PR

Automated Hermes/GPT-5.5 review decision for PR #53: bad.

Review notes

Ad-hoc verification completed for the changed behavior.

Temporary script:

  • Created under the requested temp root with hermes-verify- prefix:
    [local temp path redacted]

What it verified:

  • peer_roster_document still emits manifest-compatible JSON for a valid available node heartbeat.
  • build-peer-roster rejects a heartbeat-derived status not accepted by the manifest schema.
  • build-peer-roster rejects duplicate heartbeat-derived capabilities.
  • CLI build-peer-roster --output-path writes the same JSON it prints to stdout.

Result:

  • AD_HOC_VERIFICATION_OK peer_roster_manifest_compatibility_and_cli_output_path
  • exit_code=0

Cleanup:

  • Removed the temporary script successfully:
    cleaned=[local temp path redacted]

This is ad-hoc focused verification only, not a claim that the full canonical test suite is freshly green.

Safety notes

  • Local review log path intentionally redacted.
  • No force push used by the automation.
  • No hard reset used by the automation.

@Exohayvan
Exohayvan force-pushed the ai/next-step-20260630-050353 branch from d3982ae to 5790a0e Compare June 30, 2026 15:51
@Exohayvan

Copy link
Copy Markdown
Contributor Author

Closing during PR cleanup: this peer discovery/roster helper now conflicts with main after #50 merged . The merged command covers the active peer-log dispatch path, so this older overlapping PR is not being kept alive.

@Exohayvan Exohayvan closed this Jun 30, 2026
@Exohayvan
Exohayvan deleted the ai/next-step-20260630-050353 branch June 30, 2026 16:13
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