Port hybrid report acquisition planner onto current main - #74
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 82fb724114
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (options.RequireExactAvailabilityEvidence && snapshot.Confidence != MmsRcbAvailabilityConfidence.Exact) | ||
| return false; |
There was a problem hiding this comment.
Reject stale availability snapshots before planning writes
When a cached MmsRcbAvailabilityResult is supplied, these checks accept snapshots of any age because only confidence is examined and neither CheckedAtUtc value is validated. The resulting segment can claim an RCB is free and emit RequiresWrite=true long after another client has enabled or reserved it, despite the option contract promising fresh evidence; enforce a bounded age/session requirement or explicitly reject unverifiable freshness.
AGENTS.md reference: AGENTS.md:L151-L155
Useful? React with 👍 / 👎.
| MmsRcbAvailabilitySnapshot snapshot, | ||
| MmsReportInventory inventory) | ||
| { | ||
| var candidate = FindCandidate(inventory, snapshot.Reference) ?? CandidateFromSnapshot(snapshot); |
There was a problem hiding this comment.
Build caller-owned report details from the fresh snapshot
When the live DatSet or other RCB attributes change between inventory discovery and the availability probe, FindCandidate selects the stale inventory object while the rest of this plan uses the fresh snapshot. This can produce a self-contradictory plan where ReportPlan.ReportControl.DataSetReference differs from ReportPlan.DataSetReference and its members, so consumers may map the active report against the wrong DataSet; construct or refresh the candidate from the snapshot instead.
AGENTS.md reference: AGENTS.md:L153-L156
Useful? React with 👍 / 👎.
| return normalizedMms.Equals(memberMms, StringComparison.OrdinalIgnoreCase) || | ||
| normalizedUser.Equals(memberUser, StringComparison.OrdinalIgnoreCase); |
There was a problem hiding this comment.
Require FC compatibility for static DataSet matches
When a live DataSet member has the same normalized user reference as a requested signal but a different functional constraint, the user-reference comparison still declares coverage because neither membership.FunctionalConstraint nor member.FunctionalConstraint is checked. The signal is then removed from polling even though the report carries a different MMS variable, so static identity matching must reject known FC mismatches before accepting either reference form.
AGENTS.md reference: AGENTS.md:L144-L156
Useful? React with 👍 / 👎.
| if (!string.IsNullOrWhiteSpace(snapshot.Owner) && snapshot.Owner.Trim() != "-") | ||
| return false; |
There was a problem hiding this comment.
Preserve zero-valued Owner as an unowned RCB
When an IED exposes an empty Owner as a zero-filled OCTET STRING, the probe renderer produces text such as 0000; MmsRcbAvailabilityEvaluator.HasOwner intentionally classifies that as no owner and can return Available, but this second check rejects every nonblank value. Consequently an otherwise explicitly free BRCB is silently excluded and acquisition falls back to polling; reuse the evaluator's Owner interpretation here.
AGENTS.md reference: AGENTS.md:L151-L155
Useful? React with 👍 / 👎.
Current-main consolidation of stale draft PR #66.
This PR is based on
maind04fe94877679d66330c5e5bd1a83c245aa9ccb2. The planner, documentation, and P2.2 regression files are copied byte-for-byte from the previously CI-green #66 head; onlyCHANGELOG.mdis updated against current main.Behavior remains engine-owned and fail-closed:
StaticBrcb,StaticUrcb,DynamicBrcb,DynamicUrcb,MmsPollingFallback, andUncoveredacquisition intents;MmsRcbAvailabilityResultremains the safety authority;RptEna=false, and explicit free reservation state (Resv=falsefor URCB;ResvTms=0for BRCB);AbsentorSignal missing;No ARSAS protocol heuristic is introduced. If this fresh current-main port passes full CI and merges, old draft #66 will be closed as superseded rather than merged directly.