Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofpackage worldValidation.package·originates fromworld 07158574-5…

validator

Orchestrator and public entry point for the world validator. Composes the sibling `vfsScanner`, `scriptValidator`, `assetValidator`, and `reportFormatter` modules into one require-able surface. This is the module the toolbox tools pull in to do their work.

byzero-proxy @ DESKTOP-DB3UJOJ·posted 4mo ago
What it does

validator

Orchestrator and public entry point for the world validator. Composes the sibling vfsScanner, scriptValidator, assetValidator, and reportFormatter modules into one require-able surface. This is the module the toolbox tools pull in to do their work.

Exports

  • M.check(opts?) -> Report — full pass (world + every library).
  • M.validateWorld(opts?) -> Report — only /source/ minus libs/.
  • M.validateLibraries(opts?) -> Report — every library under /source/libs/.
  • M.validateLibrary(name, opts?) -> Report — one named library; reports library.missing if absent.
  • M.filter(report, opts) -> Report — re-filter a built report.
  • M.format(report, format?) -> string — render to human / markdown / json / summary.
  • M.summary(report) -> string — one-line summary.
  • M.saveReport(report, path, opts?) -> ok, message? — write the rendered report to path (format inferred from extension when not set).
  • M.placeholders() -> { { code, reason } } — the list of intentional placeholder checks the validator currently runs.

Report shape

{
    ok           = boolean,
    generatedAt  = unix_seconds,
    durationMs   = number,
    scope        = "all" | "world" | "libraries" | "library:<name>",
    counts       = { error, warning, info, placeholder },
    world        = Bucket | nil,        -- nil when the scope excluded the world
    libraries    = { [name]: Bucket },  -- keyed by library name (e.g. "@builtin")
    placeholders = { { code, reason } },
    truncated    = boolean,             -- true if `opts.limit` was reached
}

Each Bucket:

{
    problems       = { Problem, … },
    counts         = { error, warning, info, placeholder },
    scriptsScanned = number,
    assetsScanned  = number,
}

A Problem:

{
    severity = "error" | "warning" | "info",
    category = "structure" | "syntax" | "semantic"
             | "reference" | "schema" | "placeholder",
    code     = "<short.code>",
    path     = "<vfs path>",
    message  = "<one-line reason>",
    source   = "world" | "library:<name>",
    placeholder = boolean,
}

Usage

From outside the package — use the canonical or package-alias identity:

local V = require("@builtin::~worldValidation.validator")
-- or the canonical form:
-- local V = require("@builtin::systems.worldValidation.validator")

-- Full pass
local r = V.check()
print(V.summary(r))                       -- one line
if not r.ok then print(V.format(r)) end   -- detailed only on failure

-- Filtered: errors only, no placeholders, world only
local errs = V.validateWorld({
    severity = "error",
    includePlaceholders = false,
})

-- Save a markdown report
V.saveReport(errs, "/source/.validation/last-run.md")

-- Re-filter an existing report without re-scanning
local libsOnly = V.filter(r, { source = "library:@builtin" })

From inside the package, prefer the ~ package-relative form so the require keeps resolving if the package is moved:

local V = require("~.validator")

Placeholders

Every layer is served by a real primitive: Luau syntax and type-check by lsp.check(path) inside scriptValidator, asset structure / content / semantics by asset.validate inside assetValidator. M.placeholders() returns the list of stub checks — currently empty. A future check that lands before its engine primitive registers here so the gap stays visible in every report.

Notes

  • Validation is single-frame and synchronous. A full pass over a large world takes O(filesInSource) vfs.list + vfs.read calls.
  • The validator does not mutate world state. saveReport writes only to the destination path the caller supplied.
  • Hot reload: edits to this module or any of its dependencies reload on the next require.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

module Validator Orchestrator for the world validator. Composes vfsScanner + scriptValidator + assetValidator + reportFormatter into one call that produces a Report with world and library buckets cleanly separated. require systems/worldValidation.package/validator about The validator does ONE pass over the VFS to discover every script and asset, then dispatches each entry to the appropriate per-type validator (scripts → scriptValidator → lsp.check; asset folders → assetValidator → asset.validate). It does not spawn entities or allocate GPU resources. Repeated calls are independent — there is no shared mutable state across runs. The four helper modules (vfsScanner, scriptValidator, assetValidator, reportFormatter) sit alongside this module at the package root and are pulled in via the `~.X` package-relative form so the whole package is position-independent — moving it to any identity continues to resolve correctly without code edits.

nowMs( ) → number

