Skip to content

feat(bin): add reusable PR preview refresher - #185

Closed
aperez32 wants to merge 8 commits into
kunchenguid:mainfrom
aperez32:fm-preview-pr-helper
Closed

aperez32 wants to merge 8 commits into
kunchenguid:mainfrom
aperez32:fm-preview-pr-helper

Conversation

@aperez32

@aperez32 aperez32 commented Jul 2, 2026

Copy link
Copy Markdown

Summary

  • add bin/fm-preview-pr.sh for reusable project PR preview refreshes with dedicated preview worktrees and per-preview state
  • record owned backend/frontend PIDs, ports, branch/head, commands, logs, and ready line under state/previews/
  • add focused helper tests plus documentation for usage/configuration and preview state directories
  • include a teardown compatibility fix surfaced by validation for Git versions without merge-tree --write-tree

Validation

  • no-mistakes review: passed after auto-fixes
  • no-mistakes tests: passed, including an offline end-to-end fm-preview-pr.sh fixture that produced a canonical ready: line
  • no-mistakes docs: passed
  • no-mistakes lint: passed
  • push to upstream failed with 403 for aperez32, so branch was pushed to fork aperez32/firstmate

@aperez32 aperez32 closed this Jul 2, 2026
@aperez32
aperez32 deleted the fm-preview-pr-helper branch July 2, 2026 04:22
@mattsanchez

Copy link
Copy Markdown

Agreed — this is a package-boundary issue, not just a naming question. ADR-0034 D2 calls for a sibling web package alongside @magenta/mcp-server, and D5 says the shared HTTP stack is the web implementation with MCP StreamableHTTP mounted as a route.

I’m holding this PR and extracting the shared stack into @magenta/web before the system-SSE/WebMode slices proceed. The handshake will move with the web security seam; @magenta/mcp-server will retain only the MCP route adapter and protocol-specific behavior. The current implementation is being preserved for that migration rather than merged in its present location.

@tijnvdbroek

Copy link
Copy Markdown

Uitzondering op K56 en rood-bewijs

Closes #181

Uitzondering op K56: de codex-toetsen B-16-26 en B-20-15 zijn aangepast, alleen zover nodig om de klok eruit te halen. De aanpassing is zelf door codex geschreven en ongewijzigd gecommit ("toetsen van codex, ongewijzigd (K56 punt 2)"): stap 8 onthoudt het runId, en stap 11 opent /werk/run/<runId> (ui/16) in plaats van /werk → Eerder vandaag. Geen andere stap is veranderd, en ook de productcode niet.

Rood-bewijs (K74/K161, twee mutatiebouwen, eigen WooCommerce in Docker):

bouw mutatie toets uitslag
A M1 werk/lezen.ts: vandaag = new Date() (middernacht valt tijdens de run) oude B-16-26 ROOD op stap 11: getByText(/Klaar|Gepubliceerd/) niet zichtbaar
A M1 nieuwe B-16-26 groen: hangt niet af van het tijdstip
A M1 nieuwe B-20-15 (+ B-20-10) groen
B M2 werk/woorden.ts run klaar → Publiceren, M3 werk/run/tabel.tsx stand klaar → bezig nieuwe B-16-26 ROOD op stap 11 (Klaar in de runkop)
B M2 + M3 nieuwe B-20-15 ROOD op stap 11 (Klaar in de runkop)
schoon — B-16-26, B-20-15, B-20-10 groen

Open punt: M3 (de bewering over de stand in de tabel) is niet los rood bewezen, want M2 valt in dezelfde stap eerder om (K161: hooguit twee bouwen). pnpm controle 0, pnpm bouw 0.

