I think you are right with Japanese margins coming in higher than 30% now. There's one data point embedded in the Q3 guidance that points to GMs north of 40%. Taking midpoints they are guiding $795M in Revenue @25% GM which increases to $985M @ 28% GM if they manage to close the sale of one project on time. This implies an incremental revenue of $190M at 40.6%GM for the named project. Imo this can only be the 56MW yamaguchi project that's still on their books: https://investors.canadiansolar.com/news-releases/news-release-details/canadian-solar-converts-golf-course-56mwp-solar-power-plant
This stretches the icing from $200M to $270M.
"...Total revenue for the third quarter is expected to be in the range of $780 million to $810 million. Gross margin for the third quarter is expected to be between 24% and 26%, reflecting the positive impact of planned higher gross margin project sales primarily in Japan and the U.S. The aforementioned revenue forecast does not include the potential sales of a project that may be completed in the third quarter. If the transaction is closed in time, total revenue for the third quarter is expected to be in the range of $970 million to $1 billion and gross margin between 27% and 29%..."