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
- dc40d859tracker#31 (mission 026): duplicate titles merged — the 68 type+tmdbId pairs held by 157 records were the old tracker's (all migrated); merge.hl repair job (own clock, before the TMDB jobs) keeps one keeper per title (follows/watches > old short id > oldest), moves follows, watches, seasons, cast, credits, timelines, tombstones the rest (mergedInto, never deleted), slugs + short ids 301 to the keeper; stray seasons merged into their listed twin (Reacher S3 watches) or linked when watched; search import re-checks before its put; deploy.sh waits up to 90 s for 200; real copy 68 -> 0 dup ids, az5b2 follows/watches equal; gates 342/0, 32/0, 52/0mre
- 2667da05tracker#30 (mission 025): /my/ pages from slim cached title cards, episode rows and watch sets (after the jobs /my/series 1.8 s -> 0.06 s, /my/unwatched 4.1 -> 0.18 s); timeline page shows its name once; franchise widget under the poster/title; movies with TV leftovers (First Contact) go through the details repair; tools/count-tmdb-ids.hl; gates 327/0, 52/0, 32/0mre
- 3909810dantcolony#40: mission references in README/STATUS/docs point to the moved missionsmre
- e63b1d28antcolony#40: history (LOG.md), worker briefs (missions/) and reports moved here from antcolony, numbered per project; old numbers in antcolony docs/mission-map.mdmre
- 1cda451dtracker: Hybriel master 190aa11d (#127 both shapes, GC correctness fc838894) — conductor adopts despite /my/series 2.4x after jobs (memory 8.0 → 1.7 GB boot); see reports/071mre
- c1fa2f2etracker (mission 071): Hybriel master 190aa11d measured on the real copy vs the live binary 8590df63 — NOT adopted (after the first-start jobs /my/series 2.4x slower, /series 1.6x, RSS swings 7.4-12.2 GB; fresh it is flat at 1.7-2.2 GB and /my/unwatched faster), vendor stays 8efba065, candidate kept in .scratch/w071/vendor-190aa11d; tests/kinds.mjs: collection seed off (its TMDB request broke check 1 in 1 of 4 runs); tests/realdata-071.sh + realdata-071-bench.mjs + tools/realdata-071-table.py; README + STATUS (numbers, how to repeat); gates 325/0, 32/0, 50/0mre
- 8081350atracker docs (mission 070): README (summary, Config HL_GC_BYTES — kept at Hybriel's default, the 256 MiB setting is taken out of docker-compose.yml again: the jobs grew to 12+ GB with it too, see STATUS), Test (three gates), Deploy (first start ~50 min: kinds then seed, restart once after collections done, memory numbers), Vendored Hybriel 8efba065 + #48 audit, Files; STATUS mission 070 entry (merges, migrated counts, lambda audit, gates, RSS old vs new, how to repeat, open points); docs/kinds.md + docs/franchises.md job order; tests/realdata-070-*.sh, tools/count-migrated.hl, tools/ref-params.py, tools/lambda-audit.pymre
- 1ad19c8ctracker: re-vendor Hybriel master 8efba065 (#126 GC by bytes, #48 lambda parameters copy) (mission 070): bin/hybriel sha256 50361e95…, plugins core crypto data fetch fs http http1 mpackdb proc smtp time web; lambda audit: 13 lambdas change a passed record/list (11 through a local alias), no caller relies on it — unchanged; 319 read-only lambda parameters get & (no copy per call: /my/schedule 2.35 → 0.46 s, /my/unwatched 13.7 → 5.7 s on the real copy); /my/unwatched one merge sort instead of n² inserts; docker-compose HL_GC_BYTES=268435456; deploy.sh runs kinds.mjs + franchises.mjs too (default ports 8700–8710); tests/realdata-070.mjs; gates browser 325/0, kinds 32/0, franchises 50/0mre
- 46b21389tracker (mission 070, conductor): the sync never destroys migrated data — the one-time summary step MOVES a copied summary to migratedSummary (marker summaries-moved.txt) instead of clearing it; a migrated record's first title/genres/homepage/tagline TMDB replaces → migratedTitle/migratedGenres/migratedHomepage/migratedTagline, a migrated season's/episode's title/summary → migratedTitle/migratedSummary (set once); tests/peek-shows.hl prints them; gate 325/0mre
- 749019b0Merge t19 (tracker#19 franchises + timelines) into main (mission 070): conflicts README/STATUS/show.hl/project.hl/browser.mjs/faketmdb.mjs, both sides kept; franchise/timeline pages get #20's typed heading (Franchise | …, Timeline | …), their title links via titlePath (/movies|/series|/shows); the collection seed waits for repair, kinds and credits too; franchises.mjs URLs + 2 new checks; gates browser 323/0, kinds 32/0, franchises 50/0mre
- daf49feaMerge t20 (tracker#20 typed headings + #21 series/shows split) into main (mission 070): conflicts README/STATUS/show.hl/project.hl/search.hl/components/search.hl/browser.mjs/faketmdb.mjs, both sides kept; clock order backfill → repair → kinds → credits; withDetailsFields stores tmdbType + kind; gates: browser.mjs URLs → /series|/movies, typed h1 selectors; kinds.mjs repair/credits off, fixture name = seed name; browser 323/0, kinds 32/0mre
- 20e09d89Merge t18 (tracker#18 delta sync) into main (mission 070): conflicts README/STATUS/show.hl/project.hl/browser.mjs, both sides kept; pageShowOf summary = summaryOfmre
- f83571c3tracker#18 (mission 067): daily sync by change lists — TMDB /tv|movie/changes (since the stored day, paged) + TVmaze /updates/shows → only our changed titles (followed: full step, unfollowed: light step — changed seasons, no TVmaze), full walk on first run / gap > 14 days / failed list; show record refreshed (title, tmdbSummary, tagline, status, genres …; renamed titles re-indexed); summary = the creator's own text (page: summary > tmdbSummary > tvmazeSummary), one-time clear of copied summaries (9,647 on the live copy); gate 261, tests/realdata-018*.mjs, README + STATUSmre
- 1ed5457etracker#20 + #21 (mission 068): typed headings "<Type> | <name>" in type colours; TV titles split into Series (/series) and Shows (/shows) by TMDB type + Reality/Talk/News genres — kind stored by sync/import/adult backfill + new kind backfill (resumes), /movies/<slug>, /shows/<slug> of a series/movie → 301, /my/series + /my/shows, home 5 tiles + 3 rows, search/filmography labels; gates kinds 32 + browser 266, tests/realdata-068.mjs, tools/count-kinds.hl, docs/kinds.md, README + STATUSmre
- f2b00674Merge t26 (tracker#26 + #28) into main (mission 062): short ids for every new person (castPersonId, guest route), guest stars stored on the title and created as people only when opened (/person/tmdb/<id>?show=<id> → 302), lean watch/follow clicks (showRow a small object, cast/crew from the slug, watches cached per user, face rows only after a season toggle); gate 311, tests/realdata-062.mjs, README + STATUSmre
- 0553b51ftracker#19 (mission 066): franchises and timelines — tables, /franchises, /franchises/<slug>, /timelines/<slug> (Timeline | Release sort, series by last episode), the Prequel | Timeline | Sequel widget with the franchise above, the creator's editor, TMDB collection seed in the app (resumes, paced); gate tests/franchises.mjs 48/0 + browser.mjs 266/0, tests/realdata-066.mjs, docs/franchises.md, README + STATUSmre
- fa1f9dfatracker#29 (mission 063): unwatched check muted grey outline + check (accent only on hover), watched stays solid — no code regression, the accent outline read as ticked; gate checks real checks visibly (computed style + screenshot pixel) on /my/unwatched, show, movie, /my/movies; gate 266, tests/realdata-063.mjs, README + STATUSmre
- 10bb3f93tracker#28 (mission 061): full cast (all seasons, main cast by episodes, guest stars) + crew (created by, directed by, written by, screenplay, story, music) — stored by the details completion, the daily sync, the search import (one details request) and a background credits job (resumes, RSS limit); show page collapsed after 20 with client-side Show all; showBySlug via a slug map; gate 249, tests/realdata-028.mjs, README + STATUSmre
- d8b12d67tracker#27 (mission 060): short ids for movies, series and persons — old 702 kept (data/old-short-ids.json), new random [a-z0-9]{5} unique across both, claimed at creation, background backfill (resumes), shown under poster/photo, /<shortId> → 301; gate 259, tests/realdata-060*, README + STATUSmre
- 25a50bc4tracker#26 (mission 059): titles from a filmography are completed — on open (skeleton, step-wise face showComplete, no reload) and by the in-app details repair (resumes, TMDB-paced, series in parts); cast from TMDB credits; gate 231, tests/realdata-026.mjs, README + STATUSmre