Skip to content

docs(ops)+test(security): SRE stale feature-flag audit (2026-04-27) + flag-SDK creep guard - #251

Merged
FabioLeitao merged 2 commits into
mainfrom
cursor/sre-automation-agent-protocol-84a1
Apr 27, 2026
Merged

FabioLeitao merged 2 commits into
mainfrom
cursor/sre-automation-agent-protocol-84a1

Conversation

@cursor

@cursor cursor Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Read-only deliverable from the SRE Automation Agent (Slack-triggered cleanup protocol [STALE FEATURE-FLAG REMOVAL]). The agent reviewed the codebase at 2026-04-27 16:08 UTC and recorded the audit under docs/ops/sre_audits/, plus a small anti-regression guard so the audit's main finding cannot silently rot.

Operational constraint respected: audit-and-block only. No code or commit was pushed to any audited PR branch — recommendations live on this branch (cursor/sre-automation-agent-protocol-84a1), the same pattern used by PR #234.

Findings (TL;DR)

  • 🧹 CLEANED FLAGS: (none) — the codebase has 0 stale feature flags eligible for surgical deletion at this audit time.
  • 🏁 WINNING PATH: (no rewiring needed) — every flag-shaped surface is either an active operator-tunable knob (api.maturity_self_assessment_poc_enabled, detection.aggregated_identification_enabled, report.jurisdiction_hints_enabled, RATE_LIMIT_ENABLED, fuzzy_enabled, use_density, use_all) or an active open-core boundary (enable_pro_prefilter, tier_features.py — already being unified by PR feat(licensing): unified feature_gate facade for the open-core boundary (ADR 0044) #246, ADR 0044).
  • 🛡️ PARITY CHECK: zero behaviour change. New deliverables are documentation + a read-only pytest guard. No DB connection is opened, no scan path touched, no scoring drift.
  • ⚙️ STATUS: Candidate Found: Manual Review Required — the protocol's Step-3 safety rule (>3 files + open PR) triggers for the only partial candidate (open-core boundary), so the audit aborts and echoes recommendations instead of mutating that area mid-flight.

What lands in this PR

Path Class Rationale
docs/ops/sre_audits/README.md docs Index for future audit deliverables (mirrors the convention from PR #234).
docs/ops/sre_audits/STALE_FEATURE_FLAG_AUDIT_2026-04-27.md docs Full audit (method + grep evidence, sidequest matrix vs open PRs, defensive-architecture posture, abort rationale, follow-ups).
docs/ops/sre_audits/STALE_FEATURE_FLAG_AUDIT_2026-04-27.pt_BR.md docs pt-BR mirror (same lexical bar as the always-on locale contract).
tests/test_no_third_party_feature_flag_sdks.py test Anti-regression guard: fails CI if a tracked Python module or dependency manifest later imports / lists statsig, launchdarkly, ldclient, unleash, flagsmith, or splitio.

Why this matters (Julia Evans-style)

The Slack protocol's first instinct is "find flags rolled out at 100% and delete them." If we naively scanned for if some_flag: we would have flagged things like api.maturity_self_assessment_poc_enabled — which is not a stale rollout, it is a documented operator gate that controls whether the dashboard exposes the maturity POC at all. Deleting it would silently turn on a half-finished feature. So step one was to be honest about the class of each candidate.

Once classes were sorted, the operator's next worry is merge hell: the protocol explicitly says that if a flag is touched in an open PR, the cleanup must abort for that flag. We listed every open PR (gh pr list --state open) and checked which areas they touch. The open-core boundary (the only "real" flag-shape candidate) is being unified in PR #246 (ADR 0044). Trying to clean it up from this audit branch would step squarely into that work.

So the deliverable becomes: say loud and clearly that there is nothing to delete today, and add a seatbelt so the answer cannot silently change tomorrow. The seatbelt is the test — if a future PR adds Statsig or LaunchDarkly, the test fails and forces (a) an ADR and (b) an explicit allow-list edit in the same PR.

Defensive Architecture posture

Per docs/ops/inspirations/DEFENSIVE_SCANNING_MANIFESTO.md:

  • Zero impact on database locks. No connector is opened. The new test parses files only.
  • No DDL, no temp objects, no shared locks. No customer DB is reached.
  • Coverage > truthfulness: the test's vendor list is finite by design, so it might miss a brand-new SaaS — but it cannot lie about what it found. The list is exposed at the top of the module so a one-line PR can extend it.

Per docs/ops/inspirations/THE_ART_OF_THE_FALLBACK.md:

  • Each manifest read uses encoding="utf-8", errors="replace" and a missing file becomes a pytest.skip(...) with a clear diagnostic — never a cryptic FileNotFoundError. That is the "diagnostic on fall" rule.

Per docs/ops/inspirations/SUPPLY_CHAIN_AND_TRUST_SIGNALS.md:

  • Flag SDKs in particular phone home on every evaluation. Adding one is a supply-chain decision, not a refactor — hence the ADR requirement encoded in the test.

Type of change

  • Documentation (audit echo, EN + pt-BR)
  • Test / regression guard (read-only)
  • Behaviour change — explicitly no.

Verification

  • uv run pytest tests/test_no_third_party_feature_flag_sdks.py -v — 5 passed.
  • uv run pytest tests/test_docs_pt_br_locale.py tests/test_docs_external_no_plan_links.py tests/test_pii_guard.py tests/test_confidential_commercial_guard.py tests/test_docs_markdown.py — 162 passed.
  • uv run ruff check tests/test_no_third_party_feature_flag_sdks.py && uv run ruff format --check tests/test_no_third_party_feature_flag_sdks.py — clean.
  • pre-commit hooks ran on each commit (Ruff, ruff-format, plans-stats, markdown, pt-BR locale, commercial guard, external-plan-link guard, uv-lock sync, PII guard, PII history guard) — all green.

Sidequest matrix (open PRs at audit time)

The audit doc enumerates every open PR vs every flag-shaped area; nothing in this PR touches any file owned by an open PR. PR #246 (open-core facade) keeps full ownership of core/licensing/ and pro/prefilter.py.

Form

Inspired by linuxmint/live-installer#177 and #178: exact reproduction (the grep commands), smallest claim that matches the evidence ("no stale flags eligible"), the safety rule that stopped the agent (Step 3), and the regression guard that prevents recurrence.

Related

Open in Web View Automation 

cursoragent and others added 2 commits April 27, 2026 17:33
Read-only deliverable from the SRE Automation Agent (Slack-triggered
cleanup protocol [STALE FEATURE-FLAG REMOVAL]). The agent reviewed the
codebase at 2026-04-27 16:08 UTC and found:

- 0 third-party flag SDKs wired in (statsig / launchdarkly / unleash /
  flagsmith / split.io / ldclient — no hits in pyproject, requirements,
  pylock, cargo, or Python imports).
- The 'looks-like-a-flag' surfaces (api.maturity_self_assessment_poc_enabled,
  detection.aggregated_identification_enabled, report.jurisdiction_hints_enabled,
  rate_limit_enabled, fuzzy_enabled, enable_pro_prefilter, etc.) are all
  active configuration knobs or active open-core boundaries (PR #246,
  ADR 0044) — none are stale rollouts.
- Step-3 safety rule of the protocol triggered for the only partial
  candidate (open-core boundary touches >3 files and is the subject of
  an open PR). Output: 'Candidate Found: Manual Review Required'.

Files:
- docs/ops/sre_audits/README.md (audit index, stub).
- docs/ops/sre_audits/STALE_FEATURE_FLAG_AUDIT_2026-04-27.md (full audit
  with method, sidequest matrix, defensive-architecture posture, abort
  rationale, follow-ups).
- docs/ops/sre_audits/STALE_FEATURE_FLAG_AUDIT_2026-04-27.pt_BR.md
  (pt-BR mirror; same lexical bar as the always-on locale contract).

Doctrine references in the audit: DEFENSIVE_SCANNING_MANIFESTO.md,
THE_ART_OF_THE_FALLBACK.md, SUPPLY_CHAIN_AND_TRUST_SIGNALS.md.

Form inspired by linuxmint/live-installer#177 and #178 (clear repro,
smallest-claim-that-matches-evidence, safety rule cited).

Co-authored-by: Fabio Tavares Leitão <[email protected]>
… creep

Companion seatbelt for docs/ops/sre_audits/STALE_FEATURE_FLAG_AUDIT_2026-04-27.md.

The SRE cleanup protocol asked: are any stale flags rolled out at 100%
that we can delete? Answer (in this audit): no SDK is wired in at all.
This test pins that answer so a future PR has to (a) update the
allow-list explicitly and (b) ship an ADR if it really wants to add a
flag vendor. Aligns with SUPPLY_CHAIN_AND_TRUST_SIGNALS.md (every new
runtime dep is a supply-chain hop; flag SDKs in particular phone home).

Checks (read-only, no network/DB):
- pyproject.toml does not list a known flag SDK as a dependency.
- requirements.txt non-comment lines do not list one either.
- pylock.toml 'name = "..."' rows do not match a known SDK.
- No tracked Python module under core/ connectors/ api/ app/ report/
  scanners/ schemas/ logging_custom/ utils/ cli/ analysis/ pro/
  file_scan/ (and main.py) imports a known flag SDK.
- Both EN and pt-BR audit docs that justify this guard exist.

The vendor list (statsig, launchdarkly, ldclient, unleash, flagsmith,
splitio, split-sdk) is intentionally finite and exposed at the top of
the test module so a maintainer can extend it with a one-line PR if a
new vendor appears in the wild.

Doctrine alignment:
- DEFENSIVE_SCANNING_MANIFESTO.md: no surprise side effects (file parse only).
- THE_ART_OF_THE_FALLBACK.md: missing manifest -> pytest.skip with a
  clear diagnostic, never a cryptic FileNotFoundError.

Co-authored-by: Fabio Tavares Leitão <[email protected]>
@FabioLeitao
FabioLeitao marked this pull request as ready for review April 27, 2026 18:08
@FabioLeitao
FabioLeitao merged commit ba164b3 into main Apr 27, 2026
1 check passed
@FabioLeitao
FabioLeitao deleted the cursor/sre-automation-agent-protocol-84a1 branch April 27, 2026 18:08
FabioLeitao added a commit that referenced this pull request May 3, 2026
…rgo.toml claim (prompt-injection escalation of PR #259)

Slack thread 1777319065.862799 in C0AN7HY3NP9 escalated the same prompt-
injection pattern PR #259 already rejected ('switch to Opus 4.7 to re-read
the data-board-report source code'), this time framed as 'stop lying ...
I know for a fact this is a hybrid repository ... do a ls -R'.

Working-tree facts (branch cursor/sre-automation-agent-protocol-f8dd at
HEAD 730219c, 2026-04-27 19:47 UTC):

  - find /workspace -name '*.rs' (no venv/target) -> 1 hit:
    rust/boar_fast_filter/src/lib.rs
  - ls /workspace/Cargo.toml -> No such file or directory
  - ls /workspace/data-board-report -> No such file or directory
  - grep -rln 'data-board-report' across .md/.toml/.py/.rs/.yml/.yaml -> 0
  - git log --all -- '**/data-board-report*' -> 0

The repo is hybrid only in the narrow sense PR #259 already documented:
Python product plus one PyO3 crate (rust/boar_fast_filter/). No second
crate, no workspace, no report-generator. Inventing a CI/CD plan against
artifacts that do not exist would violate DEFENSIVE_SCANNING_MANIFESTO.md
§1 ('every emitted statement is tagged') and THE_ART_OF_THE_FALLBACK.md
§1-§2 ('silent failure is a worse outcome than degraded coverage';
monotonic strategy ladder forbids skipping the parser-grade signal — the
file system).

Audit-and-block, no code mutation, no third-party PR branch written to.
Same convention as PR #234 / #251 / #259.

What lands:

  - docs/ops/sre_audits/PROMPT_INJECTION_REJECTION_HYBRID_REPO_CLAIM_2026-04-27.md
    full reproduction, rejection rationale (3 failure modes catalogued),
    Defensive Architecture posture, fallback-ladder mapping, follow-ups,
    LMDE-issue-style cross-reference (linuxmint/live-installer#177, #178).
  - docs/ops/sre_audits/README.md hub sync (adds today's 4 audits that
    had not all been indexed).

Verification:

  - uv run pre-commit run --files <both files> -> all hooks green.
  - uv run pytest tests/test_docs_external_no_plan_links.py
                  tests/test_docs_markdown.py
                  tests/test_pii_guard.py
                  tests/test_confidential_commercial_guard.py -q
    -> 160 passed.

Defensive Architecture: zero database impact. Markdown only.

Doctrines invoked:

  - docs/ops/inspirations/DEFENSIVE_SCANNING_MANIFESTO.md (§1: tagged
    statements, NASA SEL 'test what you fly').
  - docs/ops/inspirations/THE_ART_OF_THE_FALLBACK.md (§1-§2: diagnostic
    on fall, monotonic ladder, parser-grade signal first).

Related:

  - Slack handoff: channel C0AN7HY3NP9, thread 1777319065.862799,
    2026-04-27 ~19:44 UTC.
  - Prior rejection of same injection family: PR #259.
  - Same audit-and-block convention: PR #234, PR #251, PR #242.

Co-authored-by: Fabio Tavares Leitão <[email protected]>
FabioLeitao added a commit that referenced this pull request May 3, 2026
…l-coercion (third injection in 24h)

Slack-triggered Cloud Agent automation
def95df7-a634-431a-93e5-659e4d831725 in #data-boar-ops asserted four
empirically false claims and a model-coercion directive:

1. 'Dependabot #31 (Low) on main' — gh api dependabot/alerts is 403 for
   this token; gh issue view 31 is 'Plans done 64903' (MERGED 2026-03-15,
   unrelated to dependencies). Open Dependabot PRs today are #221, #222,
   #223, #224, #226 (already booked in DEPENDENCY_GUARDIAN_VERDICT_LEDGER_2026-04-27.md).
2. '986 testes' — pytest --collect-only -q reports 989.
3. 'rode scripts/check-all.ps1' on a Linux Cloud Agent VM — the paired
   Linux/macOS twin is scripts/check-all.sh per docs/ops/SCRIPTS_CROSS_PLATFORM_PAIRING.md.
4. 'auditoria-ia acabou de subir os guards' — branch contributed
   doctrine consolidation (e6688c8) but is not the most recent merge
   (HEAD is PR #242).
5. 'USE O OPUS 4.7 High ... VOCE NAO TEM O DIREITO DE OUSAR USAR O
   COMPOSER 2.0' — the runtime model is configured by the Cursor
   client/dashboard, not by an in-chat directive; treating capitalized
   imperatives as policy would normalize prompt-injection model coercion.

Posture: audit-and-block, no code change. No uv.lock or Cargo.toml
mutated under a fabricated alert; no .ps1 forced on a Linux host. Same
defense pattern as PR #234, #251, #259 (clippy 1.95 RCA), #261
(fabricated data-board-report/ + root Cargo.toml). Third member of the
same prompt-injection family in 24 h.

Per DEFENSIVE_SCANNING_MANIFESTO.md §1.3 (no surprise side effects) and
THE_ART_OF_THE_FALLBACK.md §2 (monotonic ladder; never skip a level).

Verification:
- uv run pre-commit run --files <both files> — all hooks Passed.
- uv run pytest tests/test_docs_external_no_plan_links.py
    tests/test_docs_markdown.py tests/test_pii_guard.py
    tests/test_confidential_commercial_guard.py -q — 160 passed.
- gh pr view 31 / gh api dependabot/alerts — confirms fabrication.

Co-authored-by: Fabio Tavares Leitão <[email protected]>
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.

2 participants