Skip to content

0065: app: frontend: Add manifest-declared legal documents - #7299

Open
illume wants to merge 1 commit into
kubernetes-sigs:mainfrom
illume:upstream-0065-manifest-legal-documents
Open

0065: app: frontend: Add manifest-declared legal documents#7299
illume wants to merge 1 commit into
kubernetes-sigs:mainfrom
illume:upstream-0065-manifest-legal-documents

Conversation

@illume

@illume illume commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Load legal document declarations from app-build-manifest.json.
  • Validate document metadata and constrain file reads to packaged resources.
  • Expose legal document metadata and content through narrow desktop IPC methods.
  • Add About and Legal tabs to Version information when the host declares the capability.
  • Package the Headlamp license and third-party notices for desktop builds.

Source

The source SHA is preserved in patch 0065 from Azure PR 823, although the
force-pushed source commit is no longer directly reachable on GitHub. The
implementation commit preserves Joaquim's author identity and date and adds
René Dudfield as co-author.

Improvements over the existing changes

  • Adapt the patch to current Headlamp by sharing one application build manifest
    path instead of depending on downstream-only host-capability commits. This
    keeps the upstream change self-contained and avoids reading divergent files.
  • Expand unit coverage before the implementation commit to cover malformed
    manifests, every field guard, unreadable and escaping paths, rejected IPC
    calls, host capability absence, fallback errors, stale async work, and dialog
    interactions. This raises branch coverage above 80% for every changed module.
  • Add a Playwright flow from Home through Settings, Version, Legal, and License.
    This protects the complete user path that was not covered by the source patch.
  • Document the new TypeScript interfaces, fields, functions, parameters, and
    return values with TSDoc so the desktop contract is explicit.

Testing

  • app/electron/legal-documents.ts: 100% branch coverage, 31 tests
  • frontend/src/components/App/LegalDocuments.tsx: 93.75% branch coverage
  • frontend/src/components/App/VersionDialog.tsx: 100% branch coverage
  • Frontend focused suite: 12 tests
  • Playwright Chromium legal-document flow: 1 passed
  • npm run tsc -- --noEmit in app and frontend
  • npm run compile-electron
  • npm run build in frontend

Screenshots

Large (1280 x 800)

Before After
Version dialog before legal documents at large viewport Legal tab after manifest-declared legal documents at large viewport

Medium (768 x 1024)

Before After
Version dialog before legal documents at medium viewport Legal tab after manifest-declared legal documents at medium viewport

Mobile (390 x 844)

Before After
Version dialog before legal documents at mobile viewport Legal tab after manifest-declared legal documents at mobile viewport

Dependencies

None.

Assisted by copilot.

@kubernetes-prow kubernetes-prow Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 16, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: illume

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 16, 2026
@illume
illume requested a balanced review from Copilot August 16, 2026 21:49
@illume
illume marked this pull request as draft August 16, 2026 21:49
@kubernetes-prow kubernetes-prow Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 16, 2026

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.

Pull request overview

Adds manifest-declared legal documents to desktop builds and exposes them through IPC in the Version dialog.

Changes:

  • Validates, packages, and reads legal documents.
  • Adds About/Legal tabs and document dialogs.
  • Adds unit and end-to-end coverage.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
frontend/src/components/App/VersionDialog.tsx Adds legal-document tabs.
frontend/src/components/App/VersionDialog.test.tsx Tests dialog behavior.
frontend/src/components/App/LegalDocuments.tsx Implements legal-document UI.
frontend/src/components/App/LegalDocuments.test.tsx Tests loading and errors.
e2e-tests/tests/legalDocuments.spec.ts Adds the user-flow test.
app/package.json Packages license resources.
app/electron/preload.ts Exposes legal IPC methods.
app/electron/main.ts Registers legal IPC handlers.
app/electron/legal-documents.ts Validates and reads documents.
app/electron/legal-documents.test.ts Tests validation and reads.
app/app-build-manifest.json Declares bundled documents.

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

Comment thread app/electron/main.ts
legalDocuments.map(({ id, title }) => ({ id, title }))
);
ipcMain.handle('get-legal-document', (_event, id: unknown) =>
readLegalDocument(process.resourcesPath, legalDocuments, id)
Comment on lines +71 to +73
async function openDocument(document: LegalDocument): Promise<void> {
try {
const result = await window.desktopApi?.getLegalDocument?.(document.id);
Comment thread e2e-tests/tests/legalDocuments.spec.ts Outdated
.click();
await expect(assistantDialog).not.toBeVisible();
}
await page.getByRole("button", { name: "Settings" }).click();
file !== '.' &&
file !== '..'
);
});
import os from 'node:os';
import path from 'node:path';
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
import { getLegalDocuments, loadLegalDocuments, readLegalDocument } from './legal-documents';
/>
{hasLegalDocuments ? (
<Tabs
ariaLabel={t('translation|About dialog tabs')}
@illume
illume force-pushed the upstream-0065-manifest-legal-documents branch from a612534 to 6c17d60 Compare August 16, 2026 22:08
@kubernetes-prow kubernetes-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 17, 2026
@illume
illume force-pushed the upstream-0065-manifest-legal-documents branch from 6c17d60 to 269fcbe Compare August 17, 2026 07:45
@kubernetes-prow kubernetes-prow Bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 17, 2026
@illume
illume force-pushed the upstream-0065-manifest-legal-documents branch from 269fcbe to 1f17dca Compare August 17, 2026 07:46
Expose packaged legal documents through a validated desktop IPC capability.
This lets downstream builds declare legal content without forking the UI.

Co-authored-by: René Dudfield <renedudfield@microsoft.com>
@illume
illume force-pushed the upstream-0065-manifest-legal-documents branch from 1f17dca to 48adada Compare August 17, 2026 07:57
@kubernetes-prow kubernetes-prow Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 17, 2026
@illume
illume marked this pull request as ready for review August 17, 2026 07:57
@kubernetes-prow kubernetes-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 17, 2026
@kubernetes-prow
kubernetes-prow Bot requested a review from kahirokunn August 17, 2026 07:57
@illume illume added this to the v0.45.0 milestone Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants