Skip to content

Add CI workflows, scan config, and align README - #2

Closed
robotrocketscience wants to merge 4 commits into
mainfrom
chore/staging-gate-and-publish
Closed

Add CI workflows, scan config, and align README#2
robotrocketscience wants to merge 4 commits into
mainfrom
chore/staging-gate-and-publish

Conversation

@robotrocketscience

Copy link
Copy Markdown
Owner

Summary

  • .github/workflows/staging-gate.yml — gitleaks + pattern scan + history scan + pytest matrix on PR to main and push to staging
  • .github/workflows/ci.yml — pytest matrix on PR to main
  • .github/workflows/publish.yml — Trusted Publishing scaffold gated on v[0-9]+.[0-9]+.[0-9]+ tags; build-provenance attestation included
  • .gitleaks.toml — extends gitleaks defaults with project allowlist
  • .github-pii-exempt — exemption glob list for the pattern scan
  • README — headline aligned with shipped functionality
  • Source docstrings — scrubbed of internal references; pyproject.toml description updated to match README

All commits SSH-signed.

Test plan

  • CI green
  • Staging Gate green

@robotrocketscience
robotrocketscience deleted the chore/staging-gate-and-publish branch April 26, 2026 21:51
robotrocketscience added a commit that referenced this pull request May 5, 2026
Pure-function module that takes BFS hits, examines each surfaced
belief's incoming edges via store.edges_to, and applies a
configurable multiplicative penalty per matching edge type.
POTENTIALLY_STALE keyed by default at 0.5; multi-edge-type
composition is multiplicative. Returns a new ScoredHop list sorted
by (-score, belief.id) — the same tie-break used by expand_bfs so
the two passes compose without order surprises.

Acceptance #1, #2, #4 of the issue. Tests + bench-gate stub follow.
robotrocketscience added a commit that referenced this pull request May 5, 2026
)

Re-runs the labeled adversarial corpus through the v3 flag-on path
(use_value_comparison=True). Computes confusion-matrix tp/fp/fn/tn
on the contradicts-vs-not axis and asserts both recall and precision
floors. Per #422 acceptance #2, calibrated against #201's R2 numbers
(recall 0.033 / precision 0.667). Skip-on-no-corpus + row floor of
30 contradicts-labeled rows for stable recall measurement.

Failure message surfaces both dimensions so the operator can see
which floor is gating without re-running.
robotrocketscience added a commit that referenced this pull request May 5, 2026
)

Re-runs the labeled adversarial corpus through the v3 flag-on path
(use_value_comparison=True). Computes confusion-matrix tp/fp/fn/tn
on the contradicts-vs-not axis and asserts both recall and precision
floors. Per #422 acceptance #2, calibrated against #201's R2 numbers
(recall 0.033 / precision 0.667). Skip-on-no-corpus + row floor of
30 contradicts-labeled rows for stable recall measurement.

Failure message surfaces both dimensions so the operator can see
which floor is gating without re-running.
robotrocketscience added a commit that referenced this pull request May 8, 2026
Capture the 2026-05-06 ratification of all eight design asks in the
spec memo. Seven resolved against the spec's recommendations; #2 (what
"all" means) overridden — operator picked full benchmarks instead of
the recommended sized headline cut.

Adds a Ratification section at the bottom with the resolved table, the
superseded headline-cut numbers (LongMemEval full vs oracle subset,
StructMemEval --bench big vs small), the multi-hour cron-runtime
implication, and the 8-step implementation order this PR follows.
robotrocketscience added a commit that referenced this pull request May 8, 2026
Capture the 2026-05-06 ratification of all eight design asks in the
spec memo. Seven resolved against the spec's recommendations; #2 (what
"all" means) overridden — operator picked full benchmarks instead of
the recommended sized headline cut.

Adds a Ratification section at the bottom with the resolved table, the
superseded headline-cut numbers (LongMemEval full vs oracle subset,
StructMemEval --bench big vs small), the multi-hour cron-runtime
implication, and the 8-step implementation order this PR follows.
robotrocketscience added a commit that referenced this pull request May 9, 2026
…dy for PR

