Repository navigation
fix(demo): handle expired federated credentials gracefully - #50
Merged
Merged
Conversation
Globus→STS sessions are capped at 1 hour (DurationSeconds: 3600). A Demo 1 tab left open past that failed at the next action with a raw SDK error — "Request has expired" — which says nothing about what to do. The demo already had the expiration: credsFromIdToken returns it on AwsCreds; nothing read it. Now the demo tracks it and behaves like the portal's SessionController (same warn-then-expire shape, deliberately: two surfaces shouldn't invent two models): - A session clock under "Connected to account …" — "valid until 6:35 PM (~60 min)". Hidden entirely for pasted long-lived keys, which have no expiration. - 5 minutes out: the banner turns amber and logs a warning, so an in-flight launch isn't started against creds about to lapse. - At expiry: the banner turns red, explains the 1-hour lifetime, and offers "Sign in with Globus again". Launch + terminal are disabled, the monitor loop is stopped, and any SSM terminal is torn down — otherwise every 15s tick is a failing DescribeInstances. - Signing back in re-arms the buttons and re-shows the clock. Checked at the moment of each click, not only on the timer: a laptop asleep past the deadline doesn't fire timeouts on schedule, and the 30s refresh tick that keeps the "~N min" honest is also what notices that case. onExpiryExpired() is idempotent — it's reachable from the timer, the tick, and each guarded click, and should announce once. The poll loop stops itself on expiry with a note that the instance still self-terminates on its TTL, which is true and is the reassuring part: spored owns the deadline, not this tab. Verified by running it: demo/direct/expiry.harness.html loads the real main.ts and drives the real Globus→STS path, stubbing only window.fetch and Date.now so "expired" is reachable without waiting an hour. 18/18 assertions pass in headless Chrome, covering the fresh/warn/expired transitions, both disabled buttons, the re-sign-in affordance, announce-once, absence of the old cryptic error, and that the paste path shows no clock. Screenshot checked. The harness is dev-only — vite.config.ts lists two explicit inputs, and it's absent from a real build. typecheck (src + demo) clean; 309 tests pass.
scttfrdmn
added a commit
that referenced
this pull request
Aug 1, 2026
Cutting 0.7.0 surfaced that the process had already drifted, so this does both: the release, and the mechanism that stops the drift recurring. The drift found while reconstructing the notes: - 0.6.0 and 0.6.1 were both published to npm with NO CHANGELOG section, and 0.6.0 was never tagged at all. Both sections are now written retroactively from the commit range. - `[Unreleased]` therefore still compared from v0.5.0 and had accumulated entries that had already shipped in 0.6.0 (#28, #38). Moved. - The six audit fixes (#50, #51, #54, #55, #56, #58) had landed on main with no CHANGELOG entry at all. Written from the commit bodies. - publish.yml's subpath guard was a hardcoded list that never gained `./transfer` when #59 added that subpath — so the guard had silently stopped covering a real entry point. That is the failure mode of a duplicated list, so scripts/check-exports.mjs now derives the check from `exports` itself and checks every target, not only the .d.ts. Verified it fails on exactly the subpath the old list was missing. New `npm run release:check` is the preflight. Every assertion in it maps to a drift above rather than to a hypothetical, and each was verified to fail when violated (undated section, missing compare link, stale [Unreleased] link, version with no section, already-published version). It reports ALL problems at once, and a check it cannot run (no git, no network) is reported as unknown rather than as passing. It immediately earned itself: it caught LIB_VERSION still reading 0.6.1. That constant is stamped into the `spawn:version` launch tag and read by Go's pkg/aws/ami_mgmt.go, so shipping it stale would have mislabelled every instance launched by 0.7.0. Bumped, and the coupling is now documented at the bump step in docs/releasing.md rather than left for someone to remember. docs/releasing.md writes the process down: tag last, tag from main, tag only a pushed green commit, and never move a published tag — fix forward, as truffle-ts v0.4.1 did. 0.7.0 is MINOR, not PATCH: `launch` now refuses a spec it previously accepted (#51) and the unbounded-launch guard changed which options satisfy it (#55). A type-compatible change that rejects previously-valid input is still a break.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the "Demo 1: handle expired STS creds gracefully" item.
The bug
Globus→STS sessions are capped at 1 hour (
DurationSeconds: 3600). A Demo 1tab left open past that failed at the next action with a raw SDK error —
Request has expired— which tells the user nothing about what to do.The demo already had the expiration:
credsFromIdTokenreturns it onAwsCreds. Nothing read it.The fix
Tracks it, and follows the same warn-then-expire shape as the portal's
SessionController— deliberately, so two surfaces don't invent two models ofthe same thing.
Federated session valid until 6:35 PM (~60 min).Two details worth noting:
deadline doesn't fire
setTimeouton schedule. A 30s tick keeps the "~N min"honest and is also what notices that case.
onExpiryExpired()is idempotent. It's reachable from the timer, the tick,and every guarded click; it should announce once, not once per click.
The poll loop stops itself on expiry with a note that the instance still
self-terminates on its TTL — true, and the reassuring part:
sporedowns thedeadline, not this tab. Otherwise each 15s tick would be a failing
DescribeInstances.Verification — ran it, didn't just typecheck it
demo/direct/expiry.harness.htmlloads the realmain.tsand drives thereal Globus→STS path, stubbing only
window.fetchandDate.nowso"expired" is reachable without waiting an hour. The actual
armExpiry/onExpiryWarning/onExpiryExpiredcode runs — not a copy.18/18 assertions pass in headless Chrome, covering all three transitions,
both disabled buttons, the re-sign-in affordance, announce-once, the absence of
the old cryptic error, and the paste path showing no clock. Screenshot checked
(red banner, dimmed launch).
Worth recording: an earlier harness revision reported 5 failures that were
harness bugs, not code bugs — a stray
.goclick left the button disabled, sothe next click was a no-op that would have silently faked a pass. Fixed by
asserting the precondition that the button is clickable before the click that
matters.
The harness is dev-only:
vite.config.tslists two explicit inputs, and areal
vite buildproduces no*harness*file (verified).npm run typecheck(src + demo) ✅ · 309 tests pass ✅Also closed by inspection, no code needed
The companion item "poll-render status between launch and terminal state" —
status rows only updating at shutdown — no longer reproduces.
poll()callsrender(inst)on every 15s tick unconditionally (has sinceadd4366), andSpawnClient.get()→EC2Provider.get()is a liveDescribeInstanceswith nocache, so
running/public IP/DNS-confirmed do update live. Nothing to fix.