-
Notifications
You must be signed in to change notification settings - Fork 4
feat(testing-system): add orthogonal decomposition evaluator MVP #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
MeteorsLiu
wants to merge
7
commits into
goplus:main
Choose a base branch
from
MeteorsLiu:feat/matrix-reduce-mvp
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
89affa2
feat(testing-system): add orthogonal decomposition evaluator
MeteorsLiu 7870628
fix(trace): preserve child execve state across clone resume
MeteorsLiu 918c765
checkpoint(testing-system): save evaluator state before denoise rollback
MeteorsLiu d621c57
P
MeteorsLiu 7de7d7a
rewrite evaluator around tracessa pipeline
MeteorsLiu cbcbdd2
refine tracessa role inference around graph evidence
MeteorsLiu 03eab99
remove unused dir
MeteorsLiu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| # LLAR Project Guide | ||
|
|
||
| ## Design Rules | ||
|
|
||
| 1. No useless abstraction - don't abstract if not necessary | ||
| 2. Abstracted modules must have wide usage - only extract when broadly used | ||
| 3. All modules must be clean - each module should only handle its own responsibility | ||
|
|
||
| ## Project Overview | ||
|
|
||
| LLAR is a multi-language module manager built with XGo (gop) and xgo. It uses classfile mechanism for defining build formulas. | ||
|
|
||
| ## XGO Classfile Mechanism | ||
|
|
||
| ### What is Classfile? | ||
|
|
||
| Classfile is a DSL (Domain Specific Language) mechanism in xgo that allows defining custom file extensions with specific behavior. Each classfile extension maps to a Go struct that acts as a "class". | ||
|
|
||
| ### How Classfile Works | ||
|
|
||
| 1. **Registration**: Classfiles are registered via `xgobuild.RegisterProject()` in `internal/ixgo/classfile.go` | ||
|
|
||
| 2. **File Extension Mapping**: | ||
| - `_llar.gox` -> `ModuleF` class (formula/classfile.go) | ||
| - `_cmp.gox` -> `CmpApp` class (formula/classfile.go) | ||
|
|
||
| 3. **Code Generation**: When a `.gox` file is processed: | ||
| - The filename prefix (before `_`) becomes the struct name | ||
| - Example: `hello_llar.gox` generates struct `hello` embedding `ModuleF` | ||
| - A `MainEntry()` method is generated containing the DSL code | ||
| - A `Main()` method calls `Gopt_ModuleF_Main(this)` | ||
|
|
||
| ### Example | ||
|
|
||
| Source file `hello_llar.gox`: | ||
| ```gox | ||
| id "DaveGamble/cJSON" | ||
| fromVer "v1.0.0" | ||
|
|
||
| onRequire (proj, deps) => { | ||
| echo "hello" | ||
| } | ||
|
|
||
| onBuild (ctx, proj, out) => { | ||
| echo "hello" | ||
| } | ||
| ``` | ||
|
|
||
| Generated Go code: | ||
| ```go | ||
| package main | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "github.com/goplus/llar/formula" | ||
| ) | ||
|
|
||
| type hello struct { | ||
| formula.ModuleF | ||
| } | ||
|
|
||
| func (this *hello) MainEntry() { | ||
| this.Id("DaveGamble/cJSON") | ||
| this.FromVer("v1.0.0") | ||
| this.OnRequire(func(proj *formula.Project, deps *formula.ModuleDeps) { | ||
| fmt.Println("hello") | ||
| }) | ||
| this.OnBuild(func(ctx *formula.Context, proj *formula.Project, out *formula.BuildResult) { | ||
| fmt.Println("hello") | ||
| }) | ||
| } | ||
|
|
||
| func (this *hello) Main() { | ||
| formula.Gopt_ModuleF_Main(this) | ||
| } | ||
|
|
||
| func main() { | ||
| new(hello).Main() | ||
| } | ||
| ``` | ||
|
|
||
| ### Key Points | ||
|
|
||
| 1. **Struct Name Derivation**: The struct name comes from `strings.Cut(filename, "_")` - the part before the first underscore | ||
|
|
||
| 2. **Class Entry Point**: `Gopt_<ClassName>_Main` is the classfile entry point that: | ||
| - Calls `MainEntry()` to execute DSL code | ||
| - Initializes the embedded `gsh.App` | ||
|
|
||
| 3. **Error Handling**: If a file doesn't match any registered classfile pattern (wrong suffix), `BuildFile` returns "undefined" errors for DSL functions | ||
|
|
||
| ## Build & Test | ||
|
|
||
| ```bash | ||
| # Run tests with required ldflags (Go 1.24+) | ||
| go test -ldflags="-checklinkname=0" ./... | ||
|
|
||
| # Run specific package tests with coverage | ||
| go test -ldflags="-checklinkname=0" -cover ./internal/formula/... | ||
| ``` | ||
|
|
||
| ## Project Structure | ||
|
|
||
| - `formula/` - Classfile definitions (ModuleF, CmpApp, Context, Project, etc.) | ||
| - `internal/formula/` - Formula loading and interpretation logic | ||
| - `internal/ixgo/` - ixgo classfile registration | ||
| - `mod/` - Module and version handling |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic for creating a default matrix from the current runtime OS and architecture is duplicated in
cmd/llar/internal/test.go. To improve maintainability and avoid code duplication, this logic should be extracted into a single, shared helper function. ThedefaultRuntimeMatrix()function intest.gocould be moved to a shared location and reused here.