instar 1.3.242 → 1.3.244

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,52 @@
1
+ # Side-Effects Review - Apprenticeship manual cycle write path
2
+
3
+ **Version / slug:** `apprenticeship-manual-cycle-write-path`
4
+ **Date:** 2026-06-03
5
+ **Author:** codey
6
+
7
+ ## Summary of the change
8
+
9
+ Current `JKHeadley/main` already had `POST /apprenticeship/cycles`, so this change does not add a second route. It finishes the manual/overseer write path around that existing route:
10
+
11
+ - `src/server/routes.ts` now validates that manual cycle POST bodies are objects and that `channel`, when present, is one of the four store-supported values.
12
+ - `src/server/CapabilityIndex.ts` now surfaces the apprenticeship cycle endpoints in `/capabilities`.
13
+ - `src/scaffold/templates.ts` adds a CLAUDE.md awareness blurb for manual cycle recording.
14
+ - `src/core/PostUpdateMigrator.ts` mirrors that blurb for existing agents that do not yet have the Apprenticeship Program section.
15
+ - `src/data/builtin-manifest.json` is regenerated after the route/source changes.
16
+ - `upgrades/next/apprenticeship-manual-cycle-write-path.md` records the release-note fragment required by the publish gate.
17
+ - Route and capability tests cover strict channel validation, channel persistence, manual overseer cycle capture, and discovery.
18
+
19
+ ## Side effects and blast radius
20
+
21
+ The only behavior change on the write path is stricter HTTP validation. A malformed manual request with an unknown channel now receives HTTP 400 instead of being written as `unknown`. The lower-level `ApprenticeshipCycleStore.record()` behavior is unchanged, so legacy rows and automated/non-HTTP callers still normalize invalid or missing channels to `unknown`.
22
+
23
+ The route remains persistence-only. It does not mutate apprenticeship instance status, does not run lifecycle gates, and does not decide whether a cycle was good. It only writes the row to the cycle store, and existing role-coverage logic interprets those rows afterward.
24
+
25
+ Capability discovery changes only metadata returned by `/capabilities`; no new auth surface or prefix classification is introduced. `/apprenticeship` was already a public capability prefix, so no `INTERNAL_PREFIXES` entry is needed or appropriate.
26
+
27
+ The template and migrator changes alter generated/updated CLAUDE.md guidance text. They do not execute operational work. Existing installs that already have an Apprenticeship Program section are still protected by the current idempotency marker and will not be double-patched by this migration.
28
+
29
+ ## Risks considered
30
+
31
+ - **Breaking automated mentor ticks:** low. The automated call site writes through the store, not the HTTP route, and does not provide a channel today. Store defaulting remains unchanged.
32
+ - **Rejecting useful manual records because of a typo:** intentional. Manual/overseer HTTP writes should fail loudly when the channel is not one of the program-defined channels.
33
+ - **Capability configured status drift:** low. The capability now reports configured when either the instance program or cycle store is wired, matching the fact that cycle routes can be alive independently of the instance object in tests and boot wiring.
34
+ - **Template guidance becoming stale:** medium over time. This is mitigated by listing the same enum values exported by the store today and keeping the text concise.
35
+
36
+ ## Test evidence
37
+
38
+ Focused verification:
39
+
40
+ - `npx vitest run tests/integration/apprenticeship-routes.test.ts tests/unit/CapabilityIndex.test.ts tests/e2e/apprenticeship-lifecycle.test.ts`
41
+ - Result: 3 files passed, 31 tests passed.
42
+
43
+ Planned final checks before push:
44
+
45
+ - `pnpm lint`
46
+ - `pnpm build`
47
+ - `node dist/cli.js dev:preflight`
48
+ - `pnpm test:smoke`
49
+
50
+ ## Rollback cost
51
+
52
+ Rollback is a normal code revert. Reverting restores the previous permissive HTTP behavior, removes the capability endpoint entries, and removes the new generated/migrated awareness line. No database migration is introduced, and no existing cycle rows need transformation.
@@ -0,0 +1,56 @@
1
+ # Side-Effects Review — Telegram authorizedUserIds type-tolerant comparison
2
+
3
+ **Version / slug:** `telegram-auth-id-type-tolerant`
4
+ **Date:** `2026-06-04`
5
+ **Author:** `echo`
6
+ **Second-pass reviewer:** `not required`
7
+
8
+ ## Summary of the change
9
+
10
+ The legacy (non-shared-AuthGate) Telegram auth path used
11
+ `authorizedUserIds.includes(userId)` where `userId` is a `number` but the config
12
+ field, though typed `number[]`, is untyped JSON at runtime and may hold the id as
13
+ a string. `Array.prototype.includes` uses SameValueZero (no coercion), so a
14
+ string-configured id silently failed to match and the authorized user was treated
15
+ as unknown. The fix compares as strings (`authorized.some(id => String(id) ===
16
+ String(userId))`), mirroring the shared-AuthGate path which is already string-based.
17
+ The mini-onboarding auto-add (`server.ts`) is given the same loose membership check
18
+ so it does not append a duplicate when the list already holds the id as a string.
19
+
20
+ ## Decision-point inventory
21
+
22
+ One decision point: `isAuthorized(userId)` returns true/false (authorized vs gated).
23
+ The change only affects WHICH equal-by-value ids match; it does not change the
24
+ empty-list semantics (still "accept all" on the legacy path) or any other branch.
25
+
26
+ ## 1. Over-block
27
+
28
+ **What legitimate inputs does this change reject?** None. The change only makes the
29
+ comparison match MORE inputs that were always intended to match (an id equal by
30
+ value, regardless of number-vs-string representation). No id that previously
31
+ authorized stops authorizing: `String(n) === String(n)` holds for every number that
32
+ `includes` would have matched. The empty/absent-list "accept all" path is untouched.
33
+
34
+ ## 2. Under-block
35
+
36
+ **What does this still miss?** It does not change the fail-open vs fail-closed
37
+ posture of the legacy path (empty list still accepts all — unchanged, out of scope).
38
+ It does not touch the shared-AuthGate path (already string-based) or the Slack/
39
+ WhatsApp/iMessage adapters (separate code, their own typing). It compares by exact
40
+ string equality after coercion, so it intentionally does NOT treat e.g. leading-zero
41
+ or whitespace-padded ids as equal — Telegram ids are canonical integers, so this is
42
+ correct.
43
+
44
+ ## 3. Blast radius
45
+
46
+ Two callsites: `TelegramAdapter.isAuthorized` (the auth gate) and the `server.ts`
47
+ mini-onboarding auto-add. Both are Telegram-only. No schema, config-shape, or API
48
+ change — existing configs (number ids, string ids, or mixed) all keep working, and
49
+ configs that already worked are unaffected. Behavior strictly widens recognition to
50
+ match the documented intent.
51
+
52
+ ## 4. Reversibility
53
+
54
+ Fully reversible: revert the two edits. No state migration, no persisted format
55
+ change. Config files are not rewritten by this change (the mini-onboarding still
56
+ pushes a numeric id as before; it just no longer duplicates an existing string id).