Skip to content

website: fix the examples that fail the Check the examples gate - #3665

Merged
BaseMax merged 12 commits into
mainfrom
fix/website-examples-red
Nov 19, 2026
Merged

BaseMax merged 12 commits into
mainfrom
fix/website-examples-red

Conversation

@BaseMax

@BaseMax BaseMax commented Nov 18, 2026

Copy link
Copy Markdown
Member

The Check the examples gate of website-deploy.yml has been red since #3352 (comparison operators by language) because the examples job only runs when website files change and nobody looked at it after that. About 235 examples failed in the last runs. The compiler and std causes are fixed in #3660 to #3664 (user function size, E234 in derived code, cookie jar key, os.temp chmod, reality link encoding, X11 headers in the job). This PR fixes what is left in the examples themselves.

What changed, by cause:

  • Persian comparison operators (about 115 files, enforce comparison operator style by language #3352): Persian files must write the words, not the symbols. Every ==, !=, <, >, <= and >= became برابر, نابرابر, کوچکتر, بزرگتر, کوچکتربرابر, بزرگتربرابر, located by the lexer errors so strings and generics were never touched. Example: اگر ع != ۱ is now اگر ع نابرابر ۱.
  • English comparison words (English names: spaced names are E234 #3647 joined the words of age lt 4 into age_lt): English Salam has only the symbols, so cond-words and ops-compare use < <= >= == !=, and the three lessons that described the word forms (04 operators, 06 conditions, 47 keywords) now say English uses symbols and Persian uses words.
  • Persian names that became reserved or were renamed in std: گونه, بخش and نادرست as variable names, a local named like its function, صف اولویت دار, لیست حلقوی, متمایز, بعدی دارد, افزودن به انتها and others, plus the lost quotes in XB Zar and .ToStr in struct-tostr.
  • Rules added since the examples were written: E162 (acc = acc & x is acc &= x) in net-doh and the Persian trojan examples, E176 (a dropped tcp.Read result) in the reality loopback example, a top level call in net-trojan-Handshake moved into main.
  • Proxy stack secure defaults (net: secure defaults for the proxy stack (destination policy, connection caps, total handshake deadline, Reality time check, DoH reply validation) #3066): the trojan, socks, httpproxy and vpn examples talk to 127.0.0.1, so they now call AllowPrivate (or allowPrivate in the vpn config); the trojan adapter example reads initial_data and initial_size.
  • Page examples: rgb(0 0 0 / 18%), px units inside shadow lists, clamp() and height = value + "%" are not DSL values; callbacks passed as component parameters inside each did not lower (call to undefined function), so the two to do examples use emit and on like the page tests; Persian examples used English enum values (email, none, auto, until-found), now Persian words; the multipart enctype got Persian names in std/layout/values (#3660s sibling change was in this PR's first commit).
  • tui widget examples define Render and HandleEvent (the lowercase names are no longer the interface methods, so the widget drew nothing).
  • Outputs: db-sql-guide-analyze.out had been committed with linker errors in Update website docs/examples for or types and the result/option removal #3113 and was regenerated; db-sql-tutorial, gui-style Parse and Props changed with their code; the two layout examples print the body instead of the 25 KB page baseline; net-utls-guide-profiles printed a padding extension only when the random ECH length fell under 512, so it now turns padding off and checks 300 bytes.

Testing: every changed example and every example that failed in runs 44358822902 and 44379938786 was run with check-example.sh against a compiler built from main plus these fixes (results in the first comment). The Persian operator edits were checked by compiling each file until the lexer had nothing left to report.

Known leftovers outside this PR: tests/en/stdlib/reality_loopback is red on main for another reason (the private address defaults), and the gui.ui examples need libx11-dev and headless mode, added to the job in #3664.

@BaseMax
BaseMax requested a review from a team as a code owner November 18, 2026 23:01
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor
sha=4d0d7f020652f2994d446a6f0abc1463e5bac253

🤖 Salam AI review

Verdict: 🛠️ Changes needed before merging

commit 4d0d7f0 · 93 files · +221 −275 · model salam

Summary

This pull request updates roughly 93 website example and lesson files to make them compile and run under the current compiler and standard library, covering Persian comparison operators, reserved-word renames, proxy secure defaults, page DSL value fixes, tui method capitalization, and refreshed expected outputs. Most edits follow the documented language rules, but a few look like partial or inconsistent edits that should be cleaned up before merging.

What changed

The PR rewrites many English and Persian website examples so they pass the "Check the examples" gate: Persian files now use the word comparison operators (برابر, نابرابر, etc.), English files use only the symbols, renamed variables/methods that collided with reserved or renamed std names, added AllowPrivate calls for loopback proxy examples, switched page callbacks to emit/on, fixed tui widget method names to Render/HandleEvent, and regenerated several .out files.

Review

  1. website/content/en/examples/web-project-dashboard.salam and the matching fa file: in the table header and rows, only the first border bottom value was changed from 1px to 1 while the others remain 1px on the same line. This looks like an accidental partial edit rather than an intentional DSL requirement; either revert it or apply it consistently.
  2. website/content/en/examples/web-project-landing.salam and fa: font size = "clamp(2rem, 6vw, 3.4rem)" was replaced with font size = 3rem, and several margin values dropped px (28px -> 28) while others kept px. If the DSL rejects px in those positions, the remaining px forms need the same treatment; if both are valid, the mixed style is inconsistent.
  3. website/content/en/examples/web-project-dashboard.salam: height = value + "%" became height = value * 1.5, which changes the rendered bar heights rather than preserving the intended percentage; consider whether a DSL-friendly percentage form exists instead of altering the visual result.
  4. website/content/fa/examples/struct-tostr.salam: .ToStr() -> .to_str() is correct per stdlib, but confirm the Persian method spelling is to_str and not a Persian word, since the rest of the file uses Persian method names.
  5. website/content/en/std-examples/net-trojan/net-trojan-Handshake.salam and fa: moving trojan.AllowPrivate(config, true) into main is the right fix for a top-level call, but config remains a global mut; verify no other example relies on it being configured at package load time.
  6. The db-sql-guide-analyze.out diff was truncated in the provided patch, so I could not fully verify the regenerated linker-error output; please confirm the final file contains only the expected program output.

Tests

No test files were added; the PR relies on the existing check-example.sh gate. The author reports running every changed example, which is appropriate for this kind of change, but the regenerated .out files should be double-checked against actual runs.

Risks

The broad mechanical edits (especially the Persian comparison-operator replacements) risk touching strings or generics; the author states they were located via lexer errors, which mitigates this, but a spot check of files with string literals containing operators is still worthwhile. The inconsistent px/unit edits in the page examples may leave some examples failing the gate.


⚠️ This review was written automatically by an AI and may contain mistakes. It is a helper for maintainers, not a replacement for a human review: check the code yourself before merging.

@BaseMax
BaseMax merged commit 3e7c872 into main Nov 19, 2026
7 checks passed
@BaseMax
BaseMax deleted the fix/website-examples-red branch November 19, 2026 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant