Skip to content

feat(rfc_tools): enforce Git LFS tracking for media assets - #15

Draft
jtmcdole wants to merge 1 commit into
ci_cleanupsfrom
git_lfs
Draft

feat(rfc_tools): enforce Git LFS tracking for media assets#15
jtmcdole wants to merge 1 commit into
ci_cleanupsfrom
git_lfs

Conversation

@jtmcdole

@jtmcdole jtmcdole commented Sep 13, 2026

Copy link
Copy Markdown
Member

RFC media assets (such as screenshots) must be tracked via Git LFS (Large File Storage). Committed raw binary blobs permanently bloat Git history, even when deleted in subsequent commits.

  • Added Git LFS Configuration via .gitattributes using case-insensitive bracket globs (*.[pP][nN][gG], etc.), mapped to filter=lfs.
  • When users checkout the LFS files (smudge), this check uses git lfs fsck --pointers directly against Git revision trees in the object database, reducing false positives.
  • lfs-verify.yml with inline GitHub Actions error annotations (::error file=...::).

Flow:

flowchart TD
    A["bin/lfs_verify.dart"] --> B["LfsVerifier.verify()"]
    B --> C{"Check Prerequisites"}
    C -->|"git-lfs missing"| Err["Fail Fast: Exit 1<br/>(Prompt 'git lfs install')"]
    C -->|"git-lfs present"| D{"Execution Mode"}

    D -->|"--base-branch (PR Mode)"| E["verifyPullRequest()"]
    D -->|"Default (Trunk Mode)"| F["verifyTrackedFiles()"]

    E --> G["git diff & populateAttributeFilters()<br/>(Batched in slices of 100)"]
    F --> H["git ls-files & populateAttributeFilters()<br/>(Batched in slices of 100)"]

    G & H --> J{"Audit Scope"}
    J -->|"Default PR Mode (Squash)"| K["git lfs fsck --pointers HEAD<br/>(Scoped to PR-modified files)"]
    J -->|"--audit-intermediate-commits"| L["git lfs fsck --pointers mergeBase..HEAD"]
    J -->|"Trunk Mode (main)"| M["git lfs fsck --pointers HEAD<br/>(All tracked files)"]

    K & L & M --> N["parseFsckOutput()<br/>(Extracts file path & diagnostic detail)"]
    N --> O["LfsVerificationResult<br/>(isSuccess, issues, checkedCount)"]
    O -->|"Issues Detected"| P["GitHub Actions Annotations<br/>::error file=...::<br/>& Actionable Remediation Guidance"]
    O -->|"Zero Issues"| Q["Exit 0: Verification Passed"]
Loading

Comment thread lib/src/git_lister.dart

@jtmcdole jtmcdole Sep 13, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

cleanup: sharing logging and process runner across other binaries, testing.

Comment thread lib/src/assigner.dart

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

cleanup for process runner sharing

Comment thread .gitattributes

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this is the source of truth for what should be placed into gitlfs.

@jtmcdole
jtmcdole force-pushed the git_lfs branch 2 times, most recently from 6937ecb to 3d065b6 Compare September 13, 2026 16:13
- name: Checkout Code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

dropped any magic around fetch-depth because it was breaking assumptions. this isn't going to be a big tree, so silly optimization gone.

uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 0 || 1 }}
fetch-depth: 0

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ditto: we need the full checkout.

RFC media assets (such as screenshots) must be tracked via
Git LFS. Committed raw binary blobs permanently bloat Git history—even if
deleted in subsequent commits.

This change introduces automated verification tooling and CI enforcement:
- Configures case-insensitive Git LFS tracking in .gitattributes.
- Adds LfsVerifier and bin/lfs_verify.dart to ensure media files are
  tracked with 'filter=lfs' and backed by valid Git LFS pointers.
- Uses 'git lfs fsck --pointers' directly against Git revision trees,
  eliminating false positives from smudged working-copy binaries and
  avoiding temp-file disk I/O.
- Supports PR diff auditing (--base-branch) and full-tree auditing at
  HEAD, with an opt-in --audit-intermediate-commits flag for non-squash
  workflows.
- Adds an automated GitHub Actions workflow (.github/workflows/lfs-verify.yml)
  reporting failures via inline PR annotations.
@flutteractionsbot
flutteractionsbot changed the base branch from main to ci_cleanups September 13, 2026 16:45
@flutteractionsbot
flutteractionsbot added this pull request to stack #17 September 13, 2026 16:45
@jtmcdole
jtmcdole removed this pull request from stack #17 September 13, 2026 16:52
@jtmcdole
jtmcdole added this pull request to stack #19 September 13, 2026 16:52
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