fix(manifest): make the drift recommendation direction-aware - #271
Merged
Conversation
`ops::compute_diff` diffs `(managed, repo)`, so a delta's `weakens_egress` means "promoting izba.yml would weaken egress". Both drift surfaces narrated a single recommendation regardless of which way the delta cut, so with the live sandbox enforcing and izba.yml carrying `enforce: false` the Manifest tab advised "Review below, then Promote." directly above a red `⚠ weakens egress` marker on that same promote — the banner recommending the action the marker warns about, and the user following it back to `enforce: false`. `izba diff` grows a `next:` line and the app's flat `BANNER_TEXT` lookup becomes `bannerText(state, deltas)`; when any pending delta weakens egress both lead with that fact and point at the managed settings instead. In `repo_ahead` the copy says to keep the managed settings rather than to Export, because `canExport` is false there and Export would be a dead control. `diverged` with an empty delta list — a divergence claim with nothing to show — now says so and recommends Export to realign. The diff arithmetic is untouched: `manifest::diff`, `egress_weakens`, `DriftState`, `compute_diff` and the review token all compute exactly what they computed before. This is the recommendation only; the weakens-ack checkbox still gates the promote, which is still permitted. The `state:` labels stay byte-frozen because `hack/dogfood/gui/gui_oracles.py` maps those exact strings back to drift states, so the guidance lands on its own line; a guard test pins them. The four new weakening strings are shared BYTE-IDENTICALLY across the two surfaces, and that is enforced rather than documented: a Rust test reads `ManifestTab.tsx` at test time and asserts each const appears verbatim, so the surfaces cannot drift apart while both sides' own tests stay green. `manifest-weakens-egress-ack` is the dogfood harness's own oracle for this defect class and its `core` step pinned the contradiction, so it now pins the weakening copy. Refs #241 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Lupus
force-pushed
the
fix/direction-aware-drift-recommendation
branch
from
August 29, 2026 10:37
aa9abbf to
212525a
Compare
|
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 #241
ops::compute_diffdiffs(managed, repo), so a delta'sweakens_egressmeans "promotingizba.ymlwould weaken egress." Both drift surfaces narrated a single recommendation regardless of which way the delta cut. With the live sandbox enforcing andizba.ymlcarryingenforce: false, the Manifest tab read:directly above a red
⚠ weakens egressmarker on that same promote — the banner recommending the action the marker warns about. A user who follows it lands back onenforce: false.What changed
izba diffgrows anext:line; the app's flatBANNER_TEXTlookup becomesbannerText(state, deltas)(andbannerClass, so a weakeningrepo_aheadis no longer neutral-blue above a red marker). When any pending delta weakens egress, both surfaces lead with that fact and point at the managed settings instead.In
repo_aheadthe copy says to keep the managed settings rather than to Export —canExportis false in that state, so recommending Export would point at a dead control.divergedwith an empty delta list (a divergence claim with nothing to show and no next step) now says exactly that and recommends Export to realign.Acceptance criteria
⚠markerbannerText;repo_ahead + weakeningtest also asserts the old copy is absentizba difflikewiserecommendation();next_repo_ahead_weakening_does_not_steer_to_promotedivergedwith identical values recommends nothing that changes anythingDIVERGED_NO_DELTAS/DIVERGED_NO_DELTAS_TEXT+ a test eachcpus 2→4no-regression testmanifest::diff,egress_weakens,DriftState,compute_diff, or the review tokenAC5 is enforced, not documented
The four weakening strings are declared independently in Rust and TypeScript. A doc comment saying "change both together" is a note an editor can miss while every test on both sides stays green — the exact "a rule with a test and a call site without one" shape this repo keeps hitting.
So
shared_recommendation_copy_is_byte_identical_across_surfacesreadsapp/src/components/ManifestTab.tsxat test time and asserts each Rust const appears verbatim. Verified it actually fails: perturbing one TSX literal (izba.yml→izba.yaml) redscargo test -p izba-cli, a required gate on both platforms. The TSX literals are kept unsplit (with// prettier-ignore) precisely so a+concatenation cannot hide drift from that check.Contracts deliberately left byte-frozen
state:labels —hack/dogfood/gui/gui_oracles.py's_CLI_LABEL_TO_STATEmaps those exact strings back to drift states, anddogfood-pt2carriesexpect_stdout_reon them. Hence the guidance lands on its own line; a guard test pins the labels and names why.app/e2e/manifest.spec.ts,hack/dogfood/journeys/manifest-gui.jsonanddogfood-app-guide.md. Confirmed each of those scenarios is genuinely non-weakening: an absentspec.egressnormalizes toEgressPolicyConfig::default()(enforce: false), andegress_weakensreturnsfalsewhenever!from.enforce, so themanaged_ahead/divergedjourneys (which add a host to the live allow-list) never take the weakening branch.97af81c4/607fc3c6removed it becauseFieldClass::Liverenders as a[live]badge in the rows; the new copy says "managed settings".Dogfood journey correction
manifest-weakens-egress-ackseedsenforce: truethen flipsizba.ymltoenforce: false— a genuinely weakeningrepo_ahead, and the harness's own oracle for this defect class. Itscore: truestep pinned the contradiction (Review below, then Promote.and a red⚠ weakens egress), so it was unsatisfiable after the fix. It now pins the weakening copy.Verification
All six workspace gates plus the separate
app/src-tauri+ frontend gate run green locally:cargo test --workspace(1421 + suites, 0 failures),cargo clippy --workspace --all-targets -D warnings,cargo fmt --check, muslizba-init, windows-gnucheck+clippy,vitest514/514,npm run build,npm run lint, andsrc-taurifmt/clippy/test (123 passed).Both halves were written test-first; the failing-before-implementing output is recorded in the working notes.
🤖 Generated with Claude Code
Greptile Summary
The PR makes manifest drift guidance direction-aware so CLI and desktop recommendations do not encourage a promotion that weakens egress.
izba diff.Confidence Score: 5/5
The PR appears safe to merge, with CLI and desktop guidance consistently reflecting whether promotion would weaken egress.
The changed logic only derives recommendation text and styling from existing drift state and weakening flags; repository consumers remain compatible, safety acknowledgments are unchanged, and no actionable defect remains.
Important Files Changed
next:line and comprehensive output-contract tests, including byte consistency with the desktop copy.Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD D[Manifest diff] --> W{Any delta weakens egress?} W -->|Yes| S{Drift state} S -->|Repo ahead| K[Keep managed settings; qualify Promote] S -->|Managed ahead| E[Recommend Export] S -->|Diverged| B[Lead with Export; qualify Promote] W -->|No| N{Diverged with no deltas?} N -->|Yes| R[Recommend Export to realign] N -->|No| O[Use existing state recommendation] K --> C[Render matching CLI and desktop copy] E --> C B --> C R --> C O --> CReviews (1): Last reviewed commit: "fix(manifest): make the drift recommenda..." | Re-trigger Greptile
Context used (4)