Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.
Python calibrationclassificationdecision-modelhuggingfacejevmodernbertmultilingualnlppythonpytorchroutingtyped-decisionszero-shot
ci(go): fix the go parity and static jobs, add Go to CodeQL
Adeshina Lasisi483af995c5c1
diff --git a/.github/workflows/go.yml b/.github/workflows/go.ymlindex b21bc50b..2d3f05ac 100644--- a/.github/workflows/go.yml+++ b/.github/workflows/go.yml@@ -52,6 +52,10 @@ env:# not the one first recorded for that version.STATICCHECK_VERSION: v0.8.1GOVULNCHECK_VERSION: v1.9.0+ # Every setup-go below pins Go 1.27.1 and NOT `stable`: staticcheck reads the toolchain's+ # export data, so a Go release newer than the pinned staticcheck knows ("export data version+ # 5 is greater than maximum supported version 4") breaks the job on a day nothing in this repo+ # changed. Bump Go, staticcheck and govulncheck together.GOLDENS: ${{ github.workspace }}/.go-goldensjobs:@@ -69,7 +73,7 @@ jobs:cache-dependency-path: laya-dotnet/tools/requirements-regen.txt- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0with:- go-version: stable+ go-version: "1.27.1"cache: false- name: Install the Python toolchain the goldens are recorded withrun: |@@ -157,7 +161,7 @@ jobs:- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0with:- go-version: stable+ go-version: "1.27.1"cache: false- name: gofmtworking-directory: laya-go@@ -188,7 +192,7 @@ jobs:python-version: "3.12"- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0with:- go-version: stable+ go-version: "1.27.1"cache: false# Standard library only, so no install step.diff --git a/.github/workflows/security.yml b/.github/workflows/security.ymlindex c664a40b..9d48cbac 100644--- a/.github/workflows/security.yml+++ b/.github/workflows/security.yml@@ -136,7 +136,7 @@ jobs:# cannot see that.## A matrix rather than `languages: python, java-kotlin` in one cell: the Java cell needs a JDK- # and a build, and keeping them separate means a Java build failure cannot take the Python+ # and a build (the Go cell a toolchain and a build), and keeping them separate means a Java build failure cannot take the Python# analysis down with it.codeql:name: CodeQL (${{ matrix.language }})@@ -153,8 +153,10 @@ jobs:# matrix cell and no build risk. `csharp` is NOT here: CodeQL would have to run# `dotnet build` for it, and a build this change cannot verify locally would turn a# scanner into a broken required check. laya-dotnet is covered by gitleaks only today;- # adding it needs whoever owns that build to confirm autobuild works.- language: [python, java-kotlin, javascript-typescript]+ # adding it needs whoever owns that build to confirm autobuild works. `go` builds the+ # module in laya-go/, not the repo root: autobuild finds laya-go/go.mod itself (checked+ # with the CodeQL CLI: "Found 1 go.mod files in: laya-go/go.mod", 20 non-test files).+ language: [python, java-kotlin, javascript-typescript, go]steps:- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1# Only the Java cell compiles anything, so only it needs a JDK -- and the wrapper jar it@@ -168,13 +170,21 @@ jobs:cache: gradle- uses: gradle/actions/wrapper-validation@0b6dd653ba04f4f93bf581ec31e66cbd7dcb644d # v4if: ${{ matrix.language == 'java-kotlin' }}+ # The Go cell compiles too, so it needs the same pinned toolchain `go.yml` uses and not+ # whatever the runner image happens to carry.+ - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0+ if: ${{ matrix.language == 'go' }}+ with:+ go-version: "1.27.1"+ cache: false- uses: github/codeql-action/init@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2with:languages: ${{ matrix.language }}queries: security-extended- # Python needs no build step; Java does, and autobuild finds the Gradle build itself.+ # Python needs no build step; Java and Go do, and autobuild finds the Gradle build and+ # laya-go/go.mod itself.- uses: github/codeql-action/autobuild@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2- if: ${{ matrix.language == 'java-kotlin' }}+ if: ${{ matrix.language == 'java-kotlin' || matrix.language == 'go' }}- uses: github/codeql-action/analyze@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2supply_chain:diff --git a/laya-go/internal/unicodedata/tables_gen.go b/laya-go/internal/unicodedata/tables_gen.goindex 5d660f59..f85eb26e 100644--- a/laya-go/internal/unicodedata/tables_gen.go+++ b/laya-go/internal/unicodedata/tables_gen.go@@ -1,4 +1,4 @@-// Code generated by laya-go/scripts/gen_tables.py from CPython 3.12.2 (Unicode 15.0.0); DO NOT EDIT.+// Code generated by laya-go/scripts/gen_tables.py from CPython 3.12 (Unicode 15.0.0); DO NOT EDIT.//// Regenerate with: python laya-go/scripts/gen_tables.pydiff --git a/laya-go/scripts/check_test_json.py b/laya-go/scripts/check_test_json.pyindex d69d03d6..e7e873b4 100644--- a/laya-go/scripts/check_test_json.py+++ b/laya-go/scripts/check_test_json.py@@ -12,6 +12,7 @@ Exit 0 only when no test skipped, none failed, no package failed to build, and a"""import argparseimport json+import osimport sys@@ -57,6 +58,11 @@ def main(argv=None):parser.add_argument("--min-tests", type=int, default=1,help="fail when fewer tests than this ran (tests and subtests both count)")args = parser.parse_args(argv)+ if args.events != "-" and not os.path.isfile(args.events):+ # The step that writes this file is a separate one and an earlier step's failure skips it.+ print("check_test_json: %s does not exist: the `go test` step that writes it did not run "+ "or failed before producing it; see that step's log" % args.events, file=sys.stderr)+ return 1handle = sys.stdin if args.events == "-" else open(args.events, encoding="utf-8")with handle:counts, problems = summarise(read_events(handle))diff --git a/laya-go/scripts/gen_tables.py b/laya-go/scripts/gen_tables.pyindex 6bc2a519..1e221c4f 100644--- a/laya-go/scripts/gen_tables.py+++ b/laya-go/scripts/gen_tables.py@@ -3,7 +3,10 @@Three files, three sources, and the split is the point:- * internal/unicodedata/tables_gen.go -- recorded from CPython, because `laya/lang.py` is+ * internal/unicodedata/tables_gen.go -- recorded from CPython (the header names the minor+ version and the Unicode release, never the patch: the tables are a function of the Unicode+ database, which a patch release does not change, and a patch in the header made --check fail+ on every runner whose interpreter was not the one the file was generated on), because `laya/lang.py` iswritten against `str.isalpha()`, `str.lower()` and `re`'s `\\w`, and Go's own `unicode`package follows whichever Unicode the Go toolchain ships (it moves between releases).* lang/tables_gen.go -- read straight from `laya.lang`: the script ranges, the per-language@@ -102,7 +105,7 @@ def render_unicode():("title", "The Lt category: cased, but neither upper nor lower, so str.isupper() on a\n""// string holding one is false.", lambda cp: unicodedata.category(chr(cp)) == "Lt"),]- out = [header("CPython %s (Unicode %s)" % (sys.version.split()[0], unicodedata.unidata_version)),+ out = [header("CPython %d.%d (Unicode %s)" % (sys.version_info[:2] + (unicodedata.unidata_version,))),"package unicodedata\n\n""// Version is the Unicode release these tables were recorded from.\n""const Version = %r\n\n" % unicodedata.unidata_version]diff --git a/laya-go/scripts/test_check_test_json.py b/laya-go/scripts/test_check_test_json.pyindex 2b526669..674d7f93 100644--- a/laya-go/scripts/test_check_test_json.py+++ b/laya-go/scripts/test_check_test_json.py@@ -79,6 +79,13 @@ class CheckerTest(unittest.TestCase):code, _ = run(["go: downloading example.com/x v1.0.0"] + PASSING)self.assertEqual(code, 0)+ def test_a_missing_file_says_the_test_step_did_not_run(self):+ done = subprocess.run([sys.executable, CHECKER, "/nonexistent/go-test.json"],+ capture_output=True, text=True)+ self.assertEqual(done.returncode, 1)+ self.assertIn("did not run", done.stderr)+ self.assertNotIn("Traceback", done.stderr)+if __name__ == "__main__":unittest.main()