Skip to content

feat(trace-topology): GptpOutOfBudget reconciliation check (v0.11.0)#241

Merged
avrabe merged 2 commits into
mainfrom
feat/v0.11.0-reconciler-gptp-budget
May 24, 2026
Merged

feat(trace-topology): GptpOutOfBudget reconciliation check (v0.11.0)#241
avrabe merged 2 commits into
mainfrom
feat/v0.11.0-reconciler-gptp-budget

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented May 24, 2026

Summary

Second of the five v1 deterministic checks — extends the v0.11.0
reconciliation engine (design docs/designs/v0.10.0-trace-topology.md
§4.4; contract docs/contracts/spar-trace-topology-v1.md).

  • Extends DeclaredModel with declared_sync_budgets_ps — the
    declared Spar_TSN::Sync_Error budget per component (FQN keyed),
    populated from a SystemInstance via the existing
    spar-network::tsn::get_sync_error_ps accessor's unit conversion
    (1000 ns1_000_000 ps).
  • New check_gptp_out_of_budget — flags the owning bus / processor
    when any observed gPTP port's worst-case sync error exceeds the
    budget. Emits a single finding per owner carrying the max observed
    across over-budget ports, matching design §4.4's "worst-case
    observed error" wording.
  • Single-budget-only scope, documented in the module + this PR.
    Multi-budget needs the feature-level LLDP_Port_Id surface that
    remains deferred; emitting findings under a guessed-strict owner
    would mis-attribute, so the check is a no-op in that case.

Adds spar-network as a workspace dep of spar-trace-topology
(single source of truth for the Spar_TSN::* accessors — no cycle:
spar-network doesn't depend on spar-trace-topology).

Falsifiable claims, each test-pinned

Claim Test
Sync_Error => 1000 ns materialises as 1_000_000 ps from_instance_reads_sync_error_with_unit_conversion
Worst-case ns × 1000 > budget → one finding gptp_flags_port_over_budget, observed_above_budget_raises_gptp_out_of_budget
Worst-case ≤ budget → zero findings gptp_clean_when_all_ports_below_budget, observed_below_budget_reconciles_clean
Zero declared budgets → zero findings gptp_no_finding_when_no_budget_declared
Multiple declared budgets → zero findings (deferred) gptp_deferred_when_multiple_components_declare_budget
observed_ps = max over all violating ports gptp_reports_max_across_all_violating_ports
Per-port worst-case = max of samples (not first / mean) gptp_uses_worst_sample_per_port
observed == budget is pass (≤) gptp_observed_equal_to_budget_is_pass
Empty-samples port → no finding gptp_port_with_no_samples_does_not_flag

Artifacts: REQ-TRACE-TOPOLOGY-009 + TEST-TRACE-TOPOLOGY-GPTP-OUT-OF-BUDGET.

Test plan

  • cargo test -p spar-trace-topology --lib -- engine::tests::gptp_ — 8 unit tests
  • cargo test -p spar-trace-topology --test gptp_out_of_budget — 3 integration tests
  • cargo clippy -p spar-trace-topology --all-targets — clean
  • cargo fmt --check — clean
  • rivet validate — 0 broken cross-refs; totals byte-identical to baseline

🤖 Generated with Claude Code

avrabe and others added 2 commits May 24, 2026 12:40
Second of the five v1 deterministic checks (design §4.4). Extends the
engine module with check_gptp_out_of_budget plus the declared
sync-budget surface on DeclaredModel.

The check reads `Spar_TSN::Sync_Error` (in picoseconds, via the
existing spar-network::tsn::get_sync_error_ps accessor's unit
conversion — `1000 ns` materialises as 1_000_000 ps) off every
component of an instantiated AADL SystemInstance.  If exactly one
component (bus or processor) declares the budget, every observed gPTP
port's worst-case sync error is checked against it; otherwise the
check is a no-op.

Single-budget-only is the honest scope: multi-budget systems need
port→bus ownership, which lives on the same connection-property
surface deferred elsewhere in this module. Choosing the most-strict
budget would mis-attribute the finding's `bus_or_processor` field.

8 unit tests + 3 instantiated-AADL integration tests, each probing
one falsifiable claim independently.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Carries the new dependency edge in Cargo.lock so the workspace lock
file stays in sync with Cargo.toml.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@avrabe avrabe enabled auto-merge (squash) May 24, 2026 10:41
@github-actions
Copy link
Copy Markdown

Rivet verification gate

20/20 passed

count
Passed 20
Failed 0
Skipped (no steps) 0

Filter: (and (= type "feature") (or (has-tag "v093") (has-tag "v0100")))

Failed artifacts

(none)

Updated automatically by tools/post_verification_comment.py. Source of truth: artifacts/verification.yaml.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

❌ Patch coverage is 94.44444% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/spar-trace-topology/src/engine.rs 94.44% 8 Missing ⚠️

📢 Thoughts on this report? Let us know!

@avrabe avrabe merged commit 0a6b961 into main May 24, 2026
17 of 18 checks passed
@avrabe avrabe deleted the feat/v0.11.0-reconciler-gptp-budget branch May 24, 2026 13:22
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