Skip to content

Commit cb85d8c

Browse files
Address review advisories: align test names with FIO-001 convention
RobotDataResolveTest now follows the repo's test<CRIT-ID>_<Type><Direction> naming convention instead of a bespoke "Sanity" label, per an advisory from the scoped review of the traversal-fix commit. Cross-references it from criteria.md's FIO-001 evidence note alongside the conformance test. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011GShGLuFwRpnWNY2WL5Vz5
1 parent 3f09647 commit cb85d8c

2 files changed

Lines changed: 15 additions & 14 deletions

File tree

docs/capabilities/CAP-004-robot-file-io-sandboxing/criteria.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ Feature: Robot file I/O sandboxing
2626
And nothing was written at the path the robot named
2727
# Classic redirects silently; the robot never learns the difference. A true drive-letter-
2828
# absolute name (Windows) is a narrower case neither engine redirects; both fail the write
29-
# instead (CAP-004/design.md). Evidence: FileRedirectionConformanceTest.
29+
# instead (CAP-004/design.md). Evidence: FileRedirectionConformanceTest (Integration),
30+
# RobotDataResolveTest (Unit, resolver-level: strip/traversal-check ordering).
3031
3132
@FIO-002
3233
Scenario: The data file and the data directory resolve against the same place

robocode-api/src/test/java/dev/robocode/tankroyale/bridge/RobotDataResolveTest.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
import static org.junit.jupiter.api.Assertions.assertThrows;
1212

1313
/**
14-
* Sanity coverage for {@link RobotData}'s resolver, guarding the order asterisk-stripping and
15-
* traversal-rejection run in.
14+
* Unit coverage for {@link RobotData}'s resolver, the mechanism behind FIO-001's redirection.
1615
* <p>
17-
* FIO-001's own machine evidence is the conformance tier (Integration, per
18-
* {@code CAP-004/criteria.md}); this class covers a defect a review pass on CH-009 found in
19-
* that resolver before it shipped: checking {@code ".."} against the raw name, before
20-
* asterisks are stripped, let a name like {@code ".*."} pass the check and then collapse into
21-
* {@code ".."} once stripped, escaping the data directory.
16+
* FIO-001's declared evidence class is Integration (per {@code CAP-004/criteria.md}), carried by
17+
* {@code FileRedirectionConformanceTest}; this class adds focused unit coverage of the resolver
18+
* itself, including a defect a review pass on CH-009 found before it shipped: checking
19+
* {@code ".."} against the raw name, before asterisks are stripped, let a name like
20+
* {@code ".*."} pass the check and then collapse into {@code ".."} once stripped, escaping the
21+
* data directory.
2222
*/
2323
class RobotDataResolveTest {
2424

@@ -32,21 +32,21 @@ static void ensureRobotNameIsSet() {
3232
}
3333

3434
@Test
35-
@DisplayName("Sanity positive: a plain name resolves inside the directory")
36-
void testSanity_UnitPositive_PlainNameResolvesInsideDirectory() {
35+
@DisplayName("FIO-001 unit: a plain name resolves inside the directory")
36+
void testFIO001_UnitPositive_PlainNameResolvesInsideDirectory() {
3737
File resolved = RobotData.resolve(DIRECTORY, "plain.txt");
3838
assertEquals(new File(DIRECTORY, "plain.txt"), resolved);
3939
}
4040

4141
@Test
42-
@DisplayName("Sanity negative: a literal \"..\" is rejected")
43-
void testSanity_UnitNegative_LiteralTraversalIsRejected() {
42+
@DisplayName("FIO-001 unit negative: a literal \"..\" is rejected")
43+
void testFIO001_UnitNegative_LiteralTraversalIsRejected() {
4444
assertThrows(AccessControlException.class, () -> RobotData.resolve(DIRECTORY, "../escape.txt"));
4545
}
4646

4747
@Test
48-
@DisplayName("Sanity negative: an asterisk-adjacent traversal is rejected once stripped")
49-
void testSanity_UnitNegative_AsteriskAdjacentTraversalIsRejectedOnceStripped() {
48+
@DisplayName("FIO-001 unit negative: an asterisk-adjacent traversal is rejected once stripped")
49+
void testFIO001_UnitNegative_AsteriskAdjacentTraversalIsRejectedOnceStripped() {
5050
// No literal ".." until the "*" is gone, so a check against the raw name alone would miss this.
5151
assertThrows(AccessControlException.class, () -> RobotData.resolve(DIRECTORY, ".*./escape.txt"));
5252
assertThrows(AccessControlException.class, () -> RobotData.resolve(DIRECTORY, "sub/.*./.*./.*./escape.txt"));

0 commit comments

Comments
 (0)