G
YouTube TikTok Games
Skip to content

P0 Events: indexed 100-row history, immutable event numbers and full passive ledger drain - #165

Merged
masarray merged 3 commits into
masterfrom
feat/p0-indexed-event-history-paging-20261111
Nov 11, 2026
Merged

masarray merged 3 commits into
masterfrom
feat/p0-indexed-event-history-paging-20261111

Conversation

@masarray

Copy link
Copy Markdown
Owner

Field motivation

Siemens field simulation observed >1,000 events while ArSee's Event Log only displayed the most recent 420. A bounded WPF grid is not a protocol receive limit; operators need to inspect event #1 through #2,000+ without a giant DataGrid or a false data-loss claim.

Implementation

  • New per-session temporary indexed Event History for all WPF-admitted Event Log rows (Active Master, IEC-101 Passive and GI/command milestones). Fixed-size seek index; SHA256-checked JSON payloads; cap 1 GiB, explicit failure/unindexed counter; no SQLite or a new protocol decoder.
  • Immutable sequential Event # separate from wire frame/evidence sequence. Live remains a bounded 420-row virtualized preview.
  • History / Previous / Next / Jump # / Latest with 100 rows per page. A pinned historical ceiling prevents newly arriving events from silently moving the page. Live acquisition continues, only WPF follow is paused. Existing quick-search/category filters are disabled explicitly in History mode (search still operates only on live preview; no false global 0-match claim).
  • Historical rows are reconstructed from original event facts and original raw frame provenance without re-running signal classification, updating Values, manipulating ACD/FCB/serial TX, or incrementing SOE statistics.
  • IEC101 Passive monitor now drains all source-indexed facts in bounded 120-row batches rather than discarding older facts when lag exceeds 420. At Stop it cooperatively reconciles remaining indexed facts.
  • Both raw history and permanent forensic archive remain separately owned; this Event History is temporary until next session and cannot prove remote SICAM FIFO completeness. RTU generated count, COM RX, accepted objects and indexed Event Log rows must stay distinct.

Tests / acceptance

New deterministic 60/500/2,150 record indexed paging, frame/source provenance, bounds and explicit capacity failure regression tests. Windows Release/xUnit/WPF smoke will run on exact PR head before merge.

Integration

Base master 0cedf88 includes #164 vendor TI135. Concurrent IEC101 engine #145 remains separate, untouched. Do not merge until CI green and review findings resolved.

var take = (int)Math.Min(EventHistoryPagination.PageSize,
_eventHistoryCeiling - start);
var page = await Task.Run(() => journal.ReadAfter(start, take));
if (generation != _eventHistoryGeneration || !_eventHistoryMode ||
catch (Exception ex) when (ex is IOException or InvalidDataException or
ObjectDisposedException or JsonException)
{
if (generation != _eventHistoryGeneration || !_eventHistoryMode) return;
Comment on lines +39 to +40
_directory = Path.Combine(Path.GetTempPath(), "ArSee", "EventHistory",
Guid.NewGuid().ToString("N"));
_directory = Path.Combine(Path.GetTempPath(), "ArSee", "EventHistory",
Guid.NewGuid().ToString("N"));
Directory.CreateDirectory(_directory);
_dataPath = Path.Combine(_directory, "events.bin");
Guid.NewGuid().ToString("N"));
Directory.CreateDirectory(_directory);
_dataPath = Path.Combine(_directory, "events.bin");
_indexPath = Path.Combine(_directory, "events.idx");
@masarray
masarray marked this pull request as ready for review November 11, 2026 11:48
@masarray
masarray merged commit 960e460 into master Nov 11, 2026
8 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T11:51:24.936255Z c32ff2e Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c32ff2e280

ℹ️ 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".

Comment on lines +836 to +837
while (!_passiveLedgerReadFailed &&
_passiveLedgerCursor < session.GetProcessEventProgress().IndexedObjects)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Drain pending previews independently of the process-event cursor

When capture finishes with no outstanding indexed process events, this loop performs no final refresh—even if frame previews, GI milestones, controls, or latest-point updates are still queued. For example, a final GI termination or command response received after the last timer tick does not advance IndexedObjects, so it remains unpresented when the timer is stopped in finally. The previous unconditional refresh passes handled this case; retain a final preview reconciliation independently of the process-ledger drain.

AGENTS.md reference: AGENTS.md:L447-L447

Useful? React with 👍 / 👎.

Comment on lines +215 to +219
Frame = frame,
TypeId = TypeId,
TypeName = TypeName,
CauseOfTransmission = Cot,
CauseName = CauseName,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve decoded protocol details in historical frame snapshots

For active IEC-101/104 events whose original frame has rolled out of _protocolTraceStore, “Open original frame” falls back to this restored evidence object. The snapshot restores neither AsduDetails/InformationObjectDetails nor APCI, typed quality, and cause details; parsing the FT1.2 envelope does not restore those IEC-101 fields, and IEC-104 is not decoded here at all. Consequently, PopulateFrameProperties receives a null ASDU and hides the information-object table, while the historical inspector loses the original quality and protocol flags. Preserve the decoded details, or enough recorded decoder configuration and object identity to reconstruct them faithfully.

AGENTS.md reference: AGENTS.md:L23-L23

Useful? React with 👍 / 👎.

</ContextMenu>
</DataGrid.ContextMenu>
<DataGrid.Columns>
<DataGridTextColumn Header="#" Binding="{Binding EventNumber}" Width="67" MinWidth="57" ElementStyle="{StaticResource GridCellNoWrapText}" />

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Update the WPF acceptance probe for the inserted event column

Adding this column moves “State / value” from index 2 to index 3, but RunObservationUiAcceptanceProbeAsync still requires RelayEventGrid.Columns[2] to be a DataGridTemplateColumn bound to OperatorValue (MainWindow.ObservationAcceptance.cs:1033–1035). Index 2 is now the “Signal” text column, so the probe throws and the executable exits with status 1. The release workflow explicitly runs this probe in .github/workflows/release-package.yml:292–295, blocking release packaging. Update the assertion alongside the column change, preferably locating the column by identity rather than position.

AGENTS.md reference: AGENTS.md:L32-L32

Useful? React with 👍 / 👎.

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