Skip to content

Auto-resolve overloaded service pyspec files in pyAnalyzeLaurel#515

Draft
joehendrix wants to merge 3 commits intomainfrom
jhx/identify_overload
Draft

Auto-resolve overloaded service pyspec files in pyAnalyzeLaurel#515
joehendrix wants to merge 3 commits intomainfrom
jhx/identify_overload

Conversation

@joehendrix
Copy link
Contributor

@joehendrix joehendrix commented Mar 4, 2026

Summary

When verifying Python programs that use overloaded service clients,
users currently must manually specify a --pyspec flag for every
service module the program touches. This is tedious and error-prone,
especially as programs grow.

This PR integrates the resolveOverloads AST walker (added in the
previous commit) into pyAnalyzeLaurel so that when --dispatch files
are provided, the command automatically discovers which
.pyspec.st.ion files are needed and loads them—eliminating the need
for manual --pyspec flags in the common case.

Details

  • Auto-resolution of pyspec files. After building the dispatch
    overload table, pyAnalyzeLaurel now walks the Python AST with
    resolveOverloads to collect the set of service modules actually
    used. For each resolved module, it derives the pyspec path relative
    to the dispatch file's directory and checks that the file exists on
    disk. Auto-resolved files that are not found are skipped with a
    warning on stderr, since the program may reference services for
    which no spec has been written yet. In contrast, files explicitly
    provided via --pyspec or --dispatch still produce a hard error
    if they are missing or unreadable, since an explicit flag implies
    the user expects the file to exist.
  • Shared readDispatchOverloads helper. The dispatch-file-reading
    loop (read DDM, extract overloads, print warnings, merge tables) was
    duplicated between pyAnalyzeLaurelCommand and
    pyResolveOverloadsCommand. Both now call a single
    readDispatchOverloads function, reducing duplication and ensuring
    consistent error handling.
  • extractStmtsFromProgram helper. Small utility that encapsulates
    toPyCommands + unwrapModule for extracting top-level Python
    statements from a Strata program.
  • Backward compatibility. Explicit --pyspec flags continue to
    work unchanged; they are appended after auto-resolved paths so that
    user-specified specs always take effect.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

joehendrix and others added 3 commits March 3, 2026 21:48
Walks a Python AST against a dispatch overload table to discover which
service modules a program actually uses, so only the needed pyspec files
are loaded. Output is sorted, deduplicated module names, one per line.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When --dispatch files are provided, pyAnalyzeLaurel now automatically
discovers which pyspec files are needed by walking the program AST
with resolveOverloads, eliminating the need for manual --pyspec flags
in the common case. Explicit --pyspec flags are still supported and
appended after auto-resolved paths.

Also extracts shared helpers (readDispatchOverloads,
extractStmtsFromProgram) and simplifies pyResolveOverloadsCommand
to use the shared dispatch-reading logic.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move all dispatch-reading and auto-resolve logic into a standalone
resolveAndBuildPrelude function, keeping pyAnalyzeLaurelCommand
focused on the verification pipeline.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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