api

package module
v0.1.89 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 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 Best Practices OpenSSF Scorecard License

Code Smells Reliability Rating Security Rating Maintainability Rating Vulnerabilities

The NovaTrail platform service. 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, the learner model with it, as an append-only log of evidence. It runs each check of a learner's work, weighs the evidence of the attempt and picks the next lesson or task with a reason code.

A component of NovaTrail, a universal open platform for adaptive learning, interactive lessons and AI tutoring. Its place in the platform:

  • app, on the learner's device, calls api, by the contract that spec holds;
  • api checks the sign-in with the sign-in service and keeps its data in its own database;
  • tutor, module-kit, learner-model and engine are libraries in api's process: tutor reads the work and words the tutor's replies, module-kit gives the verdict by the module, learner-model weighs the evidence, and engine chooses what comes next;
  • AI providers are reached only through tutor, which sees the work but not whose it is;
  • the modules come from a pinned release of modules, whose packages api holds and whose device files it serves to app.

Its card is the one named api in spec's docs/architecture.md; the detail, the decisions and how to build and run it are in docs/.

Documentation

Overview

Package api holds modules.json, the release of modules that api's packages come from and the digest of its index: 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, debug-access 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, debug-access and version.
modules-check command
Command modules-check is the check of CI of modules.json: 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.
Command modules-check is the check of CI of modules.json: 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.
internal
account
Package account is api's AccountService of the contract novatrail.api.v1: the account and its invite code, its PIN, profiles, consents and deletion.
Package account is api's AccountService of the contract novatrail.api.v1: the account and its invite code, its PIN, profiles, consents and deletion.
admission
Package admission is the function of admission to AI as api asks it before an attempt: 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: 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.
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.
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.
Package authz is api's rights: OpenFGA, a library in api's own process, on its store in the database openfga.
catalog
Package catalog is api's way from a module to its package, in the contract novatrail.api.v1: 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: 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: the table of spec's part consent-age/, at the tag api pins, and the category of a learner it gives.
Package consentage is the age of digital consent by country: the table of spec's part consent-age/, at the tag api pins, and the category of a learner it gives.
countries
Package countries is what api knows of a learner's country before the DPIA: 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: 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.
debug
Package debug is the debug mode: which models serve the calls of AI of a task from paper, past the admission list, and what every call of a model made for the account returned and cost — of a task from paper, of a task of a module, of an essay, of the tutor's words, of grown-up mode —, for an account with the right of the mode.
Package debug is the debug mode: which models serve the calls of AI of a task from paper, past the admission list, and what every call of a model made for the account returned and cost — of a task from paper, of a task of a module, of an essay, of the tutor's words, of grown-up mode —, for an account with the right of the mode.
deletion
Package deletion is the deletion of a profile and of an account in this order: 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 this order: 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: 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: 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: 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, which no development agent gets, 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: 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, which no development agent gets, for the dev projects and the first app.
idem
Package idem is what tells one request from another under one idempotency key: the key's form and the request's fingerprint.
Package idem is what tells one request from another under one idempotency key: the key's form and the request's fingerprint.
invite
Package invite is the invite codes of the closed slice: 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: how a code is made, how one given back is read, and the SHA-256 that is all the database keeps of it.
langtag
Package langtag tells a well-formed language tag of BCP 47, as api takes one from app: for the profile's language and for the language of the tutor's words, which goes to a model by its name or as the tag itself.
Package langtag tells a well-formed language tag of BCP 47, as api takes one from app: for the profile's language and for the language of the tutor's words, which goes to a model by its name or as the tag itself.
learning
Package learning runs attempts of tasks: 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 submission of an essay and its feedback by the rubric, "Done", the hint ladder with the tutor's words and their fallback texts, grown-up mode, lesson runs with their segments, and the tasks from the learner's paper, found on the photo of a page.
Package learning runs attempts of tasks: 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 submission of an essay and its feedback by the rubric, "Done", the hint ladder with the tutor's words and their fallback texts, grown-up mode, lesson runs with their segments, and the tasks from the learner's paper, found on the photo of a page.
legal
Package legal is the legal texts api serves: 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 reading of spec's legal/README.md.
Package legal is the legal texts api serves: 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 reading of spec's legal/README.md.
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: 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: 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: 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: 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.
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.
pin
Package pin is the PIN of the section for adults: its form, its hash and the count of wrong PINs that closes its input.
Package pin is the PIN of the section for adults: its form, its hash and the count of wrong PINs that closes its input.
quota
Package quota is the quota of platform AI: 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: 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: 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, which run before any handler.
Package rpc is api's server of the contract novatrail.api.v1, on Connect v2: 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, 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.
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.
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.
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.
sweep
Package sweep is the daily job of the terms of keeping: 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.
Package sweep is the daily job of the terms of keeping: 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.
tutorstub
Package tutorstub is the stub of tutor in api's dev mode: it stands behind the ports through which api calls tutor — the readings of a sheet and an essay, the assessment of an essay, the tutor's words, the finding of the tasks on the photo of a page, the check of a task from paper and the drawing of grown-up mode — so that a run of the path on the dev projects calls no provider and costs nothing.
Package tutorstub is the stub of tutor in api's dev mode: it stands behind the ports through which api calls tutor — the readings of a sheet and an essay, the assessment of an essay, the tutor's words, the finding of the tasks on the photo of a page, the check of a task from paper and the drawing of grown-up mode — so that a run of the path on the dev projects calls no provider and costs nothing.
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