Closes the mcp-builder audit of src/aelfrice/mcp_server.py started this
session. Resolves both CRITICAL findings, all six MAJOR findings, and
five of the eight MINOR findings. The deferred minors are documented
in this gate body for triage in follow-up issues.

## Commits in scope (10 atomic + 1 phase-1 gate before this)

  Phase 1 — server is startable and discoverable
    9adca85 feat(mcp): aelf mcp subcommand + python -m fallback
    904bfb0 feat(mcp): docstrings on all 12 wrappers + AST regression guard
    455eaac docs(mcp): document `aelf mcp` entrypoint + fix stale refs
    46df710 gate: phase 1

  Phase 2 — well-formed
    a7576ad feat(mcp): annotations on every @mcp.tool
    232d8ab feat(mcp): instructions= overview + 9-vs-12 stale comment fix
    5f21c29 fix(mcp): tool_lock structured error vs AssertionError

  Phase 3 — input/output discipline
    6c6bf6c feat(mcp): Pydantic Field constraints via Annotated
    174d245 feat(mcp): cursor pagination on tool_locked
    7f04675 feat(mcp): response_format=markdown on read tools

  Phase 4 — wrapper-layer testing
    0214c17 test(mcp): wrapper-layer tests via static AST + fastmcp shim

## Verification

- pytest 76/76 passing across MCP test files (40 prior + 36 new):
    test_mcp_server.py, test_mcp_lock_via_worker.py,
    test_mcp_wrapper_layer.py, test_cli_mcp.py
- aelf --help: 'mcp' subcommand visible with help string
- aelf mcp (no [mcp] extra): exits 1 with actionable stderr
- Static AST guards: docstrings, annotations, instructions=, store
  lifetime, no print()-to-stdout, all green
- fastmcp shim test: 12 tools register, all with full annotations,
  read-only / destructive sets match expected
- Discretion grep: clean (only mentions Claude Code/Desktop, both
  pre-existing on main as the intended MCP host targets)

## Audit findings closure

  CRITICAL  #1  Server unstartable  → CLOSED (Phase 1 C1)
  CRITICAL  #2  Empty tool descriptions  → CLOSED (Phase 1 C2)
  MAJOR     #3  No tool annotations  → CLOSED (Phase 2 M1)
  MAJOR     #4  No Pydantic input validation  → CLOSED (Phase 3 I1)
  MAJOR     #5  No server instructions=  → CLOSED (Phase 2 M2)
  MAJOR     #6  No README/docs MCP setup section  → CLOSED (Phase 1 C3)
  MAJOR     #7  Registration layer untested  → CLOSED (Phase 4)
  MAJOR     #8  tool_lock hard assert  → CLOSED (Phase 2 M4)
  MINOR    #11  No response_format enum  → CLOSED (Phase 3 I2)
  MINOR    #12  No pagination on aelf_locked  → CLOSED (Phase 3 I3)
  MINOR    #13  Stale 9-vs-12 tools comment  → CLOSED (Phase 2 M3)

## Deferred (file follow-up issues)

  MINOR    #1   Server name "aelfrice" vs convention "aelfrice_mcp"
                — backwards-compat break, not load-bearing. Defer.
  MINOR    #6   Sync handlers (no async def) — defensible for SQLite,
                revisit if/when an async I/O dep lands.
  MINOR    #14  Polymorphic tool_onboard (3 input shapes in one tool)
                — design call. Re-evaluate after host telemetry.
  MINOR    #15  Untyped fastmcp cast `_FastMCP: Any` — fastmcp lacks
                stubs upstream. Pragmatic; revisit when stubs ship.

## Behavior changes worth flagging in PR description

- `tool_locked` return shape: ADDED keys total/has_more/next_offset.
  Existing keys (kind/n/locked) preserved. Callers that consumed
  `n` as "total locks across all locks" should switch to `total`.
- `tool_locked` returns first 50 by default instead of all locks. Tests
  on stores with <50 locks behave identically.
- `tool_lock` returns lock.error dict (with `error` field) instead of
  raising AssertionError on empty derivation. Callers that grep for
  AssertionError need to update; callers that check `out["kind"]` are
  fine.

