tracker
All repositories: gitoria
13.3 KB
// hl:core/AST — WHAT A FILE READS AND WHAT IT WRITES, from the compiler's own AST.//// The language has always been able to hand a caller the SYNTAX of a node// (`hlSyntax`) and the list of members a file declares (`hlMembers`). What it// never answered is what that syntax DOES with names: which members an// expression reads, which members a handler writes. Every consumer that needed// it wrote its own walk — hl:web's tree builder decides per tag what counts as// a read, and its browser half rediscovers the same set at runtime by walking// the DOM against the tree and JSON-comparing state afterwards (FRAMEWORK_AUDIT// §3). Two copies of one answer drift, and neither could see a write at all.//// The answer is the language's, so it lives here. `query(file)` is a table of// one file's (and, recursively, its project's) members, derivations, handlers// and methods, each with the names it reads and the names it writes, every node// carrying a stable site id `file:line:col`.//// NOTHING HERE KNOWS WHAT A VIEW IS. There is no attr, text, region, key or// component vocabulary in this file and none in the runtime rule beneath it: a// member is a member. A caller that wants one member's answer — hl:web wants// `View`'s — passes that member's NAME as the filter. That is the only way to// narrow the query, and it is a name, not a concept.//// import { query } from 'hl:core/AST'// let q = query('components/home.hl') // recursive, every member// let v = query('components/home.hl', true, 'View')//// THE GENERATION. Reflection reads a parse that is valid until the next// analysis; this package runs one of its own (`hlProject()`) the first time it// is asked and keeps the handle. `refresh()` runs a new one — a dev reload, or// a caller that changed a file. A static cannot be reassigned, so the handle// lives in a static hybrid, which can.static state = { gen = 0; graph = null; }// The live analysis generation, started on first use.static analysis = () => {if (state.gen == 0) {let g = hlProject()state.graph = gstate.gen = g.analysisGen}return state.gen}// A NEW ANALYSIS: the parses this package answers from are replaced, and every// handle a caller still holds from the old one is refused by the language.static refresh = () => {let g = hlProject()state.graph = gstate.gen = g.analysisGenreturn state.gen}// …of a project this run did not boot: a directory, a manifest, or an entry// file. The keys every answer below is filed under are that project's.static analyseFrom = (path) => {let g = hlProject(path)state.graph = gstate.gen = g.analysisGenreturn state.gen}// The project graph the generation belongs to (`hlProject()`'s answer).static project = () => {analysis()return state.graph}// ---- the reflection surface, without the generation argument ------------------// `hlSyntax` and `hlMembers` are the ambient names the framework still calls;// here they are statics of a package, which is where they belong.static syntax = (file, node) => { return hlSyntax(analysis(), file, node) }static members = (file) => { return hlMembers(analysis(), file) }static methods = (file) => { return hlMethods(analysis(), file) }static handlers = (file) => { return hlEvents(analysis(), file).handles }static denotes = (file, name) => { return hlDenotes(analysis(), file, name) }static file = (file) => { return hlFile(analysis(), file) }// ---- the syntax of one node, as a tree ----------------------------------------// Every node carries its tag, its site id and the two answers the language gives// for it: the free names it READS and the names it WRITES. The shape below is// the shape `hlSyntax` returns, followed one child at a time — there is no// interpretation of any tag, only its children.//// AN `on` HANDLER IS A LEAF HERE ON PURPOSE. Its body is not evaluated by the// literal that carries it, so the names inside are the HANDLER's reads and// writes, not the literal's; the node answers for them and the walk stops.static tree = (file, node) => {let n = hlSyntax(analysis(), file, node)if (n == null) { return null }let out = { tag = n.tag; site = n.site; line = n.line; col = n.col; reads = n.reads; writes = n.writes; }if (n.tag == 'object_expression') {let kids = []for (h of n.entries) { kids.push(tree(file, h)) }out.entries = kids} else if (n.tag == 'object_property') {out.key = n.keyout.value = tree(file, n.value)} else if (n.tag == 'view_for') {// A `for` ENTRY NAMES ITS LIST AND ITS ROW VARIABLE. The list is read in// the scope standing around the `for`; the row variable is bound inside// the body and every read of it there resolves as kind 'row'.out.row = n.varNameout.list = tree(file, n.list)out.body = tree(file, n.body)} else if (n.tag == 'view_if') {out.condition = tree(file, n.condition)out.consequent = tree(file, n.consequent)out.alternate = tree(file, n.alternate)} else if (n.tag == 'on_statement') {out.event = n.eventout.scope = n.scopeout.realm = n.realmout.handler = n.handler} else if (n.tag == 'identifier' || n.tag == 'new_expression') {out.name = n.name} else if (n.tag == 'literal') {out.kind = n.kindout.text = n.text} else if (n.tag == 'member_expression') {out.object = tree(file, n.object)out.property = tree(file, n.property)out.computed = n.computed} else if (n.tag == 'call_expression') {out.callee = tree(file, n.callee)let args = []for (h of n.args) { args.push(tree(file, h)) }out.args = args} else if (n.tag == 'binary_expression') {out.operator = n.operatorout.left = tree(file, n.left)out.right = tree(file, n.right)} else if (n.tag == 'unary_expression') {out.operator = n.operatorout.operand = tree(file, n.operand)} else if (n.tag == 'conditional_expression') {out.condition = tree(file, n.condition)out.consequent = tree(file, n.consequent)out.alternate = tree(file, n.alternate)} else if (n.tag == 'array_expression') {let els = []for (h of n.elements) { els.push(tree(file, h)) }out.elements = els}return out}// ---- names ---------------------------------------------------------------------// A read or a write is `{ name, kind, isStatic, path?, key? }`. `kind` is the// language's own resolution of the bare name: 'member', 'method', 'handler',// 'class' (a default import), 'import' (a braced one), 'plugin', 'row' (bound by// an enclosing `for` entry), 'local' (a lambda, handler or method parameter, or// a `let`), 'none' (nothing this file declares — an ambient or a typo).// the names of a read/write list, as plain stringsstatic namesOf = (list) => {let out = []for (r of list) { if (!out.includes(r.name)) { out.push(r.name) } }return out}// the subset of a read/write list that resolves to a member of the file itselfstatic membersOf = (list) => {let out = []for (r of list) {if (r.kind == 'member' && !r.isStatic && !out.includes(r.name)) { out.push(r.name) }}return out}// ---- one file's answer ---------------------------------------------------------// every `on` node inside a member's syntax tree, flattened, each at its sitestatic nestedHandlers = (member, node, &into) => {if (node == null) { return into }if (node.tag == 'on_statement') {into.push({ member = member; event = node.event; scope = node.scope; realm = node.realm; site = node.site; reads = node.reads; writes = node.writes; nested = true; })return into}if (node.entries != null) { for (c of node.entries) { nestedHandlers(member, c, into) } }if (node.args != null) { for (c of node.args) { nestedHandlers(member, c, into) } }if (node.elements != null) { for (c of node.elements) { nestedHandlers(member, c, into) } }if (node.value != null) { nestedHandlers(member, node.value, into) }if (node.list != null) { nestedHandlers(member, node.list, into) }if (node.body != null) { nestedHandlers(member, node.body, into) }if (node.condition != null) { nestedHandlers(member, node.condition, into) }if (node.consequent != null) { nestedHandlers(member, node.consequent, into) }if (node.alternate != null) { nestedHandlers(member, node.alternate, into) }if (node.object != null) { nestedHandlers(member, node.object, into) }if (node.property != null) { nestedHandlers(member, node.property, into) }if (node.callee != null) { nestedHandlers(member, node.callee, into) }if (node.left != null) { nestedHandlers(member, node.left, into) }if (node.right != null) { nestedHandlers(member, node.right, into) }if (node.operand != null) { nestedHandlers(member, node.operand, into) }return into}static one = (key, member) => {let gen = analysis()let f = hlFile(gen, key)let out = { key = key; class = f.class; members = []; derivations = []; handlers = []; methods = []; reaches = []; }for (m of hlMembers(gen, key)) {// (Hybriel has no `continue`: the body is guarded instead.)if (member == null || m.name == member) {let entry = { name = m.name; type = m.type; mandatory = m.mandatory; isStatic = m.isStatic; site = key + ':' + m.line + ':' + m.col; default = null; reads = []; writes = []; syntax = null; }if (m.hasValue) {let n = hlSyntax(gen, key, m.node)entry.default = n.siteentry.reads = n.readsentry.writes = n.writesentry.syntax = tree(key, m.node)// A DERIVATION IS AN INITIALIZER READ THE OTHER WAY: the same table,// listed by the names the value depends on.out.derivations.push({ name = m.name; site = n.site; reads = n.reads; })nestedHandlers(m.name, entry.syntax, out.handlers)for (r of n.reads) {if (r.kind == 'class' && r.key != null && !out.reaches.includes(r.key)) { out.reaches.push(r.key) }}}out.members.push(entry)}}// The DECLARED handlers and methods answer for their whole body. A member// filter narrows the member table only — a handler is not a member, and// hiding the writes would make the filtered answer a lie about the file.for (h of hlEvents(gen, key).handles) {let n = hlSyntax(gen, key, h.node)out.handlers.push({ member = null; event = h.event; scope = h.scope; realm = h.realm; params = h.params; site = n.site; reads = n.reads; writes = n.writes; nested = false; })}for (mm of hlMethods(gen, key)) {// A literal's inline `on` is hoisted as a method over the SAME body// (parser `inlineHandlerEntry`); it already answered at its site above.if (!mm.inlineHandler) {let n = hlSyntax(gen, key, mm.node)out.methods.push({ name = mm.name; params = mm.params; site = n.site; reads = n.reads; writes = n.writes; })}}// WHAT THIS FILE REACHES: every import the language resolved to another file// of the project, and every composed reference a member's syntax read.if (state.graph.files[key] != null) {for (imp of state.graph.files[key].imports) {if (imp.key != null && !out.reaches.includes(imp.key)) { out.reaches.push(imp.key) }}}if (f.wrapper != null && !out.reaches.includes(f.wrapper)) { out.reaches.push(f.wrapper) }for (k of f.inherits) { if (!out.reaches.includes(k)) { out.reaches.push(k) } }return out}// ---- the query -----------------------------------------------------------------// `query(file, recursive = true, member = null)`:// files — one answer per file reached, keyed by the analysis key// order — the keys in the order they were reached, `file` first// Recursive follows what each file reaches (its imports, its wrapper, what it// inherits, and the composed references its members read), each file once.static query = (file, recursive, member) => {let rec = recursive == null ? true : recursivelet want = member == null ? null : memberanalysis()let out = { root = file; files = {}; order = []; }let queue = [file]let seen = {}while (queue.length > 0) {let key = queue.shift()if (seen[key] == null) {seen[key] = true// A key the analysis does not hold is not this package's to parse —// the root is answered regardless, because the caller named it.if (state.graph.files[key] != null || key == file) {let answer = one(key, want)out.files[key] = answerout.order.push(key)if (rec) {for (k of answer.reaches) { if (seen[k] == null) { queue.push(k) } }}}}}return out}// EVERY FILE THE ANALYSIS HOLDS, once. A project's root reaches nearly all of// them; this reaches the rest too, which is what a whole-project report wants.static queryAll = (member) => {analysis()let out = { root = null; files = {}; order = []; }for (k of state.graph.files.keys()) {out.files[k] = one(k, member)out.order.push(k)}return out}// ---- what `hybriel --graph` carries, per file -----------------------------------// THE ONE DOCUMENT ASKS THIS PACKAGE (creator, 2026-09-14: the language scans// EVERYTHING by default and a filter only narrows). `--graph` prints the// language graph, and every file record in it carries the four tables below —// the same objects `query()` puts in `files[key]`, handed to the writer as they// are. There is no second walk and no second rendering: a person reads that// JSON, and a program imports `query` and gets the same answer as values.static tables = (path, member) => {if (path == null) { analysis() } else { analyseFrom(path) }let q = queryAll(member)let out = {}for (k of q.order) {let f = q.files[k]out[k] = { members = f.members; derivations = f.derivations; methods = f.methods; handlers = f.handlers; }}return out}
Branches
- mainmain branch
Latest commits
- 5cb85d75deploy.sh: a backup taken while a background job writes (tar exit 1) is a warning; archive checked with gzip -tmre
- 9abda75dtracker: report 035mre
- 12595e47mission 035: theme re-vendored from layouts.worldapi.org 0222f67 (two corner radii: radiusSmall 5px, radiusLarge 10px); the tracker's 18 own radii -> radiusSmall/radiusLarge (--layout-radius is gone); check-theme 0; gates 379/0, 32/0, 53/0, 229/0, 26/0; real copy: every computed radius in {0, 5px, 10px, 50%}mre
- e7305014tracker: report 032 (art + photos)mre
- fbb903cctracker#33/#37 (mission 032): a title without a TMDB poster gets its backdrop (w780, posterFromBackdrop, shown 2:3 centre-cropped); movies store runtime, the page shows release date + runtime; art backfill (public titles without poster file / movies without runtime) and person photo backfill (tmdbProfile / photoCheck) as the last start jobs (TRACKER_ART, TRACKER_PHOTOS; off in every gate start); gates 379/0, 32/0, 53/0, 229/0, 26/0, check-theme 0; live copy: art 4977 titles in 42 min (115 posters, 15 backdrops, 4609 runtimes), The Remaining shows its backdrop + 7 minmre
- 4ecc67b2tracker: STATUS/LOG for the t38 + t40 merge (gates 374/0, 32/0, 53/0, 229/0, 26/0, check-theme 0; live copy checks)mre
- e5945d2fMerge t40 (tracker#40 curated franchises, Franchises menu, superseded collections) into main: deploy.sh lists all six gates (browser, kinds, franchises, pager, franchiseseed, check-theme); search.hl keeps #37's personPhotoOf + #40's importWithCredits; pager gate runs with TRACKER_FRANCHISE_SEED=0; gates 374/0, 32/0, 53/0, 229/0, 26/0, check-theme 0mre
- b638e99dMerge t38 (tracker#38 pagination, #35 Returning/Airing label) into main: LOG/STATUS keep both sides; pager gate follows #37's /people (everyone, last updated first: seed updatedAt); gates pager 229/0, browser 374/0mre
- f8ffa4dbtracker: report 032 + The Remaining + #39mre
- 7565a863tracker: LOG timemre
- b10f00c8tracker#39: double episodes — migrated episodes whose TMDB id TMDB replaced are adopted by their number in the sync (old id -> migratedTmdbId); merge.hl step 3 merges each season's doubles at start (keeper: most watches > synced > first; watches moved/parked; tombstones into mergedEpisodes, nothing deleted); tools/count-duplicate-episodes.hl; gate fixture + paths-m039; live copy 850 -> 0 in 64 s; gates 373/0, 32/0, 52/0mre
- 8f1d4542tracker#40: superseded collections — a TMDB collection timeline whose titles are all in one curated timeline is hidden (supersededBy; kept: own page + editor finder), set by the collection seed when it makes one and by the curated build (lifted when the cover is gone); partly covered ones join that franchise; no second widget (First Contact: only Star Trek — Prime); gate franchiseseed 26/0, browser 365/0, kinds 32/0, franchises 53/0, check-theme 0; real copy 24 supersededmre
- 9448d643tracker#35 follow-up (mission 033): TVmaze 'Running' is labelled 'Returning', or 'Airing' while a non-special episode of the two newest seasons is released within today +-7 days (data unchanged); gate fixtures Running/Airing/Aired + a special; browser 366/0, kinds 32/0, franchises 52/0, pager 229/0, check-theme 0mre
- 7d4b293dtracker#40: "Franchises" in the main menu (desktop header after People, phone sidebar) → /franchises, marked on franchise and timeline pages; gates 365/0, 32/0, 53/0, 24/0, check-theme 0mre
- 8751adb8tracker: report 032mre
- 9bce1f65tracker mission 032: STATUS gate files + the hour-boundary flakemre
- 718bfb89tracker#37 (mission 032): /people = everyone, last updated first (updatedAt stamped by the person fill; view built at boot, touched people first at once), photo + name tiles (person colour) with the /movies pagination, /people/<letter> removed; photo = our file, tmdbProfile, a cast/crew entry's profile (in-memory map at boot), else the new 'no photo' placeholder; new cast/crew/created_by people keep tmdbProfile; search people rows with the photo; /settings = the heading only; util.hl sortDesc starts from sorted runs (same result, 105k: 1.6 s -> 0.15 s); gates 369/0, 32/0, 52/0, check-theme 0; README/STATUS/LOGmre
- 93dfb0batracker#40 (mission 034): the curated franchises — data/franchises.json (17 franchises, 31 timelines, 285 TMDB titles, movies + series, in-universe/release order, 12 TMDB collections attached); lib/franchiseseed.hl + jobs.hl franchiseSeedTick (last start job, imports missing titles via details.hl importWithCredits = the search's Add, one per step paced, then one build; franchiseseed.db: editor changes win, the creator's same-name franchise adopted / timeline left alone, 404 remembered, resumable, idempotent); timeline heads 'N titles · in-universe order' (orderKind) and wrap on a phone; series pages show the widget; new gate tests/franchiseseed.mjs (5th in deploy.sh), the others run with TRACKER_FRANCHISE_SEED=0; gates 365/0, 32/0, 52/0, 24/0, check-theme 0; real copy 196 imported, 0 failed, 7 min, restart unchanged=31mre
- 03ec792ftracker#38 (mission 033): pagination goes exactly to the clicked page — tilelist read the clicked button's text after pagination.hl's own handler had rebuilt the buttons (real clicks only); now li.current, else the button's own text; new gate tests/pager.mjs (5 lists x 11 pages, 390/1280, real + script clicks, Back/Forward) 229/0; browser 365/0, kinds 32/0, franchises 52/0, check-theme 0mre
- 96ba683adeploy.sh: a gate without a 'passed,' line (check-theme) no longer ends the scriptmre