Skip to content

fix(F5): remove misplaced imports and align TS types with backend models#52

Merged
Rowuni merged 2 commits into
developfrom
copilot/review-des-fondations
May 17, 2026
Merged

fix(F5): remove misplaced imports and align TS types with backend models#52
Rowuni merged 2 commits into
developfrom
copilot/review-des-fondations

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 17, 2026

Foundations review (F5) — clean up import hygiene across the stack and fix a type contract mismatch between the frontend and backend.

Changes

Unused import removed

  • agent/scan.py: dropped import sys (never referenced)

In-function imports promoted to module level

  • backend/routers/scan.py: get_scan was imported inside the route handler on every request
  • backend/repository.py: datetime / timezone were imported inside update_scan_finished

TypeScript ↔ Pydantic contract fixed

frontend/src/types/api.ts import request interfaces had field names that didn't match the backend models:

// Before — mismatched with Pydantic
interface ImportCertRequest   { pem: string }
interface ImportSshRequest    { pubkey: string }
interface ImportConfigRequest { content: string; filename: string }

// After — aligned with backend/models.py
interface ImportCertRequest   { pem_content: string }
interface ImportSshRequest    { pubkey_content: string }
interface ImportConfigRequest { config_type: 'sshd' | 'openssl'; config_content: string }

Copilot AI linked an issue May 17, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Review des fondations du projet POC fix(F5): remove misplaced imports and align TS types with backend models May 17, 2026
Copilot finished work on behalf of Rowuni May 17, 2026 16:53
Copilot AI requested a review from Rowuni May 17, 2026 16:53
@Rowuni Rowuni requested a review from Copilot May 17, 2026 16:54
@Rowuni Rowuni marked this pull request as ready for review May 17, 2026 16:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR performs small cross-stack hygiene fixes by removing/moving misplaced imports in Python modules and correcting a frontend TypeScript ↔ backend Pydantic request-shape mismatch for import endpoints.

Changes:

  • Promotes in-function Python imports to module scope (router/repository) and removes an unused import in the agent CLI.
  • Updates Import*Request TypeScript interfaces to match backend Import*Payload field names and shapes.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
frontend/src/types/api.ts Aligns import request interfaces (ImportCertRequest, ImportSshRequest, ImportConfigRequest) with backend Pydantic payload models.
backend/routers/scan.py Moves get_scan repository import to module level (aliased to avoid name clash with route handler).
backend/repository.py Moves datetime/timezone import to module level for update_scan_finished.
agent/scan.py Removes unused sys import from the agent CLI entrypoint.

@Rowuni Rowuni merged commit 307f502 into develop May 17, 2026
4 checks passed
@Rowuni Rowuni deleted the copilot/review-des-fondations branch May 17, 2026 16:57
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.

F5 - Review des fondations

3 participants