Extract baseline thresholds, harden symlink-aware batch path handling, and stabilize playbook-count assertions#27
Conversation
…sertions Agent-Logs-Url: https://github.com/faultline-cli/faultline/sessions/88f40f7b-b509-46d5-a7fb-b07fede2ee3f Co-authored-by: jacoblehr <16401696+jacoblehr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/faultline-cli/faultline/sessions/88f40f7b-b509-46d5-a7fb-b07fede2ee3f Co-authored-by: jacoblehr <16401696+jacoblehr@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR extracts fixture baseline thresholds into named constants, tightens batch source path handling, and updates supporting tests/docs/smoke checks.
Changes:
- Adds package-level baseline threshold constants in
internal/app/service.go. - Introduces batch path resolution validation plus focused helper tests.
- Updates test helpers, catalog count documentation, and smoke assertions.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
internal/app/service.go |
Adds threshold constants and path validation for batch inputs. |
internal/app/batch_test.go |
Adds tests for path resolution behavior. |
internal/repo/signals_test.go |
Replaces rune-based string generation with formatted numeric names. |
internal/store/store_helpers_test.go |
Clarifies expected nullable bool test value. |
llms.txt |
Updates top-level playbook count text. |
scripts/cli-smoke.sh |
Loosens pack provenance smoke assertions. |
Comments suppressed due to low confidence (1)
scripts/cli-smoke.sh:156
- This second provenance assertion also drops the starter pack
playbook_count, so the extra-pack smoke path can pass even if the bundled catalog is incomplete or reports the wrong count. Keep checking the expected current count while separately asserting the installed example pack entry.
grep -F '"pack_provenance":[{"name":"starter"' "$TMP_DIR/extra-pack.analysis.json" >/dev/null
grep -F '{"name":"example-pack","version":"0.0.0+local"' "$TMP_DIR/extra-pack.analysis.json" >/dev/null
| if filepath.IsAbs(cleaned) { | ||
| candidate = cleaned | ||
| } else { | ||
| candidate = filepath.Join(rootAbs, cleaned) | ||
| } | ||
|
|
| return "", fmt.Errorf("resolve absolute path: %w", err) | ||
| } | ||
|
|
||
| rel, err := filepath.Rel(rootAbs, candidateAbs) | ||
| if err != nil { | ||
| return "", fmt.Errorf("compute relative path: %w", err) | ||
| } | ||
| if rel == ".." || strings.HasPrefix(rel, ".."+string(os.PathSeparator)) { | ||
| return "", fmt.Errorf("path escapes allowed root") | ||
| } |
| # Faultline | ||
|
|
||
| > Deterministic CI failure diagnosis CLI. Analyzes build logs against 173 evidence-backed playbooks to identify and explain failures — no AI or LLM required. | ||
| > Deterministic CI failure diagnosis CLI. Analyzes build logs against 181 evidence-backed playbooks to identify and explain failures — no AI or LLM required. |
| cat "$ROOT_DIR/examples/missing-executable.log" | \ | ||
| FAULTLINE_PLAYBOOK_DIR="$PLAYBOOK_DIR" "$BINARY" analyze --json --no-history --git=false >"$TMP_DIR/missing.analysis.json" | ||
| grep -F '"pack_provenance":[{"name":"starter","playbook_count":173}]' "$TMP_DIR/missing.analysis.json" >/dev/null | ||
| grep -F '"pack_provenance":[{"name":"starter"' "$TMP_DIR/missing.analysis.json" >/dev/null |
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/faultline-cli/faultline/sessions/6ae08557-7785-408a-99a0-a4b3b6d6c229 Co-authored-by: jacoblehr <16401696+jacoblehr@users.noreply.github.com>
Applied the review-thread changes in commit This includes symlink-aware containment hardening in |
This PR applies cleanup and hardening changes across app logic, tests, and docs/scripts. It removes baseline magic numbers, strengthens batch file path handling against traversal (including symlink escape paths), and keeps starter-pack count regression checks while making smoke assertions more robust.
Baseline threshold constants
internal/app/service.goto package-level named constants.Batch source path validation
resolvePathWithinRoot(src, rootAbs)ininternal/app/service.go.Batch(...)validates each input path beforeos.Open, rejecting paths that escape the working-directory root (including absolute out-of-root paths).Targeted app test coverage for path hardening
internal/app/batch_test.gofor:../traversal rejectionRune-to-string test robustness fixes
internal/repo/signals_test.goto replace rune arithmetic string generation withfmt.Sprintf(...)for file names and commit hashes, avoiding incorrect characters once index ranges exceed single alphabet/digit spans.Test assertion clarity
internal/store/store_helpers_test.go, made the nullable-bool expectation explicit via awantvariable inTestNullableBoolTrueReturnsOne.Docs and smoke script updates
llms.txtwording/count consistency for the failure catalog references (starter count remains 173).playbook_countchecks inscripts/cli-smoke.sh.jqassertions and a configurableSTARTER_PLAYBOOK_COUNTvariable.Original prompt