Skip to content

Fix easy baseline errors (1/?) - #8081

Merged
MorganBennetDev merged 18 commits into
mainfrom
morgan/ci-typeck-fixes-2
Oct 8, 2026
Merged

MorganBennetDev merged 18 commits into
mainfrom
morgan/ci-typeck-fixes-2

Conversation

@MorganBennetDev

Copy link
Copy Markdown
Contributor

Fixes

Decreases baseline type errors from 1,294->1,029.

Summary

  • Shuffles around some dict initializations and adds TypedDicts to avoid various errors caused by improperly inferred types for dicts and items
  • Adds overload to find_docket_object so it's correctly typed
  • Changes FederalCourtsQuerySet and StateCourtsQuerySet to Managers since that's how they were being used anyway
  • Adds method to cordon off as_str_type in cl/search/forms.py

Deployment

This PR should:

  • skip-deploy (skips everything below)
    • skip-web-deploy
    • skip-celery-deploy
    • skip-cronjob-deploy
    • skip-daemon-deploy

AI Disclosure

  • No AI tools were used to create the content of this PR.
  • Parts of this PR were created with the help of an AI tool, and I have carefully reviewed all of its content and take full responsibility for it.

claude[bot]

This comment was marked as resolved.

@MorganBennetDev

Copy link
Copy Markdown
Contributor Author

but one new error from its own change was baselined instead of fixed, violating CLAUDE.md's MUST NOT rule on baselining errors in changed code.

Seeing as I am not Claude.................

@cweider cweider 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.

Some of these changes are more involved than others! Here are initial comments on the straight-forward ones.

Comment thread cl/recap/mergers.py
Comment thread cl/corpus_importer/import_columbia/parse_opinions.py Outdated
Comment thread cl/api/pagination.py
Comment thread cl/corpus_importer/import_columbia/parse_opinions.py Outdated
Comment thread cl/corpus_importer/import_columbia/parse_opinions.py Outdated
Comment thread cl/corpus_importer/import_columbia/parse_opinions.py Outdated
Comment thread cl/corpus_importer/import_columbia/parse_opinions.py Outdated
@MorganBennetDev
MorganBennetDev force-pushed the morgan/ci-typeck-include-more branch from e3e5bd5 to 08f19c4 Compare October 6, 2026 18:54
Base automatically changed from morgan/ci-typeck-include-more to main October 6, 2026 19:51
- Add all non-test modules to type checking
- Update baseline
- Update CLAUDE.md with new guidance
`FederalCourtsQuerySet` and `StateCourtQuerySet` were only used once by
calling the `as_manager` method, which erased their methods from
pyrefly. Just make them managers to fix a bunch of errors
cl.corpus_importer.import_columbia

That was certainly an experience
Mostly move things around to eliminate unnecessary
`MutableMapping.update` calls. Also add some `TypedDict`s where they
help.
`AudioTranscriptionMetadata` save
@MorganBennetDev
MorganBennetDev force-pushed the morgan/ci-typeck-fixes-2 branch from d2a61ed to b879211 Compare October 6, 2026 21:21
@MorganBennetDev

Copy link
Copy Markdown
Contributor Author

@cweider Addressed your pagination comment and got confirmation from the team that the Columbia import stuff can just be deleted so no need to mess around.

@cweider cweider 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.

Just a few things to doublecheck. If they don’t need revising, then this is good to go.

Comment thread cl/search/models.py Outdated

def all_pacer_courts(self) -> "models.QuerySet[Court]":
return (
self.get_queryset()

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.

All others use super().get_queryset() Is this intentional? I worry that the super/self distinction is setting things up for trouble down the line. If intentional, probably worth a comment.

I wonder if it’s done for optimization? I suspect that it’s probably not optimizing much. But this is only my take from reading – it’s gotten less attention from me than it has from you.

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.

There's a minimized Claude review earlier in the PR that brings up the reason why I switched the others to use super(). Originally I had everything using self and just didn't bother to change this one when fixing the other methods.

Comment thread cl/search/models.py Outdated
Court.FEDERAL_BANKRUPTCY,
Court.FEDERAL_APPELLATE,
]
class FederalCourtsManager(models.Manager):

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.

Considered models.Manager["Court"]?

@cweider cweider Oct 7, 2026 •

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.

In light of the other QuerySet subclasses, I wonder if, perhaps, the problem with the base implementation was the unspecified the generic for models.QuerySet. If done, Self could be used for all of the method return types and it would cut down substantially on the wordiness.

I don’t feel qualified to speak on which is better, a subclass of Manager or QuerySet - do whatever makes sense.

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.

Pyrefly currently erases extra methods when you call QuerySet.as_manager, which is what this was trying to solve.

Comment thread cl/search/models.py Outdated
Court.FEDERAL_APPELLATE,
]
class FederalCourtsManager(models.Manager):
def get_queryset(self) -> "models.QuerySet[Court]":

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.

Perhaps models.QuerySet["Court"] (quotes in the generic). I think this is purely aesthetic tho.

Comment thread cl/search/models.py
verbose_name_plural = "Courthouses"


class ClusterCitationQuerySet(models.query.QuerySet):

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.

It might be good to give ClusterCitationQuerySet the same treatment as FederalCourtsQuerySet.

Comment thread cl/search/models.py
]


class OpinionQuerySet(models.QuerySet):

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.

It might be good to give OpinionQuerySet the same treatment as FederalCourtsQuerySet.

Comment thread cl/search/models.py Outdated
Court.FEDERAL_BANKRUPTCY,
Court.FEDERAL_APPELLATE,
]
class FederalCourtsManager(models.Manager):

@cweider cweider Oct 7, 2026 •

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.

In light of the other QuerySet subclasses, I wonder if, perhaps, the problem with the base implementation was the unspecified the generic for models.QuerySet. If done, Self could be used for all of the method return types and it would cut down substantially on the wordiness.

I don’t feel qualified to speak on which is better, a subclass of Manager or QuerySet - do whatever makes sense.

@MorganBennetDev

Copy link
Copy Markdown
Contributor Author

@cweider Gave it a second thought and decided to leave the QuerySet->Manager changes out of this one and just wait for proper support upstream.

@cweider cweider 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.

Setting aside import_columbia, the change pretty small. I take it on faith that .pyrefly-baseline.json large additive bit is an artifact of wonky diffing and that it’s not a symptom of any new issues being introduced.

@albertisfu
albertisfu enabled auto-merge October 8, 2026 15:30
@MorganBennetDev
MorganBennetDev merged commit 081919e into main Oct 8, 2026
9 checks passed
@MorganBennetDev
MorganBennetDev deleted the morgan/ci-typeck-fixes-2 branch October 8, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants