Skip to content

fix: silence opencode lifecycle events and stabilize parity fixture#63

Merged
pruiz merged 2 commits into
masterfrom
fix/silence-catalog-integration-events
Jun 16, 2026
Merged

fix: silence opencode lifecycle events and stabilize parity fixture#63
pruiz merged 2 commits into
masterfrom
fix/silence-catalog-integration-events

Conversation

@pruiz

@pruiz pruiz commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Adds catalog.updated, integration.updated, and plugin.updated to the StateTracker's silent-drop set, consistent with existing handling of plugin.added, connector.updated, and reference.updated.

These are volatile opencode startup/config lifecycle events already classified as ignorable in _PARITY_IGNORED_TYPES. Without this fix they pass through to UnknownEventRenderer and print noisy unknown event type: lines.

Changes:

  • tools/events/state_tracker.py — extended the silent-drop tuple for lifecycle/config events
  • tests/test_new_serve_stack.py — added parametrized test cases for the new silently dropped event types
  • tools/mock-llm-scripts/comprehensive.json — changed the deterministic bash fixture to printf 'hello\n'; sleep 0.05 to avoid the opencode 1.17.x shell output drain race observed in CI

Review follow-up:

  • plugin.updated was added after review because it is already listed in _PARITY_IGNORED_TYPES and is the direct sibling of existing plugin.added handling.
  • The parity fixture change is intentionally included as a CI stabilization follow-up for the failed macOS/Python parity job after the opencode pin moved to 1.17.7.

Validation:

  • Local parity suite: tests/test_mock_llm_parity.py::TestMockLLMParity::test_parity_script passed, 5/5
  • Local lifecycle test: tests/test_new_serve_stack.py::TestStateTracker::test_bootstrap_lifecycle_events_silently_dropped passed, 6/6
  • GitHub Actions: full PR matrix passed, 6/6 jobs

Closes #62

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

StateTracker.ingest() is updated to silently drop plugin.updated, catalog.updated, and integration.updated events by adding them to the existing early-return tuple. The parametrized test for bootstrap lifecycle silent drops is extended to cover these new types. Separately, the mock LLM script's bash command is changed from echo hello to printf 'hello\n'; sleep 0.05.

Changes

StateTracker Silent Drop for New Event Types

Layer / File(s) Summary
StateTracker ingest() expansion and test coverage
tools/events/state_tracker.py, tests/test_new_serve_stack.py
StateTracker.ingest() early-return tuple extended to include plugin.updated, catalog.updated, and integration.updated; parametrized test updated to assert all new types are silently dropped during bootstrap lifecycle.

Mock LLM Script Update

Layer / File(s) Summary
Mock script bash command change
tools/mock-llm-scripts/comprehensive.json
Replaces echo hello with printf 'hello\n'; sleep 0.05 in the bash tool-call step of the comprehensive mock script.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~4 minutes

Possibly related PRs

  • pruiz/CodeCome#60: Both PRs handle catalog.updated and integration.updated lifecycle events — this PR silences them in StateTracker.ingest(), while the referenced PR ignores them in mock LLM parity diff tracking.

Poem

🐇 A hop and a skip through event-land so bright,
catalog.updated was making a fright!
Now silently dropped with its integration friend,
The StateTracker's tuple has come to an end.
No more noisy unknowns to clutter the night! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR implements the core requirement from issue #62 by extending StateTracker's silent-drop tuple for catalog.updated and integration.updated events. However, it also adds plugin.updated which is not mentioned in the issue objective. Clarify whether plugin.updated should be included in the silent-drop tuple. If out-of-scope, remove it; if necessary, update the PR title and description to document this additional change.
Out of Scope Changes check ⚠️ Warning The PR includes changes to tools/mock-llm-scripts/comprehensive.json that appear unrelated to silencing lifecycle events, involving a bash tool call modification. Remove the unrelated changes to comprehensive.json or explain their necessity. If intentional, document the purpose in the PR description.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main changes: silencing lifecycle events (catalog.updated, integration.updated, plugin.updated) in StateTracker and stabilizing the parity fixture by adjusting the mock script.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/silence-catalog-integration-events

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR silences three noisy lifecycle event types (catalog.updated, integration.updated, and plugin.updated) that were passing through to UnknownEventRenderer during opencode startup, consistent with the existing handling of plugin.added, connector.updated, and reference.updated.

  • tools/events/state_tracker.py: Three event types added to the silent-drop tuple, bringing it into full alignment with the volatile-config subset of _PARITY_IGNORED_TYPES in mock-llm-parity.py.
  • tests/test_new_serve_stack.py: Parametrized test extended with the three new event types, each verified to return [] from ingest().
  • tools/mock-llm-scripts/comprehensive.json: echo hello replaced with printf 'hello\n'; sleep 0.05 to add a small stabilisation delay for parity tests, plus a missing trailing newline added.

