Skip to content

feat: add [Finally] section and later assert modifier#20

Merged
sleipi merged 4 commits into
mainfrom
feat/finally-section-and-later-modifier
May 22, 2026
Merged

feat: add [Finally] section and later assert modifier#20
sleipi merged 4 commits into
mainfrom
feat/finally-section-and-later-modifier

Conversation

@sleipi
Copy link
Copy Markdown
Owner

@sleipi sleipi commented May 19, 2026

Summary

Implements [Finally] section and later assert modifier for EXIT NEVER entries (#19).

Changes

  • later keyword — Defers assert evaluation to file-end instead of polling. Syntax: stdout contains later "value"
  • [Finally] section — Sends a signal to background process, waits for exit, checks exit code, and evaluates post-signal asserts. Syntax: TERM EXIT 0 timeout 3000
  • Execution order at file-end: entries → later asserts → [Finally] LIFO → @defer LIFO
  • Process kept alive only when later asserts or [Finally] section present; otherwise existing kill-on-timeout behavior unchanged

Files changed

  • internal/types/types.goAssert.Later, Finally struct, Entry.Finally
  • internal/runner/runner.goSignal(), ExitCode(), Wait() on BackgroundProcess
  • internal/parser/parser.golater keyword parsing, [Finally] section parsing
  • internal/executor/executor.goBackgroundEntry(), EvaluateLaterAsserts(), ExecuteFinally()
  • cmd/clitest/run.go — Orchestration updated for new file-end flow
  • SPEC.md — Documented later modifier and [Finally] section
  • ROADMAP.md — Moved items to Completed
  • E2E tests: it_evaluates_later_asserts.clitest, it_executes_finally_section.clitest

Resolves #19

@sleipi sleipi linked an issue May 19, 2026 that may be closed by this pull request
@sleipi sleipi changed the title docs: add [Finally] section and later modifier to roadmap feat: add [Finally] section and later assert modifier May 20, 2026
@sleipi sleipi added the enhancement New feature or request label May 20, 2026
@sleipi sleipi force-pushed the feat/finally-section-and-later-modifier branch from a900d59 to 4efe5ba Compare May 22, 2026 05:36
sleipi added 3 commits May 22, 2026 07:38
…VER entries

- `later` keyword defers assert evaluation to file-end
- `[Finally]` sends signal, checks exit code, evaluates post-signal asserts
- Execution order: entries → later asserts → [Finally] LIFO → @defer LIFO
- Process kept alive only when `later` or `[Finally]` present
Automatically inserts exec for simple commands in EXIT NEVER entries
to ensure signals reach the target process directly on all /bin/sh
implementations (bash, dash, ash).

- Add internal/runner/helper.go with isSimpleCommand() and maybeExec()
- Replace ps -p with kill -0 for Alpine compatibility
- Add test-dash and test-ash Makefile targets
- Add CI jobs for dash (Ubuntu), ash (Alpine), and bash (macOS)
- Update SPEC.md and ROADMAP.md
@sleipi sleipi force-pushed the feat/finally-section-and-later-modifier branch from 4efe5ba to 275d3fb Compare May 22, 2026 05:38
@sleipi sleipi merged commit a715f54 into main May 22, 2026
4 checks passed
@sleipi sleipi deleted the feat/finally-section-and-later-modifier branch May 22, 2026 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: [Finally] section + later assert modifier for EXIT NEVER entries

1 participant