From 84e9c37fd61a0ec09103d6c023a75c6f81acf7c8 Mon Sep 17 00:00:00 2001 From: vczh Date: Wed, 10 Jun 2026 03:07:18 -0700 Subject: [PATCH] Sync copilot knowledge base --- .github/KnowledgeBase/Learning.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/KnowledgeBase/Learning.md b/.github/KnowledgeBase/Learning.md index 27e78616..313621d5 100644 --- a/.github/KnowledgeBase/Learning.md +++ b/.github/KnowledgeBase/Learning.md @@ -4,12 +4,12 @@ - Process staged tasks one by one with verification [15] - Port fixes from imports to source repositories [7] +- Verify generated artifacts with downstream consumer checks [7] - Crash early instead of adding error-tolerance fallbacks [6] -- Verify generated artifacts with downstream consumer checks [6] - Make `Stop()` drain asynchronous work before returning [5] +- Proactively remove code made redundant by refactoring [5] - Use `WString::IndexOf` with `wchar_t` (not `const wchar_t*`) [4] - Use `collections::BinarySearchLambda` on contiguous buffers (guard empty) [4] -- Proactively remove code made redundant by refactoring [4] - Use `vl::Exception` for expected semantic failures and `CHECK_ERROR` for invariants [3] - Capture dependent lambdas explicitly [2] - Don't assume observable changes are batched [2] @@ -194,6 +194,8 @@ When a generator produces artifacts for another language or toolchain, validate When generated RPC JSON values or request/response transcripts are part of the contract, run the preparation step that copies/regenerates them, include the new folders in the downstream project configuration, type-check them, and sample or audit the generated files for protocol invariants such as request/response id pairing. +When a generator produces runnable sample applications, verify the generated output through the actual app workflow too. For example, generated ChatBot RPC code should be checked by running the server and multiple clients through joins, chat messages, client exit, and server shutdown, not only by confirming generation succeeds. + ## `vl::regex` separator regex: `L"[\\/\\\\]+"` In `vl::regex::Regex`, both `/` and `\\` are escaping characters, and incorrect escaping inside `[]` can throw errors like `Illegal character set definition.` @@ -228,6 +230,8 @@ Preserve helper layers that still own observable behavior. For example, flat RPC When a destructor only resets `Ptr`, shared-pointer, or similar owning members to null, remove that destructor/reset code and let member destruction release resources naturally. +When splitting a monolithic implementation into focused files, delete empty source stubs and duplicate state fields in the same cleanup. Update project metadata and includes immediately so the old file names do not remain as stale references. + ## Keep design documentation aligned with code after refactoring When a refactoring changes architecture or behavior, update the corresponding design documents in the same task rather than deferring it. After a structural change, re-read the related documents and reconcile anything that became misaligned (for example, descriptions of a transport path that no longer exists). Treat documentation drift left by a previous refactoring as part of the current cleanup.