feat(solid_generator): track foreign signal reads - #117
Merged
Merged
Conversation
Reads of hand-written solidart signals (e.g. via @SolidEnvironment objects) now count as reactive dependencies: build() reads get a SignalBuilder and @SolidState getters over them lower to Computed, matching SPEC §4.5/§5.1 (the analysis previously only counted generator-managed members, silently emitting non-reactive widgets). Covers .value/hasValue/previousValue/hasPreviousValue/state and the callable form via a foreign-only getter set; collision-proof 'foreign:' key namespace; target_validator's resolved tier now actually rejects @SolidEnvironment on SignalBase fields (was anchored to the wrong package); new resolved-mode test infrastructure. 3.0.0-dev.11.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reads of hand-written solidart signals (e.g. reached through
@SolidEnvironmentobjects) now count as reactive dependencies, per SPEC §4.5/§5.1 — previously the reactivity analysis only counted generator-managed members, so abuild()readinggate.complete.valuegot noSignalBuilder(silently non-reactive widget) and a@SolidStategetter over a foreign signal was rejected with "has no reactive dependencies".Found in production shape in fairtile_esg's pmi_app shell (Valutazione tab never appearing until a navigation-forced rebuild).
What's in here
_maybeRecordForeignSignalReadin value_rewriter.dart: records reads of receivers statically typed as solidartSignalBasesubtypes, for.value/hasValue/previousValue/hasPreviousValue/stateand the callable form (sig(), handled invisitFunctionExpressionInvocation— the analyzer rewrites zero-arg signal calls there, neverMethodInvocation). A dedicated foreign-only getter set keeps the shared managed-member sets untouched (amachine.stateread on a@SolidStatefield still lowers tomachine.value.state— regression-tested).foreign:prefix,this.-stripped) so §7.5 wrap pruning can never conflate a foreign signal with a same-named managed member; symmetric offset guard..untrackedchains are honored as an opt-out for build() wrap placement.isSolidartSignalType(solidart + flutter_solidart): the SPEC §3.6 rejection of@SolidEnvironmenton SignalBase-typed fields previously could not fire in any real resolved build (anchored to the wrong declaring package).Isolate.resolvePackageUri-anchored fixture) covering the validator rejection, alias tracking, and the opt-out.foreign_signal_value_read(incl. callable/probe/opt-out cases) andforeign_signal_name_collision; integration test asserting rebuild-on-flip through real generated output.@SolidQuerydoesn't synthesizesource:from foreign deps;.untrackedscope;Resource.valuedeprecated →statecovered). SPEC §5.1 corrected:SignalBaseis declared inpackage:solidart.Version:
3.0.0-dev.11.Verification
dart test packages/solid_generator/— 380 pass, from both repo root (CI form,-r github --fail-fast) and the package dir. Integration tests pass per-file.dart formatclean;dart analyze --fatal-infosonly the 2 pre-existingavoid_printinfos.