diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 4cc6dee..0dcb690 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -4,17 +4,25 @@ You are operating in a multi-repo, documentation-first architecture. You MUST STRICTLY follow this protocol for every response. Failure to do so will break the workspace rules. 1. **MANDATORY OUTPUT PREFIX:** Your response MUST begin on the very first line with this format: - `[LOADED_DOCS: N files (+K this turn: )]` + `[LOADED_DOCS: N files (+K this turn: )]` - `N` = total count of `.md` files currently in your context (across all loaded docs in this conversation) - `K` = count of `.md` files newly loaded during THIS response (may be 0) - - If `K > 0`: list the newly loaded **basenames only** (no paths) after `:` + - If `K > 0`: list the newly loaded files as **shortest unique short names** (see naming rule below) - If `K = 0`: write `[LOADED_DOCS: N files, no new loads]` - If `N = 0`: write `[LOADED_DOCS: NONE]` + **Short-name rule (for each loaded `.md` file):** + - **Default:** use the basename only. Works for all topic-prefixed companions (`LOGGING_ISSUES.md`, `BINARY_FEATURES.md`) and flat single-file topics (`ARCHITECTURE.md`, `GLOSSARY.md`, `CONVENTIONS.md`) — these are already unique. + - **For `README.md` files:** always include the immediate parent folder as prefix → `TOPIC/README.md` (e.g., `LOGGING/README.md`, `BINARY/README.md`). Never write a bare `README.md` in the prefix because multiple folders have one. + - **Cross-project disambiguation:** if two files share the same short name (rare — e.g., `docs/README.md` from two different projects), extend the prefix one more level: `PROJECT/docs/README.md`. Always use the shortest unique form. + - **Never use absolute paths.** Never include the `.github/` prefix for `copilot-instructions.md` — the `.github/` location is implicit. When multiple are loaded simultaneously (typical in `protocol-audit`), apply the cross-project disambiguation above: `AyCode.Core/copilot-instructions.md`, `FruitBankHybridApp/copilot-instructions.md`, etc. + **Examples:** - `[LOADED_DOCS: NONE]` — nothing loaded yet - `[LOADED_DOCS: 1 files, no new loads]` — only `copilot-instructions.md` loaded earlier, nothing new this turn - - `[LOADED_DOCS: 4 files (+3 this turn: LOGGING.md, LOGGING_ISSUES.md, LOGGING_TODO.md)]` — 3 new this turn + - `[LOADED_DOCS: 4 files (+3 this turn: LOGGING/README.md, LOGGING_ISSUES.md, LOGGING_TODO.md)]` — logger topic folder loaded + - `[LOADED_DOCS: 7 files (+3 this turn: SIGNALR/README.md, SIGNALR_ISSUES.md, SIGNALR_TODO.md)]` — SignalR topic loaded (LOGGING was already in context) + - `[LOADED_DOCS: 5 files (+2 this turn: ARCHITECTURE.md, GLOSSARY.md)]` — top-level reference docs loaded (flat, no folder prefix needed) This prefix is MANDATORY on **EVERY** response (not just the first, not just when loading happens). It serves two purposes: **(a)** user-visible compliance signal, and **(b)** self-commitment for the no-re-read rule — in subsequent turns you read your own prior prefix from the conversation to enforce Rule #3. Dropping the prefix breaks both. @@ -50,6 +58,22 @@ You are operating in a multi-repo, documentation-first architecture. You MUST ST 5. **EXPLICIT CONSENT FOR MODIFICATIONS:** NEVER rewrite, create, or delete any file (code, documentation, configuration, memory, or otherwise) without the user's explicit permission. If the user does not specifically request a code modification (e.g., using phrases like "we are just thinking," "what do you think," "let's plan"), you MUST ONLY provide text-based analysis and planning. You are FORBIDDEN from using file-modifying tools (`replace_string_in_file`, `edit_file`, `create_file`, etc.) until the user explicitly says "ok", "go ahead", "implement", or a similar unambiguous approval. +## Session Setup + +**Mandatory reads at session start** — in addition to this `copilot-instructions.md`, the agent MUST load the three workspace skills' `SKILL.md` files: + +- `docs-discovery/SKILL.md` — **reactive** (triggers on any domain question — must be ready BEFORE the first domain query arrives) +- `docs-check/SKILL.md` — **reactive** (triggers at the end of every code-modifying response) +- `protocol-audit/SKILL.md` — **on-demand** (triggers on explicit "audit protocol" command) + +**Path resolution**: if this repo is the canonical protocol host (see `@repo` block below — typically AyCode.Core), the paths are local: `.github/skills//SKILL.md`. Otherwise, prefix with this repo's `own-dep-repos` AyCode.Core path (see the `## Shared Agent Skills` section below for explicit paths). + +**Why mandatory**: workspace skills are NOT in Claude Code's native skill-registry / system-reminder. Without pre-loading their `SKILL.md` content, the agent cannot reliably recognize implicit triggers (e.g., "domain question → invoke docs-discovery" at the moment the question arrives, not retroactively). Pre-loading is a **one-time cost** per session (~10-13K tokens); Rule #3 (no-re-read) prevents repeated reads; re-read only if Rule #4 (Context Recovery) fires. + +**Amortization — critical, do NOT re-evaluate per-turn**: the Session Setup cost is measured over the ENTIRE session, not per single turn. A typical session has many turns; the first domain question alone already recoups the investment (alternative — repeated source-code `Grep`/`Read` per turn — costs 10-20K tokens *per turn* with lower output quality). Do NOT flag pre-loaded content as "wasteful" for turns that don't invoke it — the design depends on cross-turn amortization + Rule #3 (no-re-read) + on-demand specificity of Rule #4 (Context Recovery). This amortization is the **central token-economics principle** of the entire protocol stack. + +The first response's `[LOADED_DOCS: ...]` prefix must reflect **4 files** (this `copilot-instructions.md` + 3 SKILL.md). + ## Workspace Dependencies # own-dep-repos: "name: path" — paths are relative to this repo root (.github/..) @repo { @@ -66,7 +90,7 @@ You are operating in a multi-repo, documentation-first architecture. You MUST ST ## Shared Agent Skills -Skills defined in other repos that can be referenced from here: +Skills defined in other repos. **All three are pre-loaded at session start per the `## Session Setup` section above** (mandatory — ensures implicit triggers fire reliably): - **protocol-audit** — Cross-repo consistency audit for `.github/copilot-instructions.md` across all 5 repos. Location: `AyCode.Core/.github/skills/protocol-audit/SKILL.md` @@ -76,6 +100,10 @@ Skills defined in other repos that can be referenced from here: Location: `AyCode.Core/.github/skills/docs-discovery/SKILL.md` **Invoke proactively** before any domain-related coding task (see "Documentation-first coding" below). Honours the active repo's **no-re-read** rule. +- **docs-check** — Evaluate loaded `.md` files at the end of every code-modifying response: drift vs code, missing topic coverage, csproj-glob registration gaps for new `.md` files, and new issue/TODO candidates. Emits the `[DOCUMENTATION CHECK]` section. + Location: `AyCode.Core/.github/skills/docs-check/SKILL.md` + **Invoke at the end of every code-modifying response.** Read-only on loaded docs; all patches surface as proposals (Rule #5 approval required). + ## Protocol History Cumulative log of LLM-protocol decisions (rule changes, new skills, structural shifts): @@ -131,11 +159,8 @@ Full doctrine: `../AyCode.Core/.github/copilot-instructions.md#framework-first-d 10. Do not suggest removal/rollback as a solution — find a fix for the problem. 11. All DLL references to AyCode.Core projects are via `DllReference` (not ProjectReference) — this is intentional, required for build isolation and nopCommerce plugin compatibility in consuming projects. 12. **No redundant code** — before writing new logic, check whether similar methods already exist in the current context. Reuse or extract shared logic into smaller methods rather than duplicating. -13. **Keep all .md documentation in sync (PASSIVE DETECTION & ASK FIRST)** — If you notice *any contradiction, error, or missing information* between the code and your currently loaded `.md` files, **briefly notify the user and ask for permission before making changes**. Do NOT automatically update `.md` files or trigger new searches yet. Once the user approves, you may actively search, read, and update the necessary docs in the correct layer. -**Identify missing documentation:** If you notice during your task that a frequently used pattern, underlying logic, or important behavior is missing from the docs, **and adding it would improve future LLM context-efficiency (saving searches/tokens)**, briefly notify the user to get approval. -**Topic-based separation:** When creating or expanding documentation, keep logically distinct features or domains in separate `.md` files (e.g., architecture, data model, billing) and only reference them in the main/index documents. Do not cram everything into a single monolithic file. Keep in mind: these `.md` files are primarily for LLM grounding and context providing. Keep them concise, structured, and focused on rules/patterns rather than human-readable prose. -**ENFORCEMENT:** At the end of EVERY code-modifying response, append a **`[DOCUMENTATION CHECK]`** section. Evaluate ONLY the `.md` files *already in your context*. State in 1-2 sentences if you found discrepancies or missing concepts, and ask if they should be documented. **DO NOT trigger searches or tool calls for this initial check**. -14. **Documentation layering** — write `.md` documentation at the **defining layer** (where the code lives). Higher-layer `.md` files reference the base docs (e.g. `see AyCode.Core/docs/SIGNALR.md`) and document only project-specific overrides or extensions. Never duplicate base-layer descriptions in consumer-level docs. +13. **Keep all .md documentation in sync** — at the end of EVERY code-modifying response, invoke the **`docs-check`** skill (`AyCode.Core/.github/skills/docs-check/SKILL.md`). It evaluates loaded `.md` files for drift vs code, missing topic coverage, csproj-glob registration gaps for new `.md` files, and new issue/TODO candidates — then emits the `[DOCUMENTATION CHECK]` section per its procedure (or `[DOCUMENTATION CHECK] None.` single-line when nothing to report). The skill encapsulates the full calibration (4 prerequisites, 3-item volume cap, no-ID rule, status-update-on-fix clause) and empty-state handling. Passive detection + ASK FIRST; all patches require user approval (Rule #5). Do NOT trigger new searches for this check. +14. **Documentation layering** — write `.md` documentation at the **defining layer** (where the code lives). Higher-layer `.md` files reference the base docs (e.g. `see AyCode.Core/AyCode.Services/docs/SIGNALR/README.md`) and document only project-specific overrides or extensions. Never duplicate base-layer descriptions in consumer-level docs. 15. **Do not re-read .md files** already in your context window. They only change if you modify them yourself (new content is already in context) or if the developer tells you they changed — in that case re-read them once. 16. **Folder navigation** — start from the root `README.md` for solution-level navigation. When you need to understand a folder's contents or find a type/class, read the `README.md` in that folder first — it indexes the local files and sub-folders. Follow this before grepping or reading source files. diff --git a/AyCode.Blazor.Components/AyCode.Blazor.Components.csproj b/AyCode.Blazor.Components/AyCode.Blazor.Components.csproj index a437e1b..732c6d2 100644 --- a/AyCode.Blazor.Components/AyCode.Blazor.Components.csproj +++ b/AyCode.Blazor.Components/AyCode.Blazor.Components.csproj @@ -1,4 +1,4 @@ - + true @@ -57,6 +57,7 @@ + diff --git a/AyCode.Blazor.Components/Components/Grids/README.md b/AyCode.Blazor.Components/Components/Grids/README.md index fde0082..eab2d31 100644 --- a/AyCode.Blazor.Components/Components/Grids/README.md +++ b/AyCode.Blazor.Components/Components/Grids/README.md @@ -1,6 +1,6 @@ # Grids -Core grid system built on DevExpress `DxGrid`. For the full technical reference see `AyCode.Blazor.Components/docs/MGGRID.md`. +Core grid system built on DevExpress `DxGrid`. For the full technical reference see `AyCode.Blazor.Components/docs/MGGRID/README.md`. ## Key Files diff --git a/AyCode.Blazor.Components/README.md b/AyCode.Blazor.Components/README.md index e2bfcf4..1bfc515 100644 --- a/AyCode.Blazor.Components/README.md +++ b/AyCode.Blazor.Components/README.md @@ -13,16 +13,16 @@ Blazor Razor component library targeting .NET 10. Provides reusable DevExpress-b | Document | Topic | |---|---| -| `MGGRID.md` | MgGrid system — overview, hierarchy, generic params, IMgGridBase interface | -| `MGGRID_PARAMETERS.md` | Component parameters, event callbacks, default grid settings | -| `MGGRID_CRUD.md` | Lifecycle, CRUD operations, edit flow, disposal | -| `MGGRID_LAYOUT.md` | Layout persistence (storage keys, tiers, operations) | -| `MGGRID_DETAIL.md` | Master-detail hierarchy | -| `MGGRID_RENDERING.md` | Fullscreen mode, rendering | -| `MGGRID_INFOPANEL.md` | MgGridInfoPanel, MgGridWithInfoPanel wrapper | -| `MGGRID_TOOLBAR.md` | MgGridToolbarTemplate (buttons, parameters, state) | -| `MGGRID_COLUMNS.md` | MgGridDataColumn (InfoPanel params, UrlLink) | -| `MGGRID_DATASOURCE.md` | MgGridSignalRDataSource (server-side data, local cache) | +| `MGGRID/README.md` | MgGrid system — overview, hierarchy, generic params, IMgGridBase interface | +| `MGGRID/MGGRID_PARAMETERS.md` | Component parameters, event callbacks, default grid settings | +| `MGGRID/MGGRID_CRUD.md` | Lifecycle, CRUD operations, edit flow, disposal | +| `MGGRID/MGGRID_LAYOUT.md` | Layout persistence (storage keys, tiers, operations) | +| `MGGRID/MGGRID_DETAIL.md` | Master-detail hierarchy | +| `MGGRID/MGGRID_RENDERING.md` | Fullscreen mode, rendering | +| `MGGRID/MGGRID_INFOPANEL.md` | MgGridInfoPanel, MgGridWithInfoPanel wrapper | +| `MGGRID/MGGRID_TOOLBAR.md` | MgGridToolbarTemplate (buttons, parameters, state) | +| `MGGRID/MGGRID_COLUMNS.md` | MgGridDataColumn (InfoPanel params, UrlLink) | +| `MGGRID/MGGRID_DATASOURCE.md` | MgGridSignalRDataSource (server-side data, local cache) | ## Dependencies diff --git a/AyCode.Blazor.Components/docs/MGGRID_COLUMNS.md b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_COLUMNS.md similarity index 92% rename from AyCode.Blazor.Components/docs/MGGRID_COLUMNS.md rename to AyCode.Blazor.Components/docs/MGGRID/MGGRID_COLUMNS.md index 4c17c07..2795096 100644 --- a/AyCode.Blazor.Components/docs/MGGRID_COLUMNS.md +++ b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_COLUMNS.md @@ -1,6 +1,6 @@ # MgGrid — Columns -> Part of the MgGrid system. See `MGGRID.md` for overview and component hierarchy. +> Part of the MgGrid system. See `README.md` for overview and component hierarchy. ## MgGridDataColumn diff --git a/AyCode.Blazor.Components/docs/MGGRID_CRUD.md b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_CRUD.md similarity index 98% rename from AyCode.Blazor.Components/docs/MGGRID_CRUD.md rename to AyCode.Blazor.Components/docs/MGGRID/MGGRID_CRUD.md index 80768f4..cd5c365 100644 --- a/AyCode.Blazor.Components/docs/MGGRID_CRUD.md +++ b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_CRUD.md @@ -1,6 +1,6 @@ # MgGrid — Lifecycle & CRUD -> Part of the MgGrid system. See `MGGRID.md` for overview and component hierarchy. +> Part of the MgGrid system. See `README.md` for overview and component hierarchy. ## Lifecycle diff --git a/AyCode.Blazor.Components/docs/MGGRID_DATASOURCE.md b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_DATASOURCE.md similarity index 79% rename from AyCode.Blazor.Components/docs/MGGRID_DATASOURCE.md rename to AyCode.Blazor.Components/docs/MGGRID/MGGRID_DATASOURCE.md index f65fec0..23f3ded 100644 --- a/AyCode.Blazor.Components/docs/MGGRID_DATASOURCE.md +++ b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_DATASOURCE.md @@ -1,7 +1,7 @@ # MgGrid — DataSource -> Part of the MgGrid system. See `MGGRID.md` for overview and component hierarchy. -> For the underlying `AcSignalRDataSource`: `AyCode.Services.Server/docs/SIGNALR_DATASOURCE.md` (in AyCode.Core repo) +> Part of the MgGrid system. See `README.md` for overview and component hierarchy. +> For the underlying `AcSignalRDataSource`: `AyCode.Services.Server/docs/SIGNALR/SIGNALR_DATASOURCE.md` (in AyCode.Core repo) ## MgGridSignalRDataSource diff --git a/AyCode.Blazor.Components/docs/MGGRID_DETAIL.md b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_DETAIL.md similarity index 92% rename from AyCode.Blazor.Components/docs/MGGRID_DETAIL.md rename to AyCode.Blazor.Components/docs/MGGRID/MGGRID_DETAIL.md index d09667e..d8c16ff 100644 --- a/AyCode.Blazor.Components/docs/MGGRID_DETAIL.md +++ b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_DETAIL.md @@ -1,6 +1,6 @@ # MgGrid — Master-Detail -> Part of the MgGrid system. See `MGGRID.md` for overview and component hierarchy. +> Part of the MgGrid system. See `README.md` for overview and component hierarchy. ## How It Works diff --git a/AyCode.Blazor.Components/docs/MGGRID_INFOPANEL.md b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_INFOPANEL.md similarity index 98% rename from AyCode.Blazor.Components/docs/MGGRID_INFOPANEL.md rename to AyCode.Blazor.Components/docs/MGGRID/MGGRID_INFOPANEL.md index f0f69f8..fdfbe98 100644 --- a/AyCode.Blazor.Components/docs/MGGRID_INFOPANEL.md +++ b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_INFOPANEL.md @@ -1,6 +1,6 @@ # MgGrid — InfoPanel -> Part of the MgGrid system. See `MGGRID.md` for overview and component hierarchy. +> Part of the MgGrid system. See `README.md` for overview and component hierarchy. ## MgGridWithInfoPanel Wrapper diff --git a/AyCode.Blazor.Components/docs/MGGRID/MGGRID_ISSUES.md b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_ISSUES.md new file mode 100644 index 0000000..c64c2a9 --- /dev/null +++ b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_ISSUES.md @@ -0,0 +1,27 @@ +# MGGRID — Known Issues + +For planned/actionable work see `MGGRID_TODO.md`. + +No formally-tracked issues yet. In-code TODOs are recorded as TODO entries (`GRID-T-*`) in `MGGRID_TODO.md`, since they describe unfinished work rather than confirmed broken behaviour. + +Add the first `## GRID-I-1: ...` entry below when a concrete issue is observed. + +## Issue entry template + +``` +## GRID-I-NN: Short title + +**Severity:** Trivial / Low / Minor / Major · **Status:** Open / Documented / Mitigated · **Area:** + +### Description +What breaks, and under what conditions. + +### Root cause +Why it happens (code location + design mismatch). + +### Known workaround +Steps a consumer can take until fixed. + +### Related TODO +`MGGRID_TODO.md#grid-t-NN` (if applicable). +``` diff --git a/AyCode.Blazor.Components/docs/MGGRID_LAYOUT.md b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_LAYOUT.md similarity index 96% rename from AyCode.Blazor.Components/docs/MGGRID_LAYOUT.md rename to AyCode.Blazor.Components/docs/MGGRID/MGGRID_LAYOUT.md index fb020ef..af63de8 100644 --- a/AyCode.Blazor.Components/docs/MGGRID_LAYOUT.md +++ b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_LAYOUT.md @@ -1,6 +1,6 @@ # MgGrid — Layout Persistence -> Part of the MgGrid system. See `MGGRID.md` for overview and component hierarchy. +> Part of the MgGrid system. See `README.md` for overview and component hierarchy. ## Storage Keys diff --git a/AyCode.Blazor.Components/docs/MGGRID_PARAMETERS.md b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_PARAMETERS.md similarity index 95% rename from AyCode.Blazor.Components/docs/MGGRID_PARAMETERS.md rename to AyCode.Blazor.Components/docs/MGGRID/MGGRID_PARAMETERS.md index bfadda0..2ae32a2 100644 --- a/AyCode.Blazor.Components/docs/MGGRID_PARAMETERS.md +++ b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_PARAMETERS.md @@ -1,6 +1,6 @@ # MgGrid — Parameters & Events -> Part of the MgGrid system. See `MGGRID.md` for overview and component hierarchy. +> Part of the MgGrid system. See `README.md` for overview and component hierarchy. ## Required Parameters @@ -20,7 +20,7 @@ | `UpdateMessageTag` | `int` | Tag for "update item" request | | `RemoveMessageTag` | `int` | Tag for "remove item" request | -These are bundled into a `SignalRCrudTags` during `OnInitializedAsync`. See `AyCode.Services.Server/docs/SIGNALR_DATASOURCE.md` (in AyCode.Core repo) for details. +These are bundled into a `SignalRCrudTags` during `OnInitializedAsync`. See `AyCode.Services.Server/docs/SIGNALR/SIGNALR_DATASOURCE.md` (in AyCode.Core repo) for details. ## Data & Context Parameters diff --git a/AyCode.Blazor.Components/docs/MGGRID_RENDERING.md b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_RENDERING.md similarity index 93% rename from AyCode.Blazor.Components/docs/MGGRID_RENDERING.md rename to AyCode.Blazor.Components/docs/MGGRID/MGGRID_RENDERING.md index bfb9b71..adfbd24 100644 --- a/AyCode.Blazor.Components/docs/MGGRID_RENDERING.md +++ b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_RENDERING.md @@ -1,6 +1,6 @@ # MgGrid — Fullscreen & Rendering -> Part of the MgGrid system. See `MGGRID.md` for overview and component hierarchy. +> Part of the MgGrid system. See `README.md` for overview and component hierarchy. ## Fullscreen Mode diff --git a/AyCode.Blazor.Components/docs/MGGRID/MGGRID_TODO.md b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_TODO.md new file mode 100644 index 0000000..3c8ef82 --- /dev/null +++ b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_TODO.md @@ -0,0 +1,81 @@ +# MGGRID — TODO + +For known issues / bugs see `MGGRID_ISSUES.md`. + +## Priority legend +- **P0** blocker · **P1** important · **P2** nice-to-have · **P3** idea + +--- + +## GRID-T-1: Generic ID generation in `MgGridBase.SetNewId` +**Priority:** P2 · **Type:** Refactor (framework-first) · **Origin:** 2026-04-24 in-code TODO audit · **Area:** `Components/Grids/MgGridBase.cs:460` + +`SetNewId(TDataItem dataItem)` branches on `dataItem.Id is Guid` vs `dataItem.Id is int` to produce a new ID, and converts through `TypeConverter` back to `TId`. The in-code comment `//TODO: int !!! - J.` flags this as unfinished — the logic is not cleanly generic over `TId`. + +```csharp +private void SetNewId(TDataItem dataItem) +{ + //TODO: int !!! - J. + if (dataItem.Id is Guid) + { + dataItem.Id = (TId)(_typeConverterId.ConvertTo(Guid.NewGuid(), typeof(TId)))!; + } + else if (dataItem.Id is int) + { + var newId = -1 * AcDomain.NextUniqueInt32; + dataItem.Id = (TId)(_typeConverterId.ConvertTo(newId, typeof(TId)))!; + } +} +``` + +Problems: +- Runtime type switch on a generic parameter defeats the point of generics. +- Silent no-op for any other `TId` (e.g., `long`, `short`, custom struct) — no compile error, no throw. +- The negative-int convention (`-1 * AcDomain.NextUniqueInt32`) is not expressed as a contract; consumers cannot override. + +### Fix options +- **(a)** Introduce `IAcNewIdGenerator` framework abstraction (in AyCode.Core) with default implementations for `Guid` and `int`. `MgGridBase` takes it via DI or generic parameter. Consumer-specific `TId` types register their generator. +- **(b)** Virtual protected method: `protected virtual TId GenerateNewId()` on `MgGridBase`, with default implementations for `Guid` and `int` preserved. Consumer overrides for custom `TId`. +- **(c)** Static strategy map keyed by `typeof(TId)` — registered once per app startup, resolved at runtime. + +### Acceptance criteria +- No runtime type-switch in `MgGridBase`. +- Throws explicit `NotSupportedException` (or similar) for unregistered `TId` types. +- Existing `Guid` and `int` consumers unaffected. +- Remove the `//TODO: int !!! - J.` comment. + +## GRID-T-2: Implement local grouping in `MgGridSignalRDataSource.GetGroupInfoAsync` +**Priority:** P3 · **Type:** Feature · **Origin:** 2026-04-24 in-code TODO audit · **Area:** `Components/Grids/MgGridSignalRDataSource.cs:202` + +```csharp +public override async Task> GetGroupInfoAsync( + GridCustomDataSourceGroupingOptions options, + CancellationToken cancellationToken) +{ + _logger?.Debug("[MgGridSignalRDataSource] GetGroupInfoAsync"); + + // TODO: Implement local grouping when needed + return await base.GetGroupInfoAsync(options, cancellationToken); +} +``` + +Currently delegates to the DevExpress base implementation, which for a server-side `GridCustomDataSource` triggers a server round-trip. With `MgGridSignalRDataSource` already holding a local cache (see `MGGRID_DATASOURCE.md`), grouping over the cached rows would avoid that round-trip. + +Not urgent — only light grouping usage so far; the base path works. Promote to P2 if a consumer hits perceptible grouping latency. + +### Acceptance criteria +- Local grouping computed from the cached list when the full dataset is cached. +- Falls back to base (server) path when the cache is partial / paginated. +- Unit / integration test with a grouped column. +- Remove the `// TODO: Implement local grouping when needed` comment. + +## TODO entry template + +``` +## GRID-T-NN: Short title +**Priority:** P0 / P1 / P2 / P3 · **Type:** Bug fix / Feature / Refactor / Docs · **Related:** `MGGRID_ISSUES.md#grid-i-NN` (if applicable) + +Description of what and why, including the trigger (user request, audit finding, incident). + +Options / sub-tasks / acceptance criteria. +``` diff --git a/AyCode.Blazor.Components/docs/MGGRID_TOOLBAR.md b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_TOOLBAR.md similarity index 95% rename from AyCode.Blazor.Components/docs/MGGRID_TOOLBAR.md rename to AyCode.Blazor.Components/docs/MGGRID/MGGRID_TOOLBAR.md index 86c979f..2885202 100644 --- a/AyCode.Blazor.Components/docs/MGGRID_TOOLBAR.md +++ b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_TOOLBAR.md @@ -1,6 +1,6 @@ # MgGrid — Toolbar -> Part of the MgGrid system. See `MGGRID.md` for overview and component hierarchy. +> Part of the MgGrid system. See `README.md` for overview and component hierarchy. ## MgGridToolbarTemplate diff --git a/AyCode.Blazor.Components/docs/MGGRID.md b/AyCode.Blazor.Components/docs/MGGRID/README.md similarity index 92% rename from AyCode.Blazor.Components/docs/MGGRID.md rename to AyCode.Blazor.Components/docs/MGGRID/README.md index 436904b..699e133 100644 --- a/AyCode.Blazor.Components/docs/MGGRID.md +++ b/AyCode.Blazor.Components/docs/MGGRID/README.md @@ -2,8 +2,8 @@ > Comprehensive documentation for the **MgGrid** component family — the primary UI data grid pattern in the AyCode.Blazor framework. > Source: `Components/Grids/` -> For SignalR transport: `AyCode.Services/docs/SIGNALR.md` (in AyCode.Core repo) -> For `AcSignalRDataSource`: `AyCode.Services.Server/docs/SIGNALR_DATASOURCE.md` (in AyCode.Core repo) +> For SignalR transport: `AyCode.Services/docs/SIGNALR/README.md` (in AyCode.Core repo) +> For `AcSignalRDataSource`: `AyCode.Services.Server/docs/SIGNALR/SIGNALR_DATASOURCE.md` (in AyCode.Core repo) ## Overview @@ -28,6 +28,8 @@ | `MGGRID_TOOLBAR.md` | MgGridToolbarTemplate (buttons, parameters, state) | | `MGGRID_COLUMNS.md` | MgGridDataColumn (InfoPanel params, UrlLink) | | `MGGRID_DATASOURCE.md` | MgGridSignalRDataSource (server-side data, local cache, background refresh) | +| `MGGRID_ISSUES.md` | Known issues (`GRID-I-*`, `GRID-B-*`) — currently none formally tracked | +| `MGGRID_TODO.md` | Planned work (`GRID-T-*`) — refactors, missing features, optimizations | ## Component Hierarchy @@ -57,7 +59,7 @@ MgGridBase | Parameter | Constraint | Purpose | |---|---|---| -| `TSignalRDataSource` | `: AcSignalRDataSource<…>` | SignalR-backed data source (see `AyCode.Services.Server/docs/SIGNALR_DATASOURCE.md` in AyCode.Core repo) | +| `TSignalRDataSource` | `: AcSignalRDataSource<…>` | SignalR-backed data source (see `AyCode.Services.Server/docs/SIGNALR/SIGNALR_DATASOURCE.md` in AyCode.Core repo) | | `TDataItem` | `: class, IId` | Entity type displayed in the grid | | `TId` | `: struct` | Primary key type (`int`, `Guid`) | | `TLoggerClient` | `: AcLoggerBase` | Logger for diagnostics | diff --git a/AyCode.Blazor.Components/docs/README.md b/AyCode.Blazor.Components/docs/README.md new file mode 100644 index 0000000..c0c0eca --- /dev/null +++ b/AyCode.Blazor.Components/docs/README.md @@ -0,0 +1,16 @@ +# AyCode.Blazor.Components documentation + +Topic documentation for the `AyCode.Blazor.Components` project (Blazor component library). + +## Topics + +- [`MGGRID/`](MGGRID/README.md) — MGGRID data grid component family (CRUD, layout, columns, toolbar, rendering, etc.) + +## Navigation + +Per the AI Agent Core Protocol (folder navigation rule), start from this README when browsing `docs/`. Each topic folder has its own `README.md` with the main content, plus `TOPIC_*.md` sub-topic files. + +## See also + +- **Blazor repo conventions**: `../../docs/CONVENTIONS.md` +- **Architecture overview**: `../../docs/ARCHITECTURE.md` diff --git a/README.md b/README.md index 2ca69c2..2a069ec 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Project-level docs: | Project | Documents | |---|---| -| `AyCode.Blazor.Components/docs/` | `MGGRID.md` — MgGrid system (grid base, toolbar, InfoPanel, layout, CRUD) | +| `AyCode.Blazor.Components/docs/` | `MGGRID/` — MgGrid system (grid base, toolbar, InfoPanel, layout, CRUD) | Core framework rules: `../AyCode.Core/.github/copilot-instructions.md` diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index e36abd3..db4edd7 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -49,7 +49,7 @@ User ← DxGrid ← AcSignalRDataSource ← SignalR (AcBinary) ← Server Hub ## MgGrid Component System -The primary UI pattern for data screens. Overview and index: `AyCode.Blazor.Components/docs/MGGRID.md` +The primary UI pattern for data screens. Overview and index: `AyCode.Blazor.Components/docs/MGGRID/README.md` ``` DxGrid (DevExpress) diff --git a/docs/GLOSSARY.md b/docs/GLOSSARY.md index f212366..ed6fee5 100644 --- a/docs/GLOSSARY.md +++ b/docs/GLOSSARY.md @@ -8,12 +8,12 @@ Blazor/MAUI UI terminology. For core framework terms see `AyCode.Core/docs/GLOSS |---|---| | **DxGrid** | DevExpress Blazor data grid. Used with `AcSignalRDataSource` for real-time SignalR data. | | **CardView** | Card-style layout wrapping DxGrid. Mobile-friendly alternative to table grids. | -| **AcSignalRDataSource** | Grid data source backed by SignalR. Handles load, CRUD, filtering, and change tracking. See `AyCode.Services.Server/docs/SIGNALR_DATASOURCE.md` in AyCode.Core repo. | +| **AcSignalRDataSource** | Grid data source backed by SignalR. Handles load, CRUD, filtering, and change tracking. See `AyCode.Services.Server/docs/SIGNALR/SIGNALR_DATASOURCE.md` in AyCode.Core repo. | | **AcExpressionNode** | Serializable LINQ expression tree. Grid filters are serialized as expression nodes and sent to server. | ## MgGrid System -For full technical reference see `AyCode.Blazor.Components/docs/MGGRID.md`. +For full technical reference see `AyCode.Blazor.Components/docs/MGGRID/README.md`. | Term | Definition | |---|---| @@ -26,7 +26,7 @@ For full technical reference see `AyCode.Blazor.Components/docs/MGGRID.md`. | **MgGridSignalRDataSource** | `GridCustomDataSource` wrapping `AcSignalRDataSource`. Local cache, background refresh. | | **IMgGridBase** | Public interface: `IsSyncing`, `GridEditState`, `ParentGrid`, `StepPrevRow/NextRow`, layout persistence methods. | | **MgGridEditState** | Enum: `None` (no edit), `New` (adding item), `Edit` (modifying item). | -| **SignalRCrudTags** | Bundle of 5 integer message tags (GetAll, GetItem, Add, Update, Remove) for one entity type. See `AyCode.Services.Server/docs/SIGNALR_DATASOURCE.md` in AyCode.Core repo. | +| **SignalRCrudTags** | Bundle of 5 integer message tags (GetAll, GetItem, Add, Update, Remove) for one entity type. See `AyCode.Services.Server/docs/SIGNALR/SIGNALR_DATASOURCE.md` in AyCode.Core repo. | | **IsMasterGrid** | `true` when `ParentDataItem == null` — top-level grid (not detail). | | **AutoSaveLayoutName** | Base name for localStorage layout keys. Default: `"Grid{TDataItem.Name}"`. | diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..d951674 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,23 @@ +# AyCode.Blazor documentation + +Top-level documentation for the `AyCode.Blazor` repo (Blazor/MAUI UI framework — Layer 1). + +## Reference docs (flat) + +- [`ARCHITECTURE.md`](ARCHITECTURE.md) — Repo architecture overview +- [`CONVENTIONS.md`](CONVENTIONS.md) — Coding conventions +- [`GLOSSARY.md`](GLOSSARY.md) — Domain glossary + +## Topic folders + +Topic-specific documentation lives at the sub-project level: + +- **MGGRID** (data grid component family): `../AyCode.Blazor.Components/docs/MGGRID/README.md` + +## Navigation + +Per the AI Agent Core Protocol (folder navigation rule), start from this README when browsing `docs/`. Single-file reference docs remain flat at this level; multi-file topics live in named subfolders. + +## See also + +- **Base framework docs**: `../../AyCode.Core/docs/README.md` (if present) and per-project `docs/` folders under AyCode.Core.