Stage 8.3: migrate analysis rules-leg compute to C# authority (+ CI guard alignment) - #13
Draft
IvanCodesDev wants to merge 3 commits into
Draft
Stage 8.3: migrate analysis rules-leg compute to C# authority (+ CI guard alignment)#13IvanCodesDev wants to merge 3 commits into
IvanCodesDev wants to merge 3 commits into
Conversation
- C# POST /api/v1/analysis-tasks executes the deterministic rules leg via ForgeX.Analytics and persists to forgex.node_analysis_tasks with the exact UPSERT cadence/field semantics of server/services/postgres-analysis.js, so Stage 8.1 history/SSE read endpoints serve C#-computed tasks unchanged - Node gains ANALYSIS_AUTHORITY=node|csharp rollback switch (default node); csharp mode proxies non-AI task creation to the sidecar with hashed tenant/owner context and adopts the terminal snapshot into TaskStore, keeping AI narration legs and provider credentials in Node - tests/analysis-authority.test.js (28 checks) added to the main test chain Co-authored-by: Ivan <2006ivanwong@gmail.com>
…ale lint/format - Replace the zero-PackageReference grep (red since Npgsql landed) with a per-project pinned allowlist in config/dependency-policy.json, shared by the new tools/verify-dotnet-packages.js and tools/security-audit.js - Grant browser globals (incl. Event) to tools/capture-readme-screenshots.js whose page.evaluate() callbacks run in the browser - Prettier-format the two engine TS files (modifier order only) Co-authored-by: Ivan <2006ivanwong@gmail.com>
…elog Co-authored-by: Ivan <2006ivanwong@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stage 8.3 — analysis rules-leg compute moves to C#
Per commit 026da51 ("the compute leg itself moves in Stage 8.3") and the V2.0 §4.2 roadmap inferred from
backend/NuGet.Configand Stage 8.1/8.2 conventions.What changed
ForgeX.Api): newPOST /api/v1/analysis-tasks(mounted only withAnalysisTasks:Provider=postgres) executes the deterministic rules leg viaForgeX.Analyticsand persists toforgex.node_analysis_taskswith the exact UPSERT cadence, field semantics, and RLS GUC contract ofserver/services/postgres-analysis.js. Terminal snapshot + full events returned on 201. Stage 8.1 history/SSE read endpoints serve C#-computed tasks unchanged.AnalysisTasks:TaskTtlMs(default 3600000) mirrors NodeTASK_TTL_MS. NewUpsertAsynconPostgresAnalysisTaskRepository, new create DTOs inForgeX.Contracts.ANALYSIS_AUTHORITY=node|csharpswitch (defaultnode). Incsharpmode, non-AI task creation onPOST /api/analyzeproxies to the sidecar (ownership/rate-limit checks stay local; hashed tenant/owner context headers;ANALYSIS_AUTHORITY_TIMEOUT_MS, sidecar failure → 502) and adopts the terminal snapshot viaTaskStore.adopt, so existing result/poll/SSE-replay routes work as-is. AI narration legs (Partner SSO / OpenAI-compatible) and quota degradation stay in Node; provider credentials never leave the Node process.tests/analysis-authority.test.js(28 checks: proxy contract, credential stripping, hashed context headers, adopted-task read routes, node-mode zero sidecar calls, sidecar-unavailable 502, config guards) added to the main chain.main): the zero-PackageReference grep andsecurity-audit.jscheck failed ever since Stage 8.1 sanctioned Npgsql — replaced with a per-project pinned allowlist (config/dependency-policy.json→allowedDotnetPackages, currently only Npgsql 9.0.3 inForgeX.Infrastructure) shared via newtools/verify-dotnet-packages.js; also fixed the stale ESLintno-undefintools/capture-readme-screenshots.jsand two Prettier-only engine TS warnings.Rollback
Set
ANALYSIS_AUTHORITY=node(or unset — it is the default). Behavior is then bit-identical to pre-migration; no schema or data migration is involved, and rows written by C# remain readable by Node.Test evidence
npm run check(openapi/lint/format/frontend typecheck+tests/fullnpm test) green;npm run dotnet:build0 warnings 0 errors;npm run dotnet:analytics955/955;npm run dotnet:openapi-runtime10 paths; security audit 12/12. Live end-to-end against PostgreSQL verified: C#-executed task served by Node SSE/poll/result, survives Node restart, served by C# read endpoints, and dual-run Node-vs-C# persisted reports are byte-identical excepttaskId.