api

package module
v0.1.30 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 2 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

api

CI Release CodeQL Latest release Go version Coverage OpenSSF Scorecard License

Code Smells Reliability Rating Security Rating Maintainability Rating Vulnerabilities

The NovaTrail platform service, the only service of the first slice. It checks the account owner's sign-in and keeps the learners, their consent and their attempts in its database — among the platform's parts, the one place where learners' data is stored on the server, and the learner model lives there too, as an append-only log of evidence. It runs each check — tutor reads handwritten work and module-kit gives the verdict, while a choice tapped among options is checked without AI — then has learner-model weigh the attempt's evidence and engine pick the next lesson or task with a reason code: all four are libraries in its own process, and it reaches AI providers only through tutor, without the learner's identifiers.

A component of NovaTrail, a universal open platform for adaptive learning, interactive lessons and AI tutoring. It belongs to stage 2, First slice with learners, with tutor, canvas, app, skill-map and infra.

Status

Detailing is done. The first epic of RUN.md decided everything the component's card left open, and docs/architecture.md now describes the service; the code epics it proposes are in RUN.md. The first, E2 — the skeleton, database, sign-in and deletion — is done, and has run on dev projects of Firebase and Neon: the service serves the contract on Connect, every request with a token passes the checks before learner data, an owner with an invite code creates the account and reads it, sets the PIN of the section for adults, whose requests repeat by their idempotency keys, creates the profiles — the owner's, and a child's by a consent — changes their settings, and deletes a profile or the whole account by a fresh sign-in; a daily job finishes the deletions a request left and deletes what is past its term; the other methods answer unimplemented until the tasks that build them. The second, E3, builds what the first app needs — its first build with app, which the author alone runs locally, on format 0.4 of modules. The packages of modules are in the code: modules.json pins a release of modules, CI checks the signature of its index, the binary lays its packages into the image, and serve reads them at its start and serves the catalog, the connected modules, the open views and the files of a module from them. An attempt of a task that a tap checks is in the code too: it begins by an engine's choice or again, gets its seed, instance and open view, takes the options tapped and gives their verdict by module-kit, closes the attempt "correct" with the task solved, and gives the techniques of a step. Admission to AI is in the code too: the binary reads the deployment's facts and the least stage of the admission of models, checks them by api check before the migrations, and a task of handwriting begins only where tutor's table admits models to read it and the platform holds their provider's key. Its submission, the crop of a handwriting sheet, is read by tutor's two readers, joined and judged by module-kit, and kept as its observation, never as the crop; a task with a rubric, or one on a workbook, is refused "not admitted". The hint ladder is in the code too: a hint before the first wrong answer gives the task's techniques and leading question, a wrong answer gives its rung — the tutor's words once they pass the leak check and the form check, or the rung's fallback text, which the attempt keeps until it closes —, "explain differently" words the rung anew once, and the solution is shown to an adult from the start and to a child after the ladder, by an adult's action while "ask before showing" is on. tutor v0.1.24 admits Opus 5.5 for its words at the author's stage, so the learner of the first app reads the tutor's question about their work, while words that fail a check, and the words after a correct answer, which tutor has no call for yet, stay the module's fallback texts (R47, R54). Lessons are in the code too: an engine's choice of a lesson opens one run of it on the package of the current version, its task segments begin in order on that package, an answer that closes a segment's attempt names the next segment, and "lesson done" ends the run "passed"; a run whose package is withdrawn, whose lesson no longer suits the learner, or that is idle for 30 days ends by itself (R48). The learner model is in the code too: each closed attempt that gives evidence has it appended to the journal, in the order the attempts closed, and learner-model v0.1.6 folds it into the cached skill state, recomputed when the version of learner-model, the release of modules or the window of the format changes; evidence of a skill a later major version retired goes to the skills that replaced it. The skill map gives the state of a module's skills and anchor skills, with the modules not connected that teach an anchor skill, and the progress the attempts of a profile, a page at a time, with the traps that repeat in them (R49). The engine's choice is in the code too: "something else" closes the open attempt and asks engine v0.1.8 for a lesson or a task, a correct answer or the solution shown outside a lesson and the end of a lesson run carry the next choice, a skill chosen on the skill map holds until the learner asks for something else, and each choice is kept with what a replay needs; the progress names when each attempt's task was chosen and why (R50). The jobs of a rollout are in the code too: the release names api check, api migrate and api after, which closes "unchecked" what is open on packages the image no longer gives once the new revision takes all traffic, and the daily job closes them so before it closes the abandoned ones (R51). Spec v0.15.0 is in the code too: the legal texts go with no token, the account and every consent name the current versions of their texts, a learner from the age of digital consent of their country consents themselves while a parent below it consents by a signed form whose scan the operator checks, the age is given again when the country raises its age, the storage of works is switched on and off by whoever consents for the learner, an adult reports a problem with a reply of the tutor, and the export gives api.zip by spec's part export/ (R52). The pinned release, v0.2.5, holds the packages of format 0.4: olympiad mathematics, the module of the first app, whose every lesson begins, and two small modules whose workbook and rubric tasks do not begin yet; a leading question asked for and a time of day reach the learner model by their own fields (R53). CI lays the pinned packages and walks the first app's path on them. The author has walked that path in a browser with app, locally on the dev projects: sign-in through Google, lessons, handwriting read by tutor's two models, hints, the tutor's words by a real model once tutor admitted them, and the engine's choices; a deletion of the account by a fresh sign-in went through too. The quota of platform AI is in the code too: tariffs with caps a family day, a reserve before each call of platform AI by tutor's price and its settlement after by tutor's record of usage, a new task of handwriting only with room for a typical one, the engine's pool narrowed to tasks a tap checks — and an open lesson run whose next task segment a beginning would refuse kept from the engine, open, until the segment begins again —, the flag "platform limit" and api reopen (R55–R59). On 2026-11-12 the run with app saw it run out on the tariff probe and come back the next family day, and api tariff raised it (T52). No child learns here before verifiable parental consent, the DPIA and the contracts with AI providers are in place.