## Blockers (require user decision before next phase)

- [user] Open PR? Branch is local-only on `feat/mcp-server-properly-built`.
  Need a `git push -u github feat/mcp-server-properly-built` to land it,
  then `gh pr create`. Not done by this gate.
- [user] File the four deferred-minor follow-up issues now or after
  PR merge?
- [user] Resume parked feat/aelf-upgrade-imperative work next session?
  That branch has no commits but the worktree state is captured in the
  end-of-session handoff.

Open questions: (none)

Rollback:
- Whole branch: never merged → just delete `feat/mcp-server-properly-built`.
- Per-phase: `git revert <phase-commit-range>` (see commit list above).
robotrocketscience added a commit that referenced this pull request May 9, 2026
…rchestrator

PR #432 renamed the slash command from `/aelf:upgrade` to
`/aelf:upgrade-cmd` (advisory: prints the upgrade command line; user
runs it). Reverses that rename: the slash command goes back to
`/aelf:upgrade` and now orchestrates the imperative upgrade directly
via Bash.

The mid-process replacement concern from #427 doesn't apply here. The
slash command's Bash block runs `uv tool upgrade` (or equivalent) in a
subprocess separate from the running `aelf` — `aelf` itself never
shells out to pip/uv. So the advisory framing was over-cautious for
the slash surface (it still applies to the CLI verb, which keeps the
`aelf upgrade-cmd` advisory name).

Slash command process (in src/aelfrice/slash_commands/upgrade.md):
  1. `aelf upgrade-cmd --check` → detect install context + check for update
  2. Run the printed install-aware command (uv tool upgrade / pipx upgrade / pip install --upgrade)
  3. `aelf setup` → redeploy slash command bundle (orphan-prunes any
     renamed files), refresh hook wiring
  4. `aelf upgrade-cmd` → clears the stale update-cache so the orange
     statusline banner disappears immediately

CLI surface unchanged: `aelf upgrade-cmd` (canonical advisory print)
and `aelf upgrade` (deprecated alias) both still work as before.

test_slash_commands.py reorg:
  - EXPECTED_COMMANDS: upgrade-cmd → upgrade
  - HIDDEN_SUBCOMMANDS: upgrade → upgrade-cmd (CLI verb has no slash file)
  - test_slash_command_invokes_matching_cli: add _INVOKE_EXEMPT dict
    so /aelf:upgrade is allowed to orchestrate multiple CLI calls
    instead of a single `uv run aelf upgrade` passthrough

docs/SLASH_COMMANDS.md row updated to describe the new orchestration.

Phase 1 of feat/upgrade-imperative-rename branch (Task #2). No CLI
behavior change.
robotrocketscience added a commit that referenced this pull request May 9, 2026
…dy for PR

Closes the mcp-builder audit of src/aelfrice/mcp_server.py started this
session. Resolves both CRITICAL findings, all six MAJOR findings, and
five of the eight MINOR findings. The deferred minors are documented
in this gate body for triage in follow-up issues.

## Commits in scope (10 atomic + 1 phase-1 gate before this)

  Phase 1 — server is startable and discoverable
    9adca85 feat(mcp): aelf mcp subcommand + python -m fallback
    904bfb0 feat(mcp): docstrings on all 12 wrappers + AST regression guard
    455eaac docs(mcp): document `aelf mcp` entrypoint + fix stale refs
    46df710 gate: phase 1

  Phase 2 — well-formed
    a7576ad feat(mcp): annotations on every @mcp.tool
    232d8ab feat(mcp): instructions= overview + 9-vs-12 stale comment fix
    5f21c29 fix(mcp): tool_lock structured error vs AssertionError

  Phase 3 — input/output discipline
    6c6bf6c feat(mcp): Pydantic Field constraints via Annotated
    174d245 feat(mcp): cursor pagination on tool_locked
    7f04675 feat(mcp): response_format=markdown on read tools

  Phase 4 — wrapper-layer testing
    0214c17 test(mcp): wrapper-layer tests via static AST + fastmcp shim

## Verification

- pytest 76/76 passing across MCP test files (40 prior + 36 new):
    test_mcp_server.py, test_mcp_lock_via_worker.py,
    test_mcp_wrapper_layer.py, test_cli_mcp.py
- aelf --help: 'mcp' subcommand visible with help string
- aelf mcp (no [mcp] extra): exits 1 with actionable stderr
- Static AST guards: docstrings, annotations, instructions=, store
  lifetime, no print()-to-stdout, all green
- fastmcp shim test: 12 tools register, all with full annotations,
  read-only / destructive sets match expected
- Discretion grep: clean (only mentions Claude Code/Desktop, both
  pre-existing on main as the intended MCP host targets)

## Audit findings closure

  CRITICAL  #1  Server unstartable  → CLOSED (Phase 1 C1)
  CRITICAL  #2  Empty tool descriptions  → CLOSED (Phase 1 C2)
  MAJOR     #3  No tool annotations  → CLOSED (Phase 2 M1)
  MAJOR     #4  No Pydantic input validation  → CLOSED (Phase 3 I1)
  MAJOR     #5  No server instructions=  → CLOSED (Phase 2 M2)
  MAJOR     #6  No README/docs MCP setup section  → CLOSED (Phase 1 C3)
  MAJOR     #7  Registration layer untested  → CLOSED (Phase 4)
  MAJOR     #8  tool_lock hard assert  → CLOSED (Phase 2 M4)
  MINOR    #11  No response_format enum  → CLOSED (Phase 3 I2)
  MINOR    #12  No pagination on aelf_locked  → CLOSED (Phase 3 I3)
  MINOR    #13  Stale 9-vs-12 tools comment  → CLOSED (Phase 2 M3)

## Deferred (file follow-up issues)

  MINOR    #1   Server name "aelfrice" vs convention "aelfrice_mcp"
                — backwards-compat break, not load-bearing. Defer.
  MINOR    #6   Sync handlers (no async def) — defensible for SQLite,
                revisit if/when an async I/O dep lands.
  MINOR    #14  Polymorphic tool_onboard (3 input shapes in one tool)
                — design call. Re-evaluate after host telemetry.
  MINOR    #15  Untyped fastmcp cast `_FastMCP: Any` — fastmcp lacks
                stubs upstream. Pragmatic; revisit when stubs ship.

## Behavior changes worth flagging in PR description

- `tool_locked` return shape: ADDED keys total/has_more/next_offset.
  Existing keys (kind/n/locked) preserved. Callers that consumed
  `n` as "total locks across all locks" should switch to `total`.
- `tool_locked` returns first 50 by default instead of all locks. Tests
  on stores with <50 locks behave identically.
- `tool_lock` returns lock.error dict (with `error` field) instead of
  raising AssertionError on empty derivation. Callers that grep for
  AssertionError need to update; callers that check `out["kind"]` are
  fine.

## Blockers (require user decision before next phase)

- [user] Open PR? Branch is local-only on `feat/mcp-server-properly-built`.
  Need a `git push -u github feat/mcp-server-properly-built` to land it,
  then `gh pr create`. Not done by this gate.
- [user] File the four deferred-minor follow-up issues now or after
  PR merge?
- [user] Resume parked feat/aelf-upgrade-imperative work next session?
  That branch has no commits but the worktree state is captured in the
  end-of-session handoff.

Open questions: (none)

Rollback:
- Whole branch: never merged → just delete `feat/mcp-server-properly-built`.
- Per-phase: `git revert <phase-commit-range>` (see commit list above).
robotrocketscience added a commit that referenced this pull request May 13, 2026
Staging Gate's release-docs-check tripped:
  Missing compare-link footnote '[3.0.0]: https://github.com/...' near
  bottom of file.

Per docs/RELEASING.md step 4: 'Move [Unreleased] CHANGELOG entries into
[X.Y.Z] — YYYY-MM-DD. Add link footnote.' I shipped the dated section in
a6124df but forgot the footnote. Add it now, and bump the [Unreleased]
compare-anchor from v2.0.1 (which was already stale; #2.1.0 was the
prior cut) to v3.0.0 so the [Unreleased] diff is correct on top of the
release we are cutting.
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.

1 participant