fritznoff pushed a commit to fritznoff/starship that referenced this pull request Nov 2, 2026
…nistic safe sink (kunchenguid#185)

* feat(bin): complete gateway v2 signed approval, leased execution, and safe sink

Continues the accepted gateway v2 owner through Step 2 sub-order items 5 and 6
plus the quarantine importer and installation lifecycle from item 7. The
parser, closed plan, SQLite tombstones, peer/capability binding, and refusal
guarantees from items 1 through 4 are unchanged.

Approval now completes against an enrolled signer. The signature is over the
exact canonical transcript the broker recomputes from stored state, the
challenge is one-shot, and the approver's assurance class is recorded on the
approval row, in the audit event, and in status output. There is no fallback in
either direction: the forgeable software test class is refused at enrollment and
at verification outside test mode, and the asymmetric path refuses by name when
its verification primitive is unavailable rather than accepting an unverified
approval.

Execution is claimed under a one-shot lease and settled from the executor's own
receipt store, not from the executor's report. A relay that claims success it
did not achieve settles failed or unknown, whichever the store supports.
Recovery now reconciles only leases whose deadline has passed, so a live
execution window is no longer rewritten by a concurrent read. An expired lease
becomes unknown, and neither a late settle nor a retry can leave that state.

The deterministic safe sink is the only executor the broker will claim for, its
exact bytes are bound into every plan, and its idempotency key is its store's
primary key, so a repeated click, retry, or restart produces no second effect.

Adds device.config.stage with the non-graduatable device ceiling and a device
shape in the closed plan. The gateway records the exact integer wire value and
never alters it: no corrective band, no floor, no rounding, and no decoding. A
setting whose encoding is not confirmed cannot be staged at all, and eligibility
is never defaulted to observed.

The installation lifecycle previews and never installs. Every privileged path is
a validated fixed literal, and uninstall quarantines directories by moving them
under a timestamp rather than deleting a tree, so it cannot destroy the audit
record or take a neighbouring path with it. The emitted install and uninstall
artifacts carry their own path, containment, symlink, and ownership guards, are
not executable, and refuse to run without an explicit confirmation flag.

No device was touched, no privileged installation performed, no key enrolled
outside a temporary root, and no outward action exists anywhere in this path.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* no-mistakes(review): fix gateway v2 durable unknown, plan bounds, and executor store split

* no-mistakes(review): publish plan ceiling, verify sink group, guard group rollback

* no-mistakes(review): fail closed on group rollback proof and setgid

* fix(bin): approve the gateway v2 installation prefixes in the boundary pack

The installation lifecycle installs its programs under
/usr/local/libexec/firstmate/ and its executor-owned receipt store under
/var/db/firstmate/sink/, but the worker-boundary pack's source-manifest
contract approved neither. A reviewed installation using the previewed paths
would have been rejected by the very pack that exists to verify it.

Adds exactly those two prefixes to the approved list, to the --help text that
owns it, and to the contract doc. The receipt store is a separate prefix from
/var/db/firstmate/gateway/ on purpose: the broker root stays broker-only, and
the store the broker reads is owned by the executor.

Tests cover both directions: a manifest naming the two gateway v2 install paths
passes the source invariant checker, and a path outside every approved prefix
still fails and still exits nonzero.

* fix(tests): read store modes and groups with a portable stat in the sink suite

The permission assertions called /usr/bin/stat -f, which is BSD format syntax.
GNU stat reads -f as "file system", so on the Linux CI runner the call did not
fall over on an unsupported flag - it tried to stat a filesystem named after the
format string and failed the suite.

Uses the GNU-then-BSD fallback tests/lib.sh already uses. Both spellings render
four octal digits, so the setgid bit the store depends on is still compared
rather than silently dropped.

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
@leokoh

leokoh commented Nov 3, 2026

Copy link
Copy Markdown

Round 1 fixes, at 4cd7e400dbdce5595ddc405ad3d0a608e55416ec:

  • P1 (per-unit values left the module): fixed.
    • ArmValues and OutcomeValues are gone. The per-unit values now live only in the private _values and _Values.
    • experiment_outcomes passes each outcome's values straight to 2U-2's analyse, with the plan's missing_outcome, interval and min_units_per_arm, and the hypothesis for the primary outcome only.
    • It returns only OutcomeResult(metric, token_semantics, primary, analysis), alongside purged_units.
    • The tests check the module's internal values through _values against the hand-written and independent sums. They then assert that the public result equals analyse over the hand-written values exactly, and that each arm's mean equals an exact Fraction mean.
    • test_no_per_unit_value_or_collection_of_values_leaves_the_module walks the result. It allows numbers only in the count, mean and analysis fields, and no bare collection anywhere.
  • P2 (the version-check order): documented in the module docstring. Rebuilding the lock validates the plan against the current layer, so the version check has to come first, or a changed layer would read as lock_altered. Both codes refuse, and nothing is computed.
  • P2 (field names in the PR body): fixed. The question and the risks now both use cache_read_tokens and cache_write_tokens, and state how partial reporting is handled: the reported rows are summed, and only a session where no row reports the subset gives the unit no outcome.
  • P2 (relative imports in the scan): fixed. _imported resolves relative imports against the file's package, and test_the_import_scan_sees_every_form_of_import covers from ..semantic import sessions, from . import sessions, from .sessions import … and the absolute forms.

Local checks at this commit: ruff and format clean, mypy clean, pytest 6516 passed and 1 skipped (CI-only), privacy-check 3632 passed.

ATL-HANDOFF: builder-done sha=4cd7e400dbdce5595ddc405ad3d0a608e55416ec round=2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants