• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ponder-lab / Hybridize-Functions-Refactoring / #2638
84%
main: 84%

Build:
Build:
LAST BUILD BRANCH: gh-readonly-queue/main/pr-842-77b7f38fa055d4987502c13054242de54cacb165
DEFAULT BRANCH: main
Ran 01 Aug 2026 05:25AM UTC
Jobs 1
Files 35
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

01 Aug 2026 05:21AM UTC coverage: 83.528% (+0.1%) from 83.423%
#2638

push

github

web-flow
Add a stale-variable-read safety precondition (#823)

* Add a stale-variable-read safety precondition

Decorating a function that snapshots a model's variable collection before the model's first invocation in its body breaks it at trace time: a subclassed Keras model's `trainable_variables` is silently empty before its first build, so the initial trace captures the empty snapshot, the in-trace forward pass engages `tf.function`'s variable-lifting re-trace, and on that second trace the same Python-level read yields the populated list, so `apply_gradients` creates optimizer slot variables on a non-first trace and raises the singleton-variable `ValueError`. That is multigpu_training's `run_optimization`, isolated to a three-case discrimination reproducing the exact error; the pervasive beneficial idiom (reading the collection after the forward pass) is immune because both traces then see the populated list, so the ordering is the discriminator and the classic pattern is untouched by construction.

`StaleVariableReadAnalysis` scans each body: a `trainable_variables`/`trainable_weights` read whose receiver (matched by the attribute chain's root token) is first invoked only after the read, with the snapshot flowing by def-use closure to `apply_gradients`, `minimize`, or `gradient`, fails with `HAS_STALE_VARIABLE_READS` (code 19), the fifth safety failure in the family. Whether the model is prebuilt before the first trace is runtime state, so a stale-ordered read declines regardless, the safety polarity. `alwaysCheckStaleVariableReads` mirrors the sibling knobs end-to-end.

`testStaleVariableReadsBlockHybridization` pins the distilled `run_optimization` shape and the read-after control; the fixture runs to completion eagerly, where the stale snapshot is only silently empty, which is precisely why the precondition and not eager observation must catch it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G... (continued)

88 of 101 new or added lines in 4 files covered. (87.13%)

2865 of 3430 relevant lines covered (83.53%)

0.84 hits per line

Uncovered Changes

Lines Coverage ∆ File
7
90.91
edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/StaleVariableReadAnalysis.java
4
92.15
-0.22% edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java
2
69.77
-0.16% edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/refactorings/HybridizeFunctionRefactoringProcessor.java
Jobs
ID Job ID Ran Files Coverage
1 #2638.1 01 Aug 2026 05:25AM UTC 35
83.53
Source Files on build #2638
  • Tree
  • List 35
  • Changed 3
  • Source Changed 3
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 26105b4f on github
  • Prev Build on gh-readonly-queue/main/pr-817-8737f5934c357c9f4dae3d323f07c7b75add6485
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc