Training and certification
ContentsVision Academy is the in-product training program: users learn the system by doing the real job inside a sandboxed training claim, earn points and badges per mission, and finish with a publicly verifiable certificate. Everything is deterministic and offline: training never calls the AI providers, never spends credits, and never contacts Adjust Square.
Modules, required training, and the gate
Training is organised in modules. A module is one self-contained JSON
document (cv.training.module, schema_version 1) holding its lessons,
steps, quizzes, sandbox fixture claims, and checks. Modules are picked from a
library, assigned per level of the hierarchy (deepest level wins),
marked required or optional with a due date, and an admin can always
exempt a user or extend their date. After the due date, a user who has
not passed a required module is locked: the server refuses to show,
open, or create real claims until they pass. Before it, they see a reminder.
The module document
Defined and validated by backend/app/services/training_schema.py
(Pydantic, unknown fields rejected so a typo in an imported file fails at
import). Top level:
| Field | Meaning |
|---|---|
schema, schema_version | Always cv.training.module and 1. A different version is refused. |
key, version | Slug (a-z0-9-) and version. The server assigns the version on save. |
title, summary, est_minutes, tags, badge, certificate_level | Display metadata. |
pass | min_quiz_pct (default 70) and require_all_checks (default true). |
sequential | Lessons unlock in order when true. |
fixtures.claims[] | Fake claims seeded per learner: ref, kind (blank, capture_submitted, capture_in_progress, manual), claim fields ({user} / {name} placeholders, date_of_loss_days_ago), capture (assignment id, submitted, creator name), and rooms[] with media[] (photo/video/audio fixture files) and items[]. |
fixtures.upload_results | What a training upload "finds": video_first, video, audio items and photo_names. A module without them borrows the Academy's. |
fixtures.default_claim | Which fixture claim {claim} and rules without a claim point at. |
lessons[] | key, title, points, badge, steps[], checks[] (check keys), quiz[] (q, options, answer, explain). |
lessons[].steps[] | type (read, guide, do, shortcut), title, body, route ({claim} / {claim:<ref>} resolve to the learner's sandbox claim), target (a data-guide id), await (next, click, input, check), checks, shortcut (keys, label), image, download, tour. |
checks[] | key, label, hint, rule. |
Rules (backend/app/services/training_rules.py) are declarative and graded
against the database, never against what the browser says:
room_exists, job_complete, media_count, item_field, item_count,
items_all_approved, claim_submitted, claim_created_by_user (the
learner made a claim themselves during a lesson), and activity (the
learner's activity log on the claim: action_type / action_types,
restored, and item_contains to count only actions on items whose name
contains the text, so archiving one item cannot pass a check about another).
Each rule may name
a fixture claim ref, or scratch for the claim the learner creates. Each
rule's parameters are checked at import (RULE_PARAMS).
The library
backend/app/services/training_library.py. Builtin modules ship as JSON in
backend/app/training_modules/*.json (validated at import time, so a broken
builtin fails the test suite). Custom and imported modules are rows in
training_modules, one row per version: a save or import always becomes
the next version of its key and never overwrites history, so what a learner
passed is reproducible and any version can be exported. The live document is
the highest version among the builtin file and the non-archived rows.
Archiving a builtin's custom versions reverts it to the shipped file.
The original four Academy missions are the builtin module academy. The
legacy /api/training/overview and /api/training/missions/... endpoints
and the current hub UI speak it through a compatibility shape
(training._compat_missions), and old progress rows default to
module_key = 'academy', so nothing anyone earned was lost.
Configuration per level
backend/app/services/training_config.py registers training's keys with the
shared registry (services/config_registry.py) and reads and writes them
through the shared Organization > Business Unit > Team > User resolver
(services/config.py, storage config_settings; see
Configuration and access). There is no
training-specific storage or resolution. Keys (group training, every
level, admins of the level only):
| Key | Meaning |
|---|---|
training.modules | [{module_key, required, due_date}], replaced wholesale by a deeper level |
training.exempt (+ _reason, _by, _at) | Exempt from required training; a deeper level can set it back to false |
training.due_date | Overrides every required module's date for that scope (per-user extensions) |
training.reminder_days | Default 14 |
The deepest level that sets a key wins, and a level can lock a key
(for example an organization-wide required assignment a team cannot undo;
a team override then answers 409). Each resolved value says which level
supplied it (sources in the compliance report).
Who may change it (services/scope_auth.py): settings.manage_org for the
organization, its business units and teams; settings.manage_team for
their own team and its people (including exemptions); internal admins
everywhere. Nobody exempts themselves or moves their own due date unless
they hold settings.manage_org or are an internal admin (403 otherwise). The module library itself (save, import, archive) stays
internal-admin only; reading it is open to anyone who may assign training.
The gate
backend/app/services/training_gate.py. A user is locked when a required
module's effective due date is before today (the due date itself is
still allowed) and the module is not passed (every lesson of the live
version complete; lesson completion survives version bumps as long as the
lesson key survives), unless they are exempt or an internal admin.
An assignment pointing at a module that no longer exists never locks anyone.
A required module with no due date shows a reminder (no countdown) but never
locks. Before the due date, the reminder starts training.reminder_days
(default 14) days out.
is_locked runs on every authenticated request, so it short-circuits: an
internal admin is never locked, and when no training.modules value exists
anywhere on the instance one indexed query answers without resolving the
user's chain. The flag only filters or refuses real claims, so a locked
manager can still use Settings, access, the hierarchy, and training admin
(for example to fix an exemption).
get_actor computes Actor.training_locked once per request. Enforcement is
server side:
core/ownership.py: every loader (load_claim_for_team,load_room_for_team,load_job_for_team,load_item_for_team) and the newclaim_allowed(actor, claim)raise 403 withdetail.code = "training_required"for a non-training claim.GET /api/claimsreturns only the user's own training claims;GET /api/jobsonly training jobs;GET /api/activityonly the user's own actions;POST /api/claims/statusrefuses real claims.POST /api/claimsrefuses, unless the body carriestraining_module_key(a lesson's "create a claim from scratch" step), which makes a sandbox claim with fixture refscratch.- Every
/api/integrations/...endpoint usesget_unlocked_actorand refuses.
Training itself, sign-in, Help, and Settings stay open. /api/auth/me also
forces features.training = true for anyone with assigned modules, so the
Training section is reachable even where the team-level component is hidden.
Frontend: components/training/TrainingGateBanner.tsx polls
GET /api/training/me. Before the due date it shows a reminder with a
countdown (hidden for the day when dismissed). When locked it shows a red
banner that cannot be dismissed, sends the Dashboard and other claim lists to
/training?locked=1, and watches every API response: a training_required
refusal routes the user to the Training hub. Both redirects pause while a
lesson is playing: Start from scratch begins on the Dashboard, which also
loads Integrations (refused for a locked user). The server still only allows
practice claims. The hub shows a Required
training card with each module's progress and due date.
Admin API
Under /api/admin/training/.... Library changes are require_admin;
settings, exemptions, and compliance follow scope_auth (see above). The library, the full
document, JSON export (.../export, a download) and import (multipart file,
2 MB max, 422 with a problems list when invalid), a dry-run validate
for the builder, settings per level (PUT sets keys, clear removes them so
the level above applies again), the per-user exemption / extension
(PUT /admin/training/users/{id}/exemption, a reason is required to exempt),
and the compliance report. Every change is written to the activity log.
| Method & path | Purpose | Who |
|---|---|---|
GET /api/admin/training/modules | The library. | anyone who may assign training |
GET .../modules/{key} | One module's full document. | internal admins |
GET .../modules/{key}/export | The JSON document as a download. | internal admins |
POST .../validate | Dry-run validation for the builder. | internal admins |
POST .../modules, POST .../modules/import | Save a new version; import a JSON file (2 MB max). | internal admins |
DELETE .../modules/{key} | Archive a custom module, or revert a builtin's edits. | internal admins |
GET, PUT .../settings/{scope_type}/{scope_id} | Training settings at one level. PUT takes modules, due_date, reminder_days, and a clear list of keys to remove. An unknown module key is 422. | scope_auth |
PUT .../users/{id}/exemption | {exempt, reason, due_date}. Lifting an exemption clears the user-level value rather than storing false, so a level above can apply again. | scope_auth, never yourself |
GET .../compliance | Every person with required modules, progress, due dates, status, and sources. | scope_auth |
Learner endpoints live under /api/training/...: GET /training/me (lock,
reminder, and each assigned module with progress), GET /training/modules/{key},
POST /training/modules/{key}/start, and per lesson quiz, checks (GET,
no side effects) and check (POST, grades). The legacy Academy endpoints
(overview, start, missions/..., leaderboard, certificate,
certificates/{code}) are described below.
Taking a course (learner)
/training/modules/[key] (app/training/modules/[key]/page.tsx) lists the
course's lessons with progress. Start seeds the learner's sandbox claims
(POST /api/training/modules/{key}/start), then plays the lesson in the help
chat through useGuides().startCustom(...): a lesson is a CustomGuide
(lib/guides.tsx) whose steps are the module's steps with {claim} routes
already resolved to the learner's own sandbox claim ids. It survives reloads
(sessionStorage cv.guide.custom.v1).
In the chat (components/training/ChatBubble.tsx, see the
Help Center player):
await: "check"steps pollGET .../lessons/{lesson}/checksevery 3 s, show each check ticking off with its hint, and move on by themselves when the step's checks pass (Skip is always there).shortcutsteps show the keys (lib/trainingShortcuts.mjs:modis Cmd on Mac, Ctrl elsewhere) and tick when the learner presses them for real.- Finish grades the lesson (
POST .../check) and returns to the course page with the lesson open at its knowledge check.
The Training hub lists every assigned course (required first) with progress and due dates, linking to its course page.
Basic training (builtin module basic-training)
backend/app/training_modules/basic-training.json, six lessons written
against the current UI (targets are real data-guide ids):
| Lesson | What the learner does | Checks |
|---|---|---|
| Foundations | Claim > rooms > uploads > items, sources, statuses; ? opens shortcuts | none (quiz only) |
| Review a submitted assignment | On fixture review-ready (a submitted ContentsCapture assignment): archive the planted duplicate TV, give the rug a condition, fix blender quantity 12 to 1, approve all; shortcuts A and 1 to 4 | tv-duplicate, rug-condition, blender-quantity, review-approved |
| Undo a mistake | Archive the Oak Bookshelf with the row Archive icon, then Cmd/Ctrl+Z | archived-something (activity archive_item on the bookshelf), bookshelf-back (activity unarchive_item on the bookshelf, which is what Cmd+Z sends after an archive). Nothing passes at the start, and the TV archived in the review lesson does not count. |
| Start from scratch | New Claim (a practice claim, fixture ref scratch), Kitchen room, upload, group (M), process (Cmd/Ctrl+Enter) | made-claim, scratch-kitchen, scratch-photos |
| Add media to a ContentsCapture assignment | On fixture add-media: add photos to Bedroom and to a new Closet; P processes uploads; Import from Contents Capture explained | bedroom-more, closet-media |
| Review at full speed | Review Mode keys: arrows, A, F, E, D, N, Esc | none (quiz only) |
Fixture photos live in backend/app/training_modules/media/ and are copied
into each seeded job's storage (services/training_media.py). The module
names no customer: it is enabled for a customer by assigning it (usually at
the customer's organization level in Admin > Training > Assign), never by editing copy.
Admin: Training tab
Admin dashboard > Training (components/training/AdminTrainingPanel.tsx),
admins only. Three views:
- Library: every module (built in, custom, imported) with Edit, Duplicate, Export (downloads the JSON through the authed fetch), Remove (custom) or Revert (a builtin's edits), plus Import JSON and New module. Import problems are listed one per line.
- Builder (
TrainingModuleBuilder.tsx): forms for module metadata, lessons and steps (drag to reorder with FramerReorder), step type, page route,data-guidehighlight, what finishes the step, shortcut keys, which checks a step and a lesson need, the quiz (JSON), checks (rule type picker that fills a parameter template, parameters as JSON), test claims (kind picker, claim details and rooms/items as JSON, so any special item format can be expressed), and the raw document. A sticky learner preview steps through the selected lesson as chat bubbles. The document is validated by the server as you type (debouncedPOST /api/admin/training/validate); Save new version is disabled until it is valid. - Assign: modules per level (organization, business unit, or team, from
GET /api/hierarchy): assigned or not, required or optional, due date, reminder lead time, or "use the level above". People-level overrides live in Compliance. - Compliance: every person with their required modules, progress, due dates and status (Locked, Due soon, Assigned, Passed, Exempt), with Exempt (reason required), Extend due date, and Lift exemption.

The Academy design in one paragraph
The Academy curriculum is the builtin module
backend/app/training_modules/academy.json, exposed to the legacy endpoints
as training.MISSIONS: ordered
missions, each with instruction steps, a quiz (answers stay server-side),
and "doing" checks. A mission's checks are graded against the actual
database state of the user's training claim: the user really creates the
room, really uploads media through the real uploader, really fixes the
planted inventory defects, and really runs Send for Estimation. The training
claim makes that safe: uploads into it are intercepted and completed
instantly with fixture items instead of running the pipeline, and
submission short-circuits into a dry run.
The training claim sandbox
claims.is_trainingflags a sandbox claim. One is auto-created per user byPOST /api/training/start(idempotent), numberedTRAINING-<FIRSTNAME>.- It appears in the normal dashboard with a blue Training chip, and the claim page shows a banner linking back to the Training hub.
- Everything else about it is a real claim: rooms, uploads, items, review, activity logging.
Three interception points make it free and safe:
| Hook | File | Behavior for training claims |
|---|---|---|
| Upload finalization (video/audio) | app/api/routes/upload.py, finalize_single_media_upload | Skips billing parking and the pipeline; training.complete_training_job seeds fixture items and marks the job complete synchronously. |
| Process (photos after grouping, parked confirms) | app/api/routes/jobs.py, process_job (and quote_job, which quotes 0) | Skips the credit charge and pipeline; photo jobs get one item per photo group, honoring the user's grouping, with the actually-uploaded files as item photos. |
| Submission | app/api/routes/claims.py, _submit_training_dry_run | Runs the identical room/item selection and locking (items get submitted=True), issues a fake claim key TRAINING-DRY-RUN-<id>, never touches the Adjust Square client and needs no team token. |
Deterministic fixtures and planted defects
Fixture inventories come from the claim's module (fixtures.upload_results);
for the Academy they are exposed as constants in app/services/training.py:
- The first video uploaded into a training claim seeds
MESSY_VIDEO_ITEMS: ten items with six deliberate problems (a microwave in the wrong room, a duplicated TV, a mirror-reflection non-item, quantity 12 coffee tables, a sofa with no condition, and a vague "Small Kitchen Appliance" whose audio evidence names a blender). Mission 3 grades the user on finding and fixing all six, then approving everything. - Later videos seed
EXTRA_VIDEO_ITEMS(small, clean) so re-uploads cannot corrupt the graded state. Audio uploads seedAUDIO_ITEMS(clean, with transcript and per-item audio ranges). Photo jobs create one item per group at Process time. - The downloadable sample pack lives in
frontend/public/training/(four generated JPEGs, a WAV voice memo, an MP4 test video, andsample-pack.zip). The files are real playable media, but their content is irrelevant: classification happens by extension and the pipeline never runs.
Grading
training.evaluate_module_checks runs each check's rule against the database, for example "exactly one active
item named like tv", "the item named like microwave has room like
kitchen", "claim submitted with 5+ items". A mission completes when all
checks pass and its quiz was passed (70%+); completion banks the points
exactly once (mission base + 10 per correct quiz answer). Missions unlock
sequentially. Quiz answers are never sent to the client; grading returns
per-question correctness and explanations.
Two endpoints share that evaluator:
GET /api/training/missions/{key}/checksgrades with no side effects (no attempt counter, no stored results, no completion). The on-screen task tracker polls it every few seconds so tasks tick themselves off live.POST /api/training/missions/{key}/checkis the explicit grade: it stores the results, counts the attempt, and completes the mission (banking points exactly once) when all checks and the quiz are passed.
The on-screen mission tracker
components/TrainingTracker.tsx is a floating quest log mounted app-wide in
AppShell, so the active mission's task list stays on screen while the user
works inside their training claim instead of forcing round trips to the
Training section. It follows the first unlocked, incomplete mission and:
- polls the GET checks endpoint (5s, only while expanded and the tab is visible; also on focus and route changes), so completed tasks tick off automatically;
- shows the hint for the first open task only, plus a knowledge-check row
with a deep link to the mission's quiz step (
?step=quiz); - auto-completes the mission via the POST endpoint the moment every task and the quiz are green, celebrates with the badge and points, then offers the next mission;
- renders its expanded panel through
GuideWindow(movable, resizable, zoomable, remembered per user, clamped to the visible viewport; the same window the help chat and the tour card use); - minimizes to a compact progress pill (
Mission 2and1/4); the expanded/minimized choice persists in localStorage, and dismissing the tracker hides it for that mission only; - renders nothing for users who never engaged training (no training claim),
on
/trainingand/verifypages, or once everything is complete.
Data model
training_modules: the library, one row per module version (key,version,title,sourcebuiltin/custom/imported,team_id, the fulldocument,is_archived).- Training settings: rows in the shared
config_settingstable under thetraining.*keys. claims.training_module_key/claims.training_fixture_ref: which module and fixture claim a sandbox claim belongs to (scratch= created by the learner). Blank module = an Academy claim from before modules.training_progress: one row per user per module lesson (module_key,mission_keyholds the lesson key,module_version,status, bestquiz_score,checks_passed, bankedpoints,completed_at). Badges are derived: mission complete = badge earned. No separate badge table.training_certificates: issued once every mission is complete (POST /api/training/certificate). Snapshotsholder_name/team_name, storesscore_pct(overall quiz accuracy),points, and an unguessablecodelikeCV-3F9A-C24D-71BE.revokedinvalidates without deleting.
Public verification
GET /api/training/certificates/{code} requires no auth by design: it
returns {valid, holder_name, team_name, level, score_pct, points, issued_at} (or {valid: false}) so anyone holding a shared link can confirm
the credential. The frontend page is /verify/[code], whitelisted as a
public path in AppShell (no sign-in). The hub offers Copy verification
link and a LinkedIn share for exactly this URL.
Leaderboard
GET /api/training/leaderboard aggregates points, badge counts, and
certification per user, strictly scoped to the caller's team (a tenant
never sees another tenant's names or scores).
Frontend
/training(hub): points and badge stats, path-to-certification progress, the certificate card, the mission trail, and the team leaderboard./training/missions/[key](runner): a step wizard rendering the curriculum's steps: instruction cards, the guided tour launcher, the sample pack download, live "your tasks" checks with a Check my work button, the quiz with instant feedback, and the badge celebration on completion.components/TrainingTour.tsx: the spotlight tour engine. Tours are step lists targetingdata-tour="<id>"attributes; the overlay portals todocument.body(viaModalPortal), dims the screen with a box-shadow spotlight hole, glides between targets with CSS transitions, and is advanced with Next/Back or the arrow keys (Esc exits). The step card is aGuideWindow, so it can be dragged off the target and its footer never sits under the browser toolbars. Start one from anywhere withstartTrainingTour(key, returnTo). Tagged targets today:sidebar-nav,new-claim,claims-list(dashboard),create-room,send-for-estimation(claim page),room-uploader(room page).
PDF documentation
There is no PDF generator for the handbook or Help Center in this repo today (checked 2026-11-12: no puppeteer, print stylesheet, or pipeline step). The Training section of the handbook (this page) and the Help Center articles Taking Basic Training and Getting Certified with Training carry fresh screenshots and are ready to include once one exists.
Testing
backend/tests/test_training_basic_module.py covers the Basic training
content: it ships built in and names no customer, shortcuts appear across
the hands-on lessons, start seeds both ContentsCapture fixture claims with
served photos, and every lesson's checks grade the real fixes (including
Undo by state and the learner-created practice claim).
backend/tests/test_training_modules.py covers the schema (every builtin
validates; each kind of mistake is rejected with a readable problem), export
then import round trip and versioning, invalid imports, admin-only access,
the gate (no config, reminder, the due date itself, overdue lock enforced on
real endpoints, sandbox still allowed, passing unlocks, optional and unknown
modules never lock, admins never locked), deepest-level-wins resolution,
exemptions and per-user extensions, fixture claim seeding, rule grading
(including Undo through the activity log and a learner-created claim), and
lesson completion.
backend/tests/test_training_api.py covers the sandbox lifecycle, the
fixture seeding for all three media types (including the billing bypass and
the second-video guard), sequential unlocking, quiz and check grading against
real fixes, the submission dry run (asserting the Adjust Square client is
never called), certificate issue plus no-auth verification, and leaderboard
tenant scoping. Like the rest of the suite it is fully offline.