unixSecs( ) → number

emptyCounts( ) → void

bumpCounts(counts: ?, p: ?) → void

argtypedescription
counts?
p?

validateBucket(bucket: ?, source: string, opts: any) → void

argtypedescription
bucket?
sourcestring
optsany

buildReport(scope: string, worldBucket: ?, libBuckets: ?, opts: ?, startMs: number) → void

argtypedescription
scopestring
worldBucket?
libBuckets?
opts?
startMsnumber

applyFilter(report: ?, opts: ?) → void

argtypedescription
report?
opts?

check(opts: ?) →

Validate authored content. By DEFAULT scopes to YOUR world — everything under `/source/` EXCEPT `/source/libs/` — because imported libraries and engine builtins are not yours to validate (and scanning the whole builtin tree is slow and noisy). Pass `opts.scope` to widen: `"libraries"` for every imported library, `"library:<name>"` for one, `"all"` for world + libraries together. A compiler's check, for a Zero world. (default `"world"`) plus filter fields forwarded to the formatter: `{ severity, category, code, source, path, includePlaceholders, limit }`.

argtypedescription
opts?Optional table — `scope?: "world"|"libraries"|"library:<name>"|"all"`

examples

local r = Validator.check()                         -- your world only
local r = Validator.check({ severity = "error" })   -- your world, errors only
local r = Validator.check({ scope = "all" })        -- world + imported libraries

validateWorld(opts: ?) →

Validate ONLY the world's authored content (`/source/` excluding `/source/libs/`). The returned Report has `world` populated and `libraries = {}`.

argtypedescription
opts?Optional filter table — same shape as `M.check`.

examples

local r = Validator.validateWorld()
local r = Validator.validateWorld({ severity = "error" })

validateLibraries(opts: ?) →

Validate every imported library under `/source/libs/`. The returned Report has `world = nil` and `libraries` populated for every library that exists on disk.

argtypedescription
opts?Optional filter table — same shape as `M.check`.

examples

local r = Validator.validateLibraries()
local r = Validator.validateLibraries({ source = "library:@builtin" })

validateLibrary(name: ?, opts: ?) →

Validate ONE named library under `/source/libs/<name>/`. When the library does not exist, the Report carries a single `library.missing` error against that name so callers can tell a clean run from a missing-dependency run.

argtypedescription
name?Library directory name (e.g. `"@builtin"`, `"@mylib"`).
opts?Optional filter table — same shape as `M.check`.

examples

local r = Validator.validateLibrary("@builtin")
local r = Validator.validateLibrary("@mylib", { severity = "error" })

filter(report: ?, opts: ?) →

Re-filter an existing Report without re-scanning the VFS. Forwards to `reportFormatter.filter`; the resulting Report's `counts` are recomputed from the visible problems.

argtypedescription
report?Report produced by any of the validate* functions.
opts?FilterOpts — `{ severity, category, code, source, path, includePlaceholders, limit }`.

examples

local errs = Validator.filter(report, { severity = "error" })

format(report: ?, format: ?) →

Render a Report into a string. `format` selects the renderer.

argtypedescription
report?Report produced by any of the validate* functions.
format?`"human"` (default) / `"markdown"` / `"json"` / `"summary"`.

examples

print(Validator.format(report, "human"))
local md = Validator.format(report, "markdown")

summary(report: ?) →

Compact one-line health summary — `world: NE/NW libraries: NE/NW total: OK|FAIL`.

argtypedescription
report?Report produced by any of the validate* functions.

examples

print(Validator.summary(Validator.check()))

inferFormatFromPath(path: string) → string

argtypedescription
pathstring

saveReport(report: ?, path: ?, opts: ?) →

Render a Report and write it to `path`. Format is taken from `opts.format` if present, otherwise inferred from the destination extension (`.md` → markdown, `.json` → json, anything else → human). Returns `(ok, message?)`.

argtypedescription
report?Report produced by any of the validate* functions.
path?Destination VFS path (e.g. `/source/.validation/run.md`).
opts?Optional `{ format }` override.

examples

Validator.saveReport(report, "/source/.validation/run.md")
Validator.saveReport(report, "/source/audit.json", { format = "json" })

placeholders( ) →

Enumerate the registered placeholder checks. Each placeholder is a check the validator runs today but with a stub implementation — listing them tells callers which validations still need real primitives wired up.

examples

for _, ph in ipairs(Validator.placeholders()) do print(ph.code) end

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported on this asset or on the parts this page shows. Parts it leaves out are not counted here.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.