You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(core): make loading, the local view and recording a decision callable without a terminal (#343) - #351
A change of structure with no change of behaviour, so that a caller other than the terminal — the server, in #345 — can use what the commands use. Three things move from inka-cli into inka-core, as plain operations
that take inputs and return typed results:
argument::load_argument composes loading, graph construction, shape validation and projection, and
answers with the Argument or the findings that Rejected it — as data, written nowhere. A rejection also
carries a typed RejectionCause: the stage that refused the project (load, sources, graph or shape), with the
loader's LoadError kept whole for a load failure, so a caller need not parse a message. inka-cli/src/load.rs keeps only rendering those findings to a stream.
local::LocalContent is a node's local view as content to present: the comment on the block, the
description, the evidence reference, the children with their entry comments, the deadline — the content and
order inka review prints. write_target renders it instead of reading the view itself.
review::current_hash, record_decision and decide compute the hash a decision names, append the
record, and — with an expected hash — refuse when the content is no longer what was shown. Errors are a typed DecideError whose messages are the ones the CLI printed.
No new crate and no dispatch layer; inka-core stays synchronous.
Test results
cargo test --workspace: all pass. No existing test or snapshot changed, apart from two added imports in the
test module of inka-cli/src/review.rs.
New unit tests cover the three operations, including the refusal of a changed hash, which writes nothing.
Impact
None on behaviour. inka-core gains a public API (argument, local, and the decision operations in review); tempfile becomes a dev-dependency of inka-core.
Supplementary information
The expected-hash guard in decide has no caller yet: the CLI judges the project as it was loaded. #347 uses it.
Reviewing files that changed from the base of the PR and between 5c37425 and 773941d.
Files ignored due to path filters: 1
Cargo.lock is excluded by !**/*.lock, !**/Cargo.lock
Files selected for processing: 10
crate/inka-cli/src/eval.rs
crate/inka-cli/src/load.rs
crate/inka-cli/src/review.rs
crate/inka-core/Cargo.toml
crate/inka-core/src/argument.rs
crate/inka-core/src/lib.rs
crate/inka-core/src/local.rs
crate/inka-core/src/review.rs
docs/en/design/web-ui.md
docs/ja/design/web-ui.md
Walkthrough
The PR moves project loading, local node-content assembly, and review-decision recording into inka-core. The CLI calls these core APIs and renders their returned data and diagnostics. Tests cover loading outcomes, local content, decision recording, hash mismatches, and invalid targets.
inka-core adds argument-loading APIs that return the manifest, evidence, validated view, source map, and warnings, or rejection diagnostics. The CLI delegates loading to this API and renders warnings or diagnostics.
Build and render local node content crate/inka-core/src/local.rs, crate/inka-core/src/lib.rs, crate/inka-cli/src/review.rs
inka-core adds structured local content for node details, evidence, children, and deadlines. The review CLI renders the supplied content, including child descriptions and comments.
Record decisions through core review APIs crate/inka-core/src/review.rs, crate/inka-cli/src/review.rs
inka-core adds decision recording with target validation and an optional expected-hash check. The CLI passes single decisions and queued decisions to the core APIs. Tests cover successful records, hash mismatches, unknown targets, and unhashable targets.
sequenceDiagram
participant InkaCli
participant InkaCoreReview
participant ApprovalStore
InkaCli->>InkaCoreReview: decide with target and optional expected hash
InkaCoreReview->>InkaCoreReview: calculate current view hash
InkaCoreReview->>ApprovalStore: append decision record
ApprovalStore-->>InkaCoreReview: return record
InkaCoreReview-->>InkaCli: return record or typed error
Loading
Possibly related issues
Issue 344 — This PR adds the structured local-content types that the Web UI data types depend on; it does not add generated front-end types.
Issue 340 — This PR implements core operations described as part of the Web UI revision.
Issue 345 — This PR supplies core loading and local-view operations that the server route needs.
Issue 346 — This PR moves local-view content into core as structured data for the browser rendering work.
Issue 347 — This PR adds decision recording with an expected-hash check; it does not add the browser route or its safeguards.
Path filters excluded changed files. This rating applies only to the assessed changes.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the refactor scope (core loading, local view, and decision recording callable without a terminal) and the issue number. The changeset moves project loading into inka-core as load_argum…
Linked Issues check
Directly linked issue #343 has five closing conditions. Current PR #351 addresses each one (stack objectives, current PR evidence):
1. Load project into shared view, returning view or diagnostics as …
Out of Scope Changes check
All changes introduced by PR #351 map to #343 objectives or their direct support: - inka-core/src/argument.rs, local.rs, review.rs and lib.rs changes implement the loading, local-view and deci…
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check
Explanation
The title names the refactor scope (core loading, local view, and decision recording callable without a terminal) and the issue number. The changeset moves project loading into inka-core as load_argument, adds LocalContent, and adds current_hash, record_decision, and decide. The title covers the main change. It is somewhat long at 104 characters, but it is specific and accurate.
Full details: Linked Issues check
Explanation
Directly linked issue #343 has five closing conditions. Current PR #351 addresses each one (stack objectives, current PR evidence):
Load project into shared view, returning view or diagnostics as data [#343]: Addressed by PR #351. inka-core/src/argument.rs adds load_argument and load_argument_with, returning Result<Argument, Rejected>. Rejected carries SourceMap and Diagnostics. inka-cli/src/load.rs only renders them.
Local view of a node as structure, in inka review order [#343]: Addressed by PR #351. inka-core/src/local.rs adds LocalContent::of, which preserves direct-child declaration order. review.rs queue rendering reads content from LocalContent.
Record one decision: compute hash, optionally refuse on expected-hash mismatch, append record, typed errors [#343]: Addressed by PR #351. review.rs adds current_hash, record_decision, decide and DecideError. The expected-hash refusal occurs before any write.
CLI uses these operations and keeps only parsing, prompting, rendering [#343]: Addressed by PR #351. load.rs, review.rs and eval.rs delegate to core, per the change summaries.
Existing CLI tests and snapshots pass unchanged [#343]: Addressed by PR #351 per the author report. Only two imports were added in the review.rs test module. No snapshot changed. Test results are author-reported; I did not re-run them.
Limits: Stack members #341 (uncertain), #354 and #355 (uncertain) lack current review evidence. #341 is the merge base of this PR, so its code is part of the base that the reviewed changes use. Its content was not separately reviewed. Later members are not required by #343 objectives and were not used to establish compliance. Evidence relies on the supplied file summaries and author report.
Full details: Out of Scope Changes check
Explanation
All changes introduced by PR #351 map to #343 objectives or their direct support:
inka-core/src/argument.rs, local.rs, review.rs and lib.rs changes implement the loading, local-view and decision operations (#343).
inka-cli changes (load.rs, review.rs, eval.rs) remove the moved logic and call core operations (#343).
inka-core/Cargo.toml adds tempfile as a dev-dependency. It supports the new unit tests only.
Cargo.lock is in ignored_files and was not assessed.
The expected-hash guard in decide has no CLI caller yet. It is part of the #343 requirement for optional refusal, so it is in scope.
No unrelated behaviour change was identified in the supplied evidence.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.
Preserve the structural load error alongside its diagnostic.
This conversion removes the LoadError variant and its underlying cause. A non-terminal caller cannot distinguish a missing manifest from a permission failure without parsing text. Retain a typed rejection cause alongside diagnostics; the CLI can continue to render the same message.
Based on learnings, “Flag library code that swallows or erases error context by converting to generic error types.”
Reviewing files that changed from the base of the PR and between 40a1e60 and 5c37425.
Files ignored due to path filters: 1
Cargo.lock is excluded by !**/*.lock, !**/Cargo.lock
Files selected for processing: 8
crate/inka-cli/src/eval.rs
crate/inka-cli/src/load.rs
crate/inka-cli/src/review.rs
crate/inka-core/Cargo.toml
crate/inka-core/src/argument.rs
crate/inka-core/src/lib.rs
crate/inka-core/src/local.rs
crate/inka-core/src/review.rs
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
… callable without a terminal (#343)
Three things a caller other than the terminal needs lived inside `inka-cli`,
tied to its output:
- `argument::load_argument` loads a project to the shared view and answers
with the argument or the findings that rejected it, as data.
- `local::LocalContent` is a node's local view as content to present: what
`inka review` prints, in the order it prints it.
- `review::decide` and `review::record_decision` compute the current hash,
optionally refuse when it is not the expected one, and append the record,
with typed errors.
`inka-cli` calls these and keeps argument parsing, prompting and rendering.
No behaviour changes: the existing tests and snapshots pass as they were.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014DUhbQ16uSDG5M4Lt9o3NM
…ror (#343)
`Rejected` carried only the findings, so a caller that is not a terminal had
to parse a message to tell a missing manifest from a permission failure.
`RejectionCause` names the stage that refused the project — load, sources,
graph or shape — and for a load failure keeps the loader's `LoadError` whole.
The findings, and what the CLI prints, are unchanged.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014DUhbQ16uSDG5M4Lt9o3NM
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
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.
Description
Closes #343. Part of #340. Stacked on #341.
A change of structure with no change of behaviour, so that a caller other than the terminal — the server, in
#345 — can use what the commands use. Three things move from
inka-cliintoinka-core, as plain operationsthat take inputs and return typed results:
argument::load_argumentcomposes loading, graph construction, shape validation and projection, andanswers with the
Argumentor the findings thatRejectedit — as data, written nowhere. A rejection alsocarries a typed
RejectionCause: the stage that refused the project (load, sources, graph or shape), with theloader's
LoadErrorkept whole for a load failure, so a caller need not parse a message.inka-cli/src/load.rskeeps only rendering those findings to a stream.local::LocalContentis a node's local view as content to present: the comment on the block, thedescription, the evidence reference, the children with their entry comments, the deadline — the content and
order
inka reviewprints.write_targetrenders it instead of reading the view itself.review::current_hash,record_decisionanddecidecompute the hash a decision names, append therecord, and — with an expected hash — refuse when the content is no longer what was shown. Errors are a typed
DecideErrorwhose messages are the ones the CLI printed.No new crate and no dispatch layer;
inka-corestays synchronous.Test results
cargo test --workspace: all pass. No existing test or snapshot changed, apart from two added imports in thetest module of
inka-cli/src/review.rs.cargo clippy --workspace --all-targets -- -D warnings: clean.Impact
None on behaviour.
inka-coregains a public API (argument,local, and the decision operations inreview);tempfilebecomes a dev-dependency ofinka-core.Supplementary information
The expected-hash guard in
decidehas no caller yet: the CLI judges the project as it was loaded. #347 uses it.🤖 Generated with Claude Code
https://claude.ai/code/session_014DUhbQ16uSDG5M4Lt9o3NM