Skip to content

Git import: null project descriptions scan as blank instead of failing - #1752

Open
chiang-daniel wants to merge 1 commit into
mainfrom
dchiang/KIL-806/null-description-blocks-project-scan
Open

chiang-daniel wants to merge 1 commit into
mainfrom
dchiang/KIL-806/null-description-blocks-project-scan

Conversation

@chiang-daniel

@chiang-daniel chiang-daniel commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Treats a project's name, description and id as blank when they arrive as null, so one project file can't block importing the rest of the repo.

Why

Project.description is str | None — null is a legal value, and it's what gets written for a description that was never set. The import scan assumed otherwise. It reads project files as raw JSON rather than loading them as Project, pulled the value with data.get("description", "") — a default that only covers a missing key, not a null one — and handed the result to ProjectInfo.description, typed as a required non-nullable str.

So two contracts disagreed, and a file that was valid to write was invalid to read. Since the scan validates everything it finds as a single list, one null made every project in the repo unimportable — with an error ("Description: Input should be a valid string") naming no file, no project and no step. Found on a repo with 13 projects, 12 of them fine.

To be clear about what this is not: we aren't relaxing validation to accept broken data. The file was always valid. ProjectInfo was simply typed more strictly than the datamodel it describes, and this brings the reader back in line with the contract that already exists.

The win

These fields are display-only and come from files we didn't write, so a null should read as blank rather than hide twelve valid projects next to it. Fixed at both layers: the scan coerces, and ProjectInfo no longer rejects a null. id had the same latent exposure and is covered too.

Nothing changes on the write side. Null stays legal, because every project file already on disk with one has to keep loading.

Checklists

  • Tests have been run locally and passed
  • New tests have been added to any work in /lib

🤖 Generated with Claude Code

Git Auto Sync scans a whole repo for project.kiln files and validates them
as a single list, so one bad file takes down the entire scan. A project file
carries an explicit null for any field that was never set, but the scan read
it with data.get("description", "") -- a default that only covers a missing
key, not a null one -- and ProjectInfo.description was a required
non-nullable str.

One null description therefore made every project in the repo unimportable,
with an error that named no file, no project and no step.

These fields are display-only and come from files we did not write, so a
null now reads as blank: the scan coerces, and ProjectInfo no longer rejects
one. id had the same latent exposure and is covered too.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R9sYts5tsdPzNstbhbg3F8
@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: a3f2bab6-c0d9-48a2-9d91-5cdab419e6ae

📥 Commits

Reviewing files that changed from the base of the PR and between 827eabf and 7c6b07e.

📒 Files selected for processing (5)
  • app/desktop/git_sync/clone.py
  • app/desktop/git_sync/git_sync_api.py
  • app/desktop/git_sync/test_clone.py
  • app/desktop/git_sync/test_git_sync_api.py
  • app/web_ui/src/lib/api_schema.d.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


Walkthrough

The project scanner and ProjectInfo model now normalize null name, description, and id values to empty strings. Tests cover validation, fallback naming, and complete scans. Generated schema documentation records defaults for name and description.

Changes

Project metadata normalization

Layer / File(s) Summary
Normalize project metadata at scan and model boundaries
app/desktop/git_sync/clone.py, app/desktop/git_sync/git_sync_api.py
The scanner converts null JSON fields to empty strings. ProjectInfo provides defaults for name and description, and validates null metadata as empty strings. path remains required.
Verify normalized project results
app/desktop/git_sync/test_clone.py, app/desktop/git_sync/test_git_sync_api.py, app/web_ui/src/lib/api_schema.d.ts
Tests cover null-field normalization, fallback naming, required paths, and scans containing valid and null-description projects. Schema documentation records defaults for name and description.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 7c6b0

Project imports now tolerate unset name, description, and ID fields by treating them as blank, allowing valid projects in the same repository to remain available. The covered behavior is ready to merge.

Suggested reviewers: scosman

Poem

A rabbit found nulls in the project trail
And turned each blank into a tidy detail
Names now hop to their file-path place
Descriptions vanish without a trace
The path still guards the garden gate

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 4 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly summarizes the primary change: null project descriptions are treated as blank during Git import scanning.
Description check ✅ Passed The description clearly explains the problem, cause, scope, implementation, tests, and checklist status. It omits the required Related Issues and Contributor License Agreement sections, but the core d…
Full details: Docstring Coverage

Explanation

Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 4 files. (1 skipped: 1 too large.)

Full details: Description check

Explanation

The description clearly explains the problem, cause, scope, implementation, tests, and checklist status. It omits the required Related Issues and Contributor License Agreement sections, but the core description is complete.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dchiang/KIL-806/null-description-blocks-project-scan

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

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

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

📊 Coverage Report

Overall Coverage: 92%

Diff: origin/main...HEAD

  • app/desktop/git_sync/clone.py (100%)
  • app/desktop/git_sync/git_sync_api.py (100%)

Summary

  • Total: 11 lines
  • Missing: 0 lines
  • Coverage: 100%

@chiang-daniel chiang-daniel changed the title Import from a repo again when one project has no description One project's null description no longer blocks importing the whole repo Sep 3, 2026
@chiang-daniel chiang-daniel changed the title One project's null description no longer blocks importing the whole repo Git import: null project descriptions scan as blank instead of failing Sep 3, 2026
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.

1 participant