Skip to content

feat(GSIFI-AIMS-BLUEPRINT-WP-037) v1.0.0 — Regulator-Grade AI Governance & ISO/IEC 42001 AIMS Master Blueprint for G-SIFIs (2026-2030)#73

Merged
OneFineStarstuff merged 2 commits into
mainfrom
genspark_ai_developer
May 1, 2026
Merged

feat(GSIFI-AIMS-BLUEPRINT-WP-037) v1.0.0 — Regulator-Grade AI Governance & ISO/IEC 42001 AIMS Master Blueprint for G-SIFIs (2026-2030)#73
OneFineStarstuff merged 2 commits into
mainfrom
genspark_ai_developer

Conversation

@OneFineStarstuff

@OneFineStarstuff OneFineStarstuff commented Apr 30, 2026

Copy link
Copy Markdown
Owner

Summary

Institutional-grade, regulator-ready master blueprint for ISO/IEC 42001-aligned AI governance and multi-jurisdiction regulatory compliance at G-SIFI scale, anchored on the high-risk credit underwriting use case (AI-CR-UNDERWRITE-01, EU AI Act Annex III §5(b)).

Deliverables (rag-agentic-dashboard/)

  • data/gsifi-aims-blueprint.json (63 KB) — 12 modules, 44 sections, 8 schemas, 11 code examples, 5 case studies, 78 API routes
  • gen-gsifi-aims-blueprint.py (78 KB) — idempotent JSON generator
  • gen-gsifi-aims-blueprint-html.py (16 KB) — HTML dashboard renderer
  • public/gsifi-aims-blueprint.html (76 KB) — interactive SPA dashboard
  • server.js/api/gsifi-aims/* endpoint family wired

Twelve modules (M1–M12)

  1. AIMS Sections 1–5 (ISO/IEC 42001 Cl. 4–10) — context, leadership, planning, support, operation/performance/improvement
  2. AIMS Annexes J1–J4 — AI System Inventory, SoA + Control Mapping (280 controls / 10 categories), FRIA+DPIA, RSP Template
  3. Multi-Jurisdiction Regulatory Overlays — ECB SSM, Fed SR 11-7, PRA SS1/23, EU AI Act, GDPR (overlay precedence + control mapping matrix)
  4. Regulator Submission Packs RSP v1.0 → v2.6 — versioned roadmap, decision-traceability API, Sigstore/Rekor + in-toto + PQC (Dilithium3 hybrid) + ZK predicates, FROST threshold
  5. Terraform + OPA Technical Enforcement — 5 TF modules, 7 policy bundles, 5 decision points (TF plan, CI gate, K8s admission, runtime gateway, egress), continuous configuration audit
  6. Adversarial & Self-Healing Governance Loops — 6-stage loop + 4 playbooks (SH-01..SH-04: bias drift auto-rollback, OPA digest mismatch quarantine, adverse-action SLA failover, FRIA escalation)
  7. Predictive Governance & Formally-Verified Legal Logic — Prophet/ARIMA forecasters; TLA+/Lean specs for FCRA §615, GDPR Art. 22, EU AI Act Art. 73, ECB ICAAP; counterfactual + causal supervisor queries (DoWhy/EconML/DiCE)
  8. Cross-Regulator Federation & Autonomous Supervisory Ecosystem — FedReg protocol (mTLS+SPIFFE+JSON-LD), Autonomous Tiers T0–T5, DP/ZK privacy, joint examination workflow
  9. High-Risk Credit Underwriting Pattern (AI-CR-UNDERWRITE-01) — scope, data governance, dev/validation, decisioning + adverse-action (FCRA §615, GDPR Art. 22, EU AI Act Art. 86), monitoring, regulator engagement
  10. Implementation Roadmap (2026–2030) — 5 phases (Foundation → Industrialise → Federate → Verify → Autonomous), 16 board-tracked KPIs, top 5 risks
  11. Operating Model — 3LoD, RACI matrix, 5 committees (Board AI Oversight, Group AI Risk, Model Approval, AI Ethics, Regulator Engagement)
  12. Reporting & Disclosure Templates — audience matrix (Board/Regulator/Customer/Audit/Public), <title>/<abstract>/<content> Markdown skeleton, disclosure principles

Schemas (8)

aiSystemInventoryEntry, rspManifest, decisionEnvelope, controlMapping, friaRecord, incidentRecord, fedRegMessage, obligationSpec.

Code examples (11)

opaRspGate (Rego), terraformWormEvidence (HCL, 10y Object Lock), decisionEnvelopeSigner (Ed25519 + Dilithium3 dual-sign), fairnessMonitor (AIR + SH-01 trigger), fedRegClient, predictiveDriftForecaster (Prophet), tlaPlusObligation (Art. 73 liveness), leanFcraSpec (FCRA §615 mech-checked), selfHealingPlaybookEngine, rspApiFastapi (decision traceability), merkleAnchor.

Case studies (5)

  • CS-01 EU G-SIB dual ISO/IEC 42001 + EU AI Act Art. 43 certification
  • CS-02 US BHC federated SR 11-7 + EU AI Act submission (FedReg → 5 supervisors)
  • CS-03 UK firm PRA SS1/23 SMF24 attestation pipeline (≤24h latency)
  • CS-04 Joint ECB+Fed+PRA examination drill (T4 autonomous advisory)
  • CS-05 Self-healing in production — bias drift auto-rollback (4-min MTTR)

Headline KPIs

  • Time-to-regulator-approved deployment ≤ 14 days (RSP v2.4+)
  • RSP generation latency ≤ 30 minutes
  • Decision-traceability coverage ≥ 99.95%
  • Control automation ≥ 95% / Evidence automation ≥ 96%
  • Fairness AIR floor ≥ 0.85 (FCRA / ECOA / EU AI Act Art. 10)
  • Adverse-action SLA ≤ 24h auto (FCRA §615)
  • Regulator notification ≤ 24h (EU AI Act Art. 73) / 72h (GDPR Art. 33)
  • WORM retention 10 years (extends SR 11-7 / SEC 17a-4(f))
  • Federated supervisor count ≥ 8

Standards alignment

ISO/IEC 42001:2023 (anchor), ISO/IEC 23894/5338/27001/27701, EU AI Act Art. 6/9/10/12/13/14/15/17/26/27/49/53/55/72/73 + Annex III §5(b), GDPR Art. 5/6/9/22/25/32/33/34/35, ECB SSM Guide + TRIM, SR 11-7 / OCC 2011-12, PRA SS1/23 + SS2/21, FCA Consumer Duty, Basel III/IV CRR3/CRD6, FCRA §604/§615, ECOA Reg B, CFPB Circular 2023-03, NIST AI RMF 1.0 + GenAI Profile, OECD AI Principles, G7 Hiroshima, Council of Europe AI Convention, OWASP LLM Top 10, MITRE ATLAS, SLSA L3, Sigstore/Cosign/in-toto.

Validation

  • node -c server.js SYNTAX OK; PM2 rag-dash online
  • HTTP 200 across all 12 module roots (m1–m12)
  • HTTP 200 across endpoint groups: /aims/sections, /aims/annexes, /regulatory/overlays, /rsp/versions, /enforcement/opa, /adversarial/playbooks, /predictive/forecasters, /federation/tiers, /credit-underwriting/decisioning, /roadmap/phases, /roadmap/kpis, /operating-model/raci, /reporting/audience, /schemas, /code-examples, /case-studies
  • 8 lookup tests passed (OVL-EUAIA, RSP-v2.4, M1-S3, M2-S4, P3, decisionEnvelope, leanFcraSpec, case studies count)
  • 7 404 handling cases verified (M99, OVL-BOGUS, RSP-V99, schema/code/case bogus, P99)
  • HTML dashboard /gsifi-aims-blueprint.html HTTP 200, 78,241 bytes

Summary by CodeRabbit

  • New Features
    • Added a comprehensive G-SIFI AI governance blueprint aligned with ISO/IEC 42001, featuring 12 modules covering AIMS documentation, regulatory overlays, governance enforcement, and implementation roadmaps.
    • Blueprint accessible as interactive HTML documentation and via API endpoints supporting modular access to schemas, code examples, and regulatory case studies.

…nce & ISO/IEC 42001 AIMS Master Blueprint for G-SIFIs (2026-2030)

- 12 modules / 44 sections / 8 schemas / 11 code examples / 5 case studies / 78 API routes
- AIMS documentation Sections 1-5 (ISO/IEC 42001 Cl. 4-10) + Annexes J1-J4
- Multi-jurisdiction overlays: ECB SSM, Fed SR 11-7, PRA SS1/23, EU AI Act, GDPR
- Regulator Submission Packs RSP v1.0 -> v2.6 with decision-traceability API,
  in-toto/Cosign/Rekor signing, PQC-ready (Dilithium hybrid), ZK predicates
- Terraform + OPA technical enforcement: 5 modules, 7 policy bundles,
  5 decision points (TF plan, CI gate, admission ctrl, runtime, egress)
- Adversarial governance loop + 4 self-healing playbooks (SH-01..04)
- Predictive governance (Prophet/ARIMA forecasters) + formally-verified
  obligation graph (TLA+/Lean for FCRA §615, GDPR Art. 22, EU AI Act Art. 73,
  ECB ICAAP) + counterfactual/causal supervisor queries
- Cross-regulator FedReg federation (mTLS + SPIFFE) + Autonomous Supervisory
  Tiers T0..T5 + joint ECB+Fed+PRA examination workflow
- High-risk credit underwriting reference pattern (AI-CR-UNDERWRITE-01,
  EU AI Act Annex III §5(b))
- 5-phase 2026-2030 roadmap (Foundation -> Industrialise -> Federate ->
  Verify -> Autonomous), 16 board-tracked KPIs, 3LoD + RACI + 5 committees
- Reporting templates with <title>/<abstract>/<content> tags
- Schemas: AI System Inventory, RSP Manifest, Decision Envelope, Control
  Mapping, FRIA, Incident Record, FedReg Message, Obligation Spec
- 11 code examples: OPA RSP gate, Terraform WORM evidence (10y), decision
  envelope dual-signer (Ed25519+Dilithium3), fairness monitor + SH-01,
  FedReg client, drift forecaster, TLA+ Art.73 spec, Lean FCRA spec,
  self-healing engine, FastAPI traceability API, Merkle anchor
- Generators: gen-gsifi-aims-blueprint.py (63 KB JSON) +
  gen-gsifi-aims-blueprint-html.py (76 KB HTML)
- Server.js: /api/gsifi-aims/* endpoint family wired with /:id route ordering
  (specific paths declared before parametric to avoid shadowing)
- Validated: node -c OK; PM2 online; HTTP 200 across modules M1-M12,
  endpoint groups (overlays, RSP versions, AIMS sections/annexes, roadmap
  phases/KPIs, RACI, schemas/code/cases); 8 lookup tests passed; 7 404
  handling cases verified; HTML dashboard 78,241 bytes
@semanticdiff-com

semanticdiff-com Bot commented Apr 30, 2026

Copy link
Copy Markdown

@code-genius-code-coverage

Copy link
Copy Markdown

The files' contents are under analysis for test generation.

@vercel

vercel Bot commented Apr 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
v0-one-fine-starstuff-github-io Ready Ready Preview, Comment, Open in v0 Apr 30, 2026 11:15am

@gitnotebooks

gitnotebooks Bot commented Apr 30, 2026

Copy link
Copy Markdown

@netlify

netlify Bot commented Apr 30, 2026

Copy link
Copy Markdown

Deploy Preview for onefinestarstuff failed.

Name Link
🔨 Latest commit 882be58
🔍 Latest deploy log https://app.netlify.com/projects/onefinestarstuff/deploys/69f339c34c3f720008e02b24

@sourcery-ai sourcery-ai 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.

Sorry @OneFineStarstuff, your pull request is larger than the review limit of 150000 diff characters

@difflens

difflens Bot commented Apr 30, 2026

Copy link
Copy Markdown

View changes in DiffLens

@coderabbitai

coderabbitai Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR introduces a comprehensive ISO/IEC 42001-aligned AI governance blueprint for G-SIFIs. It comprises a JSON master blueprint (1,612 lines) defining governance structure across 12 modules, a Python generator script (1,716 lines) that constructs the blueprint, an HTML renderer (406 lines) that transforms it into a styled page, a public HTML artifact (774 lines), and new Express routes (230 lines) for serving blueprint content via API.

Changes

Cohort / File(s) Summary
Blueprint Generation
data/gsifi-aims-blueprint.json, gen-gsifi-aims-blueprint.py
Introduces a master governance blueprint in JSON with 12 modules covering AIMS documentation, annexes, regulatory overlays, RSP versioning, enforcement architecture, adversarial/self-healing loops, predictive governance, federation protocols, high-risk underwriting patterns, implementation roadmap, and operating models. Generator script constructs this structure via factory functions, JSON schemas, code examples, and case studies.
Blueprint Rendering
gen-gsifi-aims-blueprint-html.py, public/gsifi-aims-blueprint.html
Adds HTML renderer that reads the blueprint JSON, recursively renders modules/sections as structured HTML with tables and bullet lists, computes KPI summaries, and outputs a styled public page. HTML artifact itself provides a single-page view of the full blueprint with inline CSS, embedded JSON schemas, code examples as collapsible details, and case studies.
Blueprint API Routes
server.js
Registers new Express routes that load the blueprint JSON and expose module registration, case-insensitive section lookup, aggregated summary with computed inventory counts, parameterized sub-resources per module (M1–M12), and dedicated endpoints for schemas, code examples, and case studies with 404 JSON error handling.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

  • OneFineStainstuff/OneFineStainstuff.github.io#60 — Adds near-identical artifacts (data JSON, generator scripts, HTML renderer, public HTML) and analogous server.js Express route handlers following the same pattern.
  • OneFineStainstuff/OneFineStainstuff.github.io#59 — Introduces similar governance blueprint infrastructure with data JSON, generator, HTML renderer, public page, and server.js API routes for module/section lookup.
  • OneFineStainstuff/OneFineStainstuff.github.io#72 — Adds parallel blueprint document artifacts and modifies server.js to register new routes that load and serve blueprint JSON via API endpoints.

Suggested labels

enhancement, Review effort [1-5]: 5

Suggested reviewers

  • gstraccini

Poem

🐰 A blueprint hops into the code,
ISO-blessed on the governance road!
Modules stack like carrots so deep,
While regulators their compliance will keep.
From JSON to HTML, routes serve the way—
A rabbit-approved system saves the day! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately describes the main change: a comprehensive, regulator-grade AI governance blueprint for G-SIFIs aligned to ISO/IEC 42001, covering the 2026-2030 timeframe with version 1.0.0 release.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch genspark_ai_developer

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ast-grep (0.42.1)
rag-agentic-dashboard/server.js

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@difflens

difflens Bot commented Apr 30, 2026

Copy link
Copy Markdown

View changes in DiffLens

@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: 882be58e1f

ℹ️ 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 thread rag-agentic-dashboard/server.js
@difflens

difflens Bot commented Apr 30, 2026

Copy link
Copy Markdown

View changes in DiffLens

@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 76 complexity · 13 duplication

Metric Results
Complexity 76
Duplication 13

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 7

🧹 Nitpick comments (2)
rag-agentic-dashboard/gen-gsifi-aims-blueprint.py (1)

1679-1702: ⚡ Quick win

Add a read-only check mode to prevent generator/output drift.

Right now the script always rewrites the artifact. Add a --check mode for CI that compares generated content against the committed file and exits non-zero on mismatch.

💡 Suggested patch
+import argparse
+import sys
 import json
 from pathlib import Path
@@
-def main():
+def main(check: bool = False):
     data = {
@@
-    OUT.parent.mkdir(parents=True, exist_ok=True)
-    OUT.write_text(json.dumps(data, indent=2), encoding="utf-8")
+    rendered = json.dumps(data, indent=2)
+    if check:
+        current = OUT.read_text(encoding="utf-8") if OUT.exists() else ""
+        if current != rendered:
+            print(f"Drift detected: {OUT} is out of date. Re-run generator.")
+            sys.exit(1)
+        print(f"OK: {OUT} is up to date.")
+        return
+
+    OUT.parent.mkdir(parents=True, exist_ok=True)
+    OUT.write_text(rendered, encoding="utf-8")
@@
 if __name__ == "__main__":
-    main()
+    parser = argparse.ArgumentParser()
+    parser.add_argument("--check", action="store_true", help="Validate generated file is up to date")
+    args = parser.parse_args()
+    main(check=args.check)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rag-agentic-dashboard/gen-gsifi-aims-blueprint.py` around lines 1679 - 1702,
Add a read-only "check" mode to main: parse a --check (or CHECK env) flag,
generate the JSON string as now (using main()'s data construction and
json.dumps) but if check is enabled do not call OUT.write_text; instead read the
existing OUT content, compare bytes/normalized JSON (e.g., same
indentation/newlines), and if they differ print a diff or message and exit with
non-zero status; if identical exit 0. Keep the existing behavior when --check is
false (create parent dirs, write file, compute size_kb). Reference the main()
function and the OUT variable for where to insert the flag parsing and
conditional write/compare logic.
rag-agentic-dashboard/server.js (1)

21768-21970: Add cache validators for these static blueprint endpoints

Most responses are static in-memory JSON. Consider ETag/Cache-Control (and optionally Last-Modified) to reduce payload transfer and improve client latency for repeated regulator-dashboard reads.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rag-agentic-dashboard/server.js` around lines 21768 - 21970, These endpoints
under the '/api/gsifi-aims' surface (handlers using GSAIMS, GSAIMS_MODULES and
gsaimsSection) return static in-memory JSON and should include cache validators:
add a small middleware (e.g. addStaticCacheHeaders) applied to these routes that
sets a Cache-Control header (public, max-age with a sensible TTL) and computes
an ETag from the JSON payload (hash the JSON string) and sets Last-Modified if
you have a stable timestamp; when the incoming If-None-Match or
If-Modified-Since matches, respond 304 without body. Apply this middleware to
the group of routes (or to app.get('/api/gsifi-aims/*', ...)) so all
schema/code-example/case-study/module/section endpoints use the validators.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@rag-agentic-dashboard/gen-gsifi-aims-blueprint-html.py`:
- Around line 96-97: The rendered module headers and TOC labels duplicate the
module id because titles sometimes start with the same id
(html.append(f"<h2>{esc(mid)} · {esc(title)}</h2>")) and TOC entries are
hard-clipped mid-word; update the rendering so you strip a leading id from title
before joining (e.g., if title.startswith(mid) remove the redundant prefix and
any punctuation/whitespace) and replace the simple substring clipping used for
TOC (lines around 132-134) with a word-aware truncator that cuts at the last
whitespace before the max length and appends an ellipsis; adjust the code paths
that build the header (variables mid and title where html.append is called) and
the TOC label construction to use the cleaned title and the new smart_truncate
helper.
- Around line 203-222: The code computing n_overlays, n_rsp_versions, n_phases
and n_kpis assumes sections has at least the indexed entries and can raise
IndexError; modify each computation to safely access sections (e.g., retrieve
sections = data.get("M3_regulatoryOverlays", {}).get("sections", []) and then
check len(sections) > 0 before accessing sections[0], similarly for M4_rsp and
M10_roadmap using appropriate index checks or using sections[index] if present
else fallback to {}), so that n_overlays = len(sections[0].get("overlays", []))
only runs when that section exists and otherwise defaults to 0 (apply same
guarded pattern for n_rsp_versions, n_phases, and n_kpis).
- Line 13: The generated confidential HTML (OUT variable in
gen-gsifi-aims-blueprint-html.py referencing gsifi-aims-blueprint.html) is being
served publicly via express.static in server.js
(app.use(express.static(path.join(__dirname, 'public')))), so either move the
artifact out of the public/static directory and write an authenticated endpoint
(e.g., /api/gsifi-aims/blueprint) that reads the file and enforces middleware
auth, or keep it public-by-design but add a documented justification in the repo
security/README; update the HTML generator/template (the code that embeds the
classification header at lines noted) to write to the secure location or to omit
classification when writing to public if you choose to keep public access.

In `@rag-agentic-dashboard/gen-gsifi-aims-blueprint.py`:
- Around line 48-51: The blueprint currently sets the "classification" field to
a confidential label but is exposed via public APIs; either change the
"classification" value to a non-confidential label (e.g., "PUBLIC") in the
blueprint declaration or remove/lock public exposure by updating the API surface
that serves this artifact so it is internal-only; locate the "classification"
key in the gen-gsifi-aims-blueprint declaration and either replace the
confidential string with the appropriate public classification or restrict the
endpoints/configuration that return this blueprint so it is not served through
public API routes, and update any related tests/docs to match the chosen change.
- Around line 105-117: The deliverableInventory dict in
gen-gsifi-aims-blueprint.py is missing the summary-compatible keys required by
the /api/gsifi-aims/summary endpoint (deliverables, sections, policies,
frameworks, standards), causing the API to fall back to hard-coded values;
update the deliverableInventory object (the dict named "deliverableInventory")
to include those keys with appropriate counts or align the server mapping to
read existing keys (e.g., map modules→deliverables or aimsSections→sections) so
the summary endpoint consumes blueprint-backed values rather than hard-coded
defaults.

In `@rag-agentic-dashboard/server.js`:
- Around line 21781-21784: The summary currently falls back to hardcoded counts
(e.g., aimsSections, annexes, regulatoryOverlays, rspVersions) when inv.* is
missing, causing incorrect /api/gsifi-aims/summary output; update the logic in
the summary builder to stop using literal numbers and instead use a safe
fallback (preferably 0 or a configurable constant) or compute the value from
available inventory arrays, e.g., replace patterns like "inv.aimsSections || 5"
with "inv.aimsSections ?? DEFAULT_AIMS_SECTIONS" (where DEFAULT_AIMS_SECTIONS is
a module-level constant or config/env value) or derive counts from
inv.aimsSections.length when inv arrays exist; apply the same change for
annexes, regulatoryOverlays, rspVersions and any other occurrences in the
/api/gsifi-aims/summary code path.
- Around line 21763-21766: gsaimsSection currently returns an empty object for
missing sections which causes downstream route handlers to send 200 with {};
change gsaimsSection(modKey, sid) to throw a NotFound (or return null) when the
section is not found (e.g., if no match, throw new Error('GSAIMS section not
found: ' + sid) or return null) and update the routes that call gsaimsSection
(the endpoints that currently assume an object) to check for that null/exception
and respond with res.status(404). Ensure the unique symbol gsaimsSection is
updated and callers catch the error or check for null and return 404 with a
clear message.

---

Nitpick comments:
In `@rag-agentic-dashboard/gen-gsifi-aims-blueprint.py`:
- Around line 1679-1702: Add a read-only "check" mode to main: parse a --check
(or CHECK env) flag, generate the JSON string as now (using main()'s data
construction and json.dumps) but if check is enabled do not call OUT.write_text;
instead read the existing OUT content, compare bytes/normalized JSON (e.g., same
indentation/newlines), and if they differ print a diff or message and exit with
non-zero status; if identical exit 0. Keep the existing behavior when --check is
false (create parent dirs, write file, compute size_kb). Reference the main()
function and the OUT variable for where to insert the flag parsing and
conditional write/compare logic.

In `@rag-agentic-dashboard/server.js`:
- Around line 21768-21970: These endpoints under the '/api/gsifi-aims' surface
(handlers using GSAIMS, GSAIMS_MODULES and gsaimsSection) return static
in-memory JSON and should include cache validators: add a small middleware (e.g.
addStaticCacheHeaders) applied to these routes that sets a Cache-Control header
(public, max-age with a sensible TTL) and computes an ETag from the JSON payload
(hash the JSON string) and sets Last-Modified if you have a stable timestamp;
when the incoming If-None-Match or If-Modified-Since matches, respond 304
without body. Apply this middleware to the group of routes (or to
app.get('/api/gsifi-aims/*', ...)) so all
schema/code-example/case-study/module/section endpoints use the validators.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 79c7da0d-d16e-486a-864d-14b578202372

📥 Commits

Reviewing files that changed from the base of the PR and between 952bdfb and 882be58.

📒 Files selected for processing (5)
  • rag-agentic-dashboard/data/gsifi-aims-blueprint.json
  • rag-agentic-dashboard/gen-gsifi-aims-blueprint-html.py
  • rag-agentic-dashboard/gen-gsifi-aims-blueprint.py
  • rag-agentic-dashboard/public/gsifi-aims-blueprint.html
  • rag-agentic-dashboard/server.js

Comment thread rag-agentic-dashboard/gen-gsifi-aims-blueprint-html.py
Comment thread rag-agentic-dashboard/gen-gsifi-aims-blueprint-html.py
Comment thread rag-agentic-dashboard/gen-gsifi-aims-blueprint-html.py
Comment thread rag-agentic-dashboard/gen-gsifi-aims-blueprint.py
Comment thread rag-agentic-dashboard/gen-gsifi-aims-blueprint.py
Comment thread rag-agentic-dashboard/server.js
Comment thread rag-agentic-dashboard/server.js
@penify-dev

penify-dev Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Failed to generate code suggestions for PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants