Skip to content

fix: type the audit-log renderers (CM-1528) - #4903

Merged
gaspergrom merged 6 commits into
mainfrom
fix/CM-1528-audit-log-renderer-types
Oct 9, 2026
Merged

gaspergrom merged 6 commits into
mainfrom
fix/CM-1528-audit-log-renderer-types

Conversation

@gaspergrom

@gaspergrom gaspergrom commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Types the audit-log renderers members-edit-manual-affiliation.ts and members-edit-organizations.ts, plus the related organization renderers and AuditLog types they share. The type-check baseline drops from 534 to 488 (46 errors). No renderer logic changes.

JIRA: https://linuxfoundation.atlassian.net/browse/CM-1528

Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
…r (CM-1528)

Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
Copilot AI balanced review requested due to automatic review settings October 9, 2026 09:52
@cursor

cursor Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Compile-time typing and display-layer helpers only; no auth or data-persistence changes, with at most minor lookup behavior if platform is missing.

Overview
Adds generic typing across audit-log rendering: AuditLog<TOld, TNew> replaces any on oldState/newState/diff, and LogRenderingConfig now takes matching type params with a shared LogChanges shape (and MergeLogState for merge/unmerge actions).

Each per-action renderer is updated with concrete state types (e.g. affiliation rows, work-experience rows, identity maps, integration platform), plus small TS fixes like LogChanges annotations, typed service/list results, and || '' when indexing lfIdentities by platform.

The segment log Changes UI now holds LogChanges | null instead of a loose record. Form change helpers only get import/format tweaks. typecheck-baseline.json drops from 534 → 488 errors.

Reviewed by Cursor Bugbot for commit 09093c4. Bugbot is set up for automated code reviews on this repo. Configure here.

Copilot AI 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.

🟡 Changes recommended

Three renderer contracts conflict with actual audit-log payloads and can cause exceptions or incorrect output.

3 open findings
What changed in this PR

Adds stronger TypeScript contracts for audit-log state and renderer output, reducing the frontend type-check baseline.

Changes:

  • Genericized AuditLog and renderer configuration types.
  • Typed member, organization, integration, and merge renderers.
  • Reduced baseline errors from 538 to 494.
File Description
frontend/​typecheck-baseline.json Updates error baseline.
frontend/​src/​modules/​lf/​segments/​types/​AuditLog.ts Adds generic state types.
frontend/​src/​modules/​lf/​segments/​components/​logs/​sections/​log-changes.vue Types rendered changes.
frontend/​src/​modules/​lf/​config/​audit-logs/​log-rendering/​index.ts Defines shared renderer contracts.
.../​organizations-unmerge.ts Types unmerge state.
.../​organizations-merge.ts Types merge state.
.../​organizations-edit-profile.ts Types profile state.
.../​organizations-edit-identities.ts Types identity state.
.../​organizations-create.ts Types creation state.
.../​members-unmerge.ts Types unmerge state.
.../​members-merge.ts Types merge state.
.../​members-edit-profile.ts Types profile state.
.../​members-edit-organizations.ts Types work-experience state.
.../​members-edit-manual-affiliation.ts Types affiliation state.
.../​members-edit-identities.ts Types identity state.
.../​members-create.ts Types creation state.
.../​integrations-reconnect.ts Types integration state.
.../​integrations-connect.ts Types integration state.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

import { lfIdentities } from '@/config/identities';

const membersEditIdentities: LogRenderingConfig = {
type MemberIdentitiesState = Record<string, string[]>;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This PR only adds types here; the renderer logic is unchanged from main, so the behaviour you describe exists today and is out of scope for CM-1528. Noted for a separate look at the producer/renderer contract.

};

const membersEditOrganizations: LogRenderingConfig = {
const membersEditOrganizations: LogRenderingConfig<MemberOrganizationStateRow[]> = {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This PR only adds types here; the renderer logic is unchanged from main, so the behaviour you describe exists today and is out of scope for CM-1528. Noted for a separate look at the producer/renderer contract.

import { lfIdentities } from '@/config/identities';

const organizationsEditIdentities: LogRenderingConfig = {
type OrganizationIdentitiesState = Record<string, { value: string; type: string; verified: boolean }[]>;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This PR only adds types here; the renderer logic is unchanged from main, so the behaviour you describe exists today and is out of scope for CM-1528. Noted for a separate look at the producer/renderer contract.

Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
Copilot AI balanced review requested due to automatic review settings October 9, 2026 10:07

Copilot AI 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.

🟡 Changes recommended

Several declared state shapes contradict persisted audit payloads and can cause renderer crashes or incorrect identity changes.

4 open findings

🧠 Review effort: Balanced

@@ -1 +1 @@
{ "errors": 534 }
{ "errors": 488 }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Description corrected to 534 -> 488.

@gaspergrom
gaspergrom merged commit 54e2f8b into main Oct 9, 2026
17 checks passed
@gaspergrom
gaspergrom deleted the fix/CM-1528-audit-log-renderer-types branch October 9, 2026 10:13
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