Skip to content

Dev0210#29

Merged
pforemski merged 10 commits intomainfrom
dev0210
Feb 10, 2026
Merged

Dev0210#29
pforemski merged 10 commits intomainfrom
dev0210

Conversation

@pforemski
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates bgpipe’s documentation and navigation, bumps the bgpfix dependency, and introduces a configurable stage stop timeout along with lifecycle tests to validate stage start/stop behavior.

Changes:

  • Bump github.com/bgpfix/bgpfix to v0.17.1 and adapt stages/grep.go to the updated eval/context API.
  • Add StageOptions.StopTimeout and update stop logic to optionally force-cancel stages after a configurable timeout; add lifecycle tests.
  • Refresh docs/site structure (mkdocs nav, rewritten intro/index/filter/json docs) and add a new Flowspec JSON format reference.

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
stages/grep.go Switch filter evaluation setup to a single eval.Set(...) call using pipe.UseContext.
core/stage.go Add StopTimeout time.Duration to stage options.
core/run.go Respect StopTimeout when stopping stages (wait up to timeout before force-cancel).
core/lifecycle_test.go Add stage lifecycle and coordination tests (build-tagged !race).
go.mod / go.sum Bump bgpfix to v0.17.1; tweak commented replace line.
mkdocs.yml Restructure navigation; rename site tagline.
docs/* Major documentation refresh; add docs/flowspec.md; update quickstart and stage docs.
README.md Update project description/links and author year.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Bidir bool // allow -LR (bidir mode)?
FilterIn bool // allow stage input filtering? (must have callbacks)
FilterOut bool // allow stage output filtering? (must have inputs)
StopTimeout time.Duration // timeout for Run to exit after Stop (default 3s, zero = default)
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

StopTimeout has a special-case behavior in runStop for negative durations (t < 0 cancels immediately), but the field comment only documents zero vs default. Please document what negative values mean (or avoid using negative as a sentinel) so stage authors don’t accidentally trigger immediate cancellation.

Suggested change
StopTimeout time.Duration // timeout for Run to exit after Stop (default 3s, zero = default)
StopTimeout time.Duration // timeout for Run to exit after Stop (default 3s; zero = default; negative = cancel immediately)

Copilot uses AI. Check for mistakes.
Comment on lines +274 to +276
// wait for stage to enter Run
time.Sleep(50 * time.Millisecond)

Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

Several tests rely on fixed time.Sleep(...) delays to wait for stages to enter Run(). This is prone to flakes under load/slow CI. Prefer synchronizing on a channel/event (e.g., signal from runFn) or polling with a deadline instead of sleeping a fixed duration.

Copilot uses AI. Check for mistakes.
Comment on lines +329 to +331
if elapsed < 80*time.Millisecond {
t.Fatalf("runStop returned too quickly (%v), expected ~100ms timeout", elapsed)
}
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

The timeout assertion is quite tight (expects ~100ms, failing if <80ms). On fast machines, scheduler granularity or timing jitter can make this non-deterministic. Consider asserting the behavior (that cancellation happens) with a generous upper bound, or measure using synchronization (e.g., wait for Ctx.Done()/done plus a max duration) rather than elapsed wall-clock thresholds.

Suggested change
if elapsed < 80*time.Millisecond {
t.Fatalf("runStop returned too quickly (%v), expected ~100ms timeout", elapsed)
}

Copilot uses AI. Check for mistakes.
Comment on lines 76 to 82
Kill the session if a default route is announced:

```bash
bgpipe \
-- connect 192.0.2.1 \
-- grep --keep --kill-match --event-match default 'prefix == 0.0.0.0/0' \
-- grep --kill-match default 'prefix == 0.0.0.0/0' \
-- connect 10.0.0.1
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

The example command uses --kill-match default, but --kill-match is a boolean flag in the implementation. This makes default get parsed as the positional FILTER argument (and the actual filter becomes an extra arg), so the example won’t work as written. Also, this option kills the process (per the option description), not just the session—if the goal is to stop a session/pipeline on match, document the correct event/stop-based approach instead.

Copilot uses AI. Check for mistakes.
@pforemski pforemski merged commit c1cbc9b into main Feb 10, 2026
@pforemski pforemski deleted the dev0210 branch February 10, 2026 15:35
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.

2 participants