You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tracking parent #291; epic #243. This is one vertical implementation slice.
Goal
Bring Python import policy to the accepted TypeScript surface: deterministic cycle findings plus configurable layer rules, while preserving graph-core as the sole Python import parser/resolver and exact hypothetical after-state behavior.
Extend python.import-graph to diagnose deterministic directed cycles from canonical repo-confined IMPORTS_FROM facts in addition to retained missing-edge validation. Do not add a TypeScript-side Python parser or resolve import text in validation.
Add python.import-layer-rules with the same user model as the accepted TypeScript layer check: named from/to/optional fromNot path rules, deterministic wildcard semantics, error severity, explicit empty-policy behavior, and Python-specific handling for imports guarded only by typing.TYPE_CHECKING.
Graph-core must attach contract-bound provenance sufficient to distinguish imports proven type-checking-only from runtime imports, including supported direct and aliased TYPE_CHECKING forms. Ambiguous/dynamic/control-flow cases remain runtime-visible or explicitly unsupported; validation may never guess from source text.
Consume the exact shared graph session owned by the ValidationFileView; all created/updated/deleted overlays, source/stub/package/namespace layouts, project boundaries, and introduced-mode fingerprints must use the same after-state edges.
Cycle canonicalization must collapse rotations, preserve direction, report each strongly connected cycle deterministically, avoid self-edge fabrication, and keep identical fingerprints across graph ordering and platforms. The finding path is stable and in-repo.
Layer rules apply only to resolved repo import edges whose endpoints are inside the selected canonical Python project/source universe. Cross-project, unresolved, namespace, stub/runtime-peer, and generated/private/cache cases produce explicit supported/ignored/degraded evidence rather than accidental matches.
Missing/stale/malformed/incomplete graph evidence is a required infrastructure/non-pass result for exact Python evaluation. No graph absence, missing type-only metadata, or empty edge set may be reported as a clean policy pass when source imports exist.
Layer rules cover exact and % wildcard paths, fromNot, multiple named rules, same-name modules in different projects, src/flat layouts, relative/absolute imports, re-exports, invalid/duplicate config, no rules, and introduced mode.
Runtime imports, if TYPE_CHECKING, typing.TYPE_CHECKING, aliased imports, nested/ambiguous conditions, and unsupported dynamic imports have explicit tested policy behavior; the graph owns the classification.
Graph status/handshake, edge serialization/store/query, contracts/schema/fixtures, and exact-state materialization preserve any new import attributes without breaking TypeScript/Rust consumers.
Missing graph, stale graph, failed exact build, incomplete edges, malformed attributes, timeout/resource failure, and out-of-root endpoints fail/degrade honestly with no empty success.
Source, config, lockfiles, environment, caches, and generated provider trees remain unchanged; all temporary graph roots are removed.
Observable outcomes
PY_IMPORT_GRAPH_CYCLE identifies one canonical directed cycle.
PY_IMPORT_LAYER_RULE identifies the named policy rule and resolved from/to paths.
Clean success includes exact graph identity/edge coverage and selected project provenance.
Implement only after a JIT review against current dev. Keep exactly one implementation run active. PR base is dev; require green checks, clean scoped diff, merged PR, closed child, #291/#243 checklist update, focused reproductions, and opcore-ci proof before advancing. Do not claim Python readiness/parity, ASP authority, old-tool replacement, security/SAST, all-stack support, automatic fixes, or a blended score.
Parent
Tracking parent #291; epic #243. This is one vertical implementation slice.
Goal
Bring Python import policy to the accepted TypeScript surface: deterministic cycle findings plus configurable layer rules, while preserving graph-core as the sole Python import parser/resolver and exact hypothetical after-state behavior.
Dependencies
Required behavior
python.import-graphto diagnose deterministic directed cycles from canonical repo-confinedIMPORTS_FROMfacts in addition to retained missing-edge validation. Do not add a TypeScript-side Python parser or resolve import text in validation.python.import-layer-ruleswith the same user model as the accepted TypeScript layer check: namedfrom/to/optionalfromNotpath rules, deterministic wildcard semantics, error severity, explicit empty-policy behavior, and Python-specific handling for imports guarded only bytyping.TYPE_CHECKING.TYPE_CHECKINGforms. Ambiguous/dynamic/control-flow cases remain runtime-visible or explicitly unsupported; validation may never guess from source text.ValidationFileView; all created/updated/deleted overlays, source/stub/package/namespace layouts, project boundaries, and introduced-mode fingerprints must use the same after-state edges.Acceptance criteria
__init__, namespace packages,.pyipeers, and overlay-created/broken/resolved cycles are deterministic.%wildcard paths,fromNot, multiple named rules, same-name modules in different projects, src/flat layouts, relative/absolute imports, re-exports, invalid/duplicate config, no rules, and introduced mode.if TYPE_CHECKING,typing.TYPE_CHECKING, aliased imports, nested/ambiguous conditions, and unsupported dynamic imports have explicit tested policy behavior; the graph owns the classification.Observable outcomes
PY_IMPORT_GRAPH_CYCLEidentifies one canonical directed cycle.PY_IMPORT_LAYER_RULEidentifies the named policy rule and resolved from/to paths.Non-goals
Verification
npm run buildnpm run lintnpm run rust:checknpm run pack:checkzeroshot cmdproof prove opcore-ciAttach exact graph-core artifact/version, project/source universe, normalized edges/diagnostics, overlay before/after proof, cleanup, and packed-install evidence.
Execution rule
Implement only after a JIT review against current
dev. Keep exactly one implementation run active. PR base isdev; require green checks, clean scoped diff, merged PR, closed child, #291/#243 checklist update, focused reproductions, andopcore-ciproof before advancing. Do not claim Python readiness/parity, ASP authority, old-tool replacement, security/SAST, all-stack support, automatic fixes, or a blended score.