Confidence Score: 5/5

Safe to merge — the change only adds event types to an existing silent-drop list and is backed by new parametrized tests.

The diff is minimal and targeted: three well-understood lifecycle event types are moved out of the unknown-event path into the silent-drop path, exactly mirroring the volatile-config subset already listed in _PARITY_IGNORED_TYPES. The new tests directly assert the expected [] return, and the rest of the ingest logic is untouched.

No files require special attention.

Important Files Changed

Filename Overview
tools/events/state_tracker.py Adds plugin.updated, catalog.updated, and integration.updated to the silent-drop tuple, making it consistent with _PARITY_IGNORED_TYPES; all added types were present in the canonical ignored set.
tests/test_new_serve_stack.py Extends the parametrized test for silently-dropped lifecycle events to cover the three newly-added types (plugin.updated, catalog.updated, integration.updated).
tools/mock-llm-scripts/comprehensive.json Replaces echo hello with printf 'hello\n'; sleep 0.05 for deterministic timing in parity tests, and adds a trailing newline to the file.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Event arrives at StateTracker.ingest] --> B{event_type?}
    B -->|session.error| C[Return error event]
    B -->|session.diff| D[Map and return]
    B -->|lifecycle/config events| E["Silent drop — return []"]
    B -->|passthrough events| F[Return event as-is]
    B -->|other known types| G[Accumulate / handle]
    B -->|unknown| H[UnknownEventRenderer]

    subgraph "Silent-drop set (after PR)"
        I["session.updated\nplugin.added\nplugin.updated\nconnector.updated\nreference.updated\ncatalog.updated\nintegration.updated"]
    end

    E --- I
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[Event arrives at StateTracker.ingest] --> B{event_type?}
    B -->|session.error| C[Return error event]
    B -->|session.diff| D[Map and return]
    B -->|lifecycle/config events| E["Silent drop — return []"]
    B -->|passthrough events| F[Return event as-is]
    B -->|other known types| G[Accumulate / handle]
    B -->|unknown| H[UnknownEventRenderer]

    subgraph "Silent-drop set (after PR)"
        I["session.updated\nplugin.added\nplugin.updated\nconnector.updated\nreference.updated\ncatalog.updated\nintegration.updated"]
    end

    E --- I
Loading

Reviews (3): Last reviewed commit: "test: avoid opencode shell output race i..." | Re-trigger Greptile

Comment thread tools/events/state_tracker.py
@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown

Coverage Report

Metric Value
Line Coverage 76.1%
Lines Covered 0 / 0

Download detailed HTML coverage reports per OS/Python from the workflow artifacts.

Generated by pytest-cov on 2026-06-16T00:20:05.903Z

… lifecycle events

Add catalog.updated, integration.updated, and plugin.updated to the
StateTracker's silent-drop set, consistent with existing handling of
plugin.added, connector.updated, and reference.updated.

Closes #62
@pruiz pruiz force-pushed the fix/silence-catalog-integration-events branch from 3367187 to 4607f2a Compare June 15, 2026 17:54
@pruiz pruiz changed the title fix: silence catalog.updated and integration.updated lifecycle events fix: silence opencode lifecycle events and stabilize parity fixture Jun 16, 2026
@pruiz

pruiz commented Jun 16, 2026

Copy link
Copy Markdown
Owner Author

Review follow-up summary:

  • plugin.updated: accepted Greptile's suggestion and added it to the silent-drop tuple plus the parametrized test because it is already in _PARITY_IGNORED_TYPES and is the sibling of existing plugin.added handling.
  • tools/mock-llm-scripts/comprehensive.json: intentionally changed the deterministic parity fixture to printf 'hello\n'; sleep 0.05 after CI exposed the opencode 1.17.x shell output drain race on macOS/Python. This keeps output comparison intact without weakening parity normalization.
  • Docstring warning: no new Python functions/classes were added in this PR, so the docstring coverage warning is unrelated/pre-existing and intentionally not addressed here.

The PR title/body have been updated to make these intentional scope additions explicit. Latest CI is green across all 6 matrix jobs.

@pruiz pruiz merged commit 3e78cb5 into master Jun 16, 2026
8 checks passed
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.

Unknown event type noise for catalog.updated and integration.updated

1 participant