Build and run

Inside the devcontainer, which pins Go and just:

just build              # a static binary, bin/api
./bin/api version       # its version, commit, build date and Go
just run                # serve on PORT, 8080 by default

just ci-lint, just ci-test, just ci-vuln and just ci-licenses are the checks CI runs: gofmt and go vet, the tests with the race detector and their coverage in coverage/go.out, govulncheck and go-licenses. just fuzz, by hand, fuzzes each fuzz test of the readers of foreign input in turn, for a minute each, or just fuzz 5m FuzzRead for one test five minutes; an input that fails is written to testdata/fuzz/ of its package, and just ci-test runs that corpus with the seeds. just ci-modules, which needs the network, checks modules.json: it verifies the signature of the pinned release's index with release-verify, then cmd/modules-check holds its digest, a release no older than main's and no current version lost but by a withdrawal, and prints each module's current version (R41). just ci-withdrawals, which the scheduled job Withdrawals runs once a day, verifies the signature of the newest release of modules and fails while its index withdraws a version that the pinned release gives, until modules.json pins a release that marks it (R61).

A release comes out by itself once CI passes on main, from just release-files: static binaries for linux/amd64 and linux/arm64, the Dockerfile, the licenses the binaries come with and SHA256SUMS, each file signed. NovaTrail publishes no image. Whoever deploys checks the files with just -f spec/justfile release-verify api <tag> <file> and builds the image around the binary: docker build --target release --build-context binary=<a folder holding the binary as api> ., with the release's Dockerfile.

The binary reads its configuration from the environment, and only these variables:

