Skip to content

feat: select the GitHub remote and bind refresh to the consented repository (BootUI 2.6.0) - #381

Draft
ffroliva wants to merge 111 commits into
mainfrom
feat/0.11.0-github-service
Draft

ffroliva wants to merge 111 commits into
mainfrom
feat/0.11.0-github-service

Conversation

@ffroliva

@ffroliva ffroliva commented Dec 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

Task 1.8 of the 0.11.0 plan (#367), rows S8, S10, C1, C2 and G1 of the BootUI 2.6.0 delta: the GitHub panel selects
the origin or upstream remote, binds a refresh to the repository the page was given permission for, and reports
the repository context, as BootUI's GitHubDashboardService, GitHubController and GitHubResource do.

  • src/sharpit/engine/collectors/github/selection.py (new): parse_remote_selection (GET) and
    parse_refresh_selection (POST refresh), framework-free ports of BootUI's parsers over the raw query items: a case
    alias of remote (Remote=), a repeated or blank remote, or a value other than origin/upstream is refused;
    the refresh also refuses unknown keys (after the remote is parsed) and requires expectedHost and
    expectedRepository together, each single, non-blank and matching BootUI's patterns in full. Errors carry only the
    three fixed messages.
  • src/sharpit/engine/collectors/github/dashboard.py: the refresh follows BootUI's order (parse, detect once,
    unavailable remote, identity mismatch, API disabled, no client, client). A mismatch returns the ERROR report
    The configured GitHub repository changed after page permission was granted., built as BootUI builds it, with no
    token read, no network call and no cache change. Reports are cached in two slots, origin and upstream, used only
    when the slot's fullName and apiBaseUrl match the detected repository. repositoryContext (selectedRemote,
    origin, upstream, upstreamUnavailableReason) is recomputed on every return and emitted last; a cached report
    is never modified by a caller.
  • src/sharpit/engine/collectors/github/detector.py: Remotes carries the origin unavailable reason from the same
    configuration read.
  • src/sharpit/fastapi/routes/github.py: GET /github and POST /github/refresh read the query items and answer a
    refused query with 400 {"error": <fixed message>}; the guard chain runs before parsing.
  • MCP and the CLI stay on origin; their output gains repositoryContext.
  • Contract and records: docs/reference/BOOTUI-CONTRACT-MVP.md, tests/parity/routes_status.json,
    docs/reference/matrix-updates/0.11.0-github.tsv (deviation rows: the 400 body shape on both routes; parameters
    are read from the query string only).

Behaviour change for users: a report cached for one repository is no longer served after the remote points at a
repository with the same name on another host.

Review scope

The branch was cut from the 0.11.0 integration line, so against main the diff also shows the earlier 0.11.0 pull
requests (Wave 0, #368 to #380). This pull request's changes are in the files listed above and their tests
(tests/engine/collectors/github/test_github_selection.py, test_github_refresh.py, test_github.py,
tests/fastapi/test_github_api.py, tests/fastapi/test_github_refresh_api.py, tests/parity/).

Red evidence

Tests were committed first with the selection module and the new service signatures as stubs; each red is an
assertion (scripts/dev/red_check.py).

Finding Test Red
The refresh ignored the requested remote and refreshed origin test_upstream_is_an_explicit_host_bound_selection_with_independent_caches, test_github_routes_pass_the_selected_remote_to_service assertion
A changed repository was refreshed without the page's permission test_refresh_rejects_a_changed_repository_identity_before_calling_the_client, test_identity_mismatch_precedes_api_disabled_and_missing_client[...] assertion
The cache was checked on the repository name only test_enterprise_and_github_com_with_same_full_name_do_not_collide_in_cache, test_changing_only_the_remote_host_invalidates_the_selected_cache assertion
No repository context in the report test_repository_context_is_the_last_key_on_every_path, test_github_golden_shape_23 assertion
Query parsing (aliases, repeats, blanks, unknown keys, exact patterns, no echo) test_github_selection.py, test_refresh_400_precedence_and_canary_never_echoed assertion
A token-call check could never fail (review) test_raw_query_rejection_precedes_io_and_cache_changes assertion 1 == 0 with the route calling the client before parsing
The origin reason had an unreachable fallback (review) test_detect_remotes_reports_required_origin_reasons assertion

The BootUI tests ported (# ported:) come from GitHubDashboardServiceTests, GitHubControllerTests and
GitHubResourceTest.

Verification

uv run ruff check, uv run ruff format --check, uv run pyright (0 errors); targeted run over the GitHub
collector, FastAPI, parity, safety, CLI, masking, fuzz, root rule and docs tests; the overhead budget tests run alone.
The full suite runs in CI.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
… file

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
…e protocol

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
The Origin header is parsed as scheme://host[:port] with an http or https scheme, as BootUI 2.6.0 does: a path (a trailing slash included), query, fragment, userinfo, control character, trailing colon, unsupported scheme or a port above 65535 makes the origin unreadable, and an unreadable origin is cross-site. The value is no longer trimmed.\n\nA port of more than five digits is refused before int() converts it, in the origin and in the request's own Host, so a very long port is a cross-site refusal and no longer an unhandled ValueError. Adds a property test of the origin parser.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
…UI 2.6.0)

A write that carries Sec-Fetch-Site must send same-origin or none (ASCII, case-insensitive); same-site, cross-site, an empty value and any unknown value are refused. A present but empty Origin header is an unreadable origin and is cross-site, no longer read as absent. A same-site navigation GET still loads the shell, and an API path still requires the request's own scheme, host and port. A request whose own origin cannot be formed stays cross-site where that comparison applies.\n\nDocuments the rule in SECURITY.md and the BootUI contract note, and records the deviations in the 0.11.0 guard matrix fragment.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Record the two deviations of the inactivity log from BootUI 2.6.0 in a matrix fragment, update the MVP plan text that still described the old log line, extract the inactivity logging of install() into a helper to keep its complexity at the pinned count, and wrap one over-long test assertion.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
An invalid SHARPIT_ENABLED must log exactly one record, the fixed warning, as BootUI does. The count of the remaining configuration warnings stays.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
An invalid SHARPIT_ENABLED is already reported by the fixed inactive warning. Counting its settings warning as well produced a second WARNING record, where BootUI logs one.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
…tests

Port BootUiInactiveStartupDiagnosticTests.deliberateDisablementIsSilentAtInfo, cite the BootUI tests the other inactivity tests port, and keep the expected log texts in one test module. A single Inactivity alias types the inactivity category. The matrix row for the warning count records that it leaves out the invalid SHARPIT_ENABLED warning.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>

# Conflicts:
#	tests/fuzz/test_trust_boundary_fuzz.py
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
…sitory (BootUI 2.6.0)

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
…r section

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
…rity

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
# Conflicts:
#	docs/reference/matrix-updates/0.11.0-github.tsv
#	src/sharpit/engine/collectors/github/client.py
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>

This branch has not been deployed

No deployments
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