Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .claude/skills/gates/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,15 @@ count check above; «Contract (Buf)» when
the contract changed; and «Host», under pyvoy and hypercorn, whenever the server job runs: the
host started on SQLite, and `pytest -m host` asking it over native gRPC — tests the ordinary
run skips, and which need a Linux runner, the host's lock and a network; and last «CI», which
passes only when every job before it succeeded or was skipped, the one check `main` requires
(#424). Nothing else.
passes only when every job before it succeeded or was skipped, the one check `master` requires
(#424). «Console» is the path-filtered Linux/Windows matrix for the separate
`tools/console/` project. Its locked Ruff and pytest gates cover the console and
its reviewed external CI/build/host inputs; see `.claude/agents/build-ci.md`.

From `tools/console/`, run `uv run --locked ruff check lessons_console tests`
and `uv run --locked pytest -q`. Console fixtures do not run the Android/server
product gates. A changed Android build script still requires the Android gates
above; a changed server implementation still requires its own gates.

## Updating measured counts

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
proto/*|buf.yaml|buf.gen.yaml|buf.lock|server/app/contract/*|android/core/data/src/main/contract/*|.github/workflows/*) contract=true ;;
esac
case "$file" in
tools/console/*|.github/workflows/*|.github/dependabot.yml|docs/build.md|server/app/config.py|server/app/db.py|server/.env.example|android/app/build.gradle.kts|.gitignore) console=true ;;
tools/console/*|.github/workflows/*|.github/dependabot.yml|docs/build.md|server/app/config.py|server/app/db.py|server/app/host.py|server/pyproject.toml|server/requirements-host.txt|requirements.txt|server/.env.example|android/app/build.gradle.kts|.gitignore) console=true ;;
esac
done <<< "$files"

Expand Down
2 changes: 2 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ From `tools/console/`, its independent gates are `uv run --locked ruff check les
and `uv run --locked pytest -q`; fake processes and a headless pilot require no SDK.
See [its README](tools/console/README.md) for preparation, cancellation and scope.

- Serialize Host startup with queued/running preparation or generation, and guard the post-queue/prelaunch boundary too (`test_console_6c.py`, #784).

CI (`.github/workflows/ci.yml`) is: ruff, mypy, pytest (`-n auto`), `./gradlew test`, both
assembles, and `./gradlew detekt` after them; and, when `proto/`, `buf.*` or
`server/app/contract/` changed, the «Contract» job: `buf lint`, `buf breaking` against the base,
Expand Down
95 changes: 94 additions & 1 deletion HANDOVER.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,100 @@ The original 6a local/first-CI notes below are historical, superseded by these
delivery receipts. 5c #770 and standalone store #777 proceed independently;
their written code does not establish runtime acceptance or permit v1 retirement.

**26 November 2026 — Console 6a (#771) and programme continuation.**
**29 November 2026 — Console 6c local gates passed; publication next.**
The one admitted Android controller completed all eight serial steps, without a
retry. Actual signing presence states, configuration-cache reuse and invalidation
after moving a synthetic keystore file all passed. The complete REST/non-streaming
`test assembleDebug assembleRelease` command passed in 15m12s: 341 tasks,
271 executed and 70 from cache. Separate Detekt passed in 28s with five executed
tasks; completed reports validate 2202 unique cases in five modules. All 1520
frozen Android inputs still matched after execution. The existing console result
remains 57 passed/locked Ruff green, with one independent review and bounded
correction readback; no extra product-suite repeat was needed.

Own process identities and completed-report hashes were retained. The coordinator
independently qualified the outcome and actually released the SDK slot, with zero
pending operations. The former commit block in the dated preparation notes below
is superseded. Publication uses the coordinated `work/console-6c` working ref from
dev `438ea369…`; Main's 5c/Room candidates stay detached and unchanged. Existing
Dependabot #768 and its dependency ref remain with their owner; do not fold its
different dependency pins into this accepted candidate.

The actual ordinary debug/release APKs and AGP metadata were retained through the
console snapshot function and independently re-read with matching identities and
hashes. This was file processing only, with no SDK tool or device call. It proves
artifact retention, not cryptographic production signing, installation or runtime
transport acceptance. Live Host, device/Home-reopen, exact-head/dev/master CI,
production and Project acceptance remain separate. Root holds #783 until 6a's
missing runtime observation is accepted; do not move persistent dev/master yet.

**28 November 2026 — Production runtime observation remains incomplete.**
Master `3ffcc33c…` and dev `438ea369…` were freshly re-read unchanged; promotion
#783 is still open and unmerged. The prior read-only v3 observation qualified
the exact source and all four alias bindings, then passed all eight health/warmup
GETs with the reviewed same-response-body decoder. Preserve their actual
26 November timestamps; they do not prove continuously current health.

The first runtime-count response was not recognized. Its second query was not
executed. The coordinator independently qualified the sanitized partial and
actually released that consumed pass on 28 November. A separate runtime-only v4
pass freshly requalified the five source/alias metadata reads, repeated no GETs
and made no write. Its first query likewise returned an unsupported formatted
text response; no zero-error count is inferred, and no second query ran.
That pass is also actually released with pending operations zero. Do not launch
another live request to guess the format. Resume runtime only from a confirmed
response contract or suitable structured counter; #783 remains separate until
6a production is accepted. All failed projections and original requests remain.

Console 6c's frozen Android request waits after the active Source 5c check and
the local Room-store check. No 6c SDK execution or resource reservation has
occurred. No Project UI action is authorized by this remote-only continuation.

**27 November 2026 — Console 6c (#782), source reviewed; Android gates pending.**
The [6c plan](docs/specs/2026-11-26-build-console-6c-plan.md) implements selected
REST/Connect APKs with retained metadata/hashes, an owned local Host occupant and
safe signing presence status. This detached candidate starts from accepted dev
`438ea369c56e3bd0056155e5d19a48da09b84de9`; it holds no working branch or
resource reservation. Native gRPC/streaming remains unavailable until accepted
5c source is integrated. The server/API/proto implementations are unchanged.

One independent review found #784 (Host startup overlapping environment/source
mutation) and #785 (a generic selected-APK row missing required parameters).
Both were corrected in one pass: three focused witnesses observed RED then
GREEN; the complete locked console suite passed 57 cases in 24.45 seconds and
Ruff passed. The same reviewer accepted the bounded correction readback.
Host guards cover submission, queued work, preflight and launch; preparation or
generation cannot overlap a starting/running Host. The parameterized APK row
uses its dedicated selectors. Both defects remain open until delivery.

Actual Android test/debug/release, separate Detekt, completed-report count and
the signing-status configuration-cache/moved-file fixture remain **unrun**.
No commit is permitted until the changed Android half's gates pass. The prepared
one-shot request uses direct Java wrapper argv, offline/one-worker/no-daemon,
private F-drive outputs and synthetic signing values; it waits behind Source's
5c/core checks and requires fresh admission. No SDK, device, port, backend or
production operation has established 6c runtime acceptance. Fake/headless results
do not establish a live Host or installed product result.

Predecessors: 6a #771 merged through #772/#780 to master
`3ffcc33c7f6cde30f55639a3628b697c719a77e9`; exact working/dev/promotion/master
CI passed. 6b #776 merged through #781 to dev `438ea369…`; its exact working/dev
and promotion #783 CI passed, but #783 is not yet merged. Fresh 6a production
verification found the owned legacy alias still on an older deployment. One
admitted assignment and an independent post-read confirmed its correction;
public health/warmup passed. The first protected helper returned HTTP 200 but
the client did not recognize the API body, so that pass stopped without retries
or runtime queries. Complete production and Project 6 acceptance remain open;
do not promote #783 until the observation is resolved and actually released.

Source #770 continues 5c foreground WatchClass. #409 and #777 continue the shared
core and Room store; the owner's one-based part 8 means this documented part 7.
Their real Gradle/KSP/integration results remain pending. Existing 5b APK 54 was
not installed: its retained emulator attempt failed before boot completion.
Preserve the accepted 5a/APK 50 evidence, all failed receipts and foreign WIP.
Family rollout and v1 retirement still require their actual acceptance.

**26 November 2026 — Console 6a (#771) and programme continuation (historical batch notes).**
The [approved console design](docs/specs/2026-10-05-build-console-design.md),
decision #308 and [6a implementation plan](docs/specs/2026-11-26-build-console-6a-plan.md)
govern this batch, isolated from the retained Android acceptance checkout.
Expand Down
26 changes: 26 additions & 0 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,32 @@ val hasReleaseSigning: Boolean =
keystoreKeyPassword != null &&
File(keystorePath).exists()

val releaseSigningMissingNames = buildList {
if (keystorePath == null || !File(keystorePath).exists()) add("LESSONS_KEYSTORE_FILE")
if (keystorePassword == null) add("LESSONS_KEYSTORE_PASSWORD")
if (keystoreKeyAlias == null) add("LESSONS_KEY_ALIAS")
if (keystoreKeyPassword == null) add("LESSONS_KEY_PASSWORD")
}
val releaseSigningStatusText = when {
hasReleaseSigning -> "configured"
keystorePath == null &&
keystorePassword == null &&
keystoreKeyAlias == null &&
keystoreKeyPassword == null ->
"not configured"
else -> "partly configured"
} + if (releaseSigningMissingNames.isEmpty()) {
""
} else {
"; missing=" + releaseSigningMissingNames.joinToString(",")
}

tasks.register("releaseSigningStatus") {
// A safe immutable value keeps secrets and Project references out of the action.
val report = releaseSigningStatusText
doLast { println("LESSONS_SIGNING_STATUS $report") }
}

// Version identity can be overridden per build so a tagged release APK is
// distinguishable from a nightly one. Both fall back to the values below.
val appVersionName = signingSecret("LESSONS_VERSION_NAME", "lessons.versionName") ?: "0.1.0"
Expand Down
8 changes: 8 additions & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ lessons/
└── docs/
```

`tools/console/` is a separate Python 3.12/Textual development tool, with its own
lock and environment. It coordinates owned build/client processes across
checkouts and retains selected APK snapshots. Its local Host is an explicit
session occupant using a verified checkout-local server installation, disposable
SQLite and an isolated environment; it is not the production deployment. Host
preparation and contract generation are exclusive with Host startup/lifetime.
Device operations retain the installed product's signature/version safeguards.

## Why the bot is the backend

The requirement was "admin panel in Telegram". Rather than build a web panel and
Expand Down
23 changes: 21 additions & 2 deletions docs/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,27 @@ Deploy reads the HTTPS origin in `LESSONS_PRODUCTION_ORIGIN` on explicit refresh
It shows production's reported condition separately from whether its schema
matches this checkout's expected revision. An unavailable database, a missing
schema or a refused request remains visible as such. This tab does not deploy,
migrate, sign in to Vercel or follow redirects. Host controls and selected
transport builds remain the next console stage.
migrate, sign in to Vercel or follow redirects.

Build also offers an explicit REST/Connect debug/release APK selection. The
selected build forces streaming off and retains the APK, AGP metadata and hashes
before releasing the build queue. Device can select that retained result. Native
gRPC and streaming remain unavailable until the foreground 5c lifecycle is
accepted in the console's source revision.

Prepare Host installs CI's current host locks and extras in this checkout's
verified server environment. Start launches one chosen backend from a private
session directory against disposable SQLite on loopback port 8000, with no
production environment inherited. A visible Host occupant persists until Stop or
quit. Starting while Prepare or Generate is queued/running is refused; those
mutations likewise cannot overlap a starting/running Host. Other heavy work needs
an explicit Stop / Run alongside / Cancel choice. The backend marker row checks
the selected owned listener; one backend result is not the two-backend CI matrix.

The explicit signing-status action runs `:app:releaseSigningStatus` and caches
its safe answer for the console session: configured, partly configured or not
configured, plus missing setting names. It neither prints values/paths nor proves
that an APK carries a valid production signature.

## From a clone to a working pair

Expand Down
72 changes: 72 additions & 0 deletions docs/specs/2026-11-26-build-console-6c-plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Build console 6c: selected APKs, owned Host and safe signing status

This implements #782 under approved #308 and programme #273, from the reviewed
6b tree delivered through #781. Source preparation is detached and reserves no
working ref or shared resource. Integrate only after its predecessor's protected
delivery. Keep 5c's frozen compiler inputs and every other owner's work untouched.

## Current contract

The Android build already reads LESSONS_TRANSPORT before lessons.transport and
LESSONS_APP_STREAMING before lessons.streaming. REST, Connect and gRPC enum/codegen
exist, but this checkout does not contain the accepted foreground 5c lifecycle.
Offer REST/Connect debug/release choices now and keep streaming off; explain why
gRPC/streaming selection is unavailable until accepted 5c source is integrated.

Host CI installs root requirements, requirements-host.txt and the server's
dev/host-check extras, launches pyvoy or hypercorn against SQLite and tests each
through pytest host markers. It deliberately sets no LESSONS_TARGET. The console
must represent this real contract rather than calling startup the complete gate.

## Implementation sequence

1. Add a separate closed selected-APK build, without altering CI-equivalent
Android gates. Validate transport/variant, explicitly override both environment
flags, preserve no-daemon/one-worker/nonparallel ownership, assemble only the
selected variant and snapshot/hash its APK plus AGP metadata before releasing
the heavy queue. Let Device select that immutable output as well as ordinary
AGP outputs; retain all 6b signature/version guards.
2. Prepare Host in the verified checkout-local server environment with current
CI's two locks and extras. Do not create a borrowed venv or install backends
implicitly. Discover missing/unsupported backends with a clear reason.
3. Start one selected backend through that interpreter in isolated mode from a
private session directory containing no dotenv. Construct an explicit inert
local environment, absolute disposable SQLite path, loopback8000, RUN_BOT=false,
CI's dummy token/secrets and streaming server flag. Inherit no production DB,
bot/proxy configuration or deployment marker. Use bounded health readiness;
an un-stamped local SQLite schema is not a production schema failure.
4. Treat Host as a visible, non-heavy persistent occupant using existing runner
ownership, logs and safe shutdown. Do not hold the heavy lock for its lifetime.
Offer meaningful Stop Host then run / Run alongside / Cancel choices for heavy
overlap, and analogous consent when starting beside an active heavy run. Stop
before Prepare changes its environment or Generate changes imported sources.
Unexpected exit updates the occupant; do not silently start a second Host.
5. Add the selected owned Host's actual host-marker test row and prepare/start/
readiness environment parity. A single backend result is labelled as such;
both backends are required for a matrix claim. Keep routes and disposable DB
bound to that owned session rather than any server already on the port.
6. Add :app:releaseSigningStatus using only the four existing resolved signing
values and hasReleaseSigning. Capture safe status/missing-name values for the
task action; print no secret or path and add no signingSecret call. An absent
keystore counts as a missing file setting. Expose an explicit heavy console
request and session-cached answer; presence is not cryptographic APK proof.

## Verification and handback

Use a small fake-command/headless set for selected artifact ownership, Host
environment/occupancy/shutdown, current CI mapping and status parsing. Reuse the
existing process-tree matrix. These fixtures perform no SDK, backend, HTTP,
port, device or production operation. Run locked Ruff and the complete small
console candidate once, with focused repeats only for real changes/failures.

The Android build script change additionally needs actual local Android gates
and a bounded signing-status/configuration-cache fixture, including a moved
keystore path, under fresh admission. Written source or a mocked response cannot
close that requirement. Do not commit while the changed half's required checks
remain unrun. Live Host and 5c Host/device acceptance stay separate proof; never
enable gRPC/streaming merely because its build property exists.

One independent review precedes delivery. Update consuming CI paths and the
reviewed inventory with changed external readers; update build/architecture
guidance and HANDOVER inside the same open batch. Working -> dev -> pinned master,
exact CI and fresh bounded production readback retain their separate meanings.
Loading