Is it correct that `#set page(...)` only applies to current document.typ?

Hi
I have a master document that includes other documents to be part of it with

#include "inputs/section1.typ"
#include "inputs/section2.typ"
...etc

I wanted to figure out how I can have a different page margin on a single page in the document.

I tried this

#pagebreak()
#set page(margin: (top: 1in))

...page content

To my surprise, this already only changed the margin of a single page. After some testing I realised that the effect of the #set rule is local to the .typ file that gets included by the master document. Is this intended behaviour?

Yes, show rules and set rules affect only the current scope. The current scope is the current file when you write at the top level, but it can be even smaller, for example you could do

#let f() = {
  set page(margin: 0pt, width: 3cm, height: 2cm)
  [x]
}

#f()

Text...

and this will apply the page settings only for the content produced by f() (so only one page, with “x” on it).