Skip to content

Skip re-checking files unaffected by a type change#2235

Open
tk0miya wants to merge 1 commit into
soutaro:masterfrom
tk0miya:claude/type-info-full-scan-SZmFO
Open

Skip re-checking files unaffected by a type change#2235
tk0miya wants to merge 1 commit into
soutaro:masterfrom
tk0miya:claude/type-info-full-scan-SZmFO

Conversation

@tk0miya

@tk0miya tk0miya commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Steep re-type-checks every source file and re-validates every signature file on each change. This adds incremental re-checking: a file is re-processed only when the change could actually affect its diagnostics, and otherwise its cached result is reused.

The decision combines two sets:

  • The referencing side ("Refs"). While type-checking a source file we collect the RBS type names it touches (Steep::TypeNameReferences); while validating a signature file we collect the names the validator touches (Signature::Validator#referenced_type_names). The set is a sound over-approximation of the file's real dependencies.

  • The changed side. The signature service computes the closure of type names whose definition changed in an update (last_changed_type_names), expanding over descendants (inheritance/mixin), nested declarations, and type alias dependencies.

A file is re-checked only when its referenced set intersects the changed set. The need-to-recheck is recorded on the cached file (an outdated flag) rather than per job, so it survives even when a file's re-check is deferred across cycles. SourceFile gains referenced_type_names/outdated, and a new SignatureFile holds the per-file validation diagnostics, refs and outdated flag on the signature side.

Soundness for newly introduced types: a file with an unresolved reference (e.g. a constant whose declaration does not exist yet) has an incomplete reference set, so it is always re-checked until the reference resolves. This keeps the rbs-inline workflow correct, where a .rb file is checked before its generated .rbs exists, leaving the type it defines unresolved until the signature appears.


This optimization reduces the incremental type-check durations (2.63s -> 1.38s) for kaigonrails/conference-app.

Before (2.0.0):

2026-06-06 15:19:05.542: INFO: [Steep 2.0.0] [master] [main] [#start_type_check(208ce340-4734-442d-9879-d92e7b69732e, ] Starting new progress...
2026-06-06 15:19:07.859: INFO: [Steep 2.0.0] [typecheck:typecheck@1] [background] Processing ValidateAppSignature for guid=208ce340-4734-442d-9879-d92e7b69732e, path=/Users/tkomiya/work/rbs/rbs/conference-app/sig/rbs_rails/path_helpers.rbs

2026-06-06 15:39:43.634: INFO: [Steep 2.0.0] [master] [main] [#start_type_check(943f5978-3cd2-4150-b1e1-f6068719f8f2, ] Starting new progress...
2026-06-06 15:39:45.911: INFO: [Steep 2.0.0] [typecheck:typecheck@1] [background] Processing ValidateAppSignature for guid=943f5978-3cd2-4150-b1e1-f6068719f8f2, path=/Users/tkomiya/work/rbs/rbs/conference-app/sig/rbs_rails/path_helpers.rbs

2026-06-06 15:39:50.404: INFO: [Steep 2.0.0] [master] [main] [#start_type_check(4b3f35f7-a7d2-4906-b95a-99b11b85988f, ] Starting new progress...
2026-06-06 15:39:53.707: INFO: [Steep 2.0.0] [typecheck:typecheck@1] [background] Processing ValidateAppSignature for guid=4b3f35f7-a7d2-4906-b95a-99b11b85988f, path=/Users/tkomiya/work/rbs/rbs/conference-app/sig/rbs_rails/path_helpers.rbs

After:

2026-06-06 15:53:35.335: INFO: [Steep 2.1.0.dev] [master] [main] [#start_type_check(3fc4e243-26f6-40f1-9b89-79419e43ef70, ] Starting new progress...
2026-06-06 15:53:36.509: INFO: [Steep 2.1.0.dev] [typecheck:typecheck@1] [background] Processing ValidateAppSignature for guid=3fc4e243-26f6-40f1-9b89-79419e43ef70, path=/Users/tkomiya/work/rbs/rbs/conference-app/sig/rbs_rails/path_helpers.rbs

2026-06-06 15:53:42.533: INFO: [Steep 2.1.0.dev] [master] [main] [#start_type_check(4e77fcaa-0252-45c4-b01d-58ed0350296d, ] Starting new progress...
2026-06-06 15:53:43.953: INFO: [Steep 2.1.0.dev] [typecheck:typecheck@1] [background] Processing ValidateAppSignature for guid=4e77fcaa-0252-45c4-b01d-58ed0350296d, path=/Users/tkomiya/work/rbs/rbs/conference-app/sig/rbs_rails/path_helpers.rbs

2026-06-06 15:53:53.719: INFO: [Steep 2.1.0.dev] [master] [main] [#start_type_check(07d8aaf1-125f-4fa4-b9d5-ab09fc98e0c4, ] Starting new progress...
2026-06-06 15:53:55.293: INFO: [Steep 2.1.0.dev] [typecheck:typecheck@1] [background] Processing ValidateAppSignature for guid=07d8aaf1-125f-4fa4-b9d5-ab09fc98e0c4, path=/Users/tkomiya/work/rbs/rbs/conference-app/sig/rbs_rails/path_helpers.rbs

@tk0miya tk0miya force-pushed the claude/type-info-full-scan-SZmFO branch from a6e3296 to 57fc8df Compare June 6, 2026 15:25
Steep re-type-checks every source file and re-validates every signature
file on each change. This adds incremental re-checking: a file is
re-processed only when the change could actually affect its diagnostics,
and otherwise its cached result is reused.

The decision combines two sets:

* The referencing side ("Refs"). While type-checking a source file we
  collect the RBS type names it touches (Steep::TypeNameReferences); while
  validating a signature file we collect the names the validator touches
  (Signature::Validator#referenced_type_names). The set is a sound
  over-approximation of the file's real dependencies.

* The changed side. The signature service computes the closure of type
  names whose definition changed in an update (last_changed_type_names),
  expanding over descendants (inheritance/mixin), nested declarations, and
  type alias dependencies.

A file is re-checked only when its referenced set intersects the changed
set. The need-to-recheck is recorded on the cached file (an `outdated`
flag) rather than per job, so it survives even when a file's re-check is
deferred across cycles. SourceFile gains referenced_type_names/outdated,
and a new SignatureFile holds the per-file validation diagnostics, refs
and outdated flag on the signature side.

Soundness for newly introduced types: a file with an unresolved reference
(e.g. a constant whose declaration does not exist yet) has an incomplete
reference set, so it is always re-checked until the reference resolves.
This keeps the rbs-inline workflow correct, where a `.rb` file is checked
before its generated `.rbs` exists, leaving the type it defines unresolved
until the signature appears.

https://claude.ai/code/session_017Dsb3STHRZuLYYvgyXrBRG
@tk0miya tk0miya force-pushed the claude/type-info-full-scan-SZmFO branch from 57fc8df to ffa94cb Compare June 6, 2026 15:49
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.

2 participants