Variable Default Meaning
PORT 8080 the port to listen on; 0, off a deployment, asks the kernel for a free one, which the startup line names
API_LOG_LEVEL info debug, info, warn or error
API_HTTP_READ_HEADER_TIMEOUT 5s how long a client may take to send its headers
API_HTTP_READ_TIMEOUT 30s how long a client may take to send its whole request
API_HTTP_WRITE_TIMEOUT 60s how long the server may take to answer
API_HTTP_IDLE_TIMEOUT 120s how long an idle connection is kept
API_SHUTDOWN_TIMEOUT 9s the whole way out after a stop is asked for; under 10s when deployed
API_REQUEST_TIMEOUT 30s the longest a request may run, under API_HTTP_WRITE_TIMEOUT; a submission that AI reads ends its reading 3 s before it, and a record of its key going older than it is of a request that fell; sweep leaves a mark or a tuple younger than that, so a job gets the value its service has
API_DATABASE_URL — the pooler's connection string of the database api, with sslmode=verify-full; required by serve, invite, tariff, reopen, countries, sweep and after
API_OPENFGA_DATABASE_URL — the pooler's connection string of openfga, the store of the rights; required by serve and sweep
API_FIREBASE_PROJECT_ID — the Firebase project whose ID tokens are accepted and whose users sweep lists; required by serve and sweep
API_FIREBASE_CREDENTIALS — a service account's key, required off a deployment and refused on one, where the service's own account is taken, with no key
API_APP_ORIGIN — the exact origin of app, which CORS answers when api has an origin of its own; on the platform's deployment, https://<project>.web.app, and not the project's firebaseapp.com
API_PACKAGES_DIR /packages the folder api packages laid, which serve, sweep and after read at their start: the image's, or the first app's outside git
API_ADMISSION_FACTS_FILE — the absolute path of the deployment's file of facts for admission to AI, outside any git working tree; tutor reads it by the admission table of this release (R25, R45). Unset, no fact holds: the table closes platform AI and leaves an adult's own key open, where a model is admitted at the stage below
API_ADMISSION_RUNG full the least stage of tutor's rule of admission of models, author or full; author is the first app's alone, and refused when K_SERVICE or CLOUD_RUN_JOB is set (R45)
API_LEGAL_DIR — a self-hosted copy's folder of its operator's legal texts, outside any git working tree: VERSION, legal.yaml and texts/ alone, read at the start by the rules of spec's part legal/; unset, the texts of the tag of spec (R52)
API_CONSENT_FORMS_BUCKET, API_CONSENT_FORMS_PREFIX — the operator's closed bucket of Cloud Storage the scans of parents' forms of consent go to, and api's prefix in it, ending in a slash; on a deployment alone, by the service's own account, which creates and erases objects and reads none (R116 spec)
API_CONSENT_FORMS_DIR — a folder outside any git working tree the scans go to instead, off a deployment; with no store, SendConsentForm is refused unavailable
API_ANTHROPIC_KEY — the platform's key of Anthropic, a secret, or API_ANTHROPIC_KEY_FILE, the absolute path of a file outside git that holds it: on Cloud Run a volume of a secret of Secret Manager. Unset, platform AI has no route to Anthropic, whose models alone the admission table admits, for reading handwriting and for the tutor's words; Anthropic's is the one adapter api gives tutor (R46, R54)
API_OPENAI_KEY — refused when set, and so is API_OPENAI_KEY_FILE: api gives tutor no adapter of OpenAI, and its binary holds no SDK of it (R54)
K_SERVICE — set by Cloud Run; a deployment is known by it
CLOUD_RUN_JOB — set by Cloud Run in a job; sweep deployed is known by it

api serve reads the packages of modules in API_PACKAGES_DIR — the index by the digest modules.json pins, each package by module-kit by the chain from it — and opens the database api, the rights and the sign-in service before it takes its port, and fails to start when one does not hold or open. Its startup line names the release of modules and how many packages it read. It serves the contract novatrail.api.v1 on Connect, in binary protobuf and in JSON with the protobuf names, reads no message larger than 11 MiB, room for the scan of a parent's form of consent — a larger one is refused resource_exhausted — and logs a line for each request: its method, code, cause and time, and nothing of who asked. A request that calls AI logs beside it a line ai_usage for each model: the provider, the model, its tokens, how the call ended and how long it took — never the work, what was read or a key (R46).

From those packages it serves the catalog of a profile and the modules connected to it, the four open views of a package by its digest — without a token, by Connect GET — and which digests the image still gives. The files of a package's device part — LICENSE, NOTICE and media/… — are no method of Connect: GET /packages/sha256-<hex>/device/<path>, without a token, answers 200 with the file — or, as http.ServeContent answers, 206 for a range and 304 for a request that names its ETag —, 404 for a path the device part does not have, 410 for a version withdrawn or out of the window, and 503 with Retry-After: 30 for a digest the image's index does not know. A file and an open view are cached for a day, a file by its digest as its ETag too, and a refusal is never cached. A file's request logs its status and time, and nothing of its path.

api migrate applies the migrations of the database api and of openfga, the store of the rights, makes that store and writes its model when it must, and exits. It reads API_LOG_LEVEL, API_MIGRATE_DATABASE_URL and API_MIGRATE_OPENFGA_DATABASE_URL, the direct connection strings — not the pooler's — with sslmode=verify-full; just migrate runs it. The tests run on a real PostgreSQL that embedded-postgres downloads on their first run, with no Docker.

api invite makes one invite code of the closed slice and prints it on stdout, once: the database api keeps its SHA-256 alone, and the code lets one owner create an account. -tariff names the tariff the code passes to that account, closed_slice by default, or probe, a few cents a day for a run that sees the quota of platform AI run out. It reads API_LOG_LEVEL and API_DATABASE_URL, and logs a failure on stderr, so that stdout holds the code alone. Run it from a terminal of the operator's own: a job's output is kept in its log, the code with it.

api tariff -tariff <tariff> <code> gives the account that redeemed an invite code another tariff, found by its code, so that the account's ID never leaves the platform; it prints the tariff the account has now, and a code no account redeemed, or one of an account being deleted, is refused. The caps of each tariff for a family day are the configuration of api, in internal/quota, which a pull request changes (R11). It reads API_LOG_LEVEL and API_DATABASE_URL.

api reopen opens platform AI again for all: a refusal of its provider by a limit on the platform's key closes it to every learner, with a platform_limit warning in the log, until this command, once the operator has lifted the limit at the provider (R11). It prints whether platform AI was closed, and reads API_LOG_LEVEL and API_DATABASE_URL.

api countries list, api countries allow <XX> and api countries remove <XX> keep the countries the deployment takes learners from, by ISO 3166-1 alpha-2. None is taken until it is allowed, and a country of the EU, the EEA or the United Kingdom is never allowed before the DPIA. It reads API_LOG_LEVEL and API_DATABASE_URL.

api consents list, api consents confirm <code> and api consents reject <code> are the operator's check of the parents' signed forms (R116 spec): the forms sent, by the code of each request and the object its scan lies at; a consent confirmed when its scan matches its code; or a form rejected, whose adult sends a new one. api reports list and api reports review <id> are the reading of the adults' problem reports on the tutor's replies, which the operator reviews within 3 days (R123 spec). Both read API_LOG_LEVEL and API_DATABASE_URL, and print to the operator's terminal, not to a log.

api packages <folder> lays the packages of the release of modules that the embedded modules.json pins into the folder, which must be empty or not there, and exits: it fetches the index from the release by its public address and checks its digest, then fetches each package in the window of the format as its archive, unpacks it in memory — files of the package alone, no links — and has module-kit read it by the chain of digests. The folder holds module-index.json, the three texts of each package under packages/sha256-<hex>/, and each file of a device part once under files/sha256-<hex>. The build of the image runs it, and just packages lays them for the first app into /home/vscode/.novatrail-dev/packages, outside git; name that folder as API_PACKAGES_DIR in dev.env. It needs the network and reads API_LOG_LEVEL.

api check checks what the deployment declares for admission to AI — the file of facts by the admission table of this release, and the stage — and serves nothing: the rollout runs it as a job of the same image before the migrations, so that a dictionary of facts this release does not know stops the rollout before anything changed (R45; the amendment of 2026-11-08 to R106 spec). It writes one line, admission: the version of the table, whether a file of facts was given and the stage, and whether the stage was named; a refusal is printed as the configuration's are. api serve reads the same at its start and refuses them as it refuses its variables, and its startup line says the same four things.

api sweep is the daily job, one pass a run: it finishes the deletions of accounts a request left marked, deletes the accounts and profiles idle for more than 12 months, closes "unchecked" the attempts and lesson runs on packages the image no longer gives, as api after does, closes the attempts with no action for 7 days, writes the evidence the closed attempts owe and ends the lesson runs with none for 30 days, deletes the users of the sign-in service with no account who have not been seen for 30 days, the dangling tuples, the minimal records of consents for children 5 years after their account or profile was deleted, the scans of forms past their term, the problem reports reviewed more than a year ago, the counters of the quota of platform AI a day after their family day ended, and the records of idempotency keys and the changelog of openfga older than a day. -for is how long the pass may run, 9m by default; it stops between items after that. It reads what serve opens but the origin of app — the packages in API_PACKAGES_DIR too, of which the evidence is built — and API_REQUEST_TIMEOUT; it logs a line for each step with its counts and nothing it did them to, and exits 1 unless the pass was clean, which the next pass picks up. A deployment runs it on a schedule as a Cloud Run job.

api after is the job after a rollout, one pass a run: it closes "unchecked" each open attempt and lesson run on a package the index of the image knows but no longer gives — a version withdrawn, or out of the window — one at a time, holding the rows as a request holds them, and writes the evidence of those whose package the image holds; what is on a package the index does not know, it leaves to the image before. -for is how long the pass may run, 9m by default. It reads API_LOG_LEVEL, API_DATABASE_URL, the pooler's string, and the packages in API_PACKAGES_DIR, and opens neither openfga nor the sign-in service; it logs a line for each step with its counts and exits 1 unless the pass was clean, as sweep does (R51).

A rollout runs these as Cloud Run jobs of the image it deploys, by the part each plays in it (the amendment of 2026-11-08 to R106 spec):

Part Command When Reads
check api check before the migrations API_ADMISSION_FACTS_FILE, API_ADMISSION_RUNG
migrate api migrate before the revision takes requests API_MIGRATE_DATABASE_URL, API_MIGRATE_OPENFGA_DATABASE_URL
after api after once the revision takes all traffic API_DATABASE_URL, API_PACKAGES_DIR
by the clock api sweep daily what serve opens but API_APP_ORIGIN, and API_REQUEST_TIMEOUT

Each reads API_LOG_LEVEL too, and a secret by its _FILE twin as serve does.

Sign-in in production

The Firebase project of the platform runs Firebase Authentication with Identity Platform, which infra sets up; api's own dev project stays on Firebase Auth without it (R03). What api expects of the project: sign-in by the Google window alone, ID tokens that carry auth_time, and users deleted by api alone. api reads no email. It makes these calls of the Identity Toolkit API, by the Admin SDK for Go v4.22.0, and no other:

Call What for Permission
accounts:lookup the revocation check of every ID token firebaseauth.users.get
accounts:batchGet the list of users that sweep reads firebaseauth.users.get
accounts:update the revocation of a user's refresh tokens, before the user is deleted firebaseauth.users.update
accounts:delete the deletion of the user firebaseauth.users.delete

They are the permissions of the role signInUsers that infra gives api's account. A release that makes a new call names it here, and spec hears of it first, so that the role grows before the release is rolled out (architecture 3.11 spec).

A secret — a key, a token, a connection string — comes from its variable or from a file outside the repository whose absolute path the variable with the suffix _FILE names; a file inside a git working tree is refused. The log is JSON on stdout, and writes only the events and fields of its table, internal/logging/events.go: no identifier, address or content of a learner's work.

Run on the dev projects

The first run is on dev projects of Firebase, on the Spark plan with Google sign-in — the same project app runs locally with, where the author adds a Web App and 127.0.0.1 among its authorized domains (Д178 of spec's RUN.md) —, and of Neon, on the Free plan in aws-us-east-1 with the databases api and openfga (R39). Their configuration lives outside the repository, in /home/vscode/.novatrail-dev/, a Docker volume the devcontainer mounts, which survives a rebuild: the service account's key as key.json, and dev.env, one API_NAME=VALUE a line, read as written and never run; no other name is taken:

# The pooler's strings, then the direct ones, each with sslmode=verify-full.
API_DATABASE_URL=
API_OPENFGA_DATABASE_URL=
API_MIGRATE_DATABASE_URL=
API_MIGRATE_OPENFGA_DATABASE_URL=
API_FIREBASE_PROJECT_ID=
API_FIREBASE_CREDENTIALS_FILE=/home/vscode/.novatrail-dev/key.json
# The folder just packages lays the packages of modules into.
API_PACKAGES_DIR=/home/vscode/.novatrail-dev/packages
# Admission to AI: the first app's stage, and its file of facts, if it declares any (R25, R45).
API_ADMISSION_RUNG=author
# The platform's key of Anthropic, in a file of its own outside the repository (R46).
API_ANTHROPIC_KEY_FILE=/home/vscode/.novatrail-dev/anthropic.key
API_ADMISSION_FACTS_FILE=/home/vscode/.novatrail-dev/facts.yaml
# The origin of app on loopback, http://127.0.0.1 and app's port, whose server proxies the paths of
# api (Д177 of spec's RUN.md).
API_APP_ORIGIN=
# Where the scans of parents' forms of consent go off a deployment (R52).
API_CONSENT_FORMS_DIR=/home/vscode/.novatrail-dev/consent-forms
# The project's Web API key, which the recipe alone reads.
API_DEV_WEB_API_KEY=

A comment is a line of its own: whatever follows = is the value.

just dev <command> runs a command of the binary with that configuration — just dev migrate, just dev invite, just dev serve, just dev sweep. just dev-check goes the whole way: api check, migrations, the country US, the packages of modules into a folder of its own run, api reopen, the server, an ID token of the test user dev-author by a custom token the service account's key signs, the account by an invite code, the owner's profile and the list of profiles, its progress and "something else", a reading of handwriting with the reserve and the settlement of the quota of platform AI, which the export shows, the legal texts and a parent's consent by its form, taken back after, then api after on the same database, and a check that each log holds no UID, email, connection string, key or token. Its server has a key of platform AI that Anthropic refuses, not the one of the dev file: the reading goes to the provider and back, free, before any model reads it, and the reserve is kept as spent. It prints no value of the configuration and puts none on a command line; a file inside a git working tree is refused. Both recipes build bin/api first.

With app: just packages lays the pinned packages into the folder API_PACKAGES_DIR names. Then just dev migrate, just dev invite for the author's invite code — just dev invite -tariff probe for a run that sees the quota run out, and just dev tariff -tariff closed_slice <code> after it —, and just dev serve, which listens on port 8080. hostname -i gives this container's address on the network novatrail-api, and app, whose container joins that network, runs NOVATRAIL_API=http://<address>:8080 just dev. deployment.local.json of app names the dev project's Web App, whose apiKey is API_DEV_WEB_API_KEY, and the browser opens http://127.0.0.1:5173, the origin API_APP_ORIGIN names.

Contributing

Report a bug or propose a change in an issue, in English or Russian, and open one before a pull request unless the pull request fixes a typo or a broken link. How a change comes in, with every commit signed off, and what every change keeps to are in the organization's CONTRIBUTING.md; the rules every NovaTrail repository shares are in spec's RULES.md: code comes with its tests, and no learner's data, not even in examples, which are synthetic. Report a vulnerability privately, as the security policy says, never in a public issue.

Work in the devcontainer: open the repository in VS Code and choose "Reopen in Container". It holds every tool at the version the repository pins. The checks are the recipes of the justfile that Build and run names, and just --list names each with its arguments. A check exits with a non-zero status when it finds a problem. CI runs them all on every pull request and on main — all but just ci-withdrawals, which the job Withdrawals runs once a day —, builds and checks the image, and a pull request merges only when they pass and its changed lines are at least 90% covered. Documents are checked by just -f spec/justfile docs-check-repo. The answers of the project to the criteria of OpenSSF Best Practices are in .bestpractices.json.

Documents

The documents are in English; the work plan, its technical debt and the archives of its epics stay in Russian.

  • docs/architecture.md — the component: what it does and does not do, its data and links, what was decided and how the service is built.
  • docs/sources.md — the external facts the documents rest on: each source with its address, the date it was read and a quote.
  • docs/measurements.md — the results of measurements: what was measured, how, and the numbers.
  • docs/decisions.md — the decision log: what was decided, why, and what was rejected.
  • RUN.md — the work plan, in epics.
  • DEBT.md — the technical debt, in Russian: table 4 of the work plan.

The working rules, for people and coding agents alike, are in CLAUDE.md and AGENTS.md. The platform's shared vocabulary, formats, contracts and decisions are in spec, checked out here as a git submodule at v0.16.3: clone this repository with git clone --recurse-submodules.

License

Apache-2.0.

Documentation

Overview

Package api holds modules.json, the release of modules that api's packages come from and the digest of its index (R07): the file is embedded here, in the package at the root of the module, because a //go:embed pattern takes no "..", so that CI checks, the build of the image lays and serve reads the one file, with no copy of it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Modules

func Modules() (packages.Config, error)

Modules is the configuration modules.json gives: the release and its index.

Types

This section is empty.

Directories

Path Synopsis
cmd
api command
Command api is NovaTrail's platform service, one binary with a command for each thing it is run for: serve, migrate, invite, tariff, reopen, countries, sweep, packages, check, after, consents, reports and version.
Command api is NovaTrail's platform service, one binary with a command for each thing it is run for: serve, migrate, invite, tariff, reopen, countries, sweep, packages, check, after, consents, reports and version.
modules-check command
Command modules-check is the check of CI of modules.json (R07, R41): just ci-modules runs it once release-verify has accepted the signature of the index, and just ci-withdrawals, the scheduled job, with the index of the newest release of modules, once release-verify has accepted its signature too (R61).
Command modules-check is the check of CI of modules.json (R07, R41): just ci-modules runs it once release-verify has accepted the signature of the index, and just ci-withdrawals, the scheduled job, with the index of the newest release of modules, once release-verify has accepted its signature too (R61).
internal
account
Package account is api's AccountService of the contract novatrail.api.v1: the account and its invite code, and, task by task, its PIN, profiles and deletion (R04, R34, R35, R36).
Package account is api's AccountService of the contract novatrail.api.v1: the account and its invite code, and, task by task, its PIN, profiles and deletion (R04, R34, R35, R36).
admission
Package admission is the function of admission to AI as api asks it before an attempt (R25, R45): the admission table of the release of spec that tutor reads, the facts the deployment declares in its file, and the least stage of tutor's rule of admission of models.
Package admission is the function of admission to AI as api asks it before an attempt (R25, R45): the admission table of the release of spec that tutor reads, the facts the deployment declares in its file, and the least stage of tutor's rule of admission of models.
argon
Package argon is api's slow hash, argon2id, for what has too few values for a fast one: a PIN, and the fingerprint of a request that carries a PIN or an age (R35).
Package argon is api's slow hash, argon2id, for what has too few values for a fast one: a PIN, and the fingerprint of a request that carries a PIN or an age (R35).
authn
Package authn is api's port to the sign-in service.
Package authn is api's port to the sign-in service.
authn/authntest
Package authntest is a fake of authn.Port for the tests of the code that holds it: a token is whatever the test says it is, and the users are the test's own.
Package authntest is a fake of authn.Port for the tests of the code that holds it: a token is whatever the test says it is, and the users are the test's own.
authz
Package authz is api's rights: OpenFGA, a library in api's own process, on its store in the database openfga (R04, R31).
Package authz is api's rights: OpenFGA, a library in api's own process, on its store in the database openfga (R04, R31).
catalog
Package catalog is api's way from a module to its package, in the contract novatrail.api.v1 (R07, R17, R18, R42): PackageService, the open views of a package by its digest and which digests the image still gives; ModuleService, the catalog of a profile and the modules connected to it; and the files of the device parts, by HTTP GET, which are no method of Connect.
Package catalog is api's way from a module to its package, in the contract novatrail.api.v1 (R07, R17, R18, R42): PackageService, the open views of a package by its digest and which digests the image still gives; ModuleService, the catalog of a profile and the modules connected to it; and the files of the device parts, by HTTP GET, which are no method of Connect.
config
Package config reads the service's configuration from the environment.
Package config reads the service's configuration from the environment.
consentage
Package consentage is the age of digital consent by country (R52; R134 spec): the table of spec's part consent-age/, at the tag api pins, and the category of a learner it gives — consent-age/README.md, section 6.
Package consentage is the age of digital consent by country (R52; R134 spec): the table of spec's part consent-age/, at the tag api pins, and the category of a learner it gives — consent-age/README.md, section 6.
countries
Package countries is what api knows of a learner's country before the DPIA (R119 spec; R36): its form, and the countries no deployment may take learners from until the DPIA is done — those of the GDPR and of the UK GDPR.
Package countries is what api knows of a learner's country before the DPIA (R119 spec; R36): its form, and the countries no deployment may take learners from until the DPIA is done — those of the GDPR and of the UK GDPR.
deletion
Package deletion is the deletion of a profile and of an account in the order of R21 (architecture 3.10): the database first, then the tuples of the rights, then the user at the sign-in service, and the account's row last.
Package deletion is the deletion of a profile and of an account in the order of R21 (architecture 3.10): the database first, then the tuples of the rights, then the user at the sign-in service, and the account's row last.
export
Package export is api's part of the export of a profile or an account, api.zip (R52; R135 spec): its files by spec's part export/ — account.json in the export of the account, a file of each profile and the .proto files the records of protobuf are written by —, of whatever the database api keeps, with what the package of a module tells of an attempt while the image holds it.
Package export is api's part of the export of a profile or an account, api.zip (R52; R135 spec): its files by spec's part export/ — account.json in the export of the account, a file of each profile and the .proto files the records of protobuf are written by —, of whatever the database api keeps, with what the package of a module tells of an attempt while the image holds it.
forms
Package forms is the port of the store of the scans of the forms of a parent's consent (R52; R116 spec): the closed bucket of the operator in Cloud Storage, where api writes under a prefix of its own and reads nothing, and a folder outside every git working tree for the dev projects and the first app.
Package forms is the port of the store of the scans of the forms of a parent's consent (R52; R116 spec): the closed bucket of the operator in Cloud Storage, where api writes under a prefix of its own and reads nothing, and a folder outside every git working tree for the dev projects and the first app.
idem
Package idem is what tells one request from another under one idempotency key (R17, R35): the key's form and the request's fingerprint.
Package idem is what tells one request from another under one idempotency key (R17, R35): the key's form and the request's fingerprint.
invite
Package invite is the invite codes of the closed slice (R04, R34): how a code is made, how one given back is read, and the SHA-256 that is all the database keeps of it.
Package invite is the invite codes of the closed slice (R04, R34): how a code is made, how one given back is read, and the SHA-256 that is all the database keeps of it.
learning
Package learning runs attempts of tasks (R44, R46, R47): their beginning, the open attempt, the submission of the work and its verdict by module-kit, on the options tapped and on what tutor read, the techniques a solving step gives, "Done", the hint ladder with the tutor's words and their fallback texts, the showing of the solution, and lesson runs with their segments (R48).
Package learning runs attempts of tasks (R44, R46, R47): their beginning, the open attempt, the submission of the work and its verdict by module-kit, on the options tapped and on what tutor read, the techniques a solving step gives, "Done", the hint ladder with the tutor's words and their fallback texts, the showing of the solution, and lesson runs with their segments (R48).
legal
Package legal is the legal texts api serves (R52; R130, R136 spec): the part legal/ of spec at the tag api pins, spec.Legal, or a self-hosted copy's folder of its operator's texts, read once at the start by the rules of legal/README.md, section 5.
Package legal is the legal texts api serves (R52; R130, R136 spec): the part legal/ of spec at the tag api pins, spec.Legal, or a self-hosted copy's folder of its operator's texts, read once at the start by the rules of legal/README.md, section 5.
logging
Package logging is the service's log: JSON lines on one stream, in the keys Cloud Logging reads, held to the table of events in events.go.
Package logging is the service's log: JSON lines on one stream, in the keys Cloud Logging reads, held to the table of events in events.go.
model
Package model is the learner model of api (R06, R08, R49): it builds the evidence of a closed attempt, appends it to the profile's journal, keeps the cache of the skill state that learner-model folds of the journal, and reads the state for the skill map.
Package model is the learner model of api (R06, R08, R49): it builds the evidence of a closed attempt, appends it to the profile's journal, keeps the cache of the skill state that learner-model folds of the journal, and reads the state for the skill map.
packages
Package packages is the module packages api holds (R07, R41): the release of modules that modules.json pins and the digest of its index, the command that lays the packages of that index which are in api's window into a folder — the image's, or the first app's outside git — and the reading of that folder when serve starts.
Package packages is the module packages api holds (R07, R41): the release of modules that modules.json pins and the digest of its index, the command that lays the packages of that index which are in api's window into a folder — the image's, or the first app's outside git — and the reading of that folder when serve starts.
packages/packagestest
Package packagestest builds, for the tests, what package packages lays and reads: the packages of the vectors of spec's format, their archives, an index of them and a release of modules that serves them, and a folder laid from them, read as serve reads it (R41).
Package packagestest builds, for the tests, what package packages lays and reads: the packages of the vectors of spec's format, their archives, an index of them and a release of modules that serves them, and a folder laid from them, read as serve reads it (R41).
pin
Package pin is the PIN of the section for adults (R04, R35): its form, its hash and the count of wrong PINs that closes its input.
Package pin is the PIN of the section for adults (R04, R35): its form, its hash and the count of wrong PINs that closes its input.
quota
Package quota is the quota of platform AI (R11, R12; architecture 3.6): its unit, the tariffs and their caps for a family day, the typical tasks a new task of handwriting must find room for, and the reserve of a kind of call when tutor gives no expected price.
Package quota is the quota of platform AI (R11, R12; architecture 3.6): its unit, the tariffs and their caps for a family day, the typical tasks a new task of handwriting must find room for, and the reserve of a kind of call when tutor gives no expected price.
rpc
Package rpc is api's server of the contract novatrail.api.v1, on Connect v2 (R17, R18, R33): the methods of the contract, its codecs, and the interceptors every request goes through — its line of the log, its time limit and the checks of architecture 3.1, which run before any handler.
Package rpc is api's server of the contract novatrail.api.v1, on Connect v2 (R17, R18, R33): the methods of the contract, its codecs, and the interceptors every request goes through — its line of the log, its time limit and the checks of architecture 3.1, which run before any handler.
server
Package server is the HTTP server of the service and its graceful stop.
Package server is the HTTP server of the service and its graceful stop.
store
Package store is api's database: its schema, the migrations that make it, the pool requests take their connections from, and the transaction a write under an account runs in (R29).
Package store is api's database: its schema, the migrations that make it, the pool requests take their connections from, and the transaction a write under an account runs in (R29).
store/storetest
Package storetest runs the tests of api's database on a real PostgreSQL with no Docker, as the devcontainer and CI have none: embedded-postgres starts one server for a test binary, when its first test asks for a database, migrates a template database once, and gives each test a database of its own made from it, which is a copy and takes milliseconds (R29; amendment of 2026-11-02 to R05).
Package storetest runs the tests of api's database on a real PostgreSQL with no Docker, as the devcontainer and CI have none: embedded-postgres starts one server for a test binary, when its first test asks for a database, migrates a template database once, and gives each test a database of its own made from it, which is a copy and takes milliseconds (R29; amendment of 2026-11-02 to R05).
sweep
Package sweep is the daily job of the terms of keeping (R05, R21, R38, R43): it finishes the deletions the requests left unfinished and deletes what is kept past its term — accounts and profiles idle for 12 months, users of the sign-in service with no account for 30 days, dangling tuples, the minimal records of consents for children 5 years after the deletion, the counters of the quota a day after their day, and the records of keys and OpenFGA's changelog after a day — and closes what a learner abandoned: an attempt with no action for 7 days, and a lesson run with none for 30 (R10, R13).
Package sweep is the daily job of the terms of keeping (R05, R21, R38, R43): it finishes the deletions the requests left unfinished and deletes what is kept past its term — accounts and profiles idle for 12 months, users of the sign-in service with no account for 30 days, dangling tuples, the minimal records of consents for children 5 years after the deletion, the counters of the quota a day after their day, and the records of keys and OpenFGA's changelog after a day — and closes what a learner abandoned: an attempt with no action for 7 days, and a lesson run with none for 30 (R10, R13).
version
Package version holds the build identity of the binary.
Package version holds the build identity of